From b4b861514b5a3c431e81d926333d6984499d0b20 Mon Sep 17 00:00:00 2001 From: benjamin reed Date: Thu, 25 Jul 2019 22:36:16 -0700 Subject: add -fmerge-all-constants flag to LINKFLAGS -fmerge-all-constants doesn't fully work if it isn't also included as part of the link step. This change will add -fmerge-all-constants to both CCFLAGS and LINKFLAGS if it is specified as a build flag. --- src/CHANGES.txt | 3 +++ src/engine/SCons/Environment.py | 1 + src/engine/SCons/EnvironmentTests.py | 6 ++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index b5b6652..85eb872 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -10,6 +10,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Whatever John Doe did. + From Ben Reed: + - Added -fmerge-all-constants to flags that get included in both CCFLAGS and LINKFLAGS. + RELEASE 3.1.0 - Mon, 20 Jul 2019 16:59:23 -0700 diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 8d06af7..5faa2d0 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -783,6 +783,7 @@ class SubstitutionEnvironment(object): elif arg in ['-mno-cygwin', '-pthread', '-openmp', + '-fmerge-all-constants', '-fopenmp']: dict['CCFLAGS'].append(arg) dict['LINKFLAGS'].append(arg) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 834cfd1..2e5f02a 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -797,6 +797,7 @@ sys.exit(0) "-F fwd3 " + \ "-dylib_file foo-dylib " + \ "-pthread " + \ + "-fmerge-all-constants " +\ "-fopenmp " + \ "-mno-cygwin -mwindows " + \ "-arch i386 -isysroot /tmp " + \ @@ -811,7 +812,8 @@ sys.exit(0) assert d['ASFLAGS'] == ['-as'], d['ASFLAGS'] assert d['CFLAGS'] == ['-std=c99'] assert d['CCFLAGS'] == ['-X', '-Wa,-as', - '-pthread', '-fopenmp', '-mno-cygwin', + '-pthread', '-fmerge-all-constants', + '-fopenmp', '-mno-cygwin', ('-arch', 'i386'), ('-isysroot', '/tmp'), ('-iquote', '/usr/include/foo1'), ('-isystem', '/usr/include/foo2'), @@ -832,7 +834,7 @@ sys.exit(0) assert LIBS == ['xxx', 'yyy', 'ascend'], (d['LIBS'], LIBS) assert d['LINKFLAGS'] == ['-Wl,-link', '-dylib_file', 'foo-dylib', - '-pthread', '-fopenmp', + '-pthread', '-fmerge-all-constants', '-fopenmp', '-mno-cygwin', '-mwindows', ('-arch', 'i386'), ('-isysroot', '/tmp'), -- cgit v0.12