<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 9, 2018, at 2:32 AM, James Henderson <<a href="mailto:jh7370.2008@my.bristol.ac.uk" class="">jh7370.2008@my.bristol.ac.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class="">By my understanding, the proposal is that the user input looks something like:<br class=""><br class=""></div>#pragma linker_directive("lib", "m")<br class=""><br class=""></div>which is passed essentially as is to the linker, i.e. the directive payload is a pair of strings, the first being "lib", the second "m". It is then up to the linker to decide if it supports "lib" directives, and translate that into the corresponding command, or do something else if it doesn't support it, e.g. emit an error or ignore it. Neither the backend nor the frontend need to do any conversion, and it makes it much clearer that these aren't like any other command-line option (due to the limited set that can be passed through, and the possible differences in behaviour, such as order on the command-line).<br class=""><br class=""></div>As an aside, this approach would aid portability to linkers that aren't command-line compatible with one another. If, for example, the switch is "-lib" on linker A, and "-l" on linker B, the user doesn't have to have different source code for each different linker their object is to be consumed by, nor does the compiler have to know about the different possible linkers.<br class=""></div></div></div></blockquote><div><br class=""></div><div>Okay, that seems reasonable enough.  I think I still like the simplicity of having it just be like a response file, but, this approach isn’t too bad for adding custom extensions to.  I do like that it gives greater portability to different linkers.</div><div><br class=""></div><div>The one last bit that still remains unanswered is the encoding.  Do we go forward with the abuse of the ELF notes or do is there enough confidence that adding a new section type shouldn’t break compatibility with older linkers?</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">James<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On 9 January 2018 at 05:15, Saleem Abdulrasool <span dir="ltr" class=""><<a href="mailto:compnerd@compnerd.org" target="_blank" class="">compnerd@compnerd.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
<br class="">
> On Jan 7, 2018, at 5:02 PM, Cary Coutant <<a href="mailto:ccoutant@gmail.com" class="">ccoutant@gmail.com</a>> wrote:<br class="">
><br class="">
>> I think we all agree that blindly allowing the linker to honor the options<br class="">
>> would be scary.  I agree that we should whitelist the options, and am of the<br class="">
>> opinion that we should force validation on the linker side (use of any<br class="">
>> option which the linker doesn't support in this form can be fatal).<br class="">
>> Starting small is the best way, with `-l` and `-L` as a starting point.  I<br class="">
>> want to retain the ability to add additional options which may not be<br class="">
>> available in all linkers.  However, whitelisting obviously requires working<br class="">
>> with the linker as would adding such options, so that could be handled at<br class="">
>> that time.<br class="">
><br class="">
> This is actually why I'd prefer a new "language" over just<br class="">
> whitelisting options. With "lib", "file", and "path", as I suggested,<br class="">
> there's no question whether an option like "-no-pie" is supported, and<br class="">
> no temptation to even try. The new language should be tailored for<br class="">
> process-to-process communication, rather than user-to-shell<br class="">
> communication.<br class="">
<br class="">
</span>I suppose I am slightly confused about what you are proposing here now.  From the user side, it would be something to that effect.  Im suggesting that we take lib and transform it to a different representation in the frontend.  Taking an explicit example:<br class="">
<br class="">
The user input<br class="">
`#pragma comment(lib, “m”)`<br class="">
<br class="">
would get transformed to `-lm` in the object file encoding.  However, this would still not permit you from injecting any arbitrary options, but the backend doesn’t change for any new option, only the frontend and the linker.<br class="">
<div class="HOEnZb"><div class="h5"><br class="">
>> I’m thinking about future enhancements.  MachO does actually provide<br class="">
>> something like `-L` -`l` in a single go via `-framework`.  But, no such<br class="">
>> option exists for ELF since it doesn’t have the concept of framework bundles<br class="">
>> (but the layout itself is interesting), and I just want to try to keep the<br class="">
>> door open for such features.<br class="">
><br class="">
> This is why I also included "path" in my suggestion. I imagine<br class="">
> something very much like -framework, where include files and library<br class="">
> search paths are handled together.<br class="">
><br class="">
> -cary<br class="">
<br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>