binutils 2.24 assertion failure on arm
rofl0r opened this issue · 3 comments
rofl0r commented
this happens when building git, mixing static and dynamic (openssl, zlib) libs
/root:/src/build/git/git-1.8.4$ gcc -fdata-sections -ffunction-sections -Os -g0
-fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -ftree-dce
-I. -DNO_GETTEXT -DHAVE_PATHS_H -DHAVE_DEV_TTY -DSHA1_HEADER='<openssl/sha.h>'
-DNO_STRLCPY -DUSE_WILDMATCH -DNO_MKSTEMPS -DSHELL_PATH='"/bin/sh"' -o git-cred
ential-store -s -Wl,--gc-sections -Wl,-z,relro,-z,now credential-store.o libgit
.a xdiff/lib.a -lz -lcrypto -lpthread
/bin/ld: BFD (GNU Binutils) 2.24 assertion fail elf32-arm.c:12387
/bin/ld: BFD (GNU Binutils) 2.24 assertion fail elf32-arm.c:12387
collect2: error: ld returned 1 exit statusbin/ld: BFD (GNU Binutils) 2.24 assertion fail elf32-arm.c:12387
collect2: error: ld returned 1 exit status
the code in binutils:
binutils-2.24/bfd/elf32-arm.c 12387
if (may_need_local_target_p
&& elf32_arm_get_plt_info (abfd, eh, r_symndx, &root_plt, &arm_plt))
{
/* If PLT refcount book-keeping is wrong and too low, we'll
see a zero value (going to -1) for the root PLT reference
count. */
if (root_plt->refcount >= 0)
{
BFD_ASSERT (root_plt->refcount != 0); // XXX
root_plt->refcount -= 1;
}
my attempts to produce a testcase failed so far.
rofl0r commented
util-linux is affected as well, dmesg fails to link
rofl0r commented
according to tests done by wbx, the bug is triggered by -s
in combination with -Wl,--gc-sections
on a dynamic linked lib ( experienced with lzo ).
possibly related bug: https://sourceware.org/bugzilla/show_bug.cgi?id=14189
rofl0r commented
filed upstream bug https://sourceware.org/bugzilla/show_bug.cgi?id=16698