[PATCH] D40849: CodeGen: support an extension to pass linker options on ELF

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 14:18:22 PST 2017


I agree with the request that we should not embed arbitrary command
line options.

If we want to have a section with instructions to the linker, I think it
should be key value where the key is a enum value with some defined
values (add_library) and a range for vendor extension like other ELF
flags.

This should also be discussed with at least the bfd and gold developers,
but ideally it should go to generic-abi at googlegroups.com.

Cheers,
Rafael

Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu added a comment.
>
>> I don't think that parsing the options on the LLVM side is a good idea. What if the linker uses a non-GNU style driver? What if there are multiple ways of specifying the option (joined vs separate)? This is something that really should be pushed further down. Can you even do -l library with the GNU driver?
>
> I'd make users pass a key-value pair instead of a single string. A key-value pair is actually more straightforward than passing a single string for something like `#pragma comment(lib, "foo")`, no?
>
> I don't think we should accept more than one way of doing one thing. If we allow -l, we should allow only -l and shouldn't allow any other form of the same option including `--library=foo`, `-library=foo` or -library foo`.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D40849


More information about the llvm-commits mailing list