From 03d6cc6106bd72503a669c8640335fe858ebeaf2 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 1 Dec 2020 11:41:57 -0800 Subject: Makefile: use -fPIC instead of -fPIE According to the gcc docs: -fPIE These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables Example failure when linking against shared library: FAILED: lib/libbrillo-core.so x86_64-cros-linux-gnu-clang++ -shared -Wl,-O2 -Wl,--as-needed -Wl,--gc-sections -Wl,--icf=all -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now -Wl,--as-needed --sysroot=/build/hatch -o ./lib/libbrillo-core.so -Wl,-soname=libbrillo-core.so @lib/libbrillo-core.so.rsp ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol subprocess_stdin; recompile with -fPIC >>> defined in /build/hatch/usr/lib/../lib64/libvboot_host.a(subprocess.o) >>> referenced by subprocess.c:278 (host/lib/subprocess.c:278) >>> subprocess.o:(subprocess_run) in archive /build/hatch/usr/lib/../lib64/libvboot_host.a BRANCH=none BUG=b:174578361 TEST=FEATURES="test" emerge-hatch vboot_reference Change-Id: I5cda8dbe87d20d1b4b659459d861bc04f492e3e5 Signed-off-by: Tom Hughes Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2568259 Commit-Queue: Julius Werner Reviewed-by: Julius Werner --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5de9f576..df7e4049 100644 --- a/Makefile +++ b/Makefile @@ -259,7 +259,7 @@ CFLAGS += -MMD -MF $@.d ifeq (${FIRMWARE_ARCH},) # Creates position independent code for non firmware target. -CFLAGS += -fPIE +CFLAGS += -fPIC endif CFLAGS += -D_GNU_SOURCE -- cgit v1.2.1