From 5bb32da2dba08dfe3f85e31e2cefd186af336a72da9dd5af6fd902041efd0f57 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Tue, 30 Jul 2013 10:59:31 +0000 Subject: [PATCH] Accepting request 184884 from home:Andreas_Schwab:Factory - warning-symbol-sections.patch: correct test in last change OBS-URL: https://build.opensuse.org/request/show/184884 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=139 --- binutils.changes | 5 ++ cross-aarch64-binutils.changes | 5 ++ cross-arm-binutils.changes | 5 ++ cross-avr-binutils.changes | 5 ++ cross-hppa-binutils.changes | 5 ++ cross-hppa64-binutils.changes | 5 ++ cross-i386-binutils.changes | 5 ++ cross-ia64-binutils.changes | 5 ++ cross-mips-binutils.changes | 5 ++ cross-ppc-binutils.changes | 5 ++ cross-ppc64-binutils.changes | 5 ++ cross-s390-binutils.changes | 5 ++ cross-s390x-binutils.changes | 5 ++ cross-sparc-binutils.changes | 5 ++ cross-sparc64-binutils.changes | 5 ++ cross-spu-binutils.changes | 5 ++ cross-x86_64-binutils.changes | 5 ++ warning-symbol-sections.patch | 155 +++++++++++++++++++++++++++++++-- 18 files changed, 233 insertions(+), 7 deletions(-) diff --git a/binutils.changes b/binutils.changes index 19457ee..b8cc05f 100644 --- a/binutils.changes +++ b/binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-aarch64-binutils.changes b/cross-aarch64-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-aarch64-binutils.changes +++ b/cross-aarch64-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-arm-binutils.changes b/cross-arm-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-arm-binutils.changes +++ b/cross-arm-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-avr-binutils.changes b/cross-avr-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-avr-binutils.changes +++ b/cross-avr-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-hppa-binutils.changes b/cross-hppa-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-hppa-binutils.changes +++ b/cross-hppa-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-hppa64-binutils.changes b/cross-hppa64-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-hppa64-binutils.changes +++ b/cross-hppa64-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-i386-binutils.changes b/cross-i386-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-i386-binutils.changes +++ b/cross-i386-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-ia64-binutils.changes b/cross-ia64-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-ia64-binutils.changes +++ b/cross-ia64-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-mips-binutils.changes b/cross-mips-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-mips-binutils.changes +++ b/cross-mips-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-ppc-binutils.changes b/cross-ppc-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-ppc-binutils.changes +++ b/cross-ppc-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-ppc64-binutils.changes b/cross-ppc64-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-ppc64-binutils.changes +++ b/cross-ppc64-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-s390-binutils.changes b/cross-s390-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-s390-binutils.changes +++ b/cross-s390-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-s390x-binutils.changes b/cross-s390x-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-s390x-binutils.changes +++ b/cross-s390x-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-sparc-binutils.changes b/cross-sparc-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-sparc-binutils.changes +++ b/cross-sparc-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-sparc64-binutils.changes b/cross-sparc64-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-sparc64-binutils.changes +++ b/cross-sparc64-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-spu-binutils.changes b/cross-spu-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-spu-binutils.changes +++ b/cross-spu-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/cross-x86_64-binutils.changes b/cross-x86_64-binutils.changes index 19457ee..b8cc05f 100644 --- a/cross-x86_64-binutils.changes +++ b/cross-x86_64-binutils.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 29 18:13:43 UTC 2013 - schwab@suse.de + +- warning-symbol-sections.patch: correct test in last change + ------------------------------------------------------------------- Mon Jul 22 07:18:33 UTC 2013 - schwab@suse.de diff --git a/warning-symbol-sections.patch b/warning-symbol-sections.patch index 31ee7d9..a0eb0c8 100644 --- a/warning-symbol-sections.patch +++ b/warning-symbol-sections.patch @@ -1,3 +1,10 @@ +2013-07-25 Alan Modra + + PR ld/15762 + PR ld/12761 + * elflink.c (elf_link_add_object_symbols): Correct test in + last patch. Remove unnecessary code. + 2013-07-20 Alan Modra PR ld/15762 @@ -9,12 +16,146 @@ Index: binutils-2.23.2/bfd/elflink.c =================================================================== --- binutils-2.23.2.orig/bfd/elflink.c +++ binutils-2.23.2/bfd/elflink.c -@@ -3468,7 +3468,7 @@ elf_link_add_object_symbols (bfd *abfd, - FALSE, bed->collect, NULL))) - goto error_return; +@@ -3368,6 +3368,7 @@ elf_link_add_object_symbols (bfd *abfd, + bfd_size_type old_dynstr_size = 0; + size_t tabsize = 0; + size_t hashsize = 0; ++ asection *s; + htab = elf_hash_table (info); + bed = get_elf_backend_data (abfd); +@@ -3409,75 +3410,64 @@ elf_link_add_object_symbols (bfd *abfd, + symbol. This differs from .gnu.warning sections, which generate + warnings when they are included in an output file. */ + /* PR 12761: Also generate this warning when building shared libraries. */ +- if (info->executable || info->shared) ++ for (s = abfd->sections; s != NULL; s = s->next) + { +- asection *s; ++ const char *name; + +- for (s = abfd->sections; s != NULL; s = s->next) ++ name = bfd_get_section_name (abfd, s); ++ if (CONST_STRNEQ (name, ".gnu.warning.")) + { +- const char *name; ++ char *msg; ++ bfd_size_type sz; + +- name = bfd_get_section_name (abfd, s); +- if (CONST_STRNEQ (name, ".gnu.warning.")) ++ name += sizeof ".gnu.warning." - 1; ++ ++ /* If this is a shared object, then look up the symbol ++ in the hash table. If it is there, and it is already ++ been defined, then we will not be using the entry ++ from this shared object, so we don't need to warn. ++ FIXME: If we see the definition in a regular object ++ later on, we will warn, but we shouldn't. The only ++ fix is to keep track of what warnings we are supposed ++ to emit, and then handle them all at the end of the ++ link. */ ++ if (dynamic) + { +- char *msg; +- bfd_size_type sz; ++ struct elf_link_hash_entry *h; ++ ++ h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE); ++ ++ /* FIXME: What about bfd_link_hash_common? */ ++ if (h != NULL ++ && (h->root.type == bfd_link_hash_defined ++ || h->root.type == bfd_link_hash_defweak)) ++ continue; ++ } + +- name += sizeof ".gnu.warning." - 1; ++ sz = s->size; ++ msg = (char *) bfd_alloc (abfd, sz + 1); ++ if (msg == NULL) ++ goto error_return; + +- /* If this is a shared object, then look up the symbol +- in the hash table. If it is there, and it is already +- been defined, then we will not be using the entry +- from this shared object, so we don't need to warn. +- FIXME: If we see the definition in a regular object +- later on, we will warn, but we shouldn't. The only +- fix is to keep track of what warnings we are supposed +- to emit, and then handle them all at the end of the +- link. */ +- if (dynamic) +- { +- struct elf_link_hash_entry *h; +- +- h = elf_link_hash_lookup (htab, name, FALSE, FALSE, TRUE); +- +- /* FIXME: What about bfd_link_hash_common? */ +- if (h != NULL +- && (h->root.type == bfd_link_hash_defined +- || h->root.type == bfd_link_hash_defweak)) +- { +- /* We don't want to issue this warning. Clobber +- the section size so that the warning does not +- get copied into the output file. */ +- s->size = 0; +- continue; +- } +- } +- +- sz = s->size; +- msg = (char *) bfd_alloc (abfd, sz + 1); +- if (msg == NULL) +- goto error_return; +- +- if (! bfd_get_section_contents (abfd, s, msg, 0, sz)) +- goto error_return; +- +- msg[sz] = '\0'; +- +- if (! (_bfd_generic_link_add_one_symbol +- (info, abfd, name, BSF_WARNING, s, 0, msg, +- FALSE, bed->collect, NULL))) +- goto error_return; +- - if (! info->relocatable) -+ if (!info->relocatable && !info->shared) - { - /* Clobber the section size so that the warning does - not get copied into the output file. */ +- { +- /* Clobber the section size so that the warning does +- not get copied into the output file. */ +- s->size = 0; +- +- /* Also set SEC_EXCLUDE, so that symbols defined in +- the warning section don't get copied to the output. */ +- s->flags |= SEC_EXCLUDE; +- } ++ if (! bfd_get_section_contents (abfd, s, msg, 0, sz)) ++ goto error_return; ++ ++ msg[sz] = '\0'; ++ ++ if (! (_bfd_generic_link_add_one_symbol ++ (info, abfd, name, BSF_WARNING, s, 0, msg, ++ FALSE, bed->collect, NULL))) ++ goto error_return; ++ ++ if (!info->relocatable && info->executable) ++ { ++ /* Clobber the section size so that the warning does ++ not get copied into the output file. */ ++ s->size = 0; ++ ++ /* Also set SEC_EXCLUDE, so that symbols defined in ++ the warning section don't get copied to the output. */ ++ s->flags |= SEC_EXCLUDE; + } + } + } +@@ -3503,7 +3493,6 @@ elf_link_add_object_symbols (bfd *abfd, + goto error_return; + else + { +- asection *s; + const char *soname = NULL; + char *audit = NULL; + struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;