Parcourir la source

[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 <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown il y a 12 ans
Parent
révision
f008698c68
1 fichiers modifiés avec 12 ajouts et 0 suppressions
  1. 12
    0
      src/arch/x86_64/Makefile

+ 12
- 0
src/arch/x86_64/Makefile Voir le fichier

@@ -26,6 +26,18 @@ CFLAGS		+= -fshort-wchar
26 26
 #
27 27
 CFLAGS			+= -Ui386
28 28
 
29
+# Add -maccumulate-outgoing-args if required by this version of gcc
30
+#
31
+ifeq ($(CCTYPE),gcc)
32
+MS_ABI_TEST_CODE := extern void __attribute__ (( ms_abi )) ms_abi(); \
33
+		    void sysv_abi ( void ) { ms_abi(); }
34
+MS_ABI_TEST = $(ECHO) '$(MS_ABI_TEST_CODE)' | \
35
+	      $(CC) -m64 -mno-accumulate-outgoing-args -x c -c - -o /dev/null \
36
+		    >/dev/null 2>&1
37
+MS_ABI_FLAGS := $(shell $(MS_ABI_TEST) || $(ECHO) '-maccumulate-outgoing-args')
38
+WORKAROUND_CFLAGS += $(MS_ABI_FLAGS)
39
+endif
40
+
29 41
 # x86_64-specific directories containing source files
30 42
 #
31 43
 SRCDIRS		+= arch/x86_64/prefix

Chargement…
Annuler
Enregistrer