bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/12760] New: LTO doesn't work with .gnu.warning section


From: hjl.tools at gmail dot com
Subject: [Bug ld/12760] New: LTO doesn't work with .gnu.warning section
Date: Sat, 14 May 2011 14:33:35 +0000

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

           Summary: LTO doesn't work with .gnu.warning section
           Product: binutils
           Version: 2.22 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
                CC: address@hidden


address@hidden warn]$ cat foo.c
extern void bar ();

void
foo ()
{
  bar ();
}
address@hidden warn]$ cat bar.c
#define linker_warning(x, msg) \
    asm(".section .gnu.warning." #x "\n\t.previous"); \
    static const char __warn_##x[] \
    __attribute__((used, section(".gnu.warning." #x "\n\t#"))) \
    = msg

void bar (void) {} 
linker_warning(bar, "Bad bar"); 
address@hidden warn]$ make
/export/build/gnu/gcc-4.6/release/usr/gcc-4.6.1/bin/gcc -O2 -fuse-linker-plugin
-flto=jobserver   -c -o foo.o foo.c
/export/build/gnu/gcc-4.6/release/usr/gcc-4.6.1/bin/gcc -O2 -fuse-linker-plugin
-flto=jobserver   -c -o bar.o bar.c
ar rv libbar.a bar.o
ar: creating libbar.a
a - bar.o
/export/build/gnu/gcc-4.6/release/usr/gcc-4.6.1/bin/gcc -Wl,-e,foo -nostdlib -o
x1 foo.o -Wl,--start-group libbar.a -Wl,--end-group
foo.o: In function `foo':
foo.c:(.text+0x3): warning: Bad bar
/export/build/gnu/gcc-4.6/release/usr/gcc-4.6.1/bin/gcc -Wl,-e,foo -nostdlib
-O2 -fuse-linker-plugin -flto=jobserver -o x2 foo.o -Wl,--start-group libbar.a
-Wl,--end-group
collect2: ld terminated with signal 11 [Segmentation fault]
make: *** [x2] Error 1
rm bar.o
address@hidden warn]$ 

Program received signal SIGSEGV, Segmentation fault.
0x000000000045011d in bfd_generic_link_read_symbols (abfd=0x80a588)
    at /export/gnu/import/git/binutils-lto/bfd/linker.c:755
755          symsize = bfd_get_symtab_upper_bound (abfd);
Missing separate debuginfos, use: debuginfo-install
glibc-2.13.90-11.1.f14.x86_64 zlib-1.2.5-2.fc14.x86_64
(gdb) bt
#0  0x000000000045011d in bfd_generic_link_read_symbols (abfd=0x80a588)
    at /export/gnu/import/git/binutils-lto/bfd/linker.c:755
#1  0x000000000041e058 in warning_callback (info=0x7c5a40, 
    warning=0x817b40 "Bad bar", symbol=0x7f6c65 "bar", abfd=0x80a588, 
    section=0x0, address=0)
    at /export/gnu/import/git/binutils-lto/ld/ldmain.c:1197
#2  0x0000000000451a43 in _bfd_generic_link_add_one_symbol (info=0x7c5a40, 
    abfd=0x7fa4c0, name=0x815241 "bar", flags=4096, section=0x816788, value=0, 
    string=0x817b40 "Bad bar", copy=0, collect=0, hashp=0x0)
    at /export/gnu/import/git/binutils-lto/bfd/linker.c:1920
#3  0x000000000048affd in elf_link_add_object_symbols (abfd=0x7fa4c0, 
    info=0x7c5a40) at /export/gnu/import/git/binutils-lto/bfd/elflink.c:3481
#4  0x000000000048eefa in bfd_elf_link_add_symbols (abfd=0x7fa4c0, 
    info=0x7c5a40) at /export/gnu/import/git/binutils-lto/bfd/elflink.c:5150
#5  0x0000000000410260 in load_symbols (entry=0x7da0c0, place=0x7fffffffdb70)
    at /export/gnu/import/git/binutils-lto/ld/ldlang.c:2822
#6  0x0000000000410e19 in open_input_bfds (s=0x7da0c0, mode=OPEN_BFD_NORMAL)
    at /export/gnu/import/git/binutils-lto/ld/ldlang.c:3269
#7  0x0000000000416c2c in lang_process ()
    at /export/gnu/import/git/binutils-lto/ld/ldlang.c:6566
#8  0x000000000041c791 in main (argc=25, argv=0x7fffffffddb8)
    at /export/gnu/import/git/binutils-lto/ld/ldmain.c:438
(gdb) p *h
$1 = {root = {next = 0x0, string = 0x7f6c65 "bar", hash = 43167049}, 
  type = bfd_link_hash_undefweak, non_ir_ref = 0, u = {undef = {next = 0x0, 
      abfd = 0x80a588, weak = 0x0}, def = {next = 0x0, section = 0x80a588, 
      value = 0}, i = {next = 0x0, link = 0x80a588, warning = 0x0}, c = {
      next = 0x0, p = 0x80a588, size = 0}}}
(gdb) p h->u.undef.abfd->filename
$2 = 0x34 <Address 0x34 out of bounds>
(gdb) p h->u.def.section->owner->filename
$3 = 0x7fa150 "bar.o (symbol from plugin)"
(gdb)

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



reply via email to

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