Re: GCC LTO options not correctly handled
On 4/12/19 6:04 PM, Bob Friesenhahn wrote: On Fri, 12 Apr 2019, Laurent Stacul wrote: 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. The path of least resistance is to use the GCC -Wl, or -Wc, syntax to pass options to the linker or compiler, respectively. This already works well with Autoconf, Automake, and libtool. Adding support to libtool to support particular GCC options is the path of greatest resistance. Compiler and linker options tend to expand continually, and it is not reasonable to support them all. You are right about that, but libtool considers anything with a -Wl prefix to be directed at itself unfortunately. Also the -Xlinker and -Xcompiler prefix cannot normally be used during configure tests. I maintain a package that uses libtool, and what I have come to rely on is to: * switch all compilation and link tests to use libtool as early as possible (i.e. directly after AC_PROG_CC and LT_INIT) * mask known flags that need to survive (like icc -shared-intel flag) with -Xcompiler and/or -Xlinker For the reason you state above (the list of problematic flags only becoming longer), this is not entirely safe, but much better than educating users about the known problems. Thomas ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: GCC LTO options not correctly handled
On Fri, 12 Apr 2019, Laurent Stacul wrote: 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. The path of least resistance is to use the GCC -Wl, or -Wc, syntax to pass options to the linker or compiler, respectively. This already works well with Autoconf, Automake, and libtool. Adding support to libtool to support particular GCC options is the path of greatest resistance. Compiler and linker options tend to expand continually, and it is not reasonable to support them all. Bob -- Bob Friesenhahn bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer,http://www.GraphicsMagick.org/ Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt ___ https://lists.gnu.org/mailman/listinfo/libtool
GCC LTO options not correctly handled
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 () # @fileGCC 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 ___ https://lists.gnu.org/mailman/listinfo/libtool