Bobby R. Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/29272 )

Change subject: scons: Revert LTO and partial linking for gcc >=8.1
......................................................................

scons: Revert LTO and partial linking for gcc >=8.1

This reverts commit f41abbdb5cf5c67233f3d730885d43517969afda,
"scons: Enable LTO and partial linking with gcc >= 8.1."

LTO and partial linking does not work on GCC 9.3 on Ubuntu 20.04 when
compiling gem5.fast. This error was exposed via the following command:

```
docker run -u $UID:$GID --volume $(pwd):/gem5 -w /gem5 --rm \
gcr.io/gem5-test/ubuntu-20.04_all-dependencies:latest scons \
build/MIPS/gem5.fast
```

The following error was received:

```
usr/bin/ld: cannot find lib.fo.partial.lto.o: No such file or directory
/usr/bin/ld: error: could not unlink output file
collect2: error: ld returned 1 exit status
scons: *** [build/MIPS/mem/ruby/system/lib.fo.partial] Error 1
```

Issue-on: https://gem5.atlassian.net/browse/GEM5-555
Change-Id: Id9e7fc81aec9f94524acc92c05aabdf96bd284cd
---
M SConstruct
1 file changed, 11 insertions(+), 6 deletions(-)



diff --git a/SConstruct b/SConstruct
index 0a18c3d..82fad3b 100755
--- a/SConstruct
+++ b/SConstruct
@@ -404,22 +404,27 @@

     main['GCC_VERSION'] = gcc_version

-    if compareVersions(gcc_version, '4.9') >= 0 and \
-       compareVersions(gcc_version, '8.1') < 0:
+    if compareVersions(gcc_version, '4.9') >= 0:
         # Incremental linking with LTO is currently broken in gcc versions
-        # 4.9 to 8.1.
+        # 4.9 and above. A version where everything works completely hasn't
+        # yet been identified.
         #
         # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67548
-        #
+        main['BROKEN_INCREMENTAL_LTO'] = True
+    if compareVersions(gcc_version, '6.0') >= 0:
         # gcc versions 6.0 and greater accept an -flinker-output flag which
         # selects what type of output the linker should generate. This is
         # necessary for incremental lto to work, but is also broken in
-        # versions of gcc up to 8.1.
+        # current versions of gcc. It may not be necessary in future
+ # versions. We add it here since it might be, and as a reminder that
+        # it exists. It's excluded if lto is being forced.
         #
         # https://gcc.gnu.org/gcc-6/changes.html
         # https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03161.html
         # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69866
-        main['BROKEN_INCREMENTAL_LTO'] = True
+        if not GetOption('force_lto'):
+            main.Append(PSHLINKFLAGS='-flinker-output=rel')
+            main.Append(PLINKFLAGS='-flinker-output=rel')

     disable_lto = GetOption('no_lto')
     if not disable_lto and main.get('BROKEN_INCREMENTAL_LTO', False) and \

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/29272
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: release-staging-v20.0.0.0
Gerrit-Change-Id: Id9e7fc81aec9f94524acc92c05aabdf96bd284cd
Gerrit-Change-Number: 29272
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to