aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2023-04-04 15:21:51 +0000
committerMark Johnston <markj@FreeBSD.org>2023-04-11 14:10:24 +0000
commitf22bd73428ddff199ee3f4554df2bf761bed5aba (patch)
treea1f0e382e620bebec1f3676eeb482d189d3530b1
parent263fa9ba098e8fbd6be233d2a4fdff7d5eeec876 (diff)
downloadsrc-f22bd73428ddff199ee3f4554df2bf761bed5aba.tar.gz
src-f22bd73428ddff199ee3f4554df2bf761bed5aba.zip
libdtrace: Do not set SHF_ALLOC on SUNW_dof relocation sections
The section will contain static relocations which do not need to be preserved after linking, and moreover these relocations may reference symbols that end up getting removed. Do not set SHF_ALLOC and instead let the linker decide what needs to be done. PR: 258872 MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 27f35b7dd418a82cf2f5bb618bd4bb7e81253f3a)
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
index 927b4415409d..d95b11501b17 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
@@ -572,7 +572,7 @@ dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
} else {
shp = &elf_file.shdr[ESHDR_REL];
shp->sh_name = 37; /* DTRACE_SHSTRTAB32[37] = ".rel.SUNW_dof" */
- shp->sh_flags = SHF_ALLOC;
+ shp->sh_flags = 0;
shp->sh_type = SHT_REL;
shp->sh_entsize = sizeof (de.de_rel[0]);
shp->sh_link = ESHDR_SYMTAB;
@@ -715,7 +715,7 @@ dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
} else {
shp = &elf_file.shdr[ESHDR_REL];
shp->sh_name = 37; /* DTRACE_SHSTRTAB64[37] = ".rel.SUNW_dof" */
- shp->sh_flags = SHF_ALLOC;
+ shp->sh_flags = 0;
shp->sh_type = SHT_RELA;
shp->sh_entsize = sizeof (de.de_rel[0]);
shp->sh_link = ESHDR_SYMTAB;