From 5c716ff64acaf8672a9fe96c21951be48b2b8d5e Mon Sep 17 00:00:00 2001 From: Alexander Egorenov Date: Wed, 26 Oct 2022 15:44:05 +0200 Subject: sys/targets: fix -static-pie for s390x arch On s390x, position independent code needs to be built with -fPIC or -fPIE for pie executables. How to reproduce on s390x ------------------------- $ git clone https://github.com/google/syzkaller.git $ cd syzkaller $ make executor go list -f '{{.Stale}}' ./sys/syz-sysgen | grep -q false || go install ./sys/syz-sysgen make .descriptions make[1]: '.descriptions' is up to date. mkdir -p ./bin/linux_s390x gcc -o ./bin/linux_s390x/syz-executor executor/executor.cc \ -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable \ -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds \ -Wno-format-overflow -static-pie -DGOOS_linux=1 -DGOARCH_s390x=1 \ -DHOSTGOOS_linux=1 -DGIT_REVISION=\"2159e4d29f58ffa1107fc2213dbc87185ff4498f\" /usr/bin/ld: read-only segment has dynamic relocations Signed-off-by: Alexander Egorenov --- sys/targets/targets.go | 1 + 1 file changed, 1 insertion(+) (limited to 'sys') diff --git a/sys/targets/targets.go b/sys/targets/targets.go index f3be708f3..45db59d11 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -285,6 +285,7 @@ var List = map[string]map[string]*Target{ PtrSize: 8, PageSize: 4 << 10, DataOffset: 0xfffff000, + CFlags: []string{"-fPIE"}, LittleEndian: false, Triple: "s390x-linux-gnu", KernelArch: "s390", -- cgit mrf-deployment