summaryrefslogtreecommitdiffstats
path: root/llvm/docs
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-03-17 22:17:24 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2017-03-17 22:17:24 +0000
commit51c962f72e9569d54dc9c853abf99e2c34fc41cf (patch)
treed0dd2501c4b1c20925959248743eb309e431d5ae /llvm/docs
parent46ddab38102b79a8e477a29e68e9441313bc1f86 (diff)
downloadbcm5719-llvm-51c962f72e9569d54dc9c853abf99e2c34fc41cf.tar.gz
bcm5719-llvm-51c962f72e9569d54dc9c853abf99e2c34fc41cf.zip
Add !associated metadata.
This is an ELF-specific thing that adds SHF_LINK_ORDER to the global's section pointing to the metadata argument's section. The effect of that is a reverse dependency between sections for the linker GC. !associated does not change the behavior of global-dce. The global may also need to be added to llvm.compiler.used. Since SHF_LINK_ORDER is per-section, !associated effectively enables fdata-sections for the affected globals, the same as comdats do. Differential Revision: https://reviews.llvm.org/D29104 llvm-svn: 298157
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/LangRef.rst25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index c5771ad5248..d68241f1ab0 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -5106,6 +5106,31 @@ Examples:
See :doc:`TypeMetadata`.
+'``associated``' Metadata
+^^^^^^^^^^^^^^^^^^^
+
+The ``associated`` metadata may be attached to a global object
+declaration with a single argument that references another global object.
+
+This metadata prevents discarding of the global object in linker GC
+unless the referenced object is also discarded. The linker support for
+this feature is spotty. For best compatibility, globals carrying this
+metadata may also:
+
+- Be in a comdat with the referenced global.
+- Be in @llvm.compiler.used.
+- Have an explicit section with a name which is a valid C identifier.
+
+It does not have any effect on non-ELF targets.
+
+Example:
+
+.. code-block:: llvm
+ $a = comdat any
+ @a = global i32 1, comdat $a
+ @b = internal global i32 2, comdat $a, section "abc", !associated !0
+ !0 = !{i32* @a}
+
Module Flags Metadata
=====================
OpenPOWER on IntegriCloud