On Wed, 19 Nov 2025 18:53:34 GMT, Chris Plummer <[email protected]> wrote:
> This seems to work:
>
> ```
> extern void* _ZTV8Metadata[];
>
> __attribute__((used))
> void* foo() {
> return _ZTV8Metadata[0];
> }
> ```
>
> You can put this anywhere since it does not reference any hotspot types. It
> just needs to be linked in with libjvm. Note I tried putting the "used"
> attribute on _ZTV8Metadata and getting rid of the foo() part, but I got the
> following warning and the vtable was dead stripped:
>
> `warning: 'used' attribute ignored on a non-definition declaration
> [-Wignored-attributes]`
Thanks for the testing and providing the workaround. Too bad that the
'retain' and 'used' are only function attributes, this makes things a bit
harder.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28319#issuecomment-3558408585