https://sourceware.org/bugzilla/show_bug.cgi?id=20321
Bug ID: 20321
Summary: Segmentation fault with plugin
Product: binutils
Version: 2.27 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: dilyan.palauzov at aegee dot org
Target Milestone: ---
I use ld 2.26.51.20160701 ./configure'd with --enable-plugins
--with-system-zlib --with-expat --with-python --disable-tui
--with-system-readline --enable-compressed-debug-sections=all --enable-gold
When I try to compile this file, called Z.c:
int main ()
{
;
return 0;
}
with gcc -pipe -O3 -fno-fat-lto-objects -flto -Wl,-O1,-s
-Wl,-plugin,/usr/local/lib/bfd-plugins/liblto_plugin.so Z.c
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core
dumped
compilation terminated.
gdb -quiet -ex 'bt f' /usr/local/bin/ld core
Reading symbols from /usr/local/bin/ld...done.
[New LWP 6862]
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by
`/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../x86_64-pc-linux-gnu/bi'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0042811d in get_symbols (handle=0x95fda0, nsyms=1, syms=0x0,
def_ironly_exp=9) at /git/binutils-gdb/ld/plugin.c:669
669 if (syms[n].def != LDPK_UNDEF)
#0 0x0042811d in get_symbols (handle=0x95fda0, nsyms=1, syms=0x0,
def_ironly_exp=9) at /git/binutils-gdb/ld/plugin.c:669
blhe = 0x1
owner_sec = 0x7f94de66b710
res = 32660
input = 0x95fda0
abfd = 0x95ee00
n = 0
__PRETTY_FUNCTION__ = "get_symbols"
#1 0x004285ad in get_symbols_v2 (handle=0x95fda0, nsyms=1, syms=0x0)
at /git/binutils-gdb/ld/plugin.c:787
No locals.
#2 0x7f94ddeca491 in write_resolution () at
../.././lto-plugin/lto-plugin.c:490
info = 0x961030
symtab = 0x961040
syms =
i = 0
f = 0xb659c0
#3 all_symbols_read_handler () at ../.././lto-plugin/lto-plugin.c:657
i =
num_lto_args =
lto_argv = 0xb669b0
linker_output_str = 0x0
lto_arg_ptr = 0xb669b0
__PRETTY_FUNCTION__ = "all_symbols_read_handler"
#4 0x0042941f in plugin_call_all_symbols_read () at
/git/binutils-gdb/ld/plugin.c:1231
rv = LDPS_OK
curplug = 0x92a0c0
#5 0x00418560 in lang_process () at /git/binutils-gdb/ld/ldlang.c:6850
added = {
head = 0x9271d0,
tail = 0x93cd60
}
files = {
head = 0x927230,
tail = 0x92a2e0
}
inputfiles = {
head = 0x9271d0,
tail = 0x95e678
}
#6 0x0041ca08 in main (argc=43, argv=0x7ffe199c9838) at
/git/binutils-gdb/ld/ldmain.c:415
emulation = 0x7ffe199ca382 "elf_x86_64"
start_time = 0
start_sbrk = 0x926000 ""
This is with gcc 7.0.0 20160627.
The same happens with gcc 5.4.1 20160630:
/usr/local/gcc5/bin/gcc -pipe -O3 -fno-fat-lto-objects -Wl,-O1,-s
-Wl,-plugin,/usr/local/gcc5/libexec/gcc/x86_64-unknown-linux-gnu/5.4.1/liblto_plugin.so
Z.c
collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core
dumped
compilation terminated.
gdb -quiet -ex 'bt f' /usr/local/bin/ld core
Reading symbols from /usr/local/bin/ld...done.
[New LWP 6939]
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `/usr/local/bin/ld -plugin
/usr/local/gcc5/libexec/gcc/x86_64-unknown-linux-gnu/'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0042811d in get_symbols (handle=0x131fd40, nsyms=1, syms=0x0,
def_ironly_exp=9) at /git/binutils-gdb/ld/plugin.c:669
669 if (syms[n].def != LDPK_UNDEF)
#0 0x0042811d in get_symbols (handle=0x131fd40, nsyms=1, syms=0x0,
def_ironly_exp=9) at /git/binutils-gdb/ld/plugin.c:669
blhe = 0x1
owner_sec = 0x7fb39c640710
res = 32691
input = 0x131fd40
abfd = 0x131eda0
n = 0
__PRETTY_FUNCTION__ = "get_symbols"
#1 0x004285ad in get_symbols_v2 (handle=0x131fd40, nsyms=1, syms=0x0)
at /git/binutils-gdb/ld/plugin.c:787
No locals.
#2 0x7fb39be9f468 in write_resolution () at
../.././lto-plugin/lto-plugin.c:476
info = 0x1320fd0
symtab = 0x1320fe0
syms =
i = 0
f = 0x14fd830
#3 all_symbols_read_handler () at ../.././lto-plugin/lto-plugin.c:643
i =
num_lto_args =
lto_argv = 0x14fa0e0
lto_arg_ptr = 0x14fa0e0
__PRETTY_FUNCTION__ = "all_symbols_read_handler"
#4 0x0042941f in plugin_call_all_symbols_read () at
/git/binutils-gdb/ld/plugin.c:1231
rv = LDPS_OK
curplug = 0x12ea040
#5 0x00