aboutsummaryrefslogtreecommitdiff
path: root/ld/ldelf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-11 10:04:53 +1030
committerAlan Modra <amodra@gmail.com>2020-03-11 15:00:44 +1030
commit1db6f990303ab6c45909f8e133641ef6c24a04d2 (patch)
treed0351e34b9b423d3f200d44b4549a9f46de23ea4 /ld/ldelf.c
parent1c33af7764d9f4eabc02e0f6f6df99917fbce0a6 (diff)
downloadgdb-1db6f990303ab6c45909f8e133641ef6c24a04d2.zip
gdb-1db6f990303ab6c45909f8e133641ef6c24a04d2.tar.gz
gdb-1db6f990303ab6c45909f8e133641ef6c24a04d2.tar.bz2
Don't merge sections with differing MASKPROC or MASKOS flags
Not just SHF_EXCLUDE but any of these flags ought to prevent merging of sections for ld -r. * ldelf.c (elf_orphan_compatible): Return false when two sections have differing SHF_MASKPROC or SHF_MASKOS flags.
Diffstat (limited to 'ld/ldelf.c')
-rw-r--r--ld/ldelf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ld/ldelf.c b/ld/ldelf.c
index b055929..fa4bf9f 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1865,13 +1865,13 @@ elf_orphan_compatible (asection *in, asection *out)
if (elf_section_data (out)->this_hdr.sh_info
!= elf_section_data (in)->this_hdr.sh_info)
return FALSE;
- /* We can't merge with member of output section group nor merge two
- sections with differing SHF_EXCLUDE when doing a relocatable link.
- */
+ /* We can't merge with a member of an output section group or merge
+ two sections with differing SHF_EXCLUDE or other processor and OS
+ specific flags when doing a relocatable link. */
if (bfd_link_relocatable (&link_info)
&& (elf_next_in_group (out) != NULL
|| ((elf_section_flags (out) ^ elf_section_flags (in))
- & SHF_EXCLUDE) != 0))
+ & (SHF_MASKPROC | SHF_MASKOS)) != 0))
return FALSE;
return _bfd_elf_match_sections_by_type (link_info.output_bfd, out,
in->owner, in);