RFR: 8017234: Hotspot should stop using mapfiles
Magnus Ihse Bursie
ihse at openjdk.org
Thu Feb 22 10:02:54 UTC 2024
On Wed, 21 Feb 2024 23:32:15 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
> **Summary:** Finally get rid of the mapfiles in Hotspot, and replace it with compiler options and `JNIEXPORT` on all platforms.
>
> The bug that this PR solves, [JDK-8017234](https://bugs.openjdk.org/browse/JDK-8017234), was created in 2013. Even back then the use of mapfiles in Hotspot was dated, so this is really good riddance with old rubbish.
>
> This code touches on central but not well understood parts of the Hotspot dynamic library, which has contributed to why this bug has stayed unresolved for so long. I will need to explain this fix in more detail than usually necessary. (Please bare with me if this gets long.) I also anticipate that not all solutions that I've picked will be accepted, and we'll have to discuss how to proceed. I think it is better to have actual concrete code to discuss around, rather than starting by an abstract discussion. To keep this description short, I will post the discussion as a comment to the PR.
>
> I have run this PR through tier 1-3 in our CI system. I have also carefully checked how the resulting dynamic library differs with this patch (not much; see discussion below). For build system changes, this is often the most relevant metric.
Let me also add some background to the *why* of this PR.
A good reason is to get rid of a lot of weird code and special cases in the build. It will also speed up the build since we needed to scan all .o files with nm after they were compiled but before they were linked, adding to the slow path of linking hotspot. But for the 10+ years this has been a JBS issue it has never completely pushed the scales.
The triggering factor now is the Hermetic Java project. We need to make properly supported static libraries for all native code in the JDK. One of the main issues with creating a single static library from all the native code is symbol visibility. If the same symbol name is exported from two different libraries, this will cause a failure. This weird "dance" in Hotspot makes it much harder to reason about, or fix, issues related to symbol visibility. That is why I want to have this fixed, once and for all.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17955#issuecomment-1959089592
More information about the build-dev
mailing list