Skip to contentSkip to conversation

package/kvm-unit-tests: fix build without ssp

PATCH Superseded Fabrice Fontaine 2 participants 2 messages May 24, 2019 – May 25, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/kvm-unit-tests: fix build without ssp

Makefile tries to detect stack-protector which will result in build failures if ssp is not available so disable stack protector is SSP is not available through EXTRA_CFLAGS

Fixes:
- http://autobuild.buildroot.org/results/e6f767755ffdb5ecc014eb5ad7519814f075a60e

---
 package/kvm-unit-tests/kvm-unit-tests.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/kvm-unit-tests/kvm-unit-tests.mk +7 -2
index 92d67fb34b..ac1bb1f7aa 100644
@@ -39,16 +39,21 @@ ifneq ($(BR2_x86_64),y)
 KVM_UNIT_TESTS_CONF_OPTS += --cross-prefix="$(TARGET_CROSS)"
 endif
 
+# Don't force -fstack-protector when SSP is not available in toolchain
+KVM_UNIT_TESTS_MAKE_OPTS += \
+	EXTRA_CFLAGS=$(if $(BR2_TOOLCHAIN_HAS_SSP),,-fno-stack-protector)
+
 define KVM_UNIT_TESTS_CONFIGURE_CMDS
 	cd $(@D) && ./configure $(KVM_UNIT_TESTS_CONF_OPTS)
 endef
 
 define KVM_UNIT_TESTS_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) standalone
+	$(TARGET_MAKE_ENV) $(MAKE) $(KVM_UNIT_TESTS_MAKE_OPTS) -C $(@D) \
+		standalone
 endef
 
 define KVM_UNIT_TESTS_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+	$(TARGET_MAKE_ENV) $(MAKE) $(KVM_UNIT_TESTS_MAKE_OPTS) -C $(@D) \
 		DESTDIR=$(TARGET_DIR)/usr/share/kvm-unit-tests/ \
 		install
 endef
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/kvm-unit-tests: fix build without ssp

Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fabrice" == Fabrice Fontaine <[email protected]> writes:

Makefile tries to detect stack-protector which will result in build failures if ssp is not available so disable stack protector is SSP is not available through EXTRA_CFLAGS

Fixes:
- http://autobuild.buildroot.org/results/e6f767755ffdb5ecc014eb5ad7519814f075a60e

---
 package/kvm-unit-tests/kvm-unit-tests.mk | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
package/kvm-unit-tests/kvm-unit-tests.mk +0 -0
index 92d67fb34b..ac1bb1f7aa 100644

package/kvm-unit-tests/kvm-unit-tests.mk ifneq ($(BR2_x86_64),y) · line 44

Quoted 6 lines
package/kvm-unit-tests/kvm-unit-tests.mk +3 -0
@@ -39,16 +39,21 @@ ifneq ($(BR2_x86_64),y)
 KVM_UNIT_TESTS_CONF_OPTS += --cross-prefix="$(TARGET_CROSS)"
 endif
 
+# Don't force -fstack-protector when SSP is not available in toolchain
+KVM_UNIT_TESTS_MAKE_OPTS += \
+	EXTRA_CFLAGS=$(if $(BR2_TOOLCHAIN_HAS_SSP),,-fno-stack-protector)

Hmm, we have BR2_SSP_* options to configure the stack protection setting to use nowadays, but this cannot work as:

- The autobuilder reference .config has BR2_TOOLCHAIN_HAS_SSP=y
- kvm-unit-tests uses the host compiler on x86-64 (where we don't know
- if ssp support is available) because of:

commit e1b344070c607f9a3f0a7004650f00c9e6e83c7b

Author: Cyril Bur <[email protected]>
Date:   Wed Oct 26 14:19:15 2016 +1100

kvm-unit-tests: Fix x86_64 to use host compiler

kvm-unit-tests requires a multilib compiler for x86_64 as it compiles 32bit boot code.

This patch uses the BR2_HOSTARCH_NEEDS_IA32_COMPILER option to enforce this and avoids using TARGET_CROSS for x86_64 targets and uses the host 32bit (and 64bit) capable compiler.

[Thomas: reword comment in .mk file.]

This is all pretty broken. I guess the best solution we have for x86-64 is to unconditionally pass -fno-stack-protector.

Signature · 1 line
Bye, Peter Korsgaard