Skip to content

Commit

Permalink
make: Expose a 'linker_supports_icf' flag.
Browse files Browse the repository at this point in the history
This will allow us to use the flag in some build configurations of Chrome.
Review URL: http://codereview.chromium.org/6883065

git-svn-id: http://gyp.googlecode.com/svn/trunk@914 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information
evan@chromium.org committed Apr 22, 2011
1 parent 56f0c4f commit 645b7d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pylib/gyp/generator/make.py
Expand Up @@ -1259,6 +1259,13 @@ def RunSystemTests():
'LINK_flags': link_flags }


def CalculateVariables(default_variables, params):
"""Calculate additional variables for use in the build (called by gyp)."""
cc_target = os.environ.get('CC.target', os.environ.get('CC', 'cc'))
default_variables['LINKER_SUPPORTS_ICF'] = \
gyp.system_test.TestLinkerSupportsICF(cc_command=cc_target)


def GenerateOutput(target_list, target_dicts, data, params):
options = params['options']
generator_flags = params.get('generator_flags', {})
Expand Down
7 changes: 7 additions & 0 deletions pylib/gyp/system_test.py
Expand Up @@ -57,6 +57,13 @@ def TestLinkerSupportsThreads(cc_command='cc'):
env={'cc': cc_command})


def TestLinkerSupportsICF(cc_command='cc'):
"""Test whether the linker supports identical code folding."""
return TestCommands(['%(cc)s -Wl,--icf=safe test.c'],
files={'test.c': 'int main(){}'},
env={'cc': cc_command})


if __name__ == '__main__':
# Run the various test functions and print the results.
def RunTest(description, function, **kwargs):
Expand Down

0 comments on commit 645b7d8

Please sign in to comment.