[9] RfR: JDK-8175307: rpath macro needs to use an argument on macosx

David DeHaven david.dehaven at oracle.com
Tue Feb 21 17:58:30 UTC 2017


> Please review this fairly trivial one line fix, the proposed patch is in the comments of the JBS issue, duplicated here for consistency:
> 
> diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4 
> --- a/common/autoconf/flags.m4 
> +++ b/common/autoconf/flags.m4 
> @@ -355,7 +355,7 @@ 
>         SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG" 
>         JVM_CFLAGS="$JVM_CFLAGS $PICFLAG" 
>       fi 
> - SET_EXECUTABLE_ORIGIN='-Wl,-rpath, at loader_path/.' 
> + SET_EXECUTABLE_ORIGIN='-Wl,-rpath, at loader_path[$]1' 
>       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN" 
>       SET_SHARED_LIBRARY_NAME='-Wl,-install_name, at rpath/[$]1' 
>       SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1' 
> 
> Existing use of the macro for macosx do not provide an argument, this results in RPATH being set to @loader_path, which is fine. New use of the macro will be consistent with linux.

Ok, so it needs to be a two line fix, different sections for gcc and clang:

diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -355,7 +355,7 @@
         SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
         JVM_CFLAGS="$JVM_CFLAGS $PICFLAG"
       fi
-      SET_EXECUTABLE_ORIGIN='-Wl,-rpath, at loader_path/.'
+      SET_EXECUTABLE_ORIGIN='-Wl,-rpath, at loader_path[$]1'
       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
       SET_SHARED_LIBRARY_NAME='-Wl,-install_name, at rpath/[$]1'
       SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
@@ -375,7 +375,7 @@
       # Linking is different on MacOSX
       PICFLAG=''
       SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $PICFLAG"
-      SET_EXECUTABLE_ORIGIN='-Wl,-rpath, at loader_path/.'
+      SET_EXECUTABLE_ORIGIN='-Wl,-rpath, at loader_path[$]1'
       SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
       SET_SHARED_LIBRARY_NAME='-Wl,-install_name, at rpath/[$]1'
       SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'

This time I actually verified it:
$ grep SET_EXECUTABLE_ORIGIN build/macosx-x64-debug/spec.gmk 
SET_EXECUTABLE_ORIGIN=-Wl,-rpath, at loader_path$1

-DrD-




More information about the build-dev mailing list