@llvm.used does not mean the linker will not kill the symbol

kinke noone at nowhere.com
Mon Apr 1 18:58:58 UTC 2019


On Monday, 1 April 2019 at 17:57:30 UTC, David Nadlinger wrote:
> It doesn't even work for LDC – compatibility with older linkers 
> was broken when that "simplification" was merged.

For reference, the PR: 
https://github.com/ldc-developers/ldc/pull/2870

'Older linker' seems to be spot-on, as it works for Shippable 
(AArch64 with Ubuntu 16.04 ld.gold IIRC; LDC doesn't work if 
ModuleInfos are stripped) and also started to work with more 
recent gold for 32-bit MIPS and ARM 
(https://github.com/ldc-developers/ldc/issues/2994).

On Monday, 1 April 2019 at 17:47:52 UTC, Johan Engelen wrote:
> After looking more into `@llvm.used` and GCC's 
> `__attribute__((used))`, I've come to the conclusion that 
> `llvm.used` does _not_ mean that the linker won't strip it. It 
> definitely will. Just try this:
>   __attribute__((used)) void foo() {}

So not even gcc works, or is that clang?


More information about the digitalmars-d-ldc mailing list