aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-01-17 00:16:27 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-01-17 00:16:27 +0000
commite06bfe8d90aba9b6adf00ccc20a0144e90938b00 (patch)
tree4885f799d8bc8b081975899d0ac269c4d9ff6188 /docs
parentb0ec16b3a4452b26d8d48834aa0a7fad64d4e68e (diff)
downloadexternal_llvm-e06bfe8d90aba9b6adf00ccc20a0144e90938b00.zip
external_llvm-e06bfe8d90aba9b6adf00ccc20a0144e90938b00.tar.gz
external_llvm-e06bfe8d90aba9b6adf00ccc20a0144e90938b00.tar.bz2
[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
Diffstat (limited to 'docs')
-rw-r--r--docs/LangRef.rst34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst
index d6cdbc4..6706f34 100644
--- a/docs/LangRef.rst
+++ b/docs/LangRef.rst
@@ -2610,6 +2610,40 @@ Some important flag interactions:
- A module with ``Objective-C Garbage Collection`` set to 0 cannot be
merged with a module with ``Objective-C GC Only`` set to 6.
+Automatic Linker Flags Module Flags Metadata
+--------------------------------------------
+
+Some targets support embedding flags to the linker inside individual object
+files. Typically this is used in conjunction with language extensions which
+allow source files to explicitly declare the libraries they depend on, and have
+these automatically be transmitted to the linker via object files.
+
+These flags are encoded in the IR using metadata in the module flags section,
+using the ``Linker Options`` key. The merge behavior for this flag is required
+to be ``AppendUnique``, and the value for the key is expected to be a metadata
+node which should be a list of other metadata nodes, each of which should be a
+list of metadata strings defining linker options.
+
+For example, the following metadata section specifies two separate sets of
+linker options, presumably to link against ``libz`` and the ``Cocoa``
+framework::
+
+ !0 = metadata !{ i32 6, "Linker Options",
+ metadata !{
+ !metadata { metadata !"-lz" },
+ !metadata { metadata !"-framework", metadata !"Cocoa" } } }
+ !llvm.module.flags = !{ !0 }
+
+The metadata encoding as lists of lists of options, as opposed to a collapsed
+list of options, is chosen so that the IR encoding can use multiple option
+strings to specify e.g., a single library, while still having that specifier be
+preserved as an atomic element that can be recognized by a target specific
+assembly writer or object file emitter.
+
+Each individual option is required to be either a valid option for the target's
+linker, or an option that is reserved by the target specific assembly writer or
+object file emitter. No other aspect of these options is defined by the IR.
+
Intrinsic Global Variables
==========================