Linux LTO with lld from llvm 9

Newbie2019 newbie2019 at
Sat Oct 12 04:26:17 UTC 2019

On Thursday, 10 October 2019 at 18:56:31 UTC, kinke wrote:
> And, more importantly, the linker definitely uses that plugin 
> with matching LLVM version; LLD might ignore it and so use its 
> LLVM, which is apparently v8 in your case.

I rebuild ldc with lld & llvm9, it can generate the binary with 

with  -linker=gold, or with  -L-plugin=.   make the link pass 2 
or 3 plugin to link.

  /opt/local/bin/ld.lld -z now -z relro --hash-style=gnu 
--eh-frame-hdr -m elf_x86_64 -static -o tests_ng2.exe 
/usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../crt1.o /usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../crti.o /usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/crtbeginT.o -Llib -L/opt/build/lib -L/usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0 -L/usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/lib -L/usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib -plugin /usr/bin/../lib/ -plugin-opt=mcpu=x86-64 -z now -z noexecstack -z text /opt/d/tests_ng2.o -plugin /usr/lib/ -plugin-opt=mcpu=x86-64 -plugin-opt=O0 -plugin-opt=-function-sections -plugin-opt=-data-sections -plugin=/opt/build/llvm/build/lib/ -lng2 -lncursesw -lrt -lpthread -lm -ldl -lpthread --start-group -lgcc -lgcc_eh --end-group /usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/crtend.o /usr/bin/../lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../crtn.o --gc-sections -plugin-opt=O3 -lssl -lcrypto -lc -lgcc

the generate binary md5 hash seems is same when pass multi plugin.

More information about the digitalmars-d-ldc mailing list