package/pcre: compile with -fPIC when BR2_PIC_PIE is set
PATCH 1/1 package/pcre: compile with -fPIC when BR2_PIC_PIE is set
Otherwise build fails with following error:
Toolchain wrapper executing: '/tools/aarch64-linux-gnu/bin//aarch64-linux-gnu-g++' '--sysroot' '/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot' '-mabi=lp64' '-fstack-protector-strong' '-fstack-clash-protection' '-mcpu=cortex-a35' '-fPIE' '-Wl,-z,now' '-Wl,-z,relro' '-shared' '-nostdlib' '/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/crti.o' '/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/crtbeginS.o' '.libs/libpcrecpp_la-pcrecpp.o' '.libs/libpcrecpp_la-pcre_scanner.o' '.libs/libpcrecpp_la-pcre_stringpiece.o' '-Wl,-rpath' '-Wl,/home/user/work/buildroot/output/build/pcre-8.44/.libs' './.libs/libpcre.so' '-L/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0' '-L/tools/aarch64-linux-gnu/bin/../lib/gcc' '-L/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/../lib64' '-L/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/
lib/../lib64' '-L/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64' '-L/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib' '-L/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/lib' '-L/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib' '-lstdc++' '-lm' '-lc' '-lgcc_s' '/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/crtendS.o' '/home/user/work/buildroot/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/crtn.o' '-Os' '-g2' '-Wl,-soname' '-Wl,libpcrecpp.so.0' '-o' '.libs/libpcrecpp.so.0.0.2'
CCLD pcretest
CCLD pcregrep
/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/ld: warning: -z noexecheap ignored
/tools/aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/ld: .libs/libpcrecpp_la-pcrecpp.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZN7pcrecpp3Arg10parse_nullEPKciPv' which may bind externally can not be used when making a shared object; recompile with -fPIC.libs/libpcrecpp_la-pcrecpp.o: in function `pcrecpp::Arg::Arg(void*)':
/home/user/work/buildroot/output/build/pcre-8.44/./pcrecpparg.h:139:(.text.startup+0x4): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
Makefile:1568: recipe for target 'libpcrecpp.la' failed
make[3]: *** [libpcrecpp.la] Error 1
--- package/pcre/pcre.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/pcre/pcre.mk +6 -0
@@ -27,5 +27,11 @@ PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_32),--enable-pcre32,--disable-pcre32) PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_UTF),--enable-utf,--disable-utf) PCRE_CONF_OPTS += $(if $(BR2_PACKAGE_PCRE_UCP),--enable-unicode-properties,--disable-unicode-properties) +ifeq ($(BR2_PIC_PIE),y) +PCRE_CFLAGS += -fPIC +PCRE_CXXFLAGS += -fPIC +PCRE_CONF_OPTS += CFLAGS="$(PCRE_CFLAGS)" CXXFLAGS="$(PCRE_CXXFLAGS)" +endif + $(eval $(autotools-package)) $(eval $(host-autotools-package))
Signature · 15 lines
2.25.1 ########################################################################### This email is confidential and may contain information subject to legal privilege. If you are not the intended recipient please advise us of our error by return e-mail then delete this email and any attached files. You may not copy, disclose or use the contents in any way. The views expressed in this email may not be those of Gallagher Group Ltd or subsidiary companies thereof. ########################################################################### _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot