-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8345683: Remove special flags for files compiled for static libraries #22606
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 ihse! A progress list of the required criteria for merging this PR into |
|
@magicus 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 64 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 |
I managed to dig up the reason for this and have sent a question to the original stakeholders. Please hold off until we get confirmation. |
|
/integrate |
|
Going to push as commit cbab40b.
Your commit was automatically rebased without conflicts. |
For various reasons, we have added some extra flags to the compiler command line when compiling C/C++ for static libraries. This is a blocker for the goal of compiling once, linking twice for static and dynamic library. Fortunately, these extra flags are not needed.
Note that
-DSTATIC_BUILD=1is still kept, but set inSetupNativeCompilation. Going forward, this flag should only be sent to the very small set of files that actually need to know if we're creating a static or dynamic library. (But that is a future follow-up.)The flags I removed, with rationales for removing them:
ffunction-sections -fdata-sections: This forces the compiler to create a separate section for each and every function and data entry. The idea is that the linker can use this to get rid of dead code when creating the static library, and hence saving space. The idea is perhaps good, but it does not work. libjvm.so gets about 10% larger with these flags than without them, so they are not only useless, but actually harmful.-DJNIEXPORT='__attribute__((visibility(\"default\")))': This is default now anyway so it does not contribute anything.-DJNIEXPORT=: The static launcher still does not work fully on Windows. (It is an ongoing project to get it to work) However, removing this flag is an essential first step, since it otherwise removes the__declspec(dllexport)annotation, and we are hence renders us unable to lookup symbols in the static libraries. (I don't understand why this was introduced in the first place.)-Xassembler -mrelax-relocations=no: This was apparently added for compatibility with "older" linkers. Unfortunately, no version was given, and the original author of the code does not remember. I can build with no ill effects without this flag, so I assume that in the years that has passed, our toolchain version increments has made this unnecessary.There is a small risk of breakage for some old/odd gcc toolchain out there. But I can see of no other realistic way of solving this than to remove the flag, and if it breaks somewhere, we can re-introduce the flag, but with a valid GCC version number attached to it.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22606/head:pull/22606$ git checkout pull/22606Update a local copy of the PR:
$ git checkout pull/22606$ git pull https://git.openjdk.org/jdk.git pull/22606/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22606View PR using the GUI difftool:
$ git pr show -t 22606Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22606.diff
Using Webrev
Link to Webrev Comment