Makefile changes/cleanups
cover Makefile changes/cleanups
Pick up Gavin's patch for building on Ubuntu Yakkety/Zesty and add a couple cleanups to ARM's and POWER's makefiles.
Andrew Jones (4):
arm/Makefile.common cleanup powerpc/Makefile.common cleanup arm/Makefile.common: generated files dep cleanup powerpc/Makefile.common: generated files dep cleanup
Gavin Guo (1):
Makefile: Disable PIE as GCC enables it by default from 6.2.0-7
Makefile | 3 +++ arm/Makefile.common | 13 ++++--------- powerpc/Makefile.common | 13 ++++--------- 3 files changed, 11 insertions(+), 18 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/5 Makefile: Disable PIE as GCC enables it by default from 6.2.0-7
From: Gavin Guo <[email protected]>
Build fail can be observed while the kvm-unit-tests builds on Ubuntu Yakkety/Zesty release:
/usr/bin/ld: x86/cstart64.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
and can be fixed by adding "-fno-pic" and "-no-pie" option.
There are other discussions:
- gcc-6 6.2.0-7 breaks kernel build if stack protection is enabled
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841368
- [yakkety,RFC,v1] disable -pie when gcc has it enabled by default
https://patchwork.ozlabs.org/patch/616621/
- https://wiki.ubuntu.com/YakketyYak/ReleaseNotes#GCC
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -51,11 +51,14 @@ fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "") fnostack_protector := $(call cc-option, -fno-stack-protector, "") fnostack_protector_all := $(call cc-option, -fno-stack-protector-all, "") wno_frame_address := $(call cc-option, -Wno-frame-address, "") +fno_pic := $(call cc-option, -fno-pic, "") +no_pie := $(call cc-option, -no-pie, "") CFLAGS += $(fomit_frame_pointer) CFLAGS += $(fno_stack_protector) CFLAGS += $(fno_stack_protector_all) CFLAGS += $(wno_frame_address) CFLAGS += $(if $(U32_LONG_FMT),-D__U32_LONG_FMT__,) +CFLAGS += $(fno_pic) $(no_pie) CXXFLAGS += $(CFLAGS)
Signature · 1 line
2.9.3
PATCH 2/5 arm/Makefile.common cleanup
In reply to Andrew JonesWe no longer need to add -fno-pic in the arm makefile. It's now added at the top-level.
--- arm/Makefile.common | 1 - 1 file changed, 1 deletion(-)
arm/Makefile.common +0 -1
@@ -22,7 +22,6 @@ phys_base = $(LOADADDR) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -fno-pic CFLAGS += -Wextra CFLAGS += -O2 CFLAGS += -I lib -I lib/libfdt
Signature · 1 line
2.9.3
PATCH 3/5 powerpc/Makefile.common cleanup
In reply to Andrew JonesRemove -fpie from CFLAGS, which is unnecessary, and now, with the addition of -no-pie to the common Makefile, even confusing.
--- powerpc/Makefile.common | 1 - 1 file changed, 1 deletion(-)
powerpc/Makefile.common +0 -1
@@ -21,7 +21,6 @@ CFLAGS += -Wextra CFLAGS += -O2 CFLAGS += -I lib -I lib/libfdt CFLAGS += -Wa,-mregnames -CFLAGS += -fpie # We want to keep intermediate files .PRECIOUS: %.o
Signature · 1 line
2.9.3
PATCH 4/5 arm/Makefile.common: generated files dep cleanup
In reply to Andrew Jones--- arm/Makefile.common | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
arm/Makefile.common +4 -8
@@ -15,7 +15,8 @@ tests-common += $(TEST_DIR)/pci-test.flat tests-common += $(TEST_DIR)/pmu.flat tests-common += $(TEST_DIR)/gic.flat -all: test_cases +tests-all = $(tests-common) $(tests) +all: $(tests-all) ################################################################## phys_base = $(LOADADDR)
@@ -74,10 +75,5 @@ arm_clean: libfdt_clean asm_offsets_clean $(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \ $(TEST_DIR)/.*.d lib/arm/.*.d -################################################################## - -generated_files = $(asm-offsets) - -test_cases: $(generated_files) $(tests-common) $(tests) - -$(TEST_DIR)/selftest.o $(cstart.o): $(asm-offsets) +generated-files = $(asm-offsets) +$(tests-all:.flat=.o) $(cstart.o) $(cflatobjs): $(generated-files)
Signature · 1 line
2.9.3
PATCH 5/5 powerpc/Makefile.common: generated files dep cleanup
In reply to Andrew Jones--- powerpc/Makefile.common | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
powerpc/Makefile.common +4 -8
@@ -11,7 +11,8 @@ tests-common = \ $(TEST_DIR)/emulator.elf \ $(TEST_DIR)/tm.elf -all: $(TEST_DIR)/boot_rom.bin test_cases +tests-all = $(tests-common) $(tests) +all: $(TEST_DIR)/boot_rom.bin $(tests-all) ##################################################################
@@ -69,10 +70,5 @@ powerpc_clean: libfdt_clean asm_offsets_clean $(RM) $(TEST_DIR)/*.{o,elf} $(TEST_DIR)/boot_rom.bin \ $(TEST_DIR)/.*.d lib/powerpc/.*.d -################################################################## - -generated_files = $(asm-offsets) - -test_cases: $(generated_files) $(tests-common) $(tests) - -$(cstart.o): $(asm-offsets) +generated-files = $(asm-offsets) +$(tests-all:.elf=.o) $(cstart.o) $(cflatobjs): $(generated-files)
Signature · 1 line
2.9.3
Radim Krčmář
Applied2017-01-16 14:38+0100, Andrew Jones:
Quoted 2 lines
Pick up Gavin's patch for building on Ubuntu Yakkety/Zesty and add a couple cleanups to ARM's and POWER's makefiles.
Applied, thanks.