From b30962503862fcef0e3c550d4b652b2318e8684a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 27 May 2004 05:53:36 +0000 Subject: bfd/ 2004-05-26 H.J. Lu * elf.c (_bfd_elf_make_section_from_shdr): Undo the last change. ld/ 2004-05-26 H.J. Lu * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Clear SEC_EXCLUDE on non-SEC_DEBUGGING sections for relocatable link. * ldlang.c (lang_add_section): Likewise. --- ld/ChangeLog | 6 ++++++ ld/emultempl/elf32.em | 7 ++++--- ld/ldlang.c | 29 ++++++++++------------------- 3 files changed, 20 insertions(+), 22 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 6c34103..b0b7158 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2004-05-26 H.J. Lu + + * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Clear + SEC_EXCLUDE on non-SEC_DEBUGGING sections for relocatable link. + * ldlang.c (lang_add_section): Likewise. + 2004-05-26 Alan Modra * ldlang.c (lang_add_section): Set SEC_EXCLUDE for SEC_GROUP diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 89c5d5d..9950649 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1182,9 +1182,10 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) #define HAVE_SECTION(hold, name) \ (hold.os != NULL || (hold.os = lang_output_section_find (name)) != NULL) - if (((s->flags & (SEC_EXCLUDE | SEC_GROUP)) != 0 && !link_info.relocatable) - || ((s->flags & (SEC_EXCLUDE | SEC_DEBUGGING)) - == (SEC_EXCLUDE | SEC_DEBUGGING))) + if (link_info.relocatable && (s->flags & SEC_DEBUGGING) == 0) + s->flags &= ~SEC_EXCLUDE; + + if ((s->flags & SEC_EXCLUDE) != 0) { if (s->output_section == NULL) s->output_section = bfd_abs_section_ptr; diff --git a/ld/ldlang.c b/ld/ldlang.c index 34cff0f..b4c2559 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1094,29 +1094,20 @@ lang_add_section (lang_statement_list_type *ptr, flags = bfd_get_section_flags (section->owner, section); - discard = FALSE; - - 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_EXCLUDE is ignored when doing a relocatable link, except in + the special case of debug info. (See bfd/stabs.c) */ + if (link_info.relocatable && (flags & SEC_DEBUGGING) == 0) { - /* SEC_GROUP sections should be dropped on a final link. */ - if ((flags & SEC_GROUP) != 0) - flags |= SEC_EXCLUDE; - } + 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); + /* Write the modified 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 = (flags & SEC_EXCLUDE) != 0; /* Discard input sections which are assigned to a section named DISCARD_SECTION_NAME. */ -- cgit v1.1