[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
This commit is contained in:
Ramy Medhat 2019-08-06 15:54:48 -04:00 committed by Kousik Kumar
parent 7298be1b47
commit f965526697
4 changed files with 18 additions and 9 deletions

View File

@ -54,6 +54,7 @@ my_asflags := $(LOCAL_ASFLAGS)
my_cc := $(LOCAL_CC) my_cc := $(LOCAL_CC)
my_cc_wrapper := $(CC_WRAPPER) my_cc_wrapper := $(CC_WRAPPER)
my_cxx := $(LOCAL_CXX) my_cxx := $(LOCAL_CXX)
my_cxx_link := $(LOCAL_CXX)
my_cxx_ldlibs := my_cxx_ldlibs :=
my_cxx_wrapper := $(CXX_WRAPPER) my_cxx_wrapper := $(CXX_WRAPPER)
my_c_includes := $(LOCAL_C_INCLUDES) my_c_includes := $(LOCAL_C_INCLUDES)
@ -1707,13 +1708,20 @@ ifeq ($(strip $(my_cxx)),)
my_cxx := $(my_cxx_wrapper) $(CLANG_CXX) my_cxx := $(my_cxx_wrapper) $(CLANG_CXX)
endif endif
ifeq ($(strip $(my_cxx_link)),)
my_cxx_link := $(CLANG_CXX)
endif
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \ my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
$(SYNTAX_TOOLS_PREFIX)/c++-analyzer $(SYNTAX_TOOLS_PREFIX)/c++-analyzer
my_cxx_link := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
$(SYNTAX_TOOLS_PREFIX)/c++-analyzer
endif endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx) $(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_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)

View File

@ -951,7 +951,7 @@ define transform-bc-to-so
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) $(BCC_COMPAT) -O3 -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \ $(hide) $(BCC_COMPAT) -O3 -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \
-rt-path $(RS_PREBUILT_CLCORE) -mtriple $(RS_COMPAT_TRIPLE) $< -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 \ -Wl,-rpath,\$$ORIGIN/../lib \
$(dir $@)/$(notdir $(<:.bc=.o)) \ $(dir $@)/$(notdir $(<:.bc=.o)) \
$(RS_PREBUILT_COMPILER_RT) \ $(RS_PREBUILT_COMPILER_RT) \
@ -1534,7 +1534,7 @@ $(hide) mv -f $@.tmp $@
endef endef
define transform-o-to-aux-executable-inner define transform-o-to-aux-executable-inner
$(hide) $(PRIVATE_CXX) -pie \ $(hide) $(PRIVATE_CXX_LINK) -pie \
-Bdynamic \ -Bdynamic \
-Wl,--gc-sections \ -Wl,--gc-sections \
$(PRIVATE_ALL_OBJECTS) \ $(PRIVATE_ALL_OBJECTS) \
@ -1553,7 +1553,7 @@ $(transform-o-to-aux-executable-inner)
endef endef
define transform-o-to-aux-static-executable-inner define transform-o-to-aux-static-executable-inner
$(hide) $(PRIVATE_CXX) \ $(hide) $(PRIVATE_CXX_LINK) \
-Bstatic \ -Bstatic \
-Wl,--gc-sections \ -Wl,--gc-sections \
$(PRIVATE_ALL_OBJECTS) \ $(PRIVATE_ALL_OBJECTS) \
@ -1654,7 +1654,7 @@ endef
# it to be overriden en-masse see combo/linux-arm.make for an example. # it to be overriden en-masse see combo/linux-arm.make for an example.
ifneq ($(HOST_CUSTOM_LD_COMMAND),true) ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-shared-lib-inner 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)) \
-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 $@) \ -shared -Wl,-soname,$(notdir $@) \
@ -1695,7 +1695,7 @@ endef
########################################################### ###########################################################
define transform-o-to-shared-lib-inner define transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \ $(hide) $(PRIVATE_CXX_LINK) \
-nostdlib -Wl,-soname,$(notdir $@) \ -nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \ -Wl,--gc-sections \
-shared \ -shared \
@ -1730,7 +1730,7 @@ endef
########################################################### ###########################################################
define transform-o-to-executable-inner define transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -pie \ $(hide) $(PRIVATE_CXX_LINK) -pie \
-nostdlib -Bdynamic \ -nostdlib -Bdynamic \
-Wl,-dynamic-linker,$(PRIVATE_LINKER) \ -Wl,-dynamic-linker,$(PRIVATE_LINKER) \
-Wl,--gc-sections \ -Wl,--gc-sections \
@ -1773,7 +1773,7 @@ endef
########################################################### ###########################################################
define transform-o-to-static-executable-inner define transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) \ $(hide) $(PRIVATE_CXX_LINK) \
-nostdlib -Bstatic \ -nostdlib -Bstatic \
$(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \ $(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \
-Wl,--gc-sections \ -Wl,--gc-sections \
@ -1811,7 +1811,7 @@ endef
ifneq ($(HOST_CUSTOM_LD_COMMAND),true) ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-executable-inner define transform-host-o-to-executable-inner
$(hide) $(PRIVATE_CXX) \ $(hide) $(PRIVATE_CXX_LINK) \
$(PRIVATE_ALL_OBJECTS) \ $(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \ -Wl,--whole-archive \
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \

View File

@ -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_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
$(rs_compatibility_jni_libs): $(BCC_COMPAT) $(rs_compatibility_jni_libs): $(BCC_COMPAT)
$(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(CLANG_CXX) $(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): PRIVATE_SDK_VERSION := $(my_min_sdk_version)
$(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \ $(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
$(renderscript_intermediate.bc_folder)%.bc \ $(renderscript_intermediate.bc_folder)%.bc \

View File

@ -21,7 +21,7 @@ ifneq ($(filter-out false,$(USE_RBE)),)
else else
rbe_dir := $(HOME)/rbe rbe_dir := $(HOME)/rbe
endif 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 # Append rewrapper to existing *_WRAPPER variables so it's possible to
# use both ccache and rewrapper. # use both ccache and rewrapper.