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