[PATCH, driver specs] Put -flto-partition= on the collect2 c/l

Iain Sandoe iain@sandoe.co.uk
Sat Aug 18 19:00:00 GMT 2018


Hi 

While working on the Darwin LTO issues I noticed that collect2 looks for "-flto-partition=none” in its command line option, but it doesn’t get passed.

So - is the attached patch the right idea, or should collect2 be looking in the COLLECT_GCC_OPTIONS as the lto-wrapper does?

(or maybe it should just be just "%{fno-lto} %{flto*}" ?)

I plan on making Darwin default to fno-lto for link unless there’s an “flto*” on the link line, since otherwise there’s a process launch for every object on the c/l to do “nm”, which is quite heavy weight.  At present, ISTM if the compiler is configured with —enable-lto, the link line defaults to assuming that every object needs to be checked.

Iain.

 diff --git a/gcc/gcc.c b/gcc/gcc.c
index 780d485..bc9772b 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1038,7 +1038,7 @@ proper position among the other output files.  */
     %(linker) " \
     LINK_PLUGIN_SPEC \
    "%{flto|flto=*:%<fcompare-debug*} \
-    %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
+    %{flto} %{flto-*} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
    "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
    "%X %{o*} %{e*} %{N} %{n} %{r}\
     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \



More information about the Gcc-patches mailing list