This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed, PATCH] PR ld/21923: Replace --rpath with -Wl,--rpath


On Tue, Aug 8, 2017 at 4:36 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Aug 8, 2017 at 3:39 PM, Alan Modra <amodra@gmail.com> wrote:
>> On Tue, Aug 08, 2017 at 02:17:05PM -0700, H.J. Lu wrote:
>>> --- a/ld/configure.ac
>>> +++ b/ld/configure.ac
>>> @@ -470,7 +470,7 @@ EMULATION_LIBPATH=$all_libpath
>>>  AC_SUBST(EMULATION_LIBPATH)
>>>
>>>  if test x${enable_static} = xno; then
>>> -  TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
>>> +  TESTBFDLIB="-Wl,--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
>>>  else
>>>    TESTBFDLIB="../bfd/.libs/libbfd.a"
>>>  fi
>>
>> Does that actually work?  I thought you needed to write -Wl options
>> without the spaces..
>>
>> TESTBFDLIB="-Wl,--rpath,../bfd/.libs,../bfd/.libs/libbfd.so"
>>
>
> Yes, a `,' is needed.  For some reason, it passed the tests without it.
>
>

I got lucky. -Wl,--rpath ../bfd/.libs works:

[hjl@gnu-tools-1 ld]$ gcc
-B/export/build/gnu/binutils-misc/build-x86_64-linux/ld/tmpdir/gccld2/
  -L/usr/local/x86_64-pc-linux-gnu/lib64 -L/usr/local/lib64 -L/lib64
-L/usr/lib64 -L/usr/local/x86_64-pc-linux-gnu/lib -L/usr/local/lib
-L/lib -L/usr/lib  -o tmpdir/xxx -Wl,--relax ldgram.o ldlex-wrapper.o
lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o
ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o
eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o
eelf_k1om.o  ldbuildid.o -Wl,--rpath ../bfd/.libs
../bfd/.libs/libbfd.so ../libiberty/libiberty.a   -L../zlib -lz -ldl
-v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-gcc-major-version-only
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl --enable-libmpx --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function
--with-tune=generic --with-arch_32=i686
--with-multilib-list=m32,m64,mx32 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.1.1 20170709 (Red Hat 7.1.1-4) (GCC)
COMPILER_PATH=/export/build/gnu/binutils-misc/build-x86_64-linux/ld/tmpdir/gccld2/:/usr/libexec/gcc/x86_64-redhat-linux/7/:/usr/libexec/gcc/x86_64-redhat-linux/7/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/7/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/export/build/gnu/binutils-misc/build-x86_64-linux/ld/tmpdir/gccld2/:/usr/lib/gcc/x86_64-redhat-linux/7/:/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-B'
'/export/build/gnu/binutils-misc/build-x86_64-linux/ld/tmpdir/gccld2/'
'-L/usr/local/x86_64-pc-linux-gnu/lib64' '-L/usr/local/lib64'
'-L/lib64' '-L/usr/lib64' '-L/usr/local/x86_64-pc-linux-gnu/lib'
'-L/usr/local/lib' '-L/lib' '-L/usr/lib' '-o' 'tmpdir/xxx' '-L../zlib'
'-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/7/collect2 -plugin
/usr/libexec/gcc/x86_64-redhat-linux/7/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
-plugin-opt=-fresolution=/tmp/cc8hQvTc.res
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --build-id --no-add-needed
--eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 -o tmpdir/xxx
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
-L/usr/local/x86_64-pc-linux-gnu/lib64 -L/usr/local/lib64 -L/lib64
-L/usr/lib64 -L/usr/local/x86_64-pc-linux-gnu/lib -L/usr/local/lib
-L/lib -L/usr/lib -L../zlib
-L/export/build/gnu/binutils-misc/build-x86_64-linux/ld/tmpdir/gccld2
-L/usr/lib/gcc/x86_64-redhat-linux/7
-L/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/7/../../..
--relax ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o
ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o
ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o
ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o --rpath ../bfd/.libs
../bfd/.libs/libbfd.so ../libiberty/libiberty.a -lz -ldl -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
--no-as-needed /usr/lib/gcc/x86_64-redhat-linux/7/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crtn.o
COLLECT_GCC_OPTIONS='-B'
'/export/build/gnu/binutils-misc/build-x86_64-linux/ld/tmpdir/gccld2/'
'-L/usr/local/x86_64-pc-linux-gnu/lib64' '-L/usr/local/lib64'
'-L/lib64' '-L/usr/lib64' '-L/usr/local/x86_64-pc-linux-gnu/lib'
'-L/usr/local/lib' '-L/lib' '-L/usr/lib' '-o' 'tmpdir/xxx' '-L../zlib'
'-v' '-mtune=generic' '-march=x86-64'
[hjl@gnu-tools-1 ld]$

I will add '.' anyway.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]