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

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 01:41:12 PST 2017


jhenderson added a comment.

Okay, I have no more comments about this, aside from still being somewhat concerned about how this is supposed to be consumed by the linker. Please wait for @ruiu's further input on this.



================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:109-110
+    Streamer.EmitBytes("LLVM");                            // name
+    Streamer.EmitIntValue(0, 1);                           // null
+    Streamer.EmitValueToAlignment(4);                      // desc
+    Streamer.EmitIntValue(1, 4);                           // version
----------------
compnerd wrote:
> jhenderson wrote:
> > I'm confused as to why you have to explicitly write a null character here instead of the code automatically using .asciz (like it does for the option string).
> I wish that it would add the trailing null, but it just does not.  This happens in the other backends as well where we are forced to write the trailing null.
Okay, sounds like this is effectively a (mostly harmless) bug in the underlying code somewhere. No worries.


================
Comment at: lib/CodeGen/TargetLoweringObjectFileImpl.cpp:109
+    // The payload is the version (4 bytes), options (n bytes), null (1 byte)
+    Streamer.EmitIntValue(sizeof(Version) + Descriptor.size() + 1, 4); // descsz
+    Streamer.EmitIntValue(ELF::NT_LLVM_LINKER_OPTIONS, 4); // type
----------------
Nit: this comment needs a full stop.


Repository:
  rL LLVM

https://reviews.llvm.org/D40849





More information about the llvm-commits mailing list