summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cryptlib/Makefile12
-rw-r--r--Cryptlib/OpenSSL/Makefile8
-rw-r--r--Make.defaults6
-rw-r--r--Make.scan-build4
4 files changed, 18 insertions, 12 deletions
diff --git a/Cryptlib/Makefile b/Cryptlib/Makefile
index 309536fb..2aa56959 100644
--- a/Cryptlib/Makefile
+++ b/Cryptlib/Makefile
@@ -5,14 +5,16 @@ CFLAGS = -ggdb -O0 -I$(TOPDIR) -iquote $(TOPDIR) -fno-stack-protector -fno-stri
-Wall $(EFI_INCLUDES) -std=gnu89 \
-ffreestanding -I$(shell $(CC) -print-file-name=include)
+CLANG_BUGS = $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)
+
ifeq ($(ARCH),x86_64)
- CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args -m64 \
- -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI -DNO_BUILTIN_VA_FUNCS \
- -DMDE_CPU_X64
+ CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc $(CLANG_BUGS) \
+ -m64 -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
+ -DNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64
endif
ifeq ($(ARCH),ia32)
- CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args -m32 \
- -DMDE_CPU_IA32
+ CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
+ $(CLANG_BUGS) -m32 -DMDE_CPU_IA32
endif
ifeq ($(ARCH),aarch64)
CFLAGS += -DMDE_CPU_AARCH64
diff --git a/Cryptlib/OpenSSL/Makefile b/Cryptlib/OpenSSL/Makefile
index d3437e29..916feac0 100644
--- a/Cryptlib/OpenSSL/Makefile
+++ b/Cryptlib/OpenSSL/Makefile
@@ -8,14 +8,16 @@ CFLAGS = -ggdb -O0 -I$(TOPDIR) -I$(TOPDIR)/.. -I$(TOPDIR)/../Include/ -I$(TOPDI
-ffreestanding -std=gnu89 -I$(shell $(CC) -print-file-name=include) \
-Wall $(EFI_INCLUDES) -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_SMALL_FOOTPRINT -DPEDANTIC
+CLANG_BUGS = $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)
+
ifeq ($(ARCH),x86_64)
- CFLAGS += -mno-mmx -mno-sse -mno-red-zone -maccumulate-outgoing-args \
+ CFLAGS += -mno-mmx -mno-sse -mno-red-zone $(CLANG_BUGS) \
-m64 -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
-UNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64
endif
ifeq ($(ARCH),ia32)
- CFLAGS += -mno-mmx -mno-sse -mno-red-zone -maccumulate-outgoing-args \
- -m32 -DMDE_CPU_IA32
+ CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
+ $(CLANG_BUGS) -m32 -DMDE_CPU_IA32
endif
ifeq ($(ARCH),aarch64)
CFLAGS += -O2 -DMDE_CPU_AARCH64
diff --git a/Make.defaults b/Make.defaults
index 8c321d2c..e11ab5a7 100644
--- a/Make.defaults
+++ b/Make.defaults
@@ -47,6 +47,8 @@ CFLAGS = -ggdb -O0 -fno-stack-protector -fno-strict-aliasing -fpic \
"-DDEFAULT_LOADER_CHAR=\"$(DEFAULT_LOADER)\"" \
$(EFI_INCLUDES)
+CLANG_BUGS = $(if $(findstring gcc,$(CC)),-maccumulate-outgoing-args,)
+
COMMIT_ID ?= $(shell if [ -e .git ] ; then git log -1 --pretty=format:%H ; elif [ -f commit ]; then cat commit ; else echo master; fi)
ifneq ($(origin OVERRIDE_SECURITY_POLICY), undefined)
@@ -63,7 +65,7 @@ endif
ifeq ($(ARCH),x86_64)
CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
- -maccumulate-outgoing-args -m64 \
+ $(CLANG_BUGS) -m64 \
-DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI \
-DNO_BUILTIN_VA_FUNCS -DMDE_CPU_X64 -DPAGE_SIZE=4096
LIBDIR ?= $(prefix)/lib64
@@ -73,7 +75,7 @@ ifeq ($(ARCH),x86_64)
endif
ifeq ($(ARCH),ia32)
CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc \
- -maccumulate-outgoing-args -m32 \
+ $(CLANG_BUGS) -m32 \
-DMDE_CPU_IA32 -DPAGE_SIZE=4096
LIBDIR ?= $(prefix)/lib
ARCH_SUFFIX ?= ia32
diff --git a/Make.scan-build b/Make.scan-build
index e110b3e1..4177906e 100644
--- a/Make.scan-build
+++ b/Make.scan-build
@@ -11,10 +11,10 @@ scan-clean :
scan-build : | scan-test
scan-build : clean-shim-objs
make $(DASHJ) Cryptlib/OpenSSL/libopenssl.a Cryptlib/libcryptlib.a
- scan-build -o scan-results make $(DASHJ) all
+ scan-build -o scan-results make $(DASHJ) CC=clang all
scan-build-all : | scan-test
scan-build-all : clean
- scan-build -o scan-results make $(DASHJ) all
+ scan-build -o scan-results make $(DASHJ) CC=clang all
.PHONY : scan-build scan-clean