<div dir="ltr"><div dir="ltr">On Thu, Mar 14, 2019 at 5:30 PM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div>I would like to propose that we focus on autolinking exclusively and that we divorce the implementation from the idea of "linker options" which, by nature, would tie source code to the vagaries of particular linkers. I don't see much value in supporting other linker operations so I suggest that the binary representation be a mergable string section (SHF_MERGE, SHF_STRINGS), called .autolink, with custom type SHT_LLVM_AUTOLINK (0x6fff4c04), and SHF_EXCLUDE set (to avoid the contents appearing in the output).</div></div></div></blockquote><div><br></div><div><div>Should we set SHF_EXCLUDE on the section? I think it may be better not to set it. The semantics of the bit are that the section will be excluded from the final output file, but there's no requirement that other sections are not excluded. For example SHT_REL(A) sections are interpreted by the linker and excluded from the output, but they do not have SHF_EXCLUDE set. The SHT_LLVM_AUTOLINK section could be treated similarly in compatible linkers. SHF_EXCLUDE is appropriate for sections that can be freely dropped without changing the semantics, such as the address significance table, but the autolink section is different because dropping it changes the semantics. By not setting the bit, we would cause incompatible linkers to leave the autolink section in the output file, which would allow downstream tools to be written that would detect (and possibly diagnose) such files.</div><div><br></div><div>Peter</div></div></div></div></div></blockquote><div><br></div><div>Great point Peter, accepted. I'm rather afraid to say that I just copied the SHF_EXCLUDE from the existing .linker-options without thinking it through. When I prototyped this up SHF_EXCLUDE doesn't actually buy you much because you still need to special case SHT_LLVM_AUTOLINK for -r links to undo the effect of SHF_EXCLUDE. Probably ELF needs some sort of EXCLUDED but not for -r links flag.</div></div></div>