This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Sat, Aug 18, 2018 at 9:00 PM Iain Sandoe <iain@sandoe.co.uk> wrote:
>
> 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?

Looking at COLLECT_GCC_OPTIONS is probably better.

> (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.

I think we wanted to transparently handle LTO objects (similar to how
it works with a linker plugin).

Ideally collect2 wouldn't use nm but simple-object to inspect files
(but that doesn't have symbol table query support
though looking for LTO specific sections would have been better in the
first place - I'd suggest .gnu.lto_.symtab).

Richard.

> 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}} \
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]