Commit 0dd3a694 authored by Florian Weimer's avatar Florian Weimer Committed by Shuah Khan (Samsung OSG)

selftests/x86: Detect -no-pie availability

Some toolchains need -no-pie to build all tests, others do not support
the -no-pie flag at all.  Therefore, add another test for the
availability of the flag.

This amends commit 3346a6a4
("selftests: x86: sysret_ss_attrs doesn't build on a PIE build").
Signed-off-by: default avatarFlorian Weimer <fweimer@redhat.com>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
parent 08529914
...@@ -8,6 +8,7 @@ include ../lib.mk ...@@ -8,6 +8,7 @@ include ../lib.mk
UNAME_M := $(shell uname -m) UNAME_M := $(shell uname -m)
CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie)
TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \
check_initial_reg_state sigreturn iopl mpx-mini-test ioperm \ check_initial_reg_state sigreturn iopl mpx-mini-test ioperm \
...@@ -31,7 +32,12 @@ BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64) ...@@ -31,7 +32,12 @@ BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32)) BINARIES_32 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_32))
BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64)) BINARIES_64 := $(patsubst %,$(OUTPUT)/%,$(BINARIES_64))
CFLAGS := -O2 -g -std=gnu99 -pthread -Wall -no-pie CFLAGS := -O2 -g -std=gnu99 -pthread -Wall
# call32_from_64 in thunks.S uses absolute addresses.
ifeq ($(CAN_BUILD_WITH_NOPIE),1)
CFLAGS += -no-pie
endif
define gen-target-rule-32 define gen-target-rule-32
$(1) $(1)_32: $(OUTPUT)/$(1)_32 $(1) $(1)_32: $(OUTPUT)/$(1)_32
......
/* Trivial program to check that compilation with certain flags is working. */
#include <stdio.h>
int
main(void)
{
puts("");
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment