You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now libiberty.a is not available for shared objects unless it was built with PIC. GCC always builds two libiberty.a and we should install the PIC one not the plain static one.
root@stable-40001 [ ~ ] # cat demangle.c
#include <stdio.h>
#include <libiberty/demangle.h>
__attribute__((constructor))
void mian() {
char *prot = cplus_demangle("_ZN9wikipedia7article6formatEv", DMGL_AUTO);
puts(prot);
}
root@stable-40001 [ ~ ] # gcc -shared -fPIC demangle.c -o test.so
root@stable-40001 [ ~ ] # load-shlib ./test.so
./test.so: undefined symbol: cplus_demangle
root@stable-40001 [ ~ ] ! gcc -shared -fPIC demangle.c -o test.so -liberty
/bin/ld: error: /usr/lib/gcc/x86_64-aosc-linux-gnu/8.3.1/../../../../lib64/libiberty.a(cplus-dem.o): requires dynamic R_X86_64_PC32 reloc against '_sch_istable' which may overflow at runtime; recompile with -fPIC
/bin/ld: error: /usr/lib/gcc/x86_64-aosc-linux-gnu/8.3.1/../../../../lib64/libiberty.a(cp-demangle.o): requires dynamic R_X86_64_PC32 reloc against 'cplus_demangle_builtin_types' which may overflow at runtime; recompile with -fPIC
/bin/ld: error: /usr/lib/gcc/x86_64-aosc-linux-gnu/8.3.1/../../../../lib64/libiberty.a(d-demangle.o): requires dynamic R_X86_64_PC32 reloc against '_sch_istable' which may overflow at runtime; recompile with -fPIC
/bin/ld: error: /usr/lib/gcc/x86_64-aosc-linux-gnu/8.3.1/../../../../lib64/libiberty.a(xmalloc.o): requires dynamic R_X86_64_PC32 reloc against 'environ' which may overflow at runtime; recompile with -fPIC
/bin/ld: error: /usr/lib/gcc/x86_64-aosc-linux-gnu/8.3.1/../../../../lib64/libiberty.a(xexit.o
): requires dynamic R_X86_64_PC32 reloc against '_xexit_cleanup' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
FYI, Arch Linux had the same issue and they fixed it:
Now libiberty.a is not available for shared objects unless it was built with PIC. GCC always builds two libiberty.a and we should install the PIC one not the plain static one.
FYI, Arch Linux had the same issue and they fixed it:
The text was updated successfully, but these errors were encountered: