-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
JDK-8317799 : AIX PPC64: FFI symbol lookup doesn't find symbols #16414
Conversation
Hi @suchismith1993, welcome to this OpenJDK project and thanks for contributing! We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user suchismith1993" as summary for the issue. If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing |
@suchismith1993 The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
/covered |
Thank you! Please allow for a few business days to verify that your employer has signed the OCA. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated! |
make/modules/java.base/Lib.gmk
Outdated
@@ -213,8 +213,10 @@ $(eval $(call SetupJdkLibrary, BUILD_SYSLOOKUPLIB, \ | |||
CXXFLAGS := $(CXXFLAGS_JDKLIB), \ | |||
LDFLAGS := $(LDFLAGS_JDKLIB), \ | |||
LDFLAGS_linux := -Wl$(COMMA)--no-as-needed, \ | |||
LDFLAGS_aix := -brtl -bloadmap:/home/hotspot/openjdk/symbol.log -bE:/home/hotspot/tmp/all-libs/1.exp , \ |
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.
These files need to get added somewhere. Maybe symbols could get added to make/data/hotspot-symbols/symbols-aix? Or to new files in the same directory (with aix in the file names)?
Also, please remove extra whitespaces.
make/modules/java.base/Lib.gmk
Outdated
TARGETS += $(BUILD_LIB_SIMD_SORT) | ||
endif | ||
|
||
################################################################################ |
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.
I guess this was done by mistake. Please revert.
|
||
|
||
|
||
|
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.
Please avoid changing lines which you don't need to modify! Is #include <math.h>
really needed, here? If so, please protect it by #ifdef _AIX
and add a comment explaining why.
07effd7
to
4533b71
Compare
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.
LGTM. You may want to replace the Copyright header of the new file. It was contributed by IBM.
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.
Still good. I suggest to remove the empty lines at the beginning.
@suchismith1993 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 21 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@TheRealMDoerr, @magicus, @dholmes-ora, @JornVernee) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
No, no... This is bad on several accounts. |
First and foremost, the Secondly: do you really need this file? It looks just like an enumeration of (a subset of?) standard library functions. This looks like a completely incorrect solution to the problem. How did you arrive at this list? What if in the future new functions are added to the standard library? |
Also, please don't ever force push once you have published a PR. Now it makes Martin's comment just dangling in the air. |
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
// Simple dummy function so this library appears as a normal library to tooling. |
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.
I assume this comment should be on line 207 instead..?
This looks like a much saner solution than the original attempt. |
|
||
char* syslookup() { | ||
return "syslookup"; | ||
} |
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.
This is probably not needed, either (see Windows version).
// Adding at least one #include removes unwanted warnings on some platforms. | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> |
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.
Are string.h and stdlib.h needed? I can't see them in the comments below.
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.
string.h is needed for strlen. Let me check for stdlib.h by excluding it.
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.
ah, a comment above strlen would help.
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
// Addresses of functions to referenced using static linking. |
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.
What does "functions to referenced" mean? Typo?
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.
To be Referenced*. Is that the right 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.
Thanks for cleaning it up! LGTM.
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.
This is much more palatable and good to be consistent with what is done on Windows. Thank.
Note that on Windows we also have a lookup mechanism on the Java side:
On Windows we need to load the global array, and then grab functions from the array. Why isn't that needed on AIX? Is |
Yes.The test cases for lookup of symbols have passed.
I think the bexpfull option helps in exporting the right symbols being
referenced.
…On Wednesday, November 22, 2023, Jorn Vernee ***@***.***> wrote:
Note that on Windows we also have a lookup mechanism on the Java side:
https://github.com/openjdk/jdk/blob/2c31ca525b1cd70c3dfcb0463c8c98
4bdd7c886a/src/java.base/share/classes/jdk/internal/
foreign/SystemLookup.java#L159
On Windows we need to load the global array, and then grab functions from
the array. Why isn't that needed on AIX? Is dlsym able to find the
statically linked functions as well?
—
Reply to this email directly, view it on GitHub
<#16414 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AESW3BAJPWKB5I7MM7IVQKDYFWOCTAVCNFSM6AAAAAA6VZ2E4KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRSGIYDKNBUGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Co-authored-by: Amit Kumar <amitlocham09@icloud.com>
Thank you @JornVernee @magicus @dholmes-ora @TheRealMDoerr @erikj79 |
/integrate |
@suchismith1993 |
/sponsor |
Going to push as commit 25cebe8.
Your commit was automatically rebased without conflicts. |
@offamitkumar @suchismith1993 Pushed as commit 25cebe8. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The math library in AIX specifically, is a static archive. Doing a -lm wont suffice, because when the symbols are looked up using dlsym or accessing native code through Java, it will lead to failures.
Hence we had to come up with a list of symbols to allow math library symbols to be accesible.
Also, there are parts of libc library that are static too, and hence those symbols also are present in this list.
Without this change, the StdLibTest and multiple other tests which make native function calls using FFI, fail with NoSuchElementException.
JBS-ISSUE : JDK-8317799
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16414/head:pull/16414
$ git checkout pull/16414
Update a local copy of the PR:
$ git checkout pull/16414
$ git pull https://git.openjdk.org/jdk.git pull/16414/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16414
View PR using the GUI difftool:
$ git pr show -t 16414
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16414.diff
Webrev
Link to Webrev Comment