From 3093fd5e5d418b91411aa9b061850b8773433cf7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 4 Aug 2017 11:47:08 -0700 Subject: [PATCH] Run vismain only if linker supports protected data symbol Gold doesn't support protected data symbol: configure:5672: checking linker support for protected data symbol configure:5682: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector -fPIC -shared conftest.c -o conftest.so configure:5685: $? = 0 configure:5692: gcc -fuse-ld=gold -nostdlib -nostartfiles -fno-stack-protector conftest.c -o conftest conftest.so /usr/local/bin/ld.gold: error: /tmp/ccXWoofs.o: cannot make copy relocation for protected symbol 'bar', defined in conftest.so collect2: error: ld returned 1 exit status Run vismain only if linker supports protected data symbol. * elf/Makefile (tests): Add vismain only if $(have-protected-data) == yes. (tests-pie): Likewise. --- ChangeLog | 6 ++++++ elf/Makefile | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 613db927a3..33caac763c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2017-08-04 H.J. Lu + + * elf/Makefile (tests): Add vismain only if + $(have-protected-data) == yes. + (tests-pie): Likewise. + 2017-08-04 H.J. Lu [BZ #21871] diff --git a/elf/Makefile b/elf/Makefile index e758a4c960..2956445de8 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -289,10 +289,12 @@ ifeq (yesyes,$(have-fpie)$(build-shared)) modules-names += tst-piemod1 tests += tst-pie1 tst-pie2 tests-pie += tst-pie1 tst-pie2 +ifeq (yes,$(have-protected-data)) tests += vismain tests-pie += vismain CFLAGS-vismain.c = $(PIE-ccflag) endif +endif modules-execstack-yes = tst-execstack-mod extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) -- 2.43.5