aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-01-04 14:37:57 -0800
committerDan Albert <danalbert@google.com>2016-01-05 11:06:48 -0800
commit7afa00d0e9576a4bb1af9a93f0e15e985b604276 (patch)
tree180d710bf149238eedef5c3ebd1e1505c880fa4d
parent7eaf9b9686e899bb69a151a5d30a0ac0e451f375 (diff)
downloadndk-7afa00d0e9576a4bb1af9a93f0e15e985b604276.tar.gz
Enable more linker warnings, make them fatal.
Bug: http://b/7382163 Change-Id: Ib80f56b5e5c8685a92dd10f7524fd7d41938669f
-rw-r--r--build/core/build-binary.mk11
-rw-r--r--build/core/definitions.mk1
2 files changed, 12 insertions, 0 deletions
diff --git a/build/core/build-binary.mk b/build/core/build-binary.mk
index 4964be15e..79d70bac7 100644
--- a/build/core/build-binary.mk
+++ b/build/core/build-binary.mk
@@ -189,6 +189,17 @@ else
LOCAL_LDFLAGS += $($(my)RELRO_LDFLAGS)
endif
+# We enable shared text relocation warnings by default. These are not allowed in
+# current versions of Android (android-21 for LP64 ABIs, android-23 for LP32
+# ABIs).
+LOCAL_LDFLAGS += -Wl,--warn-shared-textrel
+
+# We enable fatal linker warnings by default.
+# If LOCAL_DISABLE_FATAL_LINKER_WARNINGS is true, we don't enable this check.
+ifneq ($(LOCAL_DISABLE_FATAL_LINKER_WARNINGS),true)
+ LOCAL_LDFLAGS += -Wl,--fatal-warnings
+endif
+
# By default, we protect against format string vulnerabilities
# If LOCAL_DISABLE_FORMAT_STRING_CHECKS is true, we disable the protections.
ifeq ($(LOCAL_DISABLE_FORMAT_STRING_CHECKS),true)
diff --git a/build/core/definitions.mk b/build/core/definitions.mk
index b3c1a77f8..99a5eb1e2 100644
--- a/build/core/definitions.mk
+++ b/build/core/definitions.mk
@@ -395,6 +395,7 @@ modules-LOCALS := \
DISABLE_NO_EXECUTE \
DISABLE_RELRO \
DISABLE_FORMAT_STRING_CHECKS \
+ DISABLE_FATAL_LINKER_WARNINGS \
EXPORT_CFLAGS \
EXPORT_CONLYFLAGS \
EXPORT_CPPFLAGS \