Search code examples
llvmllvm-ircoff

LLVM: add linker directives to LLVM IR


How can I add linker directives found in a COFF (MSVC object file) with LLVM using LLVM IR? Or is there another tool that can add these directives?


Solution

  • LLVM 5.0

    !llvm.linker.options = !{ !0 }
    
    !0 = {!"/DEFAULTLIB:flang.lib", !"/DEFAULTLIB:flangrti.lib", !"/DEFAULTLIB:ompstub.lib"}
    

    LLVM 4.0

    !llvm.module.flags = {!0}
    
    !0 = !{i32 6, !"Linker Options", !1}
    !1 = !{!2, !3}
    !2 = !{!"/DEFAULTLIB:libcmtd.lib"}
    !3 = !{!"/DEFAULTLIB:oldnames.lib"}