unfortunately the patch won't work correctly.
libtool appends linker flags at the end of command line (after linked
libraries), so -Wl,--as-needed is useless, the ordering comes from
libtool.m4 so until that is fixed (or somebody fixes ld to not depend on
the order of arguments) it's impossible to use --as-needed.

which is a pity


On Thu, 2014-10-23 at 22:08 +0200, Kai Wasserbäch wrote:
> You can have my
> Tested-by: Kai Wasserbäch <k...@dev.carbon-project.org>
> for that, since it is essentially the same as attachment 108315 from bug 
> 85380.
> Please add a reference to that bug report.
> 
> And now I abuse this to send a ping for the fix for bug 70410 (there should 
> be a
> patch for this on the list): can we add "--system-libs" to the llvm-config
> invocation for LLVM_LIBS as well?
> 
> Thanks, Jan, for fixing this so quickly!

I ran into the problem myself (with shared libs) and discussed it with
Tom few days ago. so it was not that quick :)

since the --as-needed trick does not work I don't know what the correct
solution is

jan

> 
> Cheers,
> Kai
> 
> 
> Jan Vesely wrote on 23.10.2014 21:58:
> > Use -Wl,--as-needed instead
> > This should fix the problem of using llvm split libraries.
> > Since the component split may change it's safer to list everything and let
> > linker filter out the unneeded ones.
> > 
> > 
> > CC: Tom Stellard <t...@stellard.net>
> > CC: Emil Velikov <emil.l.veli...@gmail.com>
> > CC: k...@dev.carbon-project.org
> > Signed-off-by: Jan Vesely <jan.ves...@rutgers.edu>
> > ---
> > I'm not sure whether -Wl,--as-needed is supported by all build systems that 
> > emsa targets, or I need to add a test for it.
> > 
> >  configure.ac | 40 +++++++---------------------------------
> >  1 file changed, 7 insertions(+), 33 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 03f1bca..39dfd32 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1694,7 +1694,7 @@ if test "x$enable_gallium_llvm" = xyes; then
> >  
> >      if test "x$LLVM_CONFIG" != xno; then
> >          LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
> > -        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
> > +        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags -Wl,--as-needed`
> >          LLVM_BINDIR=`$LLVM_CONFIG --bindir`
> >          LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
> >          LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
> > @@ -1724,29 +1724,6 @@ if test "x$enable_gallium_llvm" = xyes; then
> >              AC_MSG_ERROR([LLVM 
> > $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is 
> > required])
> >          fi
> >  
> > -        LLVM_COMPONENTS="engine bitwriter"
> > -        if $LLVM_CONFIG --components | grep -qw 'mcjit'; then
> > -            LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
> > -        fi
> > -
> > -        if test "x$enable_opencl" = xyes; then
> > -            LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
> > -            # LLVM 3.3 >= 177971 requires IRReader
> > -            if $LLVM_CONFIG --components | grep -qw 'irreader'; then
> > -                LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
> > -            fi
> > -            # LLVM 3.4 requires Option
> > -            if $LLVM_CONFIG --components | grep -qw 'option'; then
> > -                LLVM_COMPONENTS="${LLVM_COMPONENTS} option"
> > -            fi
> > -            # Current OpenCL/Clover and LLVM 3.5 require ObjCARCOpts and 
> > ProfileData
> > -            if $LLVM_CONFIG --components | grep -qw 'objcarcopts'; then
> > -                LLVM_COMPONENTS="${LLVM_COMPONENTS} objcarcopts"
> > -            fi
> > -            if $LLVM_CONFIG --components | grep -qw 'profiledata'; then
> > -                LLVM_COMPONENTS="${LLVM_COMPONENTS} profiledata"
> > -            fi
> > -        fi
> >          DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT 
> > -DLLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
> >          MESA_LLVM=1
> >  
> > @@ -1873,7 +1850,6 @@ radeon_llvm_check() {
> >                        sources with the --enable-experimental-targets=R600
> >                        configure flag])
> >      fi
> > -    LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader ipo"
> >      NEED_RADEON_LLVM=yes
> >      if test "x$have_libelf" != xyes; then
> >         AC_MSG_ERROR([$1 requires libelf when using llvm])
> > @@ -1916,14 +1892,10 @@ if test -n "$with_gallium_drivers"; then
> >              gallium_require_drm_loader
> >              if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = 
> > xyes; then
> >                  radeon_llvm_check "r600g"
> > -                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
> >              fi
> >              if test "x$enable_r600_llvm" = xyes; then
> >                  USE_R600_LLVM_COMPILER=yes;
> >              fi
> > -            if test "x$enable_opencl" = xyes; then
> > -                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
> > -            fi
> >              ;;
> >          xradeonsi)
> >              HAVE_GALLIUM_RADEONSI=yes
> > @@ -1969,16 +1941,18 @@ if test -n "$with_gallium_drivers"; then
> >      done
> >  fi
> >  
> > -dnl Set LLVM_LIBS - This is done after the driver configuration so
> > -dnl that drivers can add additonal components to LLVM_COMPONENTS.
> > -dnl Previously, gallium drivers were updating LLVM_LIBS directly
> > +dnl Set LLVM_LIBS - All LLVM shared libs are added to the linking
> > +dnl stage and -Wl,--as-needed is used to filter out the unnecessary
> > +dnl ones
> > +dnl Previously drivers used LLVM_COMPONENTS to setup different components.
> > +dnl Before that, gallium drivers were updating LLVM_LIBS directly
> >  dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
> >  dnl this was causing the same libraries to be appear multiple times
> >  dnl in LLVM_LIBS.
> >  
> >  if test "x$MESA_LLVM" != x0; then
> >  
> > -    LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
> > +    LLVM_LIBS="`$LLVM_CONFIG --libs`"
> >  
> >      if test "x$enable_llvm_shared_libs" = xyes; then
> >          dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
> > 
> 

-- 
Jan Vesely <jan.ves...@rutgers.edu>

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to