forked from openkylin/platform_build
Merge "Remove global linker search paths"
This commit is contained in:
commit
39c1c9ae12
|
@ -31,14 +31,13 @@ HOST_CUSTOM_LD_COMMAND := true
|
|||
define transform-host-o-to-shared-lib-inner
|
||||
$(hide) $(PRIVATE_CXX) \
|
||||
-dynamiclib -single_module -read_only_relocs suppress \
|
||||
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
|
||||
) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
$(addprefix -force_load , $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_SHARED_LIBRARIES) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_LDLIBS) \
|
||||
-o $@ \
|
||||
-install_name @rpath/$(notdir $@) \
|
||||
|
@ -53,14 +52,13 @@ $(hide) $(PRIVATE_CXX) \
|
|||
-Wl,-rpath,@loader_path/$(path)) \
|
||||
-o $@ \
|
||||
-Wl,-headerpad_max_install_names \
|
||||
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
|
||||
) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_SHARED_LIBRARIES) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_LDFLAGS) \
|
||||
$(PRIVATE_LDLIBS)
|
||||
endef
|
||||
|
|
|
@ -684,9 +684,6 @@ else
|
|||
RELATIVE_PWD :=
|
||||
endif
|
||||
|
||||
HOST_GLOBAL_LD_DIRS := -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
|
||||
TARGET_GLOBAL_LD_DIRS := -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
||||
|
||||
HOST_PROJECT_INCLUDES :=
|
||||
HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_OUT_HEADERS)
|
||||
TARGET_PROJECT_INCLUDES :=
|
||||
|
@ -695,24 +692,20 @@ TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_OUT_HEADERS) \
|
|||
$(TARGET_PRODUCT_KERNEL_HEADERS)
|
||||
|
||||
ifdef TARGET_2ND_ARCH
|
||||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS := -L$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
||||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
|
||||
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
|
||||
endif
|
||||
|
||||
ifdef HOST_2ND_ARCH
|
||||
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS := -L$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
|
||||
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_INCLUDES := $(HOST_PROJECT_INCLUDES)
|
||||
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_PROJECT_SYSTEM_INCLUDES)
|
||||
endif
|
||||
|
||||
ifdef HOST_CROSS_OS
|
||||
HOST_CROSS_GLOBAL_LD_DIRS := -L$(HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
|
||||
HOST_CROSS_PROJECT_INCLUDES :=
|
||||
HOST_CROSS_PROJECT_SYSTEM_INCLUDES := $(HOST_CROSS_OUT_HEADERS)
|
||||
|
||||
ifdef HOST_CROSS_2ND_ARCH
|
||||
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_LD_DIRS := -L$($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
|
||||
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(HOST_CROSS_PROJECT_INCLUDES)
|
||||
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_SYSTEM_INCLUDES:= $(HOST_CROSS_PROJECT_SYSTEM_INCLUDES)
|
||||
endif
|
||||
|
|
|
@ -593,25 +593,6 @@ $(strip \
|
|||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Convert "path/to/libXXX.so" to "-lXXX".
|
||||
## Any "path/to/libXXX.a" elements pass through unchanged.
|
||||
###########################################################
|
||||
|
||||
define normalize-libraries
|
||||
$(foreach so,$(filter %.so,$(1)),-l$(patsubst lib%.so,%,$(notdir $(so))))\
|
||||
$(filter-out %.so,$(1))
|
||||
endef
|
||||
|
||||
# TODO: change users to call the common version.
|
||||
define normalize-host-libraries
|
||||
$(call normalize-libraries,$(1))
|
||||
endef
|
||||
|
||||
define normalize-target-libraries
|
||||
$(call normalize-libraries,$(1))
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## Convert a list of short module names (e.g., "framework", "Browser")
|
||||
## into the list of files that are built for those modules.
|
||||
|
@ -1674,9 +1655,9 @@ $(hide) $(PRIVATE_CXX) -pie \
|
|||
-Wl,--gc-sections \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_LDFLAGS) \
|
||||
-o $@
|
||||
endef
|
||||
|
@ -1693,9 +1674,9 @@ $(hide) $(PRIVATE_CXX) \
|
|||
-Wl,--gc-sections \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(PRIVATE_LDFLAGS) \
|
||||
-Wl,-Map=$(@).map \
|
||||
-o $@
|
||||
|
@ -1788,21 +1769,20 @@ $(hide) $(PRIVATE_CXX) \
|
|||
-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 $@) \
|
||||
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_LD_DIRS) \
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
|
||||
) \
|
||||
$(PRIVATE_LDFLAGS) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_SHARED_LIBRARIES) \
|
||||
-o $@ \
|
||||
$(PRIVATE_LDLIBS)
|
||||
endef
|
||||
|
@ -1834,10 +1814,10 @@ $(hide) $(PRIVATE_CXX) \
|
|||
$(PRIVATE_TARGET_CRTBEGIN_SO_O) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
|
@ -1922,10 +1902,10 @@ $(hide) $(PRIVATE_CXX) -pie \
|
|||
$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
|
@ -1967,15 +1947,15 @@ $(hide) $(PRIVATE_CXX) \
|
|||
$(PRIVATE_LDFLAGS) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(call normalize-target-libraries,$(filter-out %libcompiler_rt.a,$(filter-out %libc_nomalloc.a,$(filter-out %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))))) \
|
||||
$(filter-out %libcompiler_rt.a,$(filter-out %libc_nomalloc.a,$(filter-out %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)))) \
|
||||
-Wl,--start-group \
|
||||
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
|
||||
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
|
||||
$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
|
||||
$(PRIVATE_TARGET_LIBATOMIC) \
|
||||
$(call normalize-target-libraries,$(filter %libcompiler_rt.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
|
||||
$(filter %libcompiler_rt.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_TARGET_LIBGCC) \
|
||||
-Wl,--end-group \
|
||||
$(PRIVATE_TARGET_CRTEND_O)
|
||||
|
@ -2006,18 +1986,17 @@ define transform-host-o-to-executable-inner
|
|||
$(hide) $(PRIVATE_CXX) \
|
||||
$(PRIVATE_ALL_OBJECTS) \
|
||||
-Wl,--whole-archive \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
|
||||
-Wl,--no-whole-archive \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_STATIC_LIBRARIES) \
|
||||
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
|
||||
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
|
||||
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
|
||||
$(PRIVATE_ALL_SHARED_LIBRARIES) \
|
||||
-Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_INTERMEDIATE_LIBRARIES) \
|
||||
$(foreach path,$(PRIVATE_RPATHS), \
|
||||
-Wl,-rpath,\$$ORIGIN/$(path)) \
|
||||
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)GLOBAL_LD_DIRS) \
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
|
||||
) \
|
||||
|
|
|
@ -34,7 +34,7 @@ endif
|
|||
endif
|
||||
|
||||
# Define PRIVATE_ variables from global vars
|
||||
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
|
||||
my_target_global_ld_dirs :=
|
||||
ifeq ($(LOCAL_NO_LIBGCC),true)
|
||||
my_target_libgcc :=
|
||||
else
|
||||
|
|
|
@ -39,7 +39,7 @@ OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDI
|
|||
include $(BUILD_SYSTEM)/dynamic_binary.mk
|
||||
|
||||
# Define PRIVATE_ variables from global vars
|
||||
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
|
||||
my_target_global_ld_dirs :=
|
||||
ifeq ($(LOCAL_NO_LIBGCC),true)
|
||||
my_target_libgcc :=
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue