From 353d2063b1495bdfc0395a6c3cffd82192663e11 Mon Sep 17 00:00:00 2001 From: Arun Rodrigues Date: Fri, 19 Nov 2021 17:16:18 -0700 Subject: [PATCH] scons: CheckLinkFlag() only adds to flags if test succeeds Previously, did not check the return of TryLink() before appending, so unsupported flags can be used when building shared libraries. This patch adds checking. Jira Issue: https://gem5.atlassian.net/browse/GEM5-1115 Change-Id: Ief62be15009cae9e02aaaa81b4d9c2d7b26e0223 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53025 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power Maintainer: Gabe Black Tested-by: kokoro --- site_scons/gem5_scons/configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site_scons/gem5_scons/configure.py b/site_scons/gem5_scons/configure.py index 3993686769..b335673774 100644 --- a/site_scons/gem5_scons/configure.py +++ b/site_scons/gem5_scons/configure.py @@ -61,7 +61,7 @@ def CheckLinkFlag(context, flag, autoadd=True, set_for_shared=True): ret = context.TryLink('int main(int, char *[]) { return 0; }', '.cc') if not (ret and autoadd): context.env['LINKFLAGS'] = last_linkflags - if set_for_shared: + if (ret and set_for_shared): assert(autoadd) context.env.Append(SHLINKFLAGS=[flag]) context.Result(ret)