Merge "Don't export new/delete from libc shared libraries."

This commit is contained in:
Dan Albert 2015-04-01 23:33:53 +00:00 committed by Gerrit Code Review
commit ab7c79e22e
2 changed files with 33 additions and 6 deletions

View File

@ -1347,9 +1347,6 @@ LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
# TODO: This is to work around b/19059885. Remove after root cause is fixed
LOCAL_LDFLAGS_arm := -Wl,--hash-style=sysv
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
$(libc_arch_dynamic_src_files) \
@ -1359,8 +1356,10 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libc
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_REQUIRED_MODULES := tzdata
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(libc_common_additional_dependencies) \
$(LOCAL_PATH)/version_script.txt \
# Leave the symbols in the shared library so that stack unwinders can produce
# meaningful name resolution.
@ -1379,11 +1378,17 @@ LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
# Don't re-export new/delete and friends, even if the compiler really wants to.
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
# We'd really like to do this for all architectures, but since this wasn't done
# before, these symbols must continue to be exported on LP32 for binary
# compatibility.
LOCAL_LDFLAGS_64 := -Wl,--exclude-libs,libgcc.a
# TODO: This is to work around b/19059885. Remove after root cause is fixed
LOCAL_LDFLAGS_arm := -Wl,--hash-style=sysv
$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
# special for arm
@ -1431,7 +1436,9 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libc_malloc_debug_leak
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(libc_common_additional_dependencies) \
$(LOCAL_PATH)/version_script.txt \
LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_CXX_STL := none
@ -1442,6 +1449,9 @@ LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
LOCAL_STATIC_LIBRARIES += libc++abi
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
# Don't re-export new/delete and friends, even if the compiler really wants to.
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
# Don't install on release build
LOCAL_MODULE_TAGS := eng debug
LOCAL_ADDRESS_SANITIZER := false
@ -1471,12 +1481,17 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libc_malloc_debug_qemu
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(libc_common_additional_dependencies) \
$(LOCAL_PATH)/version_script.txt \
LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
# Don't re-export new/delete and friends, even if the compiler really wants to.
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
# Don't install on release build
LOCAL_MODULE_TAGS := eng debug
LOCAL_ADDRESS_SANITIZER := false

12
libc/version_script.txt Normal file
View File

@ -0,0 +1,12 @@
LIBC {
local:
_ZSt7nothrow;
_ZdaPv;
_ZdaPvRKSt9nothrow_t;
_ZdlPv;
_ZdlPvRKSt9nothrow_t;
_Znaj;
_ZnajRKSt9nothrow_t;
_Znwj;
_ZnwjRKSt9nothrow_t;
};