If I only have the binary executable file, how can I tell what linker was it built with?
Thanks to rodrigo's comment, here is a solution that seems to do the trick:
$ objdump -j .comment -s some_app
I tested it on a simple hello-world app on Linux and here is the output:
A. With the default linker:
$ objdump -j .comment -s target/release/my_hello_world_app
target/release/my_hello_world_app: file format elf64-x86-64
Contents of section .comment:
0000 4743433a 20285562 756e7475 20392e33 GCC: (Ubuntu 9.3
0010 2e302d31 37756275 6e747531 7e32302e .0-17ubuntu1~20.
0020 30342920 392e332e 3000 04) 9.3.0.
B. With the LLD linker:
$ objdump -j .comment -s target/release/my_hello_world_app
target/release/my_hello_world_app: file format elf64-x86-64
Contents of section .comment:
0000 4c696e6b 65723a20 4c4c4420 31302e30 Linker: LLD 10.0
0010 2e300047 43433a20 28556275 6e747520 .0.GCC: (Ubuntu
0020 392e332e 302d3137 7562756e 7475317e 9.3.0-17ubuntu1~
0030 32302e30 34292039 2e332e30 0000 20.04) 9.3.0..
BTW I used the following global config file ~/.cargo/config
to activate the LLD linker:
[build]
rustflags = [
"-C", "link-arg=-fuse-ld=lld",
]
This setting could be at a project-level only. That shouldn't really matter, I believe, but I am writing those details, since some people might find them useful.