Il 20/11/2013 08:23, Markus Trippelsdorf ha scritto:
> Hi,
> 
> now that slim-lto objects are enabled by default, it would be nice to
> use them when building gcc with bootstrap-lto. The following patch
> implements the handling of these objects in gcc's build machinery.
> (Once -fuse-linker-plugin is made the default, -ffat-lto-objects in
> config/bootstrap-lto.mk could be dropped.)
> 
> LTO-Bootstrapped on x86_64-linux (with default -fuse-linker-plugin).
> The patch was already approved by Paolo Bonzini.
> 
> Please apply, because I don't have access.

Note that you need to regenerate all users of libtool.m4.  Please post a
patch _with_ the regeneration so that whoever applies it won't screw up.

Paolo

> Thanks.
> 
> 2013-11-20  Markus Trippelsdorf  <mar...@trippelsdorf.de>
> 
>       * libtool.m4 : Handle slim-lto objects.
>       * ltmain.sh: Handle lto options.
> 
> diff --git a/libtool.m4 b/libtool.m4
> index 797468f02a5a..c55b6eba7a94 100644
> --- a/libtool.m4
> +++ b/libtool.m4
> @@ -3440,6 +3440,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
> @@ -4459,7 +4460,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
> @@ -5525,8 +5526,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'
> @@ -6503,6 +6504,13 @@ public class foo {
>  };
>  _LT_EOF
>  ])
> +
> +_lt_libdeps_save_CFLAGS=$CFLAGS
> +case "$CC $CFLAGS " in #(
> +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
> +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
> +esac
> +
>  dnl Parse the compiler output and extract the necessary
>  dnl objects, libraries and library flags.
>  if AC_TRY_EVAL(ac_compile); then
> @@ -6551,6 +6559,7 @@ if AC_TRY_EVAL(ac_compile); then
>         fi
>         ;;
>  
> +    *.lto.$objext) ;; # Ignore GCC LTO objects
>      *.$objext)
>         # This assumes that the test object file only shows up
>         # once in the compiler output.
> @@ -6586,6 +6595,7 @@ else
>  fi
>  
>  $RM -f confest.$objext
> +CFLAGS=$_lt_libdeps_save_CFLAGS
>  
>  # PORTME: override above test on systems where it is broken
>  m4_if([$1], [CXX],
> diff --git a/ltmain.sh b/ltmain.sh
> index a03433f17894..2e0910194f24 100644
> --- a/ltmain.sh
> +++ b/ltmain.sh
> @@ -4980,7 +4980,8 @@ func_mode_link ()
>        # @file GCC response files
>        # -tp=* Portland pgcc target processor selection
>        -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
> -      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
> +      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*| \
> +      -O*|-flto*|-fwhopr|-fuse-linker-plugin)
>          func_quote_for_eval "$arg"
>       arg="$func_quote_for_eval_result"
>          func_append compile_command " $arg"
> 

Reply via email to