bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .gnu.warning.foo interferes with archive-member rules


From: Alan Modra
Subject: Re: .gnu.warning.foo interferes with archive-member rules
Date: Tue, 7 Jun 2011 18:38:30 +0930
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, Jun 06, 2011 at 03:41:14PM -0700, Roland McGrath wrote:
> Consider:
> 
>       % head ref.s def.s
>       ==> ref.s <==
>               .data
>       ptrsym:
>       .long badsym
> 
>               .section .gnu.warning.badsym,"",@progbits
>               .string "badsym warning"
> 
>       ==> def.s <==
>       .comm badsym,4
>       % as --32 -o ref.o ref.s
>       % as --32 -o def.o def.s
>       % ar cqs def.a def.o
>       % ./ld/ld-new -m elf_i386 -o foo ref.o def.a
>       ref.o: In function `ptrsym':
>       (.data+0x0): warning: badsym warning
>       ./ld/ld-new: warning: cannot find entry symbol _start; defaulting to 
> 0000000008048054
>       ref.o: In function `ptrsym':
>       (.data+0x0): undefined reference to `badsym'
>       [Exit 1]
>       % 

I think you've managed to hit two bugs.  I'll commit the following
after some testing.

bfd/
        * elflink.c (_bfd_elf_archive_symbol_lookup): Follow warning and
        indirect links here.
ld/
        * ldlang.c (lang_one_common): Handle warning symbols.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.406
diff -u -p -r1.406 elflink.c
--- bfd/elflink.c       26 May 2011 04:28:20 -0000      1.406
+++ bfd/elflink.c       7 Jun 2011 09:03:39 -0000
@@ -4911,7 +4911,7 @@ _bfd_elf_archive_symbol_lookup (bfd *abf
   char *p, *copy;
   size_t len, first;
 
-  h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE);
+  h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, TRUE);
   if (h != NULL)
     return h;
 
@@ -4934,14 +4934,14 @@ _bfd_elf_archive_symbol_lookup (bfd *abf
   memcpy (copy, name, first);
   memcpy (copy + first, name + first + 1, len - first);
 
-  h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, FALSE);
+  h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, TRUE);
   if (h == NULL)
     {
       /* We also need to check references to the symbol without the
         version.  */
       copy[first - 1] = '\0';
       h = elf_link_hash_lookup (elf_hash_table (info), copy,
-                               FALSE, FALSE, FALSE);
+                               FALSE, FALSE, TRUE);
     }
 
   bfd_release (abfd, copy);
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.370
diff -u -p -r1.370 ldlang.c
--- ld/ldlang.c 23 May 2011 05:41:01 -0000      1.370
+++ ld/ldlang.c 7 Jun 2011 09:03:41 -0000
@@ -5885,6 +5885,9 @@ lang_one_common (struct bfd_link_hash_en
   bfd_vma size;
   asection *section;
 
+  if (h->type == bfd_link_hash_warning)
+    h = h->u.i.link;
+
   if (h->type != bfd_link_hash_common)
     return TRUE;
 


-- 
Alan Modra
Australia Development Lab, IBM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]