https://sourceware.org/bugzilla/show_bug.cgi?id=20858
Bug ID: 20858 Summary: [2.28 Regression] binutils fails to link with -rpath \$ORIGIN Product: binutils Version: 2.28 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: doko at debian dot org Target Milestone: --- seen in package builds of wine and xorp, both using -rpath \$ORIGIN: - wine: https://bugs.debian.org/845171 - xorp: https://bugs.debian.org/844847 extracted an example from the wine link on i686-linux-gnu: https://people.debian.org/~doko/tmp/linktst.tar.xz cd linktst/link sh -x link.sh <results in the malloc error> cp -a ../tst . <replacing -L../tst with -L./tst in link.sh> sh -x link.sh <links successfully> - you have to use collect2 with the plugin option, or else the link succeeds. - just omitting the -rpath option lets the link succeed as well. LFLAGS='-L../tst' #LFLAGS='-L./tst' /usr/lib/gcc/i686-linux-gnu/6/collect2 \ -plugin /usr/lib/gcc/i686-linux-gnu/6/liblto_plugin.so \ --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu \ -dynamic-linker /lib/ld-linux.so.2 \ -o wine-installed \ ../tst/crt1.o \ ../tst/crti.o \ ../tst/crtbegin.o \ $LFLAGS \ ../tst/main.o \ --rpath \$ORIGIN/../i386-linux-gnu/wine-development \ --export-dynamic \ -Ttext-segment=0x7c000000 -z max-page-size=0x1000 \ -lwine -lpthread ../tst/libwine_port.a \ -z relro -z now \ -lgcc --as-needed -lgcc_s --no-as-needed -lc \ -lgcc --as-needed -lgcc_s --no-as-needed \ ../tst/crtend.o \ ../tst/crtn.o looking at the backtrace: [New LWP 10042] Core was generated by `/usr/bin/ld -plugin /usr/lib/gcc/i686-linux-gnu/6/liblto_plugin.so -plugin-opt='. Program terminated with signal SIGABRT, Aborted. #0 0xf7745be9 in __kernel_vsyscall () (gdb) bt #0 0xf7745be9 in __kernel_vsyscall () #1 0xf741cdc0 in __libc_signal_restore_set (set=0xffa22360) at ../sysdeps/unix/sysv/linux/nptl-signals.h:79 #2 __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:55 #3 0xf741e287 in __GI_abort () at abort.c:89 #4 0xf745833f in __libc_message (do_abort=<optimized out>, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:175 #5 0xf745ef77 in malloc_printerr (action=<optimized out>, str=0xf754ebf3 "malloc(): memory corruption", ptr=<optimized out>, ar_ptr=0xf75a4780 <main_arena>) at malloc.c:5046 #6 0xf7460e12 in _int_malloc (av=av@entry=0xf75a4780 <main_arena>, bytes=bytes@entry=118) at malloc.c:3509 #7 0xf74629e5 in __GI___libc_malloc (bytes=118) at malloc.c:2925 #8 0xf76e0365 in xmalloc (size=118) at ../../libiberty/xmalloc.c:148 #9 0x5660cd02 in gldelf_i386_search_needed ( path=0x5768fb88 "$ORIGIN/../i386-linux-gnu/wine-development:/usr/lib/i386-linux-gnu/wine-development", n=0xffa228d4, force=0) at eelf_i386.c:619 #10 0x5660e1f0 in gldelf_i386_after_open () at eelf_i386.c:1297 #11 0x56605fc9 in ldemul_after_open () at ../../ld/ldemul.c:64 #12 0x565fab9f in lang_process () at ../../ld/ldlang.c:6954 #13 0x565fedde in main (argc=60, argv=0xffa22ab4) at ../../ld/ldmain.c:428 (gdb) up #1 0xf741cdc0 in __libc_signal_restore_set (set=0xffa22360) at ../sysdeps/unix/sysv/linux/nptl-signals.h:79 79 ../sysdeps/unix/sysv/linux/nptl-signals.h: No such file or directory. (gdb) up #2 __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:55 55 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) up #3 0xf741e287 in __GI_abort () at abort.c:89 89 abort.c: No such file or directory. (gdb) up #4 0xf745833f in __libc_message (do_abort=<optimized out>, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:175 175 ../sysdeps/posix/libc_fatal.c: No such file or directory. (gdb) up #5 0xf745ef77 in malloc_printerr (action=<optimized out>, str=0xf754ebf3 "malloc(): memory corruption", ptr=<optimized out>, ar_ptr=0xf75a4780 <main_arena>) at malloc.c:5046 5046 malloc.c: No such file or directory. (gdb) up #6 0xf7460e12 in _int_malloc (av=av@entry=0xf75a4780 <main_arena>, bytes=bytes@entry=118) at malloc.c:3509 3509 in malloc.c (gdb) up #9 0x5660cd02 in gldelf_i386_search_needed ( path=0x5768fb88 "$ORIGIN/../i386-linux-gnu/wine-development:/usr/lib/i386-linux-gnu/wine-development", n=0xffa228d4, force=0) at eelf_i386.c:619 warning: Source file is more recent than executable. 619 char * filename2 = xmalloc (flen + strlen (replacement)); (gdb) -- 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