[Compile Driver] Proper Linker Usage
edg-l opened this issue · 0 comments
edg-l commented
Good related read: https://fabiensanglard.net/dc/driver.php
I looked into the Rust source code, they also call the linker as a command line program.
What we need to do is analyse properly the requirements of the program to be linked, such as dependencies and files to link together, and whether it is a shared, static library or a binary.
Things to analyse and pass to the linker cli:
- Arch (x86_64, aarch64, etc)
- On linux The crt (c runtime) which defines _start and proper exit. On macOS it looks like it's done automatically?.
- On linux, the loader, i think for 64bit its always
/lib64/ld-linux-x86-64.so.2
. Used with the argument--dynamic-linker
- Libraries / object files to link together
Optional:
- Allow to specify the linker, such as ld, lld, mold
https://github.com/lambdaclass/concrete/blob/main/crates/concrete_codegen_mlir/src/linker.rs