<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 8, 2018 at 9:51 AM, Peter Smith via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I was thinking specifically of the subset of the commands for dealing<br>
with files, for example INPUT, GROUP and SEARCH_DIR. I agree that it<br>
would not be wise to allow the full generality of linker scripts.<br>
Thinking about this a bit more I think my main concern is that we<br>
should try hard to make sure that any commands that are embedded in an<br>
object file are compatible with any equivalent linker script commands.<br></blockquote><div><br></div><div>I'm not sure that "compatible with any equivalent linker script commands" is a goal that we want to achieve. That might in principle simplify the spec, but I think that in practice the difficulties specifying what the "embedded linker options" mean will be about how the object's position in the command line interacts with the semantics (e.g. does it go at the end, or right after the current object file, or unspecified). I don't think that tying ourselves to linker scripts really simplifies this at all.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On 8 January 2018 at 17:35, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> On Mon, Jan 8, 2018 at 3:22 AM, Peter Smith <<a href="mailto:peter.smith@linaro.org">peter.smith@linaro.org</a>> wrote:<br>
>><br>
>> On 8 January 2018 at 09:32, James Henderson via llvm-dev<br>
>> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> > On 8 January 2018 at 08:14, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
>> >><br>
>> >> On Mon, Jan 8, 2018 at 3:55 AM, Sean Silva via llvm-dev<br>
>> >> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> On Jan 7, 2018 5:02 PM, "Cary Coutant via llvm-dev"<br>
>> >>> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>> >>><br>
>> >>> > I think we all agree that blindly allowing the linker to honor the<br>
>> >>> > options<br>
>> >>> > would be scary. I agree that we should whitelist the options, and<br>
>> >>> > am<br>
>> >>> > of the<br>
>> >>> > opinion that we should force validation on the linker side (use of<br>
>> >>> > any<br>
>> >>> > option which the linker doesn't support in this form can be fatal).<br>
>> >>> > Starting small is the best way, with `-l` and `-L` as a starting<br>
>> >>> > point.<br>
>> >>> > I<br>
>> >>> > want to retain the ability to add additional options which may not<br>
>> >>> > be<br>
>> >>> > available in all linkers. However, whitelisting obviously requires<br>
>> >>> > working<br>
>> >>> > with the linker as would adding such options, so that could be<br>
>> >>> > handled<br>
>> >>> > at<br>
>> >>> > that time.<br>
>> >>><br>
>> >>> This is actually why I'd prefer a new "language" over just<br>
>> >>> whitelisting options. With "lib", "file", and "path", as I suggested,<br>
>> >>> there's no question whether an option like "-no-pie" is supported, and<br>
>> >>> no temptation to even try.<br>
>> >>><br>
>> >>><br>
>> >>> That's a very simple and elegant solution.<br>
>> >><br>
>> >><br>
>> >> I really like that approach too. Command line options and "embedded<br>
>> >> options" are different, so making them actually look different makes<br>
>> >> sense.<br>
>> ><br>
>> ><br>
>> > +1 from me. This is very similar to what we have in the Playstation<br>
>> > linker<br>
>> > (which uses integers instead of strings to denote the type of<br>
>> > directive). As<br>
>> > Paul mentioned earlier, we support "lib" and "export" directives, both<br>
>> > of<br>
>> > which would fit nicely into this format.<br>
>> ><br>
>> >><br>
>><br>
>> I'm wondering how much of the likely extensions are already covered by<br>
>> linker script commands<br>
>><br>
>> (<a href="https://sourceware.org/binutils/docs/ld/File-Commands.html#File-Commands" rel="noreferrer" target="_blank">https://sourceware.org/<wbr>binutils/docs/ld/File-<wbr>Commands.html#File-Commands</a>).<br>
>> Would it be worth investigating embedding fragments of linker script<br>
>> [*] in the same way as the .directive sections that could be<br>
>> concatenated or overridden by any user provided linker script? This<br>
>> would have some advantages:<br>
>> - there is already a specification and implementation of the commands<br>
>> and experience of their use and limitations.<br>
>> - it will be easier to resolve conflicts with existing linker script<br>
>> commands that might conflict.<br>
>> - if new commands are needed they can be added to linker scripts.<br>
><br>
><br>
> If we allow users embed linker scripts to object files, all ELF linkers will<br>
> have to start supporting the linker script even for linking trivial<br>
> programs. I don't think that's a good situation. IMO linker script is too<br>
> powerful and too GNU-ish that we want to use it only for some limited<br>
> purposes (e.g. embedded programming.)<br>
><br>
>> [*] The encoding in the object file need not match, as long as the<br>
>> permitted set of options can map 1:1 to a linker script command.<br>
>><br>
>> My experience with Arm Build Attributes, which are used to reason<br>
>> about compatibility of relocatable objects and not communication of<br>
>> options; is that users expect to be able to move binary only objects<br>
>> between projects, and information embedded in object files that isn't<br>
>> easily accessible to them that causes a link to fail is extremely<br>
>> unpopular. I'm definitely of the opinion that we should be cautious<br>
>> with what we allow to be put in.<br>
>><br>
>> Peter<br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div></div>