summaryrefslogtreecommitdiff
path: root/docs/ProgrammersManual.html
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-03-07 15:45:40 +0000
committerDuncan Sands <baldrick@free.fr>2009-03-07 15:45:40 +0000
commit667d4b8de6dea70195ff12ef39a4deebffa2f5c7 (patch)
tree7c3eab01e7683698c4818410c678d6af0ebfa56b /docs/ProgrammersManual.html
parent0dd2a6a89f49438b239638ab147ac5746d6c32c3 (diff)
downloadllvm-667d4b8de6dea70195ff12ef39a4deebffa2f5c7.tar.gz
llvm-667d4b8de6dea70195ff12ef39a4deebffa2f5c7.tar.bz2
llvm-667d4b8de6dea70195ff12ef39a4deebffa2f5c7.tar.xz
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions, except that they indicate that the global will only be overridden by an *equivalent* global. In C, a function with weak linkage can be overridden by a function which behaves completely differently. This means that IP passes have to skip weak functions, since any deductions made from the function definition might be wrong, since the definition could be replaced by something completely different at link time. This is not allowed in C++, thanks to the ODR (One-Definition-Rule): if a function is replaced by another at link-time, then the new function must be the same as the original function. If a language knows that a function or other global can only be overridden by an equivalent global, it can give it the weak_odr linkage type, and the optimizers will understand that it is alright to make deductions based on the function body. The code generators on the other hand map weak and weak_odr linkage to the same thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/ProgrammersManual.html')
-rw-r--r--docs/ProgrammersManual.html11
1 files changed, 6 insertions, 5 deletions
diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html
index 289a569024..cf46a97e68 100644
--- a/docs/ProgrammersManual.html
+++ b/docs/ProgrammersManual.html
@@ -3322,11 +3322,12 @@ never change at runtime).</p>
<p>Create a new global variable of the specified type. If
<tt>isConstant</tt> is true then the global variable will be marked as
unchanging for the program. The Linkage parameter specifies the type of
- linkage (internal, external, weak, linkonce, appending) for the variable. If
- the linkage is InternalLinkage, WeakLinkage, or LinkOnceLinkage,&nbsp; then
- the resultant global variable will have internal linkage. AppendingLinkage
- concatenates together all instances (in different translation units) of the
- variable into a single variable but is only applicable to arrays. &nbsp;See
+ linkage (internal, external, weak, linkonce, appending) for the variable.
+ If the linkage is InternalLinkage, WeakAnyLinkage, WeakODRLinkage,
+ LinkOnceAnyLinkage or LinkOnceODRLinkage,&nbsp; then the resultant
+ global variable will have internal linkage. AppendingLinkage concatenates
+ together all instances (in different translation units) of the variable
+ into a single variable but is only applicable to arrays. &nbsp;See
the <a href="LangRef.html#modulestructure">LLVM Language Reference</a> for
further details on linkage types. Optionally an initializer, a name, and the
module to put the variable into may be specified for the global variable as