This is modelled on the Mach-O linker options implementation and should
support a Clang implementation of #pragma comment(lib/linker).
Details
Diff Detail
Event Timeline
+
+ // Emit the linker options if present.
+ if (LinkerOptions) {
Please use an early return
if (!LinkerOptions)
return;
+ const MCSection *Sec = getDrectveSection();
+ Streamer.SwitchSection(Sec);
+ for (unsigned i = 0, e = LinkerOptions->getNumOperands(); i != e; ++i) {
+ MDNode *MDOptions = cast<MDNode>(LinkerOptions->getOperand(i));
+ for (unsigned ii = 0, ie = MDOptions->getNumOperands(); ii != ie; ++ii) {
+ MDString *MDOption = cast<MDString>(MDOptions->getOperand(ii));
+ Streamer.EmitBytes(" ");
+ Streamer.EmitBytes(MDOption->getString());
Is the format documented somewhere we could link to?
Index: test/MC/COFF/linker-options.ll
- /dev/null
+++ test/MC/COFF/linker-options.ll
@@ -0,0 +1,28 @@
+; RUN: llc -O0 -mtriple=i386-pc-win32 -filetype=obj -o - %s | llvm-readobj -s -sd | FileCheck %s
+
Please test the output of the assembly file. No need to use -filetype=obj.
Cheers,
Rafael