diff options
author | Alan Modra <amodra@bigpond.net.au> | 2004-05-26 10:23:51 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2004-05-26 10:23:51 +0000 |
commit | 00f4e74f46db76b1a659e03290612c4e049bd226 (patch) | |
tree | 17e38f2418afd7a2f1bb449ecd13ecef1c37b4a4 /ld/ldlang.c | |
parent | 06552f9aaf0f0656babe3b79890ef6817ddc667d (diff) | |
download | binutils-redhat-00f4e74f46db76b1a659e03290612c4e049bd226.tar.gz |
bfd/
* elf.c (_bfd_elf_make_section_from_shdr): Don't set SEC_EXCLUDE
for SHT_GROUP sections.
ld/
* ldlang.c (lang_add_section): Set SEC_EXCLUDE for SEC_GROUP
sections when doing a final link. Clear SEC_EXCLUDE when doing
a relocable link, except for SEC_DEBUGGING sections.
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Use the
same condition here to drop SEC_EXCLUDE orphan sections.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c index 7a268c0eb2..34cff0f762 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1096,11 +1096,26 @@ lang_add_section (lang_statement_list_type *ptr, discard = FALSE; - /* Discard sections marked with SEC_EXCLUDE if we are doing a final - link. Discard debugging sections marked with SEC_EXCLUDE on a - relocatable link too. */ - if ((flags & SEC_EXCLUDE) != 0 - && ((flags & SEC_DEBUGGING) != 0 || !link_info.relocatable)) + if (link_info.relocatable) + { + /* SEC_EXCLUDE is ignored when doing a relocatable link, + except in the special case of debug info. (See bfd/stabs.c) */ + if ((flags & SEC_DEBUGGING) == 0) + flags &= ~SEC_EXCLUDE; + } + else + { + /* SEC_GROUP sections should be dropped on a final link. */ + if ((flags & SEC_GROUP) != 0) + flags |= SEC_EXCLUDE; + } + + /* Write SEC_EXCLUDE flag back, to simplify later linker code. */ + if (section->owner != NULL) + bfd_set_section_flags (section->owner, section, flags); + + /* Discard sections marked with SEC_EXCLUDE. */ + if ((flags & SEC_EXCLUDE) != 0) discard = TRUE; /* Discard input sections which are assigned to a section named |