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;
}
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)
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
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;
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;