[llvm-dev] Linker Option support for ELF
Saleem Abdulrasool via llvm-dev
llvm-dev at lists.llvm.org
Thu Jan 4 11:00:26 PST 2018
On Wed, Jan 3, 2018 at 4:02 PM, Saleem Abdulrasool <compnerd at compnerd.org>
> Hello all,
> There was some interest from a number of a few people about adding support
> for embedded linker options to ELF. This would be an extension that
> requires linker support to actually work, but has significant prior art
> with PE/COFF as well as MachO both having support for this.
> The desire here is to actually add support to LLVM to pass along the
> necessary information into the object file. In order to keep this focused
> on that, this thread is specifically for the *backend*, we are not
> discussing how to get the information to the backend here at all, but
> assuming that the information is present in the same LLVM IR encoding
> (llvm.linker-options module metadata string).
> In order to have compatibility with existing linkers, I am suggesting the
> use of an ELF note. These are implicitly dropped by the linker so we can
> be certain that the options will not end up in the final binary even if the
> extension is not supported. The payload would be a 4-byte version
> identifier (to allow future enhancements) and a null-terminated string of
> This allows for the backend to be entirely oblivious to the data as the
> other backends and allows for extensions in the future without having to
> teach the backend anything about the new functionality (again, something
> which both of the other file formats support).
> As an example of how this can be useful, it would help with Swift support
> on Linux where currently the linker options are pushed into a custom
> section, and a secondary program is used to extract the options from this
> section prior to the linker being invoked. This adds a lot of complexity
> to the driver as well as additional tools being invoked in the build chain
> slowing down the build.
I realized that I had missed the link to the change that I had put up due
to the original conversation. It is available at
https://reviews.llvm.org/D40849 for those who are interested.
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev