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

           Summary: .gnu.warning.* doesn't work when building shared
                    library
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassig...@sources.redhat.com
        ReportedBy: hjl.to...@gmail.com


[hjl@gnu-mic-1 warn-5]$ cat foo.c
extern void bar ();

void
foo ()
{
  bar ();
}
[hjl@gnu-mic-1 warn-5]$ cat bar.c
#define linker_warning(x, msg) \
    static const char __warn_##x[] \
    __attribute__((used, section(".gnu.warning." #x))) \
    = msg

void bar (void) {} 
linker_warning(bar, "Bad bar"); 
[hjl@gnu-mic-1 warn-5]$ make
/usr/gcc-4.6/bin/gcc  -O2 -fPIC   -c -o foo.o foo.c
/usr/gcc-4.6/bin/gcc  -O2 -fPIC   -c -o bar.o bar.c
/usr/gcc-4.6/bin/gcc  -Wl,-e,foo -nostdlib -o x1 foo.o bar.o
foo.o: In function `foo':
foo.c:(.text+0x3): warning: Bad bar
/usr/gcc-4.6/bin/gcc  -shared -nostdlib -o x2 foo.o bar.o
[hjl@gnu-mic-1 warn-5]$ ./ld.gold -shared -o x2 foo.o bar.o
foo.o:foo.c:function foo: warning: Bad bar
[hjl@gnu-mic-1 warn-5]$

-- 
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