Warning about direct access to weak symbols

Jacob Carlborg doob at me.com
Wed Jan 15 19:57:51 UTC 2020


On 2020-01-12 13:16, kinke wrote:
> On Saturday, 11 January 2020 at 11:06:08 UTC, Jacob Carlborg wrote:
>> ld: warning: direct access in function 'ltmp2' from file 
>> 'objects-unittest-debug/std/algorithm/comparison.o' to global weak 
>> symbol [...]
> 
> Templated function instantiations aren't supposed to be weak and 
> overridable at runtime (!); they are emitted with `weak_odr` LLVM 
> linkage, meaning that only a single definition is kept when linking (and 
> that it cannot be stripped even if unreferenced). LDC has a 
> `-linkonce-templates` option to switch to `linkonce_odr` linkage which 
> might be interesting for testing (only difference to weak_odr: 
> unreferenced symbols can be stripped).

Not sure I understand. Are these warnings to be expected?

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list