aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-02-25 03:49:15 +0000
committerAlan Modra <amodra@gmail.com>2010-02-25 03:49:15 +0000
commitdfa7b0b81709461db624556e4826b98994533f05 (patch)
tree7e151fd80c35ef6d73ac91401a9c44966dc087b1 /bfd/elf.c
parent63d0fa4e9e574017c5b6df9bec23771a63f7b3cd (diff)
downloadgdb-dfa7b0b81709461db624556e4826b98994533f05.zip
gdb-dfa7b0b81709461db624556e4826b98994533f05.tar.gz
gdb-dfa7b0b81709461db624556e4826b98994533f05.tar.bz2
bfd/
PR ld/11304 * elf.c (_bfd_elf_init_private_section_data): Rename need_group to final_link and invert. For final link allow some flags to differ. Don't specially allow flags to be all zero. ld/ * ldlang.c (init_os): Remove isec param. Don't check for bfd_section already set or call bfd_init_private_section_data here. (exp_init_os): Update init_os call. (lang_add_section): Tidy. Really don't set SEC_LINK_ONCE flags. Call bfd_init_private_section_data here. (map_input_to_output_sections): Tidy. Update init_os calls. Use os->sectype to select sec flags for lang_data_statement.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 20b82a7..dbb13d4 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6056,18 +6056,21 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
{
Elf_Internal_Shdr *ihdr, *ohdr;
- bfd_boolean need_group = link_info == NULL || link_info->relocatable;
+ bfd_boolean final_link = link_info != NULL && !link_info->relocatable;
if (ibfd->xvec->flavour != bfd_target_elf_flavour
|| obfd->xvec->flavour != bfd_target_elf_flavour)
return TRUE;
- /* Don't copy the output ELF section type from input if the
- output BFD section flags have been set to something different.
- elf_fake_sections will set ELF section type based on BFD
- section flags. */
+ /* For objcopy and relocatable link, don't copy the output ELF
+ section type from input if the output BFD section flags have been
+ set to something different. For a final link allow some flags
+ that the linker clears to differ. */
if (elf_section_type (osec) == SHT_NULL
- && (osec->flags == isec->flags || !osec->flags))
+ && (osec->flags == isec->flags
+ || (final_link
+ && ((osec->flags ^ isec->flags)
+ & ~ (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)) == 0)))
elf_section_type (osec) = elf_section_type (isec);
/* FIXME: Is this correct for all OS/PROC specific flags? */
@@ -6078,7 +6081,7 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
SHT_GROUP section will have its elf_next_in_group pointing back
to the input group members. Ignore linker created group section.
See elfNN_ia64_object_p in elfxx-ia64.c. */
- if (need_group)
+ if (!final_link)
{
if (elf_sec_group (isec) == NULL
|| (elf_sec_group (isec)->flags & SEC_LINKER_CREATED) == 0)