llvm.org GIT mirror llvm / e06bfe8
[IR] Reserve/define the purpose for the "Linker Options" metadata flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172681 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 7 years ago
1 changed file(s) with 34 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
26092609 - A module with ``Objective-C Garbage Collection`` set to 0 cannot be
26102610 merged with a module with ``Objective-C GC Only`` set to 6.
2612 Automatic Linker Flags Module Flags Metadata
2613 --------------------------------------------
2615 Some targets support embedding flags to the linker inside individual object
2616 files. Typically this is used in conjunction with language extensions which
2617 allow source files to explicitly declare the libraries they depend on, and have
2618 these automatically be transmitted to the linker via object files.
2620 These flags are encoded in the IR using metadata in the module flags section,
2621 using the ``LinkerĀ Options`` key. The merge behavior for this flag is required
2622 to be ``AppendUnique``, and the value for the key is expected to be a metadata
2623 node which should be a list of other metadata nodes, each of which should be a
2624 list of metadata strings defining linker options.
2626 For example, the following metadata section specifies two separate sets of
2627 linker options, presumably to link against ``libz`` and the ``Cocoa``
2628 framework::
2630 !0 = metadata !{ i32 6, "Linker Options",
2631 metadata !{
2632 !metadata { metadata !"-lz" },
2633 !metadata { metadata !"-framework", metadata !"Cocoa" } } }
2634 !llvm.module.flags = !{ !0 }
2636 The metadata encoding as lists of lists of options, as opposed to a collapsed
2637 list of options, is chosen so that the IR encoding can use multiple option
2638 strings to specify e.g., a single library, while still having that specifier be
2639 preserved as an atomic element that can be recognized by a target specific
2640 assembly writer or object file emitter.
2642 Each individual option is required to be either a valid option for the target's
2643 linker, or an option that is reserved by the target specific assembly writer or
2644 object file emitter. No other aspect of these options is defined by the IR.
26122646 Intrinsic Global Variables
26132647 ==========================