RFR: 8371893: [macOS aarch64] use dead_strip linker option to reduce binary size

Matthias Baesken mbaesken at openjdk.org
Wed Nov 19 15:22:45 UTC 2025


On Wed, 19 Nov 2025 02:29:31 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> I reproduced the SA issues locally. Not surprisingly almost every SA test failed (I'm not sure why only 3 were listed above). They seemed to all fail trying to get a vtable for a hotspot type. The tests that didn't failed were doing mundane things like testing attaching, hotspot flags, and clhsdb history, but not doing anything with hotspot objects, or at least not with hotspot metadata.
> 
> I was able to confirm the problem is with the Metadata vtable missing. I fixed it by allocating a Metadata instance and assigning it to a global. However, in order to get this to compile I had make Metadata no longer be abstract. All tests passed after I did this. I'm not sure how viable a solution this is. The hotspot team will probably object to the Metadata changes. Maybe there is some other way to cause a reference to the Metadata vtable so it is not dead stripped.

There seem to be attributes for this kind of use case in clang, e.g. retain 
https://reviews.llvm.org/D97447
https://clang.llvm.org/docs/AttributeReference.html#retain
Should we add this to 'class Metadata'  ?
If we can do it with attributes or something similar (and without changing lots of code locations) it sounds better to me than adjusting the coding.
'Pseudo dead' stuff that is used from external tools (so it is not really 'dead' in practise) should be somehow marked to assist the tools.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28319#issuecomment-3553303689


More information about the build-dev mailing list