On Mon, 20 Apr 2026 16:43:32 GMT, Chris Plummer <[email protected]> wrote:

> Regarding the proposed fix, it's not clear to me how adding a constructor 
> forces the vtable to be retained.

With the NOINLINE, the constructor of Metadata is kept in the libjvm.so binary  
(even with lto).
If I disassemble it, I see the following 

`objdump -d --demangle --disassemble="Metadata::Metadata()"   
images/jdk/lib/server/libjvm.so`


images/jdk/lib/server/libjvm.so:     file format elf64-x86-64


Disassembly of section .init:

Disassembly of section .plt:

Disassembly of section .text:

0000000000bca790 <Metadata::Metadata()>:
  bca790:       48 8d 05 c1 81 94 00    lea    0x9481c1(%rip),%rax        # 
1512958 <vtable for Metadata+0x10>
  bca797:       48 89 07                mov    %rax,(%rdi)
  bca79a:       c3                      ret



So the remaining constructor touches (inits?)  the vtable.  The lto 'sees' 
this, and so it better keeps it in the binary.

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

PR Comment: https://git.openjdk.org/jdk/pull/30771#issuecomment-4289403243

Reply via email to