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 From b947140417e2641331106036ed3b30e981942edd Mon Sep 17 00:00:00 2001 From: benjamin reed Date: Wed, 31 Jul 2019 00:14:09 -0700 Subject: simple changes to tests and doc * made test coverage for -fmerge-all-constants match -mno-cygwin * added -fmerge-all-constants to Environment.xml --- src/engine/SCons/Environment.xml | 49 ++++++++++++++++++------------------ src/engine/SCons/EnvironmentTests.py | 4 ++- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/engine/SCons/Environment.xml b/src/engine/SCons/Environment.xml index 1b0a04c..e51f957 100644 --- a/src/engine/SCons/Environment.xml +++ b/src/engine/SCons/Environment.xml @@ -2301,30 +2301,31 @@ and added to the following construction variables: --arch CCFLAGS, LINKFLAGS --D CPPDEFINES --framework FRAMEWORKS --frameworkdir= FRAMEWORKPATH --include CCFLAGS --isysroot CCFLAGS, LINKFLAGS --isystem CCFLAGS --iquote CCFLAGS --idirafter CCFLAGS --I CPPPATH --l LIBS --L LIBPATH --mno-cygwin CCFLAGS, LINKFLAGS --mwindows LINKFLAGS --pthread CCFLAGS, LINKFLAGS --std= CFLAGS --Wa, ASFLAGS, CCFLAGS --Wl,-rpath= RPATH --Wl,-R, RPATH --Wl,-R RPATH --Wl, LINKFLAGS --Wp, CPPFLAGS -- CCFLAGS -+ CCFLAGS, LINKFLAGS +-arch CCFLAGS, LINKFLAGS +-D CPPDEFINES +-framework FRAMEWORKS +-frameworkdir= FRAMEWORKPATH +-fmerge-all-constants CCFLAGS, LINKFLAGS +-include CCFLAGS +-isysroot CCFLAGS, LINKFLAGS +-isystem CCFLAGS +-iquote CCFLAGS +-idirafter CCFLAGS +-I CPPPATH +-l LIBS +-L LIBPATH +-mno-cygwin CCFLAGS, LINKFLAGS +-mwindows LINKFLAGS +-pthread CCFLAGS, LINKFLAGS +-std= CFLAGS +-Wa, ASFLAGS, CCFLAGS +-Wl,-rpath= RPATH +-Wl,-R, RPATH +-Wl,-R RPATH +-Wl, LINKFLAGS +-Wp, CPPFLAGS +- CCFLAGS ++ CCFLAGS, LINKFLAGS diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 2e5f02a..8355f26 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -2027,6 +2027,7 @@ def generate(env): "-F fwd3 " + \ "-pthread " + \ "-mno-cygwin -mwindows " + \ + "-fmerge-all-constants " + \ "-arch i386 -isysroot /tmp " + \ "-iquote /usr/include/foo1 " + \ "-isystem /usr/include/foo2 " + \ @@ -2037,7 +2038,7 @@ def generate(env): assert save_command == ['fake command'], save_command assert env['ASFLAGS'] == ['assembler', '-as'], env['ASFLAGS'] assert env['CCFLAGS'] == ['', '-X', '-Wa,-as', - '-pthread', '-mno-cygwin', + '-pthread', '-fmerge-all-constants', '-mno-cygwin', ('-arch', 'i386'), ('-isysroot', '/tmp'), ('-iquote', '/usr/include/foo1'), ('-isystem', '/usr/include/foo2'), @@ -2051,6 +2052,7 @@ def generate(env): assert env['LIBPATH'] == ['list', '/usr/fax', 'foo'], env['LIBPATH'] assert env['LIBS'] == ['xxx', 'yyy', env.File('abc')], env['LIBS'] assert env['LINKFLAGS'] == ['', '-Wl,-link', '-pthread', + '-fmerge-all-constants', '-mno-cygwin', '-mwindows', ('-arch', 'i386'), ('-isysroot', '/tmp'), -- cgit v0.12 From 7b0ca02591b88f5b86d1a8a57b3fb12c97cca21f Mon Sep 17 00:00:00 2001 From: benjamin reed Date: Wed, 31 Jul 2019 17:09:07 -0700 Subject: make expected flag order match the order passed. --- src/engine/SCons/EnvironmentTests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 8355f26..70e1a37 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -2026,8 +2026,8 @@ def generate(env): "-Ffwd2 " + \ "-F fwd3 " + \ "-pthread " + \ - "-mno-cygwin -mwindows " + \ "-fmerge-all-constants " + \ + "-mno-cygwin -mwindows " + \ "-arch i386 -isysroot /tmp " + \ "-iquote /usr/include/foo1 " + \ "-isystem /usr/include/foo2 " + \ -- cgit v0.12 From 2b4e05d0f38b1115e0909f53f06b6f52ed0ef3d4 Mon Sep 17 00:00:00 2001 From: benjamin reed Date: Wed, 31 Jul 2019 23:16:33 -0700 Subject: Added -fopenmp and -openmp to the docs. --- src/engine/SCons/Environment.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine/SCons/Environment.xml b/src/engine/SCons/Environment.xml index e51f957..46a00d2 100644 --- a/src/engine/SCons/Environment.xml +++ b/src/engine/SCons/Environment.xml @@ -2306,6 +2306,7 @@ and added to the following construction variables: -framework FRAMEWORKS -frameworkdir= FRAMEWORKPATH -fmerge-all-constants CCFLAGS, LINKFLAGS +-fopenmp CCFLAGS, LINKFLAGS -include CCFLAGS -isysroot CCFLAGS, LINKFLAGS -isystem CCFLAGS @@ -2316,6 +2317,7 @@ and added to the following construction variables: -L LIBPATH -mno-cygwin CCFLAGS, LINKFLAGS -mwindows LINKFLAGS +-openmp CCFLAGS, LINKFLAGS -pthread CCFLAGS, LINKFLAGS -std= CFLAGS -Wa, ASFLAGS, CCFLAGS -- cgit v0.12