Bug 1684914: stop passing `-flto=thin` to gcc since it doesn't actually work r=glandium,mhentges a=RyanVM
authorConnor Sheehan <sheehan@mozilla.com>
Fri, 08 Jan 2021 15:54:54 +0000
changeset 627408 38febe1e15c432c2ae3ecb0738cfecfad57f097c
parent 627407 dc65d4fdd35de931e991c3f5283300789caf81c4
child 627409 413eab2554831cc39095593d0379fd40a66a5063
push id15031
push userryanvm@gmail.com
push dateFri, 15 Jan 2021 19:25:13 +0000
treeherdermozilla-beta@38febe1e15c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, mhentges, RyanVM
bugs1684914
milestone85.0
Bug 1684914: stop passing `-flto=thin` to gcc since it doesn't actually work r=glandium,mhentges a=RyanVM Passing `-flto=thin` worked previously but the value passed was just ignored and full lto was performed. On newer versions of gcc passing an unknown value causes failure. So this commit checks if `-flto=thin` is passed and fails with an error message if so, else full lto is enabled if any other value is passed. Differential Revision: https://phabricator.services.mozilla.com/D100953
build/moz.configure/lto-pgo.configure
--- a/build/moz.configure/lto-pgo.configure
+++ b/build/moz.configure/lto-pgo.configure
@@ -272,20 +272,23 @@ def lto(
             #
             # https://github.com/llvm/llvm-project/blob/e7694f34ab6a12b8bb480cbfcb396d0a64fe965f/llvm/lib/Target/X86/X86.td#L1165-L1187
             if target.cpu == "x86_64":
                 ldflags.append("-mllvm:-mcpu=x86-64")
             # We do not need special flags for arm64.  Hooray for fixed-length
             # instruction sets.
         else:
             num_cores = multiprocessing.cpu_count()
-            if len(value) and value[0].lower() == "full":
+            if len(value) and value[0].lower() == "thin":
+                die(
+                    "gcc does not support thin LTO. Use `--enable-lto` "
+                    "to enable full LTO for gcc."
+                )
+            else:
                 cflags.append("-flto")
-            else:
-                cflags.append("-flto=thin")
             cflags.append("-flifetime-dse=1")
 
             ldflags.append("-flto=%s" % num_cores)
             ldflags.append("-flifetime-dse=1")
 
         # Tell LTO not to inline functions above a certain size, to mitigate
         # binary size growth while still getting good performance.
         # (For hot functions, PGO will put a multiplier on this limit.)