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

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 10:38:41 PST 2017


compnerd added a comment.

This could be embedded within the note structure.  Because we want this section to be discarded by default, having a `PROGBITS` section seems like a bad idea to me, but if someone else has a better way to accomplish this, I'm not tied to this.

The version field is for future enhancements.  I suppose we can make it a ULEB, but, does a total of 8-bytes matter that much?  (even in a ULEB encoding, that only saves us 6-bytes, in the object file, not the final binary, which should not preserve this field).

No, sorry, the reserved field is for future enhancements; you are right, that I forgot to null terminate the array.

I would be interested in the format of the structure in your linker; it is possible that you have a better format specified or that this version could be improved before we implement it.

Right now, I expect that most ELF linkers would process the command line arguments after all the objects have been loaded.  In such a scenario, the most likely place for the addition will be the end of the command line, which is fine.  For `-r` links, I would expect that the sections would be preserved across all the object files and re-emitted into the relocatable linked object.  The final consumption of the object will process the concatenated options and then discard the note.


Repository:
  rL LLVM

https://reviews.llvm.org/D40849





More information about the llvm-commits mailing list