bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/16477] New: ld fails with internal error in elf_x86_64_rel


From: zbyszek at in dot waw.pl
Subject: [Bug binutils/16477] New: ld fails with internal error in elf_x86_64_relocate_section with .gnu.warning.<symbol> section
Date: Tue, 21 Jan 2014 19:46:39 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=16477

            Bug ID: 16477
           Summary: ld fails with internal error in
                    elf_x86_64_relocate_section with .gnu.warning.<symbol>
                    section
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: zbyszek at in dot waw.pl

This is a continuation of pr16467, but a different failure.
Tests below are performed with binutils git from 20/01/2014 with patch from
pr16467 on top.

I'm trying to generate a warning when linking against the obsolete library,
following
http://ninjalj.blogspot.com/2011/11/your-own-linker-warnings-using-gnu.html.

$ tail liba.c liba.sym libb.c libb.sym linkwarning.h test1.c 
==> liba.c <==
const char* sd_get_seats(void) {return "bla bla";}

==> liba.sym <==
LIBSYSTEMD_209 {
global:
        sd_get_seats;
};

==> libb.c <==
#include "linkwarning.h"
void new_sd_get_seats(void);
__asm__(".symver new_sd_get_seats,address@hidden");
static void (*resolve_sd_get_seats(void)) (void) {
        return new_sd_get_seats;
}
void sd_get_seats(void) __attribute__((ifunc("resolve_sd_get_seats")));
link_warning(sd_get_seats, "sd_get_seats is obsolete");            #<-- this is
new

==> libb.sym <==
LIBSYSTEMD_208 {
global:
        sd_get_seats;
};


==> linkwarning.h <==
#define link_warning(symbol, msg)                             \
  static const char __evoke_link_warning_##symbol[]           \
    __attribute__ ((used, section (".gnu.warning." #symbol))) \
    = msg

==> test1.c <==
#include <stdio.h>
const char* sd_get_seats(void);

int main(int argc, char **argv) {
        printf("%s\n", sd_get_seats());
        return 0;
}

$ gcc -shared -o liba.so liba.c -fPIC -Wl,--version-script=liba.sym
-Wl,-fuse-ld=bfd
$ gcc -shared -o libb.so libb.c -fPIC -L. -la -Wl,--version-script=libb.sym
-Wl,-fuse-ld=bfd
/usr/bin/ld.bfd: BFD (GNU Binutils) 2.24.51.20140120 internal error, aborting
at elf64-x86-64.c line 3364 in elf_x86_64_relocate_section

/usr/bin/ld.bfd: Please report this bug.

collect2: error: ld returned 1 exit status

With gold:
$ gcc -shared -o liba.so liba.c -fPIC -Wl,--version-script=liba.sym
-Wl,-fuse-ld=gold
$ gcc -shared -o libb.so libb.c -fPIC -L. -la -Wl,--version-script=libb.sym
-Wl,-fuse-ld=gold
$ LD_LIBRARY_PATH=. gcc -L. -lb test1.c -o test1 -Wl,-fuse-ld=gold
/tmp/ccwEa1hI.o:test1.c:function main: warning: sd_get_seats is obsolete
$ LD_LIBRARY_PATH=. ./test1 
bla bla

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