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.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to