-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8348663: [AIX] clang pollutes the burned-in library search paths of the generated executables #23313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back jkern! A progress list of the required criteria for merging this PR into |
|
@JoKern65 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 46 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@magicus Hi Magnus, I'm faced with the problem that I cannot check in an executable script. On the other side the compilers -fuse_ld parameter needs an executable script. Is there a way to circumvent this. |
|
This look like a very hacky workaround overall. Can't you just unset LIBPATH in spec.gmk? Or just before linking? Is this a documented behavior of the linker on AIX, or a bug? |
Webrevs
|
|
Unfortunately, there is no other way. The LIBPATH envvar during our build is already unset. The compiler itself, when called as the Linker is setting some paths into LIBPATH before he calls the real Linker by himself. This is the only way to get rid of the unwanted burned in paths. This was an advice from IBM to do so as a standard trick. |
|
I still think you should report it as a bug, but I accept that we need to have a workaround in the meantime (or forever, if it doesn't get fixed). However, you need to shape up the patch a bit first.
|
|
I'm not sure what is a better place. Perhaps BASIC_POST_CONFIG_OUTPUT where we copy/chmod other files, even if this one is not strictly necessary to do late in the configure process. |
|
I followed all of Magnus proposals: |
make/autoconf/basic.m4
Outdated
| # Copy the linker wrapper script for AIX' clang and make it executable | ||
| if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix && | ||
| test -e "${TOPDIR}/make/scripts/aix/ld.sh"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can assume that checked-in files exist and do not need to test for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
make/autoconf/basic.m4
Outdated
| # Copy the linker wrapper script for AIX' clang and make it executable | ||
| if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix && | ||
| test -e "${TOPDIR}/make/scripts/aix/ld.sh"; then | ||
| $CP -f "${TOPDIR}/make/scripts/aix/ld.sh" "$OUTPUTDIR/ld.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| $CP -f "${TOPDIR}/make/scripts/aix/ld.sh" "$OUTPUTDIR/ld.sh" | |
| $CP -f "$TOPDIR/make/scripts/aix/ld.sh" "$OUTPUTDIR/ld.sh" |
We normally prefer to use $ without {} unless they are necessary, but in some parts of the code the ${} style is prevalent for historical reasons, and in those places it is better to keep with that style. But for code like this, you should stick to the {}-less style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
make/autoconf/basic.m4
Outdated
| # Make the compare script executable | ||
| $CHMOD +x $OUTPUTDIR/compare.sh | ||
| # Copy the linker wrapper script for AIX' clang and make it executable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # Copy the linker wrapper script for AIX' clang and make it executable | |
| # Copy the linker wrapper script for clang on AIX and make it executable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Just one comment fix and then this is okay. Also please verify that the latest version still works on AIX. |
|
All done and also latest version still works on AIX. |
magicus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now. Thanks!
|
Looks good to me, too. However, you should update the copyright years in the modified files and also add a license header in the newly added script (like in other .sh files in that directory but with SAP copyright). |
|
Copyrights modified/added. |
make/scripts/aix/ld.sh
Outdated
| @@ -0,0 +1,28 @@ | |||
| #!/bin/bash | |||
| # | |||
| # Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave out Oracle here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close to perfect. 😄
|
/integrate |
|
Going to push as commit e0c2cb4.
Your commit was automatically rebased without conflicts. |
The clang compiler which we use since jdk21 pollutes the burned-in library search paths of the generated executables.
e.g. a dump -X64 -H ... /jdk-23.0.1+11-jre/lib/libnio.so
amongst others produces the following lines
INDEX PATH BASE MEMBER
0 /opt/IBM/openxlC/17.1.1/../../../../usr/lpp/xlC/lib:/opt/IBM/openxlC/17.1.1/lib:/opt/IBM/openxlC/17.1.1/bin/../../../../../usr/lpp/xlC/lib:/usr/opt/zlibNX/lib:/opt/freeware/lib/pthread:/opt/freeware/lib:/usr/lib
The long string is the burned in library search path which will be used after searching with LIBPATH envvar.
You see there are some compiler paths which customers will not have; also /opt/freeware is unwanted.
A proper executable should only have the burned in default search path
/usr/lib:lib
To ensure this we want to call the linker with the flag
-fuse-ld=our-wrapper-script-cleaning-LIBPATH- and-calling-original-ld-afterwards
This script we want to deliver in make/scripts/aix/ld.sh
just containing
#!/bin/bash
unset LIBPATH
exec /usr/bin/ld "$@"
return $?
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23313/head:pull/23313$ git checkout pull/23313Update a local copy of the PR:
$ git checkout pull/23313$ git pull https://git.openjdk.org/jdk.git pull/23313/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23313View PR using the GUI difftool:
$ git pr show -t 23313Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23313.diff
Using Webrev
Link to Webrev Comment