summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2017-09-03 23:42:58 +0200
committerNico Huber <nico.h@gmx.de>2017-09-23 10:57:40 +0000
commit1850aa6df6a324960bd0873277660d84562cdb61 (patch)
treeed1e44a1d0e4bd715fead2e1aed8e636e764e01d
parent5218533ae7cb5c52f07b60a8c08a5ac3d8f37f7c (diff)
toolchain: Always use GCC for Ada sources
We can't use $(CC) in case it's set to Clang. TEST=Built one target with Ada sources before and after this change and verified that the same compiler commands are emitted. Change-Id: I9b8ea35352d74b364f09fc12d8d981ca42f8b7c8 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/21366 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rw-r--r--Makefile16
-rw-r--r--src/lib/gnat/Makefile.inc2
-rw-r--r--toolchain.inc3
3 files changed, 14 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 4ad0177420..329eaeb2c9 100644
--- a/Makefile
+++ b/Makefile
@@ -308,13 +308,19 @@ define create_cc_template
# $4 additional dependencies
ifn$(EMPTY)def $(1)-objs_$(2)_template
de$(EMPTY)fine $(1)-objs_$(2)_template
+ifn$(EMPTY)eq ($(filter ads adb,$(2)),)
$$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $$(call create_ada_deps,$1,$$(call src-to-ali,$1,$$(1).$2)) $(KCONFIG_AUTOHEADER) $(4)
+ @printf " GCC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
+ $(GCC_$(1)) \
+ $$$$(ADAFLAGS_$(1)) $$$$(addprefix -I,$$$$($(1)-ada-dirs)) \
+ $(3) -c -o $$$$@ $$$$<
+el$(EMPTY)se
+$$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $(KCONFIG_AUTOHEADER) $(4)
@printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
$(CC_$(1)) \
- $$(if $$(filter-out ads adb,$(2)), \
- -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@), \
- $$$$(ADAFLAGS_$(1)) $$$$(addprefix -I,$$$$($(1)-ada-dirs))) \
+ -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) \
$(3) -c -o $$$$@ $$$$<
+end$(EMPTY)if
en$(EMPTY)def
end$(EMPTY)if
endef
@@ -345,8 +351,8 @@ $$(obj)/$(1)/b__$(1).adb: $$$$(filter-out $$(obj)/$(1)/b__$(1).ali,$$$$($(1)-ali
-L$(1)_ada -o $$(notdir $$@) \
$$(subst $$(dir $$@),,$$^)
$$(obj)/$(1)/b__$(1).o: $$(obj)/$(1)/b__$(1).adb
- @printf " CC $$(subst $$(obj)/,,$$@)\n"
- $(CC_$(1)) $$(ADAFLAGS_$(1)) -c -o $$@ $$<
+ @printf " GCC $$(subst $$(obj)/,,$$@)\n"
+ $(GCC_$(1)) $$(ADAFLAGS_$(1)) -c -o $$@ $$<
$(1)-objs += $$(obj)/$(1)/b__$(1).o
$($(1)-alis): %.ali: %.o ;
endef
diff --git a/src/lib/gnat/Makefile.inc b/src/lib/gnat/Makefile.inc
index 5c4c510f7e..3f22c0e8e1 100644
--- a/src/lib/gnat/Makefile.inc
+++ b/src/lib/gnat/Makefile.inc
@@ -24,7 +24,7 @@ ADAFLAGS_libgnat-$(1) := \
-gnatg \
-gnatpg \
-I$$(src)/lib/gnat/ \
- $$(CFLAGS_$(1)) \
+ $$(GCC_CFLAGS_$(1)) \
libgnat-$(1)-y += a-unccon.ads
libgnat-$(1)-y += ada.ads
diff --git a/toolchain.inc b/toolchain.inc
index 936eb14c7f..f8ee87578e 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -120,6 +120,7 @@ define create_class_compiler
$(if $(2),,$(warning *** The toolchain architecture for $(1) is unknown.) \
$(error Check your .config file for CONFIG_ARCH_$(1)_* settings))
CC_$(1) := $(CC_$(2))
+GCC_$(1) := $(GCC_CC_$(2))
LD_$(1) := $(LD_$(2))
NM_$(1) := $(NM_$(2))
AR_$(1) := $(AR_$(2))
@@ -129,7 +130,7 @@ OBJDUMP_$(1) := $(OBJDUMP_$(2))
STRIP_$(1) := $(STRIP_$(2))
READELF_$(1) := $(READELF_$(2))
CFLAGS_$(1) = $$(CFLAGS_common) $$(CFLAGS_$(2))
-ADAFLAGS_$(1) = --RTS=$$(obj)/libgnat-$(2)/ $$(ADAFLAGS_common) $$(CFLAGS_$(2))
+ADAFLAGS_$(1) = --RTS=$$(obj)/libgnat-$(2)/ $$(ADAFLAGS_common) $$(GCC_CFLAGS_$(2))
CPPFLAGS_$(1) = $$(CPPFLAGS_common) $$(CPPFLAGS_$(2)) -D__ARCH_$(2)__
COMPILER_RT_$(1) := $$(COMPILER_RT_$(2))
COMPILER_RT_FLAGS_$(1) := $$(COMPILER_RT_FLAGS_$(2))