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 27f35b7dd4)
This commit is contained in:
Mark Johnston 2023-04-04 11:21:51 -04:00
parent 263fa9ba09
commit f22bd73428

View file

@ -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;