198d863a5SJerome Forissier# CROSS_COMPILE_$(sm) is derived from CROSS_COMPILE/CROSS_COMPILE32/ 298d863a5SJerome Forissier# CROSS_COMPILE64 and indicates the target that should be passed to clang. Path 398d863a5SJerome Forissier# components are ignored, as well as any command before the compiler name (for 498d863a5SJerome Forissier# instance "/some/path/ccache /other/path/arm-linux-gnueabihf-"). 598d863a5SJerome Forissier# We try to extract any ccache command if present. 698d863a5SJerome Forissierclang-target := $(patsubst %-,%,$(notdir $(lastword $(CROSS_COMPILE_$(sm))))) 798d863a5SJerome Forissierccache-cmd := $(if $(findstring ccache,$(CROSS_COMPILE_$(sm))),$(firstword $(CROSS_COMPILE_$(sm))) ,) 898d863a5SJerome Forissier 998d863a5SJerome ForissierCC$(sm) := $(ccache-cmd)clang --target=$(clang-target) 10*be3bc461SJerome ForissierCXX$(sm) := false # Untested yet 11c12b5608SVictor Chong# Due to the absence of clang-cpp in AOSP's prebuilt version of clang, 12c12b5608SVictor Chong# use the equivalent command of 'clang -E' 13c12b5608SVictor ChongCPP$(sm) := $(ccache-cmd)clang --target=$(clang-target) -E 1498d863a5SJerome ForissierLD$(sm) := $(ccache-cmd)ld.lld 1598d863a5SJerome Forissier 1698d863a5SJerome ForissierAR$(sm) := $(ccache-cmd)llvm-ar 1798d863a5SJerome ForissierNM$(sm) := llvm-nm 1833017d85SJerome ForissierOBJCOPY$(sm) := llvm-objcopy 19787d2737SJerome ForissierOBJDUMP$(sm) := llvm-objdump 2098d863a5SJerome ForissierREADELF$(sm) := llvm-readelf 2198d863a5SJerome Forissier 2298d863a5SJerome Forissiernostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ 2398d863a5SJerome Forissier -print-file-name=include 2> /dev/null) 2498d863a5SJerome Forissier 2598d863a5SJerome Forissiercomp-cflags-warns-clang := -Wno-language-extension-token \ 2698d863a5SJerome Forissier -Wno-gnu-zero-variadic-macro-arguments 2798d863a5SJerome Forissier 2816013599SVictor Chong# Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of 2916013599SVictor Chong# libgcc for clang 309e4ebcdcSJerome Forissierlibgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ 3116013599SVictor Chong -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) 3298d863a5SJerome Forissier 33b77aa8a0SJerome Forissier# Core ASLR relies on the executable being ready to run from its preferred load 34b77aa8a0SJerome Forissier# address, because some symbols are used before the MMU is enabled and the 35b77aa8a0SJerome Forissier# relocations are applied. 36b77aa8a0SJerome Forissierldflag-apply-dynamic-relocs := --apply-dynamic-relocs 37b77aa8a0SJerome Forissier 3898d863a5SJerome Forissier# Define these to something to discover accidental use 3998d863a5SJerome ForissierCC := false 40*be3bc461SJerome ForissierCXX := false 4198d863a5SJerome ForissierCPP := false 4298d863a5SJerome ForissierLD := false 4398d863a5SJerome ForissierAR := false 4498d863a5SJerome ForissierNM := false 4598d863a5SJerome ForissierOBJCOPY := false 4698d863a5SJerome ForissierOBJDUMP := false 4798d863a5SJerome ForissierREADELF := false 4898d863a5SJerome Forissiernostdinc := --bad-nostdinc-variable 4998d863a5SJerome Forissierlibgcc := --bad-libgcc-variable 5098d863a5SJerome Forissier 51