bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20535] DSO1 needed by DSO2 linked into executable not found with


From: nickc at redhat dot com
Subject: [Bug ld/20535] DSO1 needed by DSO2 linked into executable not found without -rpath-link, even though DT_RPATH and -rpath would find it
Date: Wed, 28 Sep 2016 12:17:02 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20535

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |nickc at redhat dot com
         Resolution|---                         |INVALID

--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
Hi Stephan,

  The problem here is that you are using environment variables which are not
  being expanded at link time.

> $ gcc -shared -fPIC -o dsos/libdso2.so -Wl,-rpath='$ORIGIN' dso2.c -Ldsos 
> -ldso1

  This stores a DT_NEEDED string of "$ORIGIN" into libdso2.so.  It does *not* 
  store the expansion of $ORIGIN into the DT_NEEDED entry. 

> $ gcc -Wl,-rpath='$ORIGIN/dsos' main.c -Ldsos -ldso2

  This makes the linker look in a directory path called "$ORIGIN/dsos", again
  with no expansion of $ORIGIN, which is why this approach also fails.  (Note
  this behaviour is intended.  The linker does not perform expansion of 
  environment variables found in path names).

  This sequence does work:

  % setenv ORIGIN `pwd`
  % mkdir dsos
  % gcc -shared -fPIC -o dsos/libdso1.so dso1.c
  % gcc -shared -fPIC -o dsos/libdso2.so -Wl,-rpath=$ORIGIN/dsos dso2.c -Ldsos
-ldso1
  % gcc main.c -Ldsos -ldso2                                                    

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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