On Mon, 22 Jul 2024 12:15:59 GMT, Julian Waters <jwat...@openjdk.org> wrote:

> This seems odd, since I recall Magnus forcing the JDK to use lld when clang 
> is the compiler, so ld being invoked seems strange to me. Does this still 
> happen with lld?

The issue occurs with clang linker `lld` during linking executable using `.a` 
static libraries created using `ld -r`. There are two different linking phases 
involved:

1) Create `.a` static libraries using `ld -r`. I only tested with clang linker 
`lld` for this issue.
2) Create executable using the `.a` libraries created by above step (or/and 
created using `objcopy`). I only tested with clang linker `lld`.

As the short summary described in https://bugs.openjdk.org/browse/JDK-8336849, 
the specific issue is:

The `-Wl,--icf=safe` linker option cannot work well with binaries created using 
`ld -r` or `objcopy`. `--icf=safe` uses `.llvm_addrsig` section, which contains 
symbol indexes and `ld -r` or `objcopy` may change the the symbol table. That 
causes the linker errors referenced above.

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

PR Comment: https://git.openjdk.org/jdk/pull/20265#issuecomment-2243496659

Reply via email to