Sorry, v1 does not work with GCC. gcc x86_64 rejects -mpreferred-stack-boundary=2, so we need to check -mpreferred-stack-boundary=4 instead
Signed-off-by: Fangrui Song maskray@google.com --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile index 7720db9..66b3eab 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ CPPFLAGS = -P -MD -MT $@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -Wall -Wno-strict-aliasing -Wold-style-definition \ $(call cc-option,-Wtype-limits) \ - -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \ + -m32 -march=i386 -mregparm=3 \ -minline-all-stringops -fomit-frame-pointer \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ -ffunction-sections -fdata-sections -fno-common -fno-merge-constants @@ -69,6 +69,11 @@ COMMONCFLAGS += $(call cc-option,-fno-stack-protector) COMMONCFLAGS += $(call cc-option,-fno-stack-protector-all) COMMONCFLAGS += $(call cc-option,-fstack-check=no) COMMONCFLAGS += $(call cc-option,-Wno-address-of-packed-member) +ifneq ($(call cc-option,-mpreferred-stack-boundary=4),) +COMMONCFLAGS += -mpreferred-stack-boundary=2 +else +COMMONCFLAGS += -mstack-alignment=4 +endif COMMA := ,
CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0