Description of problem: Trying to link a trivial test program against libgeos_c fails when linker hardening is enabled. Compiling this program with: #include "geos_c.h" int main () { GEOSversion(); return 0; } with: gcc -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o geostest geostest.c -lgeos_c reports: /usr/bin/ld: /tmp/cc6TBrjv.o: relocation R_X86_64_PC32 against undefined symbol `GEOSversion' can not be used when making a shared object; recompile with -fPIC That appears to be saying that geos_c was not compiled as PIC but objdump on the debuginfo tells me that geos_ts_c.cpp which contains that function was compiled with: -m64 -mtune=generic -march=x86-64 -g -O2 -ansi -ffloat-store -fexceptions -fstack-protector-strong -fPIC --param ssp-buffer-size=4 which does include the -fPIC switch. Version-Release number of selected component (if applicable): binutils-2.25-15.fc23.x86_64
No, that is just user error. If you are using -specs=/usr/lib/rpm/redhat/redhat-hardened-ld at link time, you also need to use -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 at compile time, and as you are compiling and linking at the same time, you need either both, or drop the -specs=/usr/lib/rpm/redhat/redhat-hardened-ld .
Thanks. Think I've found the real problem now...
ah, that's it ! , This "R_X86_64_PC32 against undefined symbol can not be used when making a shared object; recompile with -fPIC" happens when LDFLAGS are set with hardening and CFLAGS not . here is my fix for dvd95.spec --- dvd95-code-01dd592f7a8352d61fd5d8faa75463ebfd954980/configure.in.orig 2016-07-09 18:35:26.738348447 +0100 +++ dvd95-code-01dd592f7a8352d61fd5d8faa75463ebfd954980/configure.in 2016-07-10 04:00:33.515939022 +0100 @@ -13,7 +13,7 @@ AC_ISC_POSIX dnl dnl warning flags; always add -Wall dnl -CFLAGS="-Wall -O3" +#CFLAGS="-Wall -O3" AC_PROG_CC AM_PROG_CC_STDC