libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GCC LTO options not correctly handled


From: Laurent Stacul
Subject: GCC LTO options not correctly handled
Date: Fri, 12 Apr 2019 15:53:25 +0200

Hello,

I have a flow in which I compile my object files with the Link-Time
Optimization (LTO) with gcc (option -flto -ffat-lto-objects). At link
time, I can decide if I want the LTO or not.

When I decide I don't want to use LTO for the final binary, I set
-fno-lto in the LDFLAGS. But depending on the project I want to build,
I can remain -flto due to a bad usage of the CFLAGS/CPPFLAGS/CXXFLAGS
in the project.

As I don't have the ownership on the project, I need to patch (and
provide a patch upstream). But this can be tedious on big projects, so
it would great if libtool don't filter the options like -fno-lto,
-fno-whopr.

I was thinking to something like:

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 96b37003..f37a0cc7 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5375,14 +5375,19 @@ func_mode_link ()
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
-      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time
optimization
+      # -O*, -g*             Optimization, debugging
+      # -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -ffat-lto-objects, -fno-fat-lto-objects GCC GIMPLE in ELF section
+      # -fno-lto, -fno-whopr GCC disable LTO
       # -specs=*             GCC specs files
       # -stdlib=*            select c++ std lib with clang
       # -fsanitize=*         Clang/GCC memory and address sanitizer
       # -fuse-ld=*           Linker select flags for GCC
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*|
\
-      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*|
\
+      -O*|-g*|-flto*|-fno-lto|-fwhopr*|-fno-whopr| \
+      -ffat-lto-objects|-fno-fat-lto-objects| \
+      -fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
       -specs=*|-fsanitize=*|-fuse-ld=*)
         func_quote_arg pretty "$arg"
        arg=$func_quote_arg_result

Regards,
Stac



reply via email to

[Prev in Thread] Current Thread [Next in Thread]