From: Michael Brown Date: Fri, 2 Nov 2012 13:21:52 +0000 (+0000) Subject: [build] Use -maccumulate-outgoing-args if required by gcc X-Git-Tag: v1.20.1~1607 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f008698c68618111babd2a5b7c5438110f69261e;p=thirdparty%2Fipxe.git [build] Use -maccumulate-outgoing-args if required by gcc Current versions of gcc require -maccumulate-outgoing-args if any sysv_abi functions call ms_abi functions. This requirement is likely to be lifted in future gcc versions, so test explicitly to see if the current version of gcc requires -maccumulate-outgoing-args. This problem is currently masked since the implied -fasynchronous-unwind-tables (which is the default in current gcc versions) implies -maccumulate-outgoing-args. Signed-off-by: Michael Brown --- diff --git a/src/arch/x86_64/Makefile b/src/arch/x86_64/Makefile index d2c2ff53d..b687f3407 100644 --- a/src/arch/x86_64/Makefile +++ b/src/arch/x86_64/Makefile @@ -26,6 +26,18 @@ CFLAGS += -fshort-wchar # CFLAGS += -Ui386 +# Add -maccumulate-outgoing-args if required by this version of gcc +# +ifeq ($(CCTYPE),gcc) +MS_ABI_TEST_CODE := extern void __attribute__ (( ms_abi )) ms_abi(); \ + void sysv_abi ( void ) { ms_abi(); } +MS_ABI_TEST = $(ECHO) '$(MS_ABI_TEST_CODE)' | \ + $(CC) -m64 -mno-accumulate-outgoing-args -x c -c - -o /dev/null \ + >/dev/null 2>&1 +MS_ABI_FLAGS := $(shell $(MS_ABI_TEST) || $(ECHO) '-maccumulate-outgoing-args') +WORKAROUND_CFLAGS += $(MS_ABI_FLAGS) +endif + # x86_64-specific directories containing source files # SRCDIRS += arch/x86_64/prefix