From 26d054d903488d956c23a17d78b6bc8cbd9553cb Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 5 Aug 2009 05:21:07 +0000 Subject: Clarify common linkage and the requirements on it. Enforce them in the verifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78160 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/LangRef.html b/docs/LangRef.html index 33fc7d4ff6..52ec97888d 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -552,19 +552,22 @@ define i32 @main() { ; i32()* linkonce globals are allowed to be discarded. +
weak:
+
"weak" linkage has the same merging semantics as + linkonce linkage, except that unreferenced globals with + weak linkage may not be discarded. This is used for globals that + are declared "weak" in C source code.
+
common:
-
"common" linkage is exactly the same as linkonce - linkage, except that unreferenced common globals may not be - discarded. This is used for globals that may be emitted in multiple - translation units, but that are not guaranteed to be emitted into every - translation unit that uses them. One example of this is tentative - definitions in C, such as "int X;" at global scope.
+
"common" linkage is most similar to "weak" linkage, but + they are used for tentative definitions in C, such as "int X;" at + global scope. + Symbols with "common" linkage are merged in the same way as + weak symbols, and they may not be deleted if unreferenced. + Further, common symbols may not have an explicit section, and + must have a zero initializer. Functions and aliases may not have common + linkage.
-
weak:
-
"weak" linkage is the same as common linkage, except - that some targets may choose to emit different assembly sequences for them - for target-dependent reasons. This is used for globals that are declared - "weak" in C source code.
appending:
"appending" linkage may only be applied to global variables of -- cgit v1.2.3