summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2015-09-25 10:27:29 -0700
committerAdam Langley <agl@google.com>2015-09-25 10:27:29 -0700
commit184bc93440dbfefbd499f7164e8a1b22540f5571 (patch)
tree360ada970b7bb1046ae069d253ba24d9622eb3ad
parentb8494591d1b1a143f3b192d845c238bbf3bc629d (diff)
downloadexternal_boringssl-184bc93440dbfefbd499f7164e8a1b22540f5571.zip
external_boringssl-184bc93440dbfefbd499f7164e8a1b22540f5571.tar.gz
external_boringssl-184bc93440dbfefbd499f7164e8a1b22540f5571.tar.bz2
BoringSSL: always build with symbol visibility flags.
When building for shared libraries, setting BORINGSSL_SHARED_LIBRARY, BORINGSSL_IMPLEMENTATION and setting the default symbol visibility to “hidden” causes the correct symbol visibility to be set. This change causes symbol visibility always to be set, even for the static builds. The reason is the the static builds are often then included in shared libraries, so they're not really static after all. Setting the symbol visibility in this case can avoid a lot of references via the PLT and GOT for internal symbols. Most importantly, some of the x86 asm code has IP-relative references to data and, unless the visibility of the target symbol is “hidden”, the linker believes that it needs a textrel, which breaks linking that code into shared libraries. Change-Id: I00e8d045bcece7b872d88bdf965c5baf65c2d639
-rw-r--r--Android.mk12
1 files changed, 6 insertions, 6 deletions
diff --git a/Android.mk b/Android.mk
index e904263..5ae544c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -13,7 +13,7 @@ LOCAL_MODULE := libcrypto_static
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
LOCAL_SDK_VERSION := 9
-LOCAL_CFLAGS = -Wno-unused-parameter
+LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -Wno-unused-parameter
# sha256-armv4.S does not compile with clang.
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
LOCAL_CLANG_ASFLAGS_arm64 += -march=armv8-a+crypto
@@ -41,7 +41,7 @@ LOCAL_CPP_EXTENSION := cc
LOCAL_MODULE := bssl
LOCAL_MODULE_TAGS := optional
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/sources.mk
-LOCAL_CFLAGS = -Wno-unused-parameter
+LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -Wno-unused-parameter
LOCAL_SHARED_LIBRARIES=libcrypto libssl
include $(LOCAL_PATH)/sources.mk
LOCAL_SRC_FILES = $(tool_sources)
@@ -54,7 +54,7 @@ LOCAL_MODULE := libcrypto_static
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/crypto-sources.mk
-LOCAL_CFLAGS = -Wno-unused-parameter
+LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -Wno-unused-parameter
# Windows and Macs both have problems with assembly files
LOCAL_CFLAGS_darwin += -DOPENSSL_NO_ASM
LOCAL_CFLAGS_windows += -DOPENSSL_NO_ASM
@@ -85,7 +85,7 @@ LOCAL_MODULE := libssl_static
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/ssl-sources.mk
LOCAL_SDK_VERSION := 9
-LOCAL_CFLAGS = -Wno-unused-parameter
+LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -Wno-unused-parameter
include $(LOCAL_PATH)/ssl-sources.mk
include $(BUILD_STATIC_LIBRARY)
@@ -107,7 +107,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libssl_static-host
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/src/include
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/ssl-sources.mk
-LOCAL_CFLAGS = -Wno-unused-parameter
+LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -Wno-unused-parameter
include $(LOCAL_PATH)/ssl-sources.mk
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -119,7 +119,7 @@ LOCAL_CPP_EXTENSION := cc
LOCAL_MODULE := bssl
LOCAL_MODULE_TAGS := optional
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/sources.mk
-LOCAL_CFLAGS = -Wno-unused-parameter
+LOCAL_CFLAGS += -fvisibility=hidden -DBORINGSSL_SHARED_LIBRARY -DBORINGSSL_IMPLEMENTATION -Wno-unused-parameter
LOCAL_SHARED_LIBRARIES=libcrypto-host libssl-host
# Needed for clock_gettime.
LOCAL_LDFLAGS := -lrt