http://sourceware.org/bugzilla/show_bug.cgi?id=14591

             Bug #: 14591
           Summary: Wrong symbol type with common symbol and weak function
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassig...@sourceware.org
        ReportedBy: hjl.to...@gmail.com
    Classification: Unclassified


[hjl@gnu-6 pr14590]$ cat x.c 
#include <stdio.h>

int foo;
int
main ()
{
  foo = getchar ();
  return foo != 0;
}
[hjl@gnu-6 pr14590]$ cat y.c
void alt (void) { }

void foo (void);
void * foo_ifunc (void) __asm__ ("foo");
//__asm__(".type foo, %gnu_indirect_function");
__asm__(".weak foo");

void *
foo_ifunc (void)
{
  return alt;
}
[hjl@gnu-6 pr14590]$ make
gcc -B./ -g   -c -o x.o x.c
gcc -B./ -g   -c -o y.o y.c
gcc -B./ -static -o x x.o y.o
readelf -s --wide x | grep foo
  1793: 00000000006b4f70     4 FUNC    GLOBAL DEFAULT   26 foo
echo 0 | ./x
make: *** [all] Error 1
[hjl@gnu-6 pr14590]$ 

"foo" should be marked as OBJECT, not FUNC.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to