From f9655266976f88520bb97f62dd44e3eae37f38f9 Mon Sep 17 00:00:00 2001 From: Ramy Medhat Date: Tue, 6 Aug 2019 15:54:48 -0400 Subject: [PATCH] [DO NOT MERGE] Add labels to rewrapper cc compile action. Prevent ccwrapper from being used in links. Test: Built aosp-arm64_eng with and without USE_RBE=1 Bug: b/166182389 Change-Id: I8d04069219a9467c3de9a028eb68e3115173f1e2 Merged-In: I8d04069219a9467c3de9a028eb68e3115173f1e2 --- core/binary.mk | 8 ++++++++ core/definitions.mk | 16 ++++++++-------- core/java_renderscript.mk | 1 + core/rbe.mk | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index de4f1fc739..87a8a92b6d 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -54,6 +54,7 @@ my_asflags := $(LOCAL_ASFLAGS) my_cc := $(LOCAL_CC) my_cc_wrapper := $(CC_WRAPPER) my_cxx := $(LOCAL_CXX) +my_cxx_link := $(LOCAL_CXX) my_cxx_ldlibs := my_cxx_wrapper := $(CXX_WRAPPER) my_c_includes := $(LOCAL_C_INCLUDES) @@ -1707,13 +1708,20 @@ ifeq ($(strip $(my_cxx)),) my_cxx := $(my_cxx_wrapper) $(CLANG_CXX) endif +ifeq ($(strip $(my_cxx_link)),) + my_cxx_link := $(CLANG_CXX) +endif + ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \ $(SYNTAX_TOOLS_PREFIX)/c++-analyzer + my_cxx_link := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \ + $(SYNTAX_TOOLS_PREFIX)/c++-analyzer endif $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX_LINK := $(my_cxx_link) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) diff --git a/core/definitions.mk b/core/definitions.mk index 85db6dbedf..9636d0e00c 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -951,7 +951,7 @@ define transform-bc-to-so $(hide) mkdir -p $(dir $@) $(hide) $(BCC_COMPAT) -O3 -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \ -rt-path $(RS_PREBUILT_CLCORE) -mtriple $(RS_COMPAT_TRIPLE) $< -$(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) -nostdlib \ +$(hide) $(PRIVATE_CXX_LINK) -shared -Wl,-soname,$(notdir $@) -nostdlib \ -Wl,-rpath,\$$ORIGIN/../lib \ $(dir $@)/$(notdir $(<:.bc=.o)) \ $(RS_PREBUILT_COMPILER_RT) \ @@ -1534,7 +1534,7 @@ $(hide) mv -f $@.tmp $@ endef define transform-o-to-aux-executable-inner -$(hide) $(PRIVATE_CXX) -pie \ +$(hide) $(PRIVATE_CXX_LINK) -pie \ -Bdynamic \ -Wl,--gc-sections \ $(PRIVATE_ALL_OBJECTS) \ @@ -1553,7 +1553,7 @@ $(transform-o-to-aux-executable-inner) endef define transform-o-to-aux-static-executable-inner -$(hide) $(PRIVATE_CXX) \ +$(hide) $(PRIVATE_CXX_LINK) \ -Bstatic \ -Wl,--gc-sections \ $(PRIVATE_ALL_OBJECTS) \ @@ -1654,7 +1654,7 @@ endef # it to be overriden en-masse see combo/linux-arm.make for an example. ifneq ($(HOST_CUSTOM_LD_COMMAND),true) define transform-host-o-to-shared-lib-inner -$(hide) $(PRIVATE_CXX) \ +$(hide) $(PRIVATE_CXX_LINK) \ -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \ -Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \ -shared -Wl,-soname,$(notdir $@) \ @@ -1695,7 +1695,7 @@ endef ########################################################### define transform-o-to-shared-lib-inner -$(hide) $(PRIVATE_CXX) \ +$(hide) $(PRIVATE_CXX_LINK) \ -nostdlib -Wl,-soname,$(notdir $@) \ -Wl,--gc-sections \ -shared \ @@ -1730,7 +1730,7 @@ endef ########################################################### define transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -pie \ +$(hide) $(PRIVATE_CXX_LINK) -pie \ -nostdlib -Bdynamic \ -Wl,-dynamic-linker,$(PRIVATE_LINKER) \ -Wl,--gc-sections \ @@ -1773,7 +1773,7 @@ endef ########################################################### define transform-o-to-static-executable-inner -$(hide) $(PRIVATE_CXX) \ +$(hide) $(PRIVATE_CXX_LINK) \ -nostdlib -Bstatic \ $(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \ -Wl,--gc-sections \ @@ -1811,7 +1811,7 @@ endef ifneq ($(HOST_CUSTOM_LD_COMMAND),true) define transform-host-o-to-executable-inner -$(hide) $(PRIVATE_CXX) \ +$(hide) $(PRIVATE_CXX_LINK) \ $(PRIVATE_ALL_OBJECTS) \ -Wl,--whole-archive \ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \ diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk index 13a6f8e66b..3fe0d0e939 100644 --- a/core/java_renderscript.mk +++ b/core/java_renderscript.mk @@ -139,6 +139,7 @@ $(rs_compatibility_jni_libs): $(RS_PREBUILT_CLCORE) \ $(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt) $(rs_compatibility_jni_libs): $(BCC_COMPAT) $(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(CLANG_CXX) +$(rs_compatibility_jni_libs): PRIVATE_CXX_LINK := $(CLANG_CXX) $(rs_compatibility_jni_libs): PRIVATE_SDK_VERSION := $(my_min_sdk_version) $(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \ $(renderscript_intermediate.bc_folder)%.bc \ diff --git a/core/rbe.mk b/core/rbe.mk index 766b121533..fb39d51d25 100644 --- a/core/rbe.mk +++ b/core/rbe.mk @@ -21,7 +21,7 @@ ifneq ($(filter-out false,$(USE_RBE)),) else rbe_dir := $(HOME)/rbe endif - RBE_WRAPPER := $(rbe_dir)/rewrapper + RBE_WRAPPER := $(rbe_dir)/rewrapper --labels=type=compile,lang=cpp,compiler=clang # Append rewrapper to existing *_WRAPPER variables so it's possible to # use both ccache and rewrapper.