From d0d6a25bf3db9eea811699671a0f218e75586ca0 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 30 Apr 2004 14:26:09 +0000 Subject: [PATCH] * ldlang.c (unique_section_p): Pass section parm, return true on group sections. (output_section_callback): Adjust. * ldlang.h (unique_section_p): Update prototype. * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Adjust. --- ld/ChangeLog | 8 ++++++++ ld/emultempl/elf32.em | 2 +- ld/ldlang.c | 11 +++++++++-- ld/ldlang.h | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 0d60bad..f77eb40 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2004-04-30 Alan Modra + + * ldlang.c (unique_section_p): Pass section parm, return true on + group sections. + (output_section_callback): Adjust. + * ldlang.h (unique_section_p): Update prototype. + * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Adjust. + 2004-04-30 Eric Botcazou * ld.texinfo (--gc-sections): Remove restriction for diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 92f502d..1a838f3 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1142,7 +1142,7 @@ gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) isdyn = 1; } - if (isdyn || (!config.unique_orphan_sections && !unique_section_p (secname))) + if (isdyn || (!config.unique_orphan_sections && !unique_section_p (s))) { /* Look through the script to see where to place this section. */ os = lang_output_section_find (secname); diff --git a/ld/ldlang.c b/ld/ldlang.c index 6460c32..d2b5fed 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -121,10 +121,17 @@ stat_alloc (size_t size) } bfd_boolean -unique_section_p (const char *secnam) +unique_section_p (const asection *sec) { struct unique_sections *unam; + const char *secnam; + if (link_info.relocatable + && sec->owner != NULL + && bfd_is_group_section (sec->owner, sec)) + return TRUE; + + secnam = sec->name; for (unam = unique_section_list; unam; unam = unam->next) if (wildcardp (unam->name) ? fnmatch (unam->name, secnam, 0) == 0 @@ -1262,7 +1269,7 @@ output_section_callback (lang_wild_statement_type *ptr, lang_statement_union_type *before; /* Exclude sections that match UNIQUE_SECTION_LIST. */ - if (unique_section_p (bfd_get_section_name (file->the_bfd, section))) + if (unique_section_p (section)) return; /* If the wild pattern was marked KEEP, the member sections diff --git a/ld/ldlang.h b/ld/ldlang.h index 649fea1..0ba31bb 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -556,7 +556,7 @@ extern struct bfd_elf_version_deps *lang_add_vers_depend extern void lang_register_vers_node (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *); bfd_boolean unique_section_p - (const char *); + (const asection *); extern void lang_add_unique (const char *); extern const char *lang_get_output_target -- 2.7.4