libtool-patches
[Top][All Lists]
Advanced

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

[PATCH 3/3] Support GCC LTO on GNU/Linux.


From: Ralf Wildenhues
Subject: [PATCH 3/3] Support GCC LTO on GNU/Linux.
Date: Sun, 29 Aug 2010 18:19:27 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

* libltdl/config/ltmain.m4sh (func_mode_link): Allow through
flags matching -O*, -flto*, -fwhopr, -fuse-linker-plugin.
* libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Drop symbols
starting with __gnu_lto.
(_LT_LINKER_SHLIBS) [linux] <archive_cmds, archive_expsyms_cmds>:
Add $pic_flag for GCC.
(_LT_LANG_CXX_CONFIG) [linux] <archive_cmds, archive_expsyms_cmds>:
Likewise.
(_LT_SYS_HIDDEN_LIBDEPS): Ignore files matching *.lto.o.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <address@hidden>
---
 ChangeLog                  |   12 ++++++++++++
 NEWS                       |    1 +
 libltdl/config/ltmain.m4sh |    4 +++-
 libltdl/m4/libtool.m4      |    8 +++++---
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f7e2943..4878aee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2010-08-29  Ralf Wildenhues  <address@hidden>
 
+       Support GCC LTO on GNU/Linux.
+       * libltdl/config/ltmain.m4sh (func_mode_link): Allow through
+       flags matching -O*, -flto*, -fwhopr, -fuse-linker-plugin.
+       * libltdl/m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Drop symbols
+       starting with __gnu_lto.
+       (_LT_LINKER_SHLIBS) [linux] <archive_cmds, archive_expsyms_cmds>:
+       Add $pic_flag for GCC.
+       (_LT_LANG_CXX_CONFIG) [linux] <archive_cmds, archive_expsyms_cmds>:
+       Likewise.
+       (_LT_SYS_HIDDEN_LIBDEPS): Ignore files matching *.lto.o.
+       * NEWS: Update.
+
        Disable GCC LTO for verbose library extraction.
        * libltdl/m4/libtool.m4 (_LT_SYS_HIDDEN_LIBDEPS): Temporarily
        append -fno-lto or -fno-whopr to CFLAGS if CC or CFLAGS (which
diff --git a/NEWS b/NEWS
index 688bdca..f321bf0 100644
--- a/NEWS
+++ b/NEWS
@@ -97,6 +97,7 @@ New in 2.2.7b 2010-05-20: git version 2.2.7a, Libtool team:
   - With binutils 2.19.50+, shared libraries can be built on AIX.
   - Initial support for the Cuda Compiler Driver on GNU/Linux.
   - Support for Haiku (i586-pc-haiku).
+  - Initial support for GCC link-time optimization (LTO) flags.
 
 * Bug fixes:
 
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 32860c7..e86e944 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -5015,8 +5015,10 @@ func_mode_link ()
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr, -fuse-linker-plugin GCC link-time optimization
       -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=*)
+      
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr|-fuse-linker-plugin)
         func_quote_for_eval "$arg"
        arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 0a5f5b1..8ae64b7 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -3615,6 +3615,7 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[    
]]\($symcode$symcode*\)[[       ]][[    
]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ 
__gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -4664,7 +4665,7 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
         && test "$tmp_diet" = no
       then
-       tmp_addflag=
+       tmp_addflag=' $pic_flag'
        tmp_sharedflag='-shared'
        case $cc_basename,$host_cpu in
         pgcc*)                         # Portland Group C compiler
@@ -5788,8 +5789,8 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o 
$lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname 
$wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname 
$wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib 
$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname 
$wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -6897,6 +6898,7 @@ if AC_TRY_EVAL(ac_compile); then
        prev=
        ;;
 
+    *.lto.$objext) ;; # Ignore GCC LTO objects
     *.$objext)
        # This assumes that the test object file only shows up
        # once in the compiler output.
-- 
1.7.2.1.222.g9988




reply via email to

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