Skip to content

Fake linker plugin compatible with lld and GNU ld, which dumps the linker's command-line in a file.

License

Notifications You must be signed in to change notification settings

ergrelet/llvm-ebc-lddump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

llvm-ebc-lddump

Fake linker plugin compatible with lld and GNU ld, which dumps the linker's command-line in a file. This is meant to be used with clang's -fembed-bitcode on platforms where bitcode embedding doesn't include linker options.

Disclaimer: the code works as is but isn't meant to be production-ready.

Supported Platforms

  • Linux (GNU ld, lld)
  • Windows (lld)

How to Build

Linux

cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build

Windows

cmake -B build && cmake --build build --config Release

How to Use

Linux

lld

When using clang with lld, you can use the plugin like so:

clang -O2 -fuse-ld=lld -fembed-bitcode -Wl,-mllvm=-load=/path/to/libplugin.so file.c

GNU ld

When using clang with GNU ld, you can use the plugin like so:

clang -O2 -fembed-bitcode -Wl,-plugin=/path/to/libplugin.so file.c

Windows

lld

When using clang with lld, you can use the plugin like so:

clang -O2 -fuse-ld=lld -fembed-bitcode -Wl,/mllvm:-load=C:\\path\\to\\plugin.dll file.c

Output

The linker options are dumped into a file located next to the output executable, with the .llvmldcmd extension.

Much like the .llvmcmd section generated by the linker, the output file generated by the plugin contains each command-line argument separated by NUL chars. However, please note that the first argument will be the linker's file path.

About

Fake linker plugin compatible with lld and GNU ld, which dumps the linker's command-line in a file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published