From 195fba9143ccbe22c8f79d2e0ec06c28475a745d Mon Sep 17 00:00:00 2001 From: "shashishekhar@chromium.org" Date: Wed, 3 Jul 2013 04:32:49 +0000 Subject: [PATCH] Add compiler flags that prevent text relocations. Text relocations are a minor security risk. Add compiler flags that prevent them from reappearing in Android binary. All existing occurences have been removed after http://crrev.com/17714003. TEST=Compile. BUG=b/8061013 Review URL: https://chromiumcodereview.appspot.com/17820002 git-svn-id: http://src.chromium.org/svn/trunk/src/build@209885 4ff67af0-8c30-449e-8e8b-ad334ec8d88c --- common.gypi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common.gypi b/common.gypi index 86d133de7..c57f6c2d9 100644 --- a/common.gypi +++ b/common.gypi @@ -2761,10 +2761,14 @@ ], 'conditions' : [ ['OS=="android"', { - # Only link with needed input sections. This is to avoid getting - # undefined reference to __cxa_bad_typeid in the CDU library. 'ldflags': [ + '-Wl,--fatal-warnings', + # Only link with needed input sections. This is to avoid + # getting undefined reference to __cxa_bad_typeid in the CDU + # library. '-Wl,--gc-sections', + # Warn in case of text relocations. + '-Wl,--warn-shared-textrel', ], }], ['OS=="android" and android_full_debug==0', { @@ -2834,6 +2838,11 @@ 'cflags': [ '-fomit-frame-pointer', ], + 'ldflags': [ + '-Wl,--fatal-warnings', + # Warn in case of text relocations. + '-Wl,--warn-shared-textrel', + ], }], ['clang==1', { 'cflags!': [