diff options
author | Alan Modra <amodra@gmail.com> | 2010-11-05 05:56:53 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2010-11-05 05:56:53 +0000 |
commit | f4eaaf7fceed097ed62542f9940986b1de01aa48 (patch) | |
tree | bf874d78f5edddba96666ef788fc9a99b98b1db1 /ld | |
parent | 7cdfa31841aea9665682cadb03aaade2821721b1 (diff) | |
download | gdb-f4eaaf7fceed097ed62542f9940986b1de01aa48.zip gdb-f4eaaf7fceed097ed62542f9940986b1de01aa48.tar.gz gdb-f4eaaf7fceed097ed62542f9940986b1de01aa48.tar.bz2 |
* ldlang.c (lang_add_section): Distinguish ELF treatment of NOLOAD.
(map_input_to_output_sections): Likewise.
(lang_size_sections_1): Likewise.
(IGNORE_SECTION): Don't test SEC_NEVER_LOAD.
(lang_check_section_addresses): Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 8 | ||||
-rw-r--r-- | ld/ldlang.c | 38 |
2 files changed, 27 insertions, 19 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index cd29ee8..e3620b9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2010-11-05 Alan Modra <amodra@gmail.com> + + * ldlang.c (lang_add_section): Distinguish ELF treatment of NOLOAD. + (map_input_to_output_sections): Likewise. + (lang_size_sections_1): Likewise. + (IGNORE_SECTION): Don't test SEC_NEVER_LOAD. + (lang_check_section_addresses): Likewise. + 2010-11-04 Kai Tietz <kai.tietz@onevision.com> * scripttempl/pe.sc (.debug_types): New. diff --git a/ld/ldlang.c b/ld/ldlang.c index 798d7a1..9038ebf 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -2250,16 +2250,14 @@ lang_add_section (lang_statement_list_type *ptr, case noload_section: flags &= ~SEC_LOAD; flags |= SEC_NEVER_LOAD; - if (((bfd_get_flavour (section->owner) - == bfd_target_ecoff_flavour) - || (bfd_get_flavour (section->owner) - == bfd_target_coff_flavour))) - { - if ((flags & (SEC_COFF_SHARED_LIBRARY | SEC_DEBUGGING)) == 0) - flags &= ~SEC_HAS_CONTENTS; - } - else + /* Unfortunately GNU ld has managed to evolve two different + meanings to NOLOAD in scripts. ELF gets a .bss style noload, + alloc, no contents section. All others get a noload, noalloc + section. */ + if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour) flags &= ~SEC_HAS_CONTENTS; + else + flags &= ~SEC_ALLOC; break; } @@ -3571,7 +3569,11 @@ map_input_to_output_sections flags = SEC_HAS_CONTENTS; break; case noload_section: - flags = SEC_NEVER_LOAD; + if (bfd_get_flavour (link_info.output_bfd) + == bfd_target_elf_flavour) + flags = SEC_NEVER_LOAD | SEC_ALLOC; + else + flags = SEC_NEVER_LOAD | SEC_HAS_CONTENTS; break; } if (os->bfd_section == NULL) @@ -4633,13 +4635,9 @@ sort_sections_by_lma (const void *arg1, const void *arg2) return 0; } -/* On ELF, a debugging section must never set SEC_NEVER_LOAD, as no output - would be written for it. So the combination of debugging and never-load - is something which can only happen for pe-coff and must not be ignored. */ #define IGNORE_SECTION(s) \ - ((s->flags & (SEC_NEVER_LOAD | SEC_DEBUGGING)) == SEC_NEVER_LOAD \ - || (s->flags & SEC_ALLOC) == 0 \ - || ((s->flags & SEC_THREAD_LOCAL) != 0 \ + ((s->flags & SEC_ALLOC) == 0 \ + || ((s->flags & SEC_THREAD_LOCAL) != 0 \ && (s->flags & SEC_LOAD) == 0)) /* Check to see if any allocated sections overlap with other allocated @@ -4671,8 +4669,7 @@ lang_check_section_addresses (void) for (s = link_info.output_bfd->sections; s != NULL; s = s->next) { /* Only consider loadable sections with real contents. */ - if ((s->flags & (SEC_NEVER_LOAD | SEC_DEBUGGING)) == SEC_NEVER_LOAD - || !(s->flags & SEC_LOAD) + if (!(s->flags & SEC_LOAD) || !(s->flags & SEC_ALLOC) || s->size == 0) continue; @@ -5251,7 +5248,10 @@ lang_size_sections_1 should have space allocated to it, unless the user has explicitly stated that the section should not be allocated. */ - if (output_section_statement->sectype != noalloc_section) + if (output_section_statement->sectype != noalloc_section + && (output_section_statement->sectype != noload_section + || (bfd_get_flavour (link_info.output_bfd) + == bfd_target_elf_flavour))) output_section_statement->bfd_section->flags |= SEC_ALLOC; } dot = newdot; |