[PATCH] [mc-coff] Forward Linker Option flags into the .drectve section

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Apr 24 15:58:32 PDT 2013


> +
> +  // 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



More information about the llvm-commits mailing list