I installed clang 15.0.0 with LLD project to see the reduction in execution time for a matrix multiplication program. But the execution time remains the same unlike mentioned in the website LLD - The LLVM Linker — lld 16.0.0git documentation. that there is reduction of execution with the use of LLD linker instead of GNU ld.
why is the time same??
Also , with the command
readelf --string-dump .comment ./a.out
String dump of section ‘.comment’:
[ 0] Linker: LLD 15.0.0
[ 13] clang version 15.0.0
[ 29] GCC: (GNU) 8.5.0 20210514 (Red Hat 8.5.0-4)
[ 55] GCC: (GNU) 8.5.0 20210514 (Red Hat 8.5.0-3)
It is found that gcc is being used. May I know the reason for it???
To be clear (I found the prompt ambiguous): lld is not likely reduce the execution time of the resulting program, it just link the program faster than the gnu linker in general. That is your build time is faster (and it is noticeable on large programs).
Is this all of what is printed? Also did you try with -v?
The message about using a generic driver also makes me think you probably would better prepend /llvm15/llvm-project-llvmorg-15.0.0/build/bin to your PATH with export PATH=/llvm15/llvm-project-llvmorg-15.0.0/build/bin/:$PATH, check that you have the right clang/lld: which clang and invoke clang -fuse-ld=ld.lld lld.c
LLD can be significantly faster than GNU linkers: https://lld.llvm.org scroll down to performance.
As you see the effect becomes larger for larger binaries. For small tools, the difference is probably not noticeable.
The recommended option is -fuse-ld=lld. If you want to specify a path, -fuse-ld=lld --ld-path=path/to/ld.lld. -fuse-ld=path/to/something is a deprecated form.
In an lld linked output, the section layout is different from GNU ld’s output, but generally there should be no execution time difference.
lld is a generic driver.
lld implements ELF, Mach-O, PE/COFF, and wasm. It uses argv[0] to know which port should be used.