[llvm-commits] [llvm] r66339 - in /llvm/trunk: docs/ include/llvm-c/ include/llvm/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/JIT/ lib/Linker/ lib/Target/ lib/Target/ARM/ lib/Target/ARM/AsmPrinter/ lib/Target/Alpha/AsmPrinter/ lib/Target/CellSPU/AsmPrinter/ lib/Target/CppBackend/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/AsmPrinter/ lib/Target/Sparc/AsmPrinter/ lib/Target/X86/ lib/Target/X86/AsmPrinte...
Duncan Sands
baldrick at free.fr
Sat Mar 7 07:45:45 PST 2009
Author: baldrick
Date: Sat Mar 7 09:45:40 2009
New Revision: 66339
URL: http://llvm.org/viewvc/llvm-project?rev=66339&view=rev
Log:
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.
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/docs/ProgrammersManual.html
llvm/trunk/include/llvm-c/Core.h
llvm/trunk/include/llvm/GlobalValue.h
llvm/trunk/lib/Analysis/DebugInfo.cpp
llvm/trunk/lib/AsmParser/LLLexer.cpp
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLToken.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
llvm/trunk/lib/CodeGen/ELFWriter.cpp
llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
llvm/trunk/lib/CodeGen/MachOWriter.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/trunk/lib/CodeGen/ShadowStackGC.cpp
llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
llvm/trunk/lib/Linker/LinkModules.cpp
llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp
llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86Subtarget.cpp
llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp
llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp
llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp
llvm/trunk/lib/Transforms/Utils/InlineCost.cpp
llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/utils/emacs/llvm-mode.el
llvm/trunk/utils/llvm.grm
llvm/trunk/utils/vim/llvm.vim
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Sat Mar 7 09:45:40 2009
@@ -545,11 +545,26 @@
</dd>
<dt><tt><b><a name="linkage_externweak">extern_weak</a></b></tt>: </dt>
+
<dd>The semantics of this linkage follow the ELF object file model: the
symbol is weak until linked, if not linked, the symbol becomes null instead
of being an undefined reference.
</dd>
+ <dt><tt><b><a name="linkage_linkonce">linkonce_odr</a></b></tt>: </dt>
+ <dt><tt><b><a name="linkage_common">common_odr</a></b></tt>: </dt>
+ <dt><tt><b><a name="linkage_weak">weak_odr</a></b></tt>: </dt>
+ <dt><tt><b><a name="linkage_externweak">extern_weak_odr</a></b></tt>: </dt>
+ <dd>Some languages allow inequivalent globals to be merged, such as two
+ functions with different semantics. Other languages, such as <tt>C++</tt>,
+ ensure that only equivalent globals are ever merged (the "one definition
+ rule" - <tt>odr</tt>). Such languages can use the <tt>linkonce_odr</tt>,
+ <tt>common_odr</tt>, <tt>weak_odr</tt> and <tt>extern_weak_odr</tt> linkage
+ types to indicate that the global will only be merged with equivalent
+ globals. These linkage types are otherwise the same as their
+ non-<tt>odr</tt> versions.
+ </dd>
+
<dt><tt><b><a name="linkage_external">externally visible</a></b></tt>:</dt>
<dd>If none of the above identifiers are used, the global is externally
@@ -592,9 +607,9 @@
outside of the current module.</p>
<p>It is illegal for a function <i>declaration</i>
to have any linkage type other than "externally visible", <tt>dllimport</tt>,
-or <tt>extern_weak</tt>.</p>
-<p>Aliases can have only <tt>external</tt>, <tt>internal</tt> and <tt>weak</tt>
-linkages.</p>
+<tt>extern_weak</tt> or <tt>extern_weak_odr</tt>.</p>
+<p>Aliases can have only <tt>external</tt>, <tt>internal</tt>, <tt>weak</tt>
+or <tt>weak_odr</tt> linkages.</p>
</div>
<!-- ======================================================================= -->
Modified: llvm/trunk/docs/ProgrammersManual.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/docs/ProgrammersManual.html (original)
+++ llvm/trunk/docs/ProgrammersManual.html Sat Mar 7 09:45:40 2009
@@ -3322,11 +3322,12 @@
<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, 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. See
+ linkage (internal, external, weak, linkonce, appending) for the variable.
+ If the linkage is InternalLinkage, WeakAnyLinkage, WeakODRLinkage,
+ LinkOnceAnyLinkage or LinkOnceODRLinkage, 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. 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
Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Sat Mar 7 09:45:40 2009
@@ -115,16 +115,26 @@
typedef enum {
LLVMExternalLinkage, /**< Externally visible function */
- LLVMLinkOnceLinkage, /**< Keep one copy of function when linking (inline)*/
- LLVMWeakLinkage, /**< Keep one copy of function when linking (weak) */
+ LLVMLinkOnceAnyLinkage, /**< Keep one copy of function when linking (inline)*/
+ LLVMLinkOnceODRLinkage, /**< Same, but only replaced by something
+ equivalent. */
+ LLVMWeakAnyLinkage, /**< Keep one copy of function when linking (weak) */
+ LLVMWeakODRLinkage, /**< Same, but only replaced by something
+ equivalent. */
LLVMAppendingLinkage, /**< Special purpose, only applies to global arrays */
LLVMInternalLinkage, /**< Rename collisions when linking (static
functions) */
+ LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */
LLVMDLLImportLinkage, /**< Function to be imported from DLL */
LLVMDLLExportLinkage, /**< Function to be accessible from DLL */
- LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
- LLVMGhostLinkage /**< Stand-in functions for streaming fns from
+ LLVMExternalWeakAnyLinkage,/**< ExternalWeak linkage description */
+ LLVMExternalWeakODRLinkage,/**< Same, but only replaced by something
+ equivalent. */
+ LLVMGhostLinkage, /**< Stand-in functions for streaming fns from
bitcode */
+ LLVMCommonAnyLinkage, /**< Tentative definitions */
+ LLVMCommonODRLinkage /**< Same, but only replaced by something
+ equivalent. */
} LLVMLinkage;
typedef enum {
Modified: llvm/trunk/include/llvm/GlobalValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/include/llvm/GlobalValue.h (original)
+++ llvm/trunk/include/llvm/GlobalValue.h Sat Mar 7 09:45:40 2009
@@ -31,16 +31,20 @@
/// @brief An enumeration for the kinds of linkage for global values.
enum LinkageTypes {
ExternalLinkage = 0,///< Externally visible function
- LinkOnceLinkage, ///< Keep one copy of function when linking (inline)
- WeakLinkage, ///< Keep one copy of named function when linking (weak)
+ LinkOnceAnyLinkage, ///< Keep one copy of function when linking (inline)
+ LinkOnceODRLinkage, ///< Same, but only replaced by something equivalent.
+ WeakAnyLinkage, ///< Keep one copy of named function when linking (weak)
+ WeakODRLinkage, ///< Same, but only replaced by something equivalent.
AppendingLinkage, ///< Special purpose, only applies to global arrays
InternalLinkage, ///< Rename collisions when linking (static functions)
PrivateLinkage, ///< Like Internal, but omit from symbol table
DLLImportLinkage, ///< Function to be imported from DLL
DLLExportLinkage, ///< Function to be accessible from DLL
- ExternalWeakLinkage,///< ExternalWeak linkage description
+ ExternalWeakAnyLinkage,///< ExternalWeak linkage description
+ ExternalWeakODRLinkage,///< Same, but only replaced by something equivalent.
GhostLinkage, ///< Stand-in functions for streaming fns from BC files
- CommonLinkage ///< Tentative definitions
+ CommonAnyLinkage, ///< Tentative definitions
+ CommonODRLinkage ///< Same, but only replaced by something equivalent.
};
/// @brief An enumeration for the kinds of visibility of global values.
@@ -99,31 +103,67 @@
return reinterpret_cast<const PointerType*>(User::getType());
}
- bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
- bool hasLinkOnceLinkage() const { return Linkage == LinkOnceLinkage; }
- bool hasWeakLinkage() const { return Linkage == WeakLinkage; }
- bool hasCommonLinkage() const { return Linkage == CommonLinkage; }
- bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; }
- bool hasInternalLinkage() const { return Linkage == InternalLinkage; }
- bool hasPrivateLinkage() const { return Linkage == PrivateLinkage; }
- bool hasLocalLinkage() const {
+ static LinkageTypes getLinkOnceLinkage(bool ODR) {
+ return ODR ? LinkOnceODRLinkage : LinkOnceAnyLinkage;
+ }
+ static LinkageTypes getWeakLinkage(bool ODR) {
+ return ODR ? WeakODRLinkage : WeakAnyLinkage;
+ }
+ static LinkageTypes getCommonLinkage(bool ODR) {
+ return ODR ? CommonODRLinkage : CommonAnyLinkage;
+ }
+ static LinkageTypes getExternalWeakLinkage(bool ODR) {
+ return ODR ? ExternalWeakODRLinkage : ExternalWeakAnyLinkage;
+ }
+
+ bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
+ bool hasLinkOnceLinkage() const {
+ return Linkage == LinkOnceAnyLinkage || Linkage == LinkOnceODRLinkage;
+ }
+ bool hasWeakLinkage() const {
+ return Linkage == WeakAnyLinkage || Linkage == WeakODRLinkage;
+ }
+ bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; }
+ bool hasInternalLinkage() const { return Linkage == InternalLinkage; }
+ bool hasPrivateLinkage() const { return Linkage == PrivateLinkage; }
+ bool hasLocalLinkage() const {
return Linkage == InternalLinkage || Linkage == PrivateLinkage;
}
- bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; }
- bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; }
- bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; }
- bool hasGhostLinkage() const { return Linkage == GhostLinkage; }
+ bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; }
+ bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; }
+ bool hasExternalWeakLinkage() const {
+ return Linkage == ExternalWeakAnyLinkage ||
+ Linkage == ExternalWeakODRLinkage;
+ }
+ bool hasGhostLinkage() const { return Linkage == GhostLinkage; }
+ bool hasCommonLinkage() const {
+ return Linkage == CommonAnyLinkage || Linkage == CommonODRLinkage;
+ }
+
void setLinkage(LinkageTypes LT) { Linkage = LT; }
LinkageTypes getLinkage() const { return Linkage; }
/// mayBeOverridden - Whether the definition of this global may be replaced
- /// at link time. For example, if a function has weak linkage then the code
- /// defining it may be replaced by different code.
+ /// by something non-equivalent at link time. For example, if a function has
+ /// weak linkage then the code defining it may be replaced by different code.
bool mayBeOverridden() const {
- return (Linkage == WeakLinkage ||
- Linkage == LinkOnceLinkage ||
- Linkage == CommonLinkage ||
- Linkage == ExternalWeakLinkage);
+ return (Linkage == WeakAnyLinkage ||
+ Linkage == LinkOnceAnyLinkage ||
+ Linkage == CommonAnyLinkage ||
+ Linkage == ExternalWeakAnyLinkage);
+ }
+
+ /// isWeakForLinker - Whether the definition of this global may be replaced at
+ /// link time, whether the replacement is equivalent to the original or not.
+ bool isWeakForLinker() const {
+ return (Linkage == WeakAnyLinkage ||
+ Linkage == WeakODRLinkage ||
+ Linkage == LinkOnceAnyLinkage ||
+ Linkage == LinkOnceODRLinkage ||
+ Linkage == CommonAnyLinkage ||
+ Linkage == CommonODRLinkage ||
+ Linkage == ExternalWeakAnyLinkage ||
+ Linkage == ExternalWeakODRLinkage);
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Sat Mar 7 09:45:40 2009
@@ -344,7 +344,7 @@
if (GV->hasInitializer())
return SubProgramAnchor = DIAnchor(GV);
- GV->setLinkage(GlobalValue::LinkOnceLinkage);
+ GV->setLinkage(GlobalValue::LinkOnceAnyLinkage);
GV->setSection("llvm.metadata");
GV->setConstant(true);
M.addTypeName("llvm.dbg.anchor.type", EltTy);
Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLLexer.cpp Sat Mar 7 09:45:40 2009
@@ -456,15 +456,19 @@
KEYWORD(private);
KEYWORD(internal);
KEYWORD(linkonce);
+ KEYWORD(linkonce_odr);
KEYWORD(weak);
+ KEYWORD(weak_odr);
KEYWORD(appending);
KEYWORD(dllimport);
KEYWORD(dllexport);
KEYWORD(common);
+ KEYWORD(common_odr);
KEYWORD(default);
KEYWORD(hidden);
KEYWORD(protected);
KEYWORD(extern_weak);
+ KEYWORD(extern_weak_odr);
KEYWORD(external);
KEYWORD(thread_local);
KEYWORD(zeroinitializer);
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Sat Mar 7 09:45:40 2009
@@ -116,12 +116,16 @@
case lltok::kw_private: // OptionalLinkage
case lltok::kw_internal: // OptionalLinkage
case lltok::kw_weak: // OptionalLinkage
+ case lltok::kw_weak_odr: // OptionalLinkage
case lltok::kw_linkonce: // OptionalLinkage
+ case lltok::kw_linkonce_odr: // OptionalLinkage
case lltok::kw_appending: // OptionalLinkage
case lltok::kw_dllexport: // OptionalLinkage
case lltok::kw_common: // OptionalLinkage
+ case lltok::kw_common_odr: // OptionalLinkage
case lltok::kw_dllimport: // OptionalLinkage
case lltok::kw_extern_weak: // OptionalLinkage
+ case lltok::kw_extern_weak_odr: // OptionalLinkage
case lltok::kw_external: { // OptionalLinkage
unsigned Linkage, Visibility;
if (ParseOptionalLinkage(Linkage) ||
@@ -377,7 +381,8 @@
return true;
if (Linkage != GlobalValue::ExternalLinkage &&
- Linkage != GlobalValue::WeakLinkage &&
+ Linkage != GlobalValue::WeakAnyLinkage &&
+ Linkage != GlobalValue::WeakODRLinkage &&
Linkage != GlobalValue::InternalLinkage &&
Linkage != GlobalValue::PrivateLinkage)
return Error(LinkageLoc, "invalid linkage type for alias");
@@ -461,7 +466,8 @@
// present.
Constant *Init = 0;
if (!HasLinkage || (Linkage != GlobalValue::DLLImportLinkage &&
- Linkage != GlobalValue::ExternalWeakLinkage &&
+ Linkage != GlobalValue::ExternalWeakAnyLinkage &&
+ Linkage != GlobalValue::ExternalWeakODRLinkage &&
Linkage != GlobalValue::ExternalLinkage)) {
if (ParseGlobalValue(Ty, Init))
return true;
@@ -576,10 +582,10 @@
return 0;
}
- FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, Name, M);
+ FwdVal = Function::Create(FT, GlobalValue::ExternalWeakAnyLinkage, Name, M);
} else {
FwdVal = new GlobalVariable(PTy->getElementType(), false,
- GlobalValue::ExternalWeakLinkage, 0, Name, M);
+ GlobalValue::ExternalWeakAnyLinkage, 0, Name, M);
}
ForwardRefVals[Name] = std::make_pair(FwdVal, Loc);
@@ -620,10 +626,10 @@
Error(Loc, "function may not return opaque type");
return 0;
}
- FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, "", M);
+ FwdVal = Function::Create(FT, GlobalValue::ExternalWeakAnyLinkage, "", M);
} else {
FwdVal = new GlobalVariable(PTy->getElementType(), false,
- GlobalValue::ExternalWeakLinkage, 0, "", M);
+ GlobalValue::ExternalWeakAnyLinkage, 0, "", M);
}
ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc);
@@ -746,27 +752,36 @@
/// ::= 'private'
/// ::= 'internal'
/// ::= 'weak'
+/// ::= 'weak_odr'
/// ::= 'linkonce'
+/// ::= 'linkonce_odr'
/// ::= 'appending'
/// ::= 'dllexport'
/// ::= 'common'
+/// ::= 'common_odr'
/// ::= 'dllimport'
/// ::= 'extern_weak'
+/// ::= 'extern_weak_odr'
/// ::= 'external'
bool LLParser::ParseOptionalLinkage(unsigned &Res, bool &HasLinkage) {
HasLinkage = false;
switch (Lex.getKind()) {
- default: Res = GlobalValue::ExternalLinkage; return false;
- case lltok::kw_private: Res = GlobalValue::PrivateLinkage; break;
- case lltok::kw_internal: Res = GlobalValue::InternalLinkage; break;
- case lltok::kw_weak: Res = GlobalValue::WeakLinkage; break;
- case lltok::kw_linkonce: Res = GlobalValue::LinkOnceLinkage; break;
- case lltok::kw_appending: Res = GlobalValue::AppendingLinkage; break;
- case lltok::kw_dllexport: Res = GlobalValue::DLLExportLinkage; break;
- case lltok::kw_common: Res = GlobalValue::CommonLinkage; break;
- case lltok::kw_dllimport: Res = GlobalValue::DLLImportLinkage; break;
- case lltok::kw_extern_weak: Res = GlobalValue::ExternalWeakLinkage; break;
- case lltok::kw_external: Res = GlobalValue::ExternalLinkage; break;
+ default: Res = GlobalValue::ExternalLinkage; return false;
+ case lltok::kw_private: Res = GlobalValue::PrivateLinkage; break;
+ case lltok::kw_internal: Res = GlobalValue::InternalLinkage; break;
+ case lltok::kw_weak: Res = GlobalValue::WeakAnyLinkage; break;
+ case lltok::kw_weak_odr: Res = GlobalValue::WeakODRLinkage; break;
+ case lltok::kw_linkonce: Res = GlobalValue::LinkOnceAnyLinkage; break;
+ case lltok::kw_linkonce_odr: Res = GlobalValue::LinkOnceODRLinkage; break;
+ case lltok::kw_appending: Res = GlobalValue::AppendingLinkage; break;
+ case lltok::kw_dllexport: Res = GlobalValue::DLLExportLinkage; break;
+ case lltok::kw_common: Res = GlobalValue::CommonAnyLinkage; break;
+ case lltok::kw_common_odr: Res = GlobalValue::CommonODRLinkage; break;
+ case lltok::kw_dllimport: Res = GlobalValue::DLLImportLinkage; break;
+ case lltok::kw_extern_weak: Res = GlobalValue::ExternalWeakAnyLinkage; break;
+ case lltok::kw_extern_weak_odr:
+ Res = GlobalValue::ExternalWeakODRLinkage; break;
+ case lltok::kw_external: Res = GlobalValue::ExternalLinkage; break;
}
Lex.Lex();
HasLinkage = true;
@@ -2074,21 +2089,25 @@
case GlobalValue::ExternalLinkage:
break; // always ok.
case GlobalValue::DLLImportLinkage:
- case GlobalValue::ExternalWeakLinkage:
+ case GlobalValue::ExternalWeakAnyLinkage:
+ case GlobalValue::ExternalWeakODRLinkage:
if (isDefine)
return Error(LinkageLoc, "invalid linkage for function definition");
break;
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
case GlobalValue::DLLExportLinkage:
if (!isDefine)
return Error(LinkageLoc, "invalid linkage for function declaration");
break;
case GlobalValue::AppendingLinkage:
case GlobalValue::GhostLinkage:
- case GlobalValue::CommonLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
return Error(LinkageLoc, "invalid function linkage type");
}
Modified: llvm/trunk/lib/AsmParser/LLToken.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLToken.h?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLToken.h (original)
+++ llvm/trunk/lib/AsmParser/LLToken.h Sat Mar 7 09:45:40 2009
@@ -36,9 +36,10 @@
kw_declare, kw_define,
kw_global, kw_constant,
- kw_private, kw_internal, kw_linkonce, kw_weak, kw_appending, kw_dllimport,
- kw_dllexport, kw_common, kw_default, kw_hidden, kw_protected,
- kw_extern_weak,
+ kw_private, kw_internal, kw_linkonce, kw_linkonce_odr, kw_weak, kw_weak_odr,
+ kw_appending, kw_dllimport, kw_dllexport, kw_common, kw_common_odr,
+ kw_default, kw_hidden, kw_protected,
+ kw_extern_weak, kw_extern_weak_odr,
kw_external, kw_thread_local,
kw_zeroinitializer,
kw_undef, kw_null,
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sat Mar 7 09:45:40 2009
@@ -59,15 +59,19 @@
switch (Val) {
default: // Map unknown/new linkages to external
case 0: return GlobalValue::ExternalLinkage;
- case 1: return GlobalValue::WeakLinkage;
+ case 1: return GlobalValue::WeakAnyLinkage;
case 2: return GlobalValue::AppendingLinkage;
case 3: return GlobalValue::InternalLinkage;
- case 4: return GlobalValue::LinkOnceLinkage;
+ case 4: return GlobalValue::LinkOnceAnyLinkage;
case 5: return GlobalValue::DLLImportLinkage;
case 6: return GlobalValue::DLLExportLinkage;
- case 7: return GlobalValue::ExternalWeakLinkage;
- case 8: return GlobalValue::CommonLinkage;
+ case 7: return GlobalValue::ExternalWeakAnyLinkage;
+ case 8: return GlobalValue::CommonAnyLinkage;
case 9: return GlobalValue::PrivateLinkage;
+ case 10: return GlobalValue::WeakODRLinkage;
+ case 11: return GlobalValue::LinkOnceODRLinkage;
+ case 12: return GlobalValue::ExternalWeakODRLinkage;
+ case 13: return GlobalValue::CommonODRLinkage;
}
}
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Sat Mar 7 09:45:40 2009
@@ -276,15 +276,19 @@
default: assert(0 && "Invalid linkage!");
case GlobalValue::GhostLinkage: // Map ghost linkage onto external.
case GlobalValue::ExternalLinkage: return 0;
- case GlobalValue::WeakLinkage: return 1;
+ case GlobalValue::WeakAnyLinkage: return 1;
case GlobalValue::AppendingLinkage: return 2;
case GlobalValue::InternalLinkage: return 3;
- case GlobalValue::LinkOnceLinkage: return 4;
+ case GlobalValue::LinkOnceAnyLinkage: return 4;
case GlobalValue::DLLImportLinkage: return 5;
case GlobalValue::DLLExportLinkage: return 6;
- case GlobalValue::ExternalWeakLinkage: return 7;
- case GlobalValue::CommonLinkage: return 8;
+ case GlobalValue::ExternalWeakAnyLinkage: return 7;
+ case GlobalValue::CommonAnyLinkage: return 8;
case GlobalValue::PrivateLinkage: return 9;
+ case GlobalValue::WeakODRLinkage: return 10;
+ case GlobalValue::LinkOnceODRLinkage: return 11;
+ case GlobalValue::ExternalWeakODRLinkage: return 12;
+ case GlobalValue::CommonODRLinkage: return 13;
}
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Sat Mar 7 09:45:40 2009
@@ -3135,9 +3135,8 @@
GlobalVariable *GV = getGlobalVariable(V);
if (!GV)
return false;
-
- if (GV->getLinkage() != GlobalValue::InternalLinkage
- && GV->getLinkage() != GlobalValue::LinkOnceLinkage)
+
+ if (!GV->hasInternalLinkage () && !GV->hasLinkOnceLinkage())
return false;
DIDescriptor DI(GV);
@@ -3449,8 +3448,10 @@
}
// If corresponding function is weak definition, this should be too.
- if ((linkage == Function::WeakLinkage ||
- linkage == Function::LinkOnceLinkage) &&
+ if ((linkage == Function::WeakAnyLinkage ||
+ linkage == Function::WeakODRLinkage ||
+ linkage == Function::LinkOnceAnyLinkage ||
+ linkage == Function::LinkOnceODRLinkage) &&
TAI->getWeakDefDirective())
O << TAI->getWeakDefDirective() << EHFrameInfo.FnName << "\n";
@@ -3461,8 +3462,10 @@
// unwind info is to be available for non-EH uses.
if (!EHFrameInfo.hasCalls &&
!UnwindTablesMandatory &&
- ((linkage != Function::WeakLinkage &&
- linkage != Function::LinkOnceLinkage) ||
+ ((linkage != Function::WeakAnyLinkage &&
+ linkage != Function::WeakODRLinkage &&
+ linkage != Function::LinkOnceAnyLinkage &&
+ linkage != Function::LinkOnceODRLinkage) ||
!TAI->getWeakDefDirective() ||
TAI->getSupportsWeakOmittedEHFrame()))
{
Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Sat Mar 7 09:45:40 2009
@@ -174,8 +174,10 @@
case GlobalValue::ExternalLinkage:
FnSym.SetBind(ELFWriter::ELFSym::STB_GLOBAL);
break;
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
FnSym.SetBind(ELFWriter::ELFSym::STB_WEAK);
break;
case GlobalValue::PrivateLinkage:
Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Sat Mar 7 09:45:40 2009
@@ -316,7 +316,7 @@
Name[i] = '_';
Module* M = F->getParent();
F = cast<Function>(M->getOrInsertFunction(Name, FT));
- F->setLinkage(GlobalValue::WeakLinkage);
+ F->setLinkage(GlobalValue::WeakAnyLinkage);
// If we haven't defined the impl function yet, do so now
if (F->isDeclaration()) {
@@ -490,7 +490,7 @@
Name[i] = '_';
Module* M = F->getParent();
F = cast<Function>(M->getOrInsertFunction(Name, FT));
- F->setLinkage(GlobalValue::WeakLinkage);
+ F->setLinkage(GlobalValue::WeakAnyLinkage);
// If we haven't defined the impl function yet, do so now
if (F->isDeclaration()) {
Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Sat Mar 7 09:45:40 2009
@@ -956,9 +956,12 @@
default:
assert(0 && "Unexpected linkage type!");
break;
- case GlobalValue::WeakLinkage:
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::CommonLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
assert(!isa<Function>(gv) && "Unexpected linkage type for Function!");
case GlobalValue::ExternalLinkage:
GVName = TAI->getGlobalPrefix() + name;
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sat Mar 7 09:45:40 2009
@@ -728,7 +728,7 @@
if (getTargetMachine().getRelocationModel() == Reloc::DynamicNoPIC &&
GA &&
!GA->getGlobal()->isDeclaration() &&
- !GA->getGlobal()->mayBeOverridden())
+ !GA->getGlobal()->isWeakForLinker())
return true;
// Otherwise assume nothing is safe.
Modified: llvm/trunk/lib/CodeGen/ShadowStackGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGC.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ShadowStackGC.cpp (original)
+++ llvm/trunk/lib/CodeGen/ShadowStackGC.cpp Sat Mar 7 09:45:40 2009
@@ -293,12 +293,12 @@
// If the root chain does not exist, insert a new one with linkonce
// linkage!
Head = new GlobalVariable(StackEntryPtrTy, false,
- GlobalValue::LinkOnceLinkage,
+ GlobalValue::LinkOnceAnyLinkage,
Constant::getNullValue(StackEntryPtrTy),
"llvm_gc_root_chain", &M);
} else if (Head->hasExternalLinkage() && Head->isDeclaration()) {
Head->setInitializer(Constant::getNullValue(StackEntryPtrTy));
- Head->setLinkage(GlobalValue::LinkOnceLinkage);
+ Head->setLinkage(GlobalValue::LinkOnceAnyLinkage);
}
return true;
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Sat Mar 7 09:45:40 2009
@@ -580,8 +580,8 @@
}
if (F->isDeclaration()) {
- bool AbortOnFailure = !areDlsymStubsEnabled() &&
- F->getLinkage() != GlobalValue::ExternalWeakLinkage;
+ bool AbortOnFailure =
+ !areDlsymStubsEnabled() && !F->hasExternalWeakLinkage();
void *Addr = getPointerToNamedFunction(F->getName(), AbortOnFailure);
addGlobalMapping(F, Addr);
return Addr;
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Sat Mar 7 09:45:40 2009
@@ -460,7 +460,7 @@
LT = Src->getLinkage();
}
} else if (Dest->hasExternalWeakLinkage()) {
- //If the Dest is weak, use the source linkage
+ // If the Dest is weak, use the source linkage.
LinkFromSrc = true;
LT = Src->getLinkage();
} else {
@@ -683,15 +683,22 @@
static GlobalValue::LinkageTypes
CalculateAliasLinkage(const GlobalValue *SGV, const GlobalValue *DGV) {
- if (SGV->hasExternalLinkage() || DGV->hasExternalLinkage())
+ GlobalValue::LinkageTypes SL = SGV->getLinkage();
+ GlobalValue::LinkageTypes DL = DGV->getLinkage();
+ if (SL == GlobalValue::ExternalLinkage || DL == GlobalValue::ExternalLinkage)
return GlobalValue::ExternalLinkage;
- else if (SGV->hasWeakLinkage() || DGV->hasWeakLinkage())
- return GlobalValue::WeakLinkage;
- else if (SGV->hasInternalLinkage() && DGV->hasInternalLinkage())
+ else if (SL == GlobalValue::WeakAnyLinkage ||
+ DL == GlobalValue::WeakAnyLinkage)
+ return GlobalValue::WeakAnyLinkage;
+ else if (SL == GlobalValue::WeakODRLinkage ||
+ DL == GlobalValue::WeakODRLinkage)
+ return GlobalValue::WeakODRLinkage;
+ else if (SL == GlobalValue::InternalLinkage &&
+ DL == GlobalValue::InternalLinkage)
return GlobalValue::InternalLinkage;
else {
- assert (SGV->hasPrivateLinkage() && DGV->hasPrivateLinkage() &&
- "Unexpected linkage type");
+ assert (SL == GlobalValue::PrivateLinkage &&
+ DL == GlobalValue::PrivateLinkage && "Unexpected linkage type");
return GlobalValue::PrivateLinkage;
}
}
Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Sat Mar 7 09:45:40 2009
@@ -854,7 +854,7 @@
bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
if (GV->hasHiddenVisibility() && (!isDecl && !GV->hasCommonLinkage()))
return false;
- return RelocM != Reloc::Static && (isDecl || GV->mayBeOverridden());
+ return RelocM != Reloc::Static && (isDecl || GV->isWeakForLinker());
}
SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op,
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -208,8 +208,10 @@
SwitchToTextSection("\t.text", F);
O << "\t.globl\t" << CurrentFnName << "\n";
break;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
if (Subtarget->isTargetDarwin()) {
SwitchToTextSection(
".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F);
@@ -853,7 +855,7 @@
}
}
- if (GVar->hasLocalLinkage() || GVar->mayBeOverridden()) {
+ if (GVar->hasLocalLinkage() || GVar->isWeakForLinker()) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (isDarwin) {
@@ -899,9 +901,12 @@
SwitchToSection(TAI->SectionForGlobal(GVar));
switch (GVar->getLinkage()) {
- case GlobalValue::CommonLinkage:
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
if (isDarwin) {
O << "\t.globl " << name << "\n"
<< "\t.weak_definition " << name << "\n";
Modified: llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -163,8 +163,10 @@
case Function::ExternalLinkage:
O << "\t.globl " << CurrentFnName << "\n";
break;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
O << TAI->getWeakRefDirective() << CurrentFnName << "\n";
break;
}
@@ -231,9 +233,12 @@
// 2: Kind
switch (GVar->getLinkage()) {
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
- case GlobalValue::CommonLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
O << TAI->getWeakRefDirective() << name << '\n';
break;
case GlobalValue::AppendingLinkage:
Modified: llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -445,8 +445,10 @@
O << "\t.global\t" << CurrentFnName << "\n"
<< "\t.type\t" << CurrentFnName << ", @function\n";
break;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
O << "\t.global\t" << CurrentFnName << "\n";
O << "\t.weak_definition\t" << CurrentFnName << "\n";
break;
@@ -534,7 +536,7 @@
if (C->isNullValue() && /* FIXME: Verify correct */
!GVar->hasSection() &&
(GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
- GVar->mayBeOverridden())) {
+ GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasExternalLinkage()) {
@@ -555,9 +557,12 @@
switch (GVar->getLinkage()) {
// Should never be seen for the CellSPU platform...
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
- case GlobalValue::CommonLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
O << "\t.global " << name << '\n'
<< "\t.type " << name << ", @object\n"
<< "\t.weak " << name << '\n';
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Sat Mar 7 09:45:40 2009
@@ -294,10 +294,14 @@
Out << "GlobalValue::InternalLinkage"; break;
case GlobalValue::PrivateLinkage:
Out << "GlobalValue::PrivateLinkage"; break;
- case GlobalValue::LinkOnceLinkage:
- Out << "GlobalValue::LinkOnceLinkage "; break;
- case GlobalValue::WeakLinkage:
- Out << "GlobalValue::WeakLinkage"; break;
+ case GlobalValue::LinkOnceAnyLinkage:
+ Out << "GlobalValue::LinkOnceAnyLinkage "; break;
+ case GlobalValue::LinkOnceODRLinkage:
+ Out << "GlobalValue::LinkOnceODRLinkage "; break;
+ case GlobalValue::WeakAnyLinkage:
+ Out << "GlobalValue::WeakAnyLinkage"; break;
+ case GlobalValue::WeakODRLinkage:
+ Out << "GlobalValue::WeakODRLinkage"; break;
case GlobalValue::AppendingLinkage:
Out << "GlobalValue::AppendingLinkage"; break;
case GlobalValue::ExternalLinkage:
@@ -306,12 +310,16 @@
Out << "GlobalValue::DLLImportLinkage"; break;
case GlobalValue::DLLExportLinkage:
Out << "GlobalValue::DLLExportLinkage"; break;
- case GlobalValue::ExternalWeakLinkage:
- Out << "GlobalValue::ExternalWeakLinkage"; break;
+ case GlobalValue::ExternalWeakAnyLinkage:
+ Out << "GlobalValue::ExternalWeakAnyLinkage"; break;
+ case GlobalValue::ExternalWeakODRLinkage:
+ Out << "GlobalValue::ExternalWeakODRLinkage"; break;
case GlobalValue::GhostLinkage:
Out << "GlobalValue::GhostLinkage"; break;
- case GlobalValue::CommonLinkage:
- Out << "GlobalValue::CommonLinkage"; break;
+ case GlobalValue::CommonAnyLinkage:
+ Out << "GlobalValue::CommonAnyLinkage"; break;
+ case GlobalValue::CommonODRLinkage:
+ Out << "GlobalValue::CommonODRLinkage"; break;
}
}
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Sat Mar 7 09:45:40 2009
@@ -75,7 +75,7 @@
const Section*
DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
- bool isWeak = GV->mayBeOverridden();
+ bool isWeak = GV->isWeakForLinker();
bool isNonStatic = TM.getRelocationModel() != Reloc::Static;
switch (Kind) {
Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Sat Mar 7 09:45:40 2009
@@ -49,14 +49,16 @@
case Function::DLLExportLinkage:
case Function::ExternalLinkage:
return TextSection;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
std::string Name = UniqueSectionForGlobal(GV, Kind);
unsigned Flags = SectionFlagsForGlobal(GV, Name.c_str());
return getNamedSection(Name.c_str(), Flags);
}
} else if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) {
- if (GVar->mayBeOverridden()) {
+ if (GVar->isWeakForLinker()) {
std::string Name = UniqueSectionForGlobal(GVar, Kind);
unsigned Flags = SectionFlagsForGlobal(GVar, Name.c_str());
return getNamedSection(Name.c_str(), Flags);
Modified: llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/IA64/IA64AsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -278,7 +278,7 @@
if (C->isNullValue() && !GVar->hasSection()) {
if (!GVar->isThreadLocal() &&
- (GVar->hasLocalLinkage() || GVar->mayBeOverridden())) {
+ (GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasLocalLinkage()) {
@@ -296,9 +296,12 @@
}
switch (GVar->getLinkage()) {
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::CommonLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
// Nonnull linkonce -> weak
O << "\t.weak " << name << '\n';
break;
Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -504,7 +504,7 @@
if (C->isNullValue() && !GVar->hasSection()) {
if (!GVar->isThreadLocal() &&
- (GVar->hasLocalLinkage() || GVar->mayBeOverridden())) {
+ (GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasLocalLinkage())
@@ -519,9 +519,12 @@
}
}
switch (GVar->getLinkage()) {
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::CommonLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
// FIXME: Verify correct for weak.
// Nonnull linkonce -> weak
O << "\t.weak " << name << '\n';
Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Sat Mar 7 09:45:40 2009
@@ -85,7 +85,7 @@
SectionKind::Kind K = SectionKindForGlobal(GV);
const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
- if (GVA && (!GVA->mayBeOverridden()))
+ if (GVA && (!GVA->isWeakForLinker()))
switch (K) {
case SectionKind::SmallData:
return getSmallDataSection();
Modified: llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -388,7 +388,7 @@
// External or weakly linked global variables need non-lazily-resolved stubs
if (TM.getRelocationModel() != Reloc::Static) {
- if (GV->isDeclaration() || GV->mayBeOverridden()) {
+ if (GV->isDeclaration() || GV->isWeakForLinker()) {
if (GV->hasHiddenVisibility()) {
if (!GV->isDeclaration() && !GV->hasCommonLinkage())
O << Name;
@@ -592,8 +592,10 @@
O << "\t.global\t" << CurrentFnName << '\n'
<< "\t.type\t" << CurrentFnName << ", @function\n";
break;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
O << "\t.global\t" << CurrentFnName << '\n';
O << "\t.weak\t" << CurrentFnName << '\n';
break;
@@ -689,7 +691,7 @@
if (C->isNullValue() && /* FIXME: Verify correct */
!GVar->hasSection() &&
(GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
- GVar->mayBeOverridden())) {
+ GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasExternalLinkage()) {
@@ -709,9 +711,12 @@
}
switch (GVar->getLinkage()) {
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
- case GlobalValue::CommonLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
O << "\t.global " << name << '\n'
<< "\t.type " << name << ", @object\n"
<< "\t.weak " << name << '\n';
@@ -785,8 +790,10 @@
case Function::ExternalLinkage:
O << "\t.globl\t" << CurrentFnName << '\n';
break;
- case Function::WeakLinkage:
- case Function::LinkOnceLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
O << "\t.globl\t" << CurrentFnName << '\n';
O << "\t.weak_definition\t" << CurrentFnName << '\n';
break;
@@ -918,7 +925,7 @@
if (C->isNullValue() && /* FIXME: Verify correct */
!GVar->hasSection() &&
(GVar->hasLocalLinkage() || GVar->hasExternalLinkage() ||
- GVar->mayBeOverridden()) &&
+ GVar->isWeakForLinker()) &&
TAI->SectionKindForGlobal(GVar) != SectionKind::RODataMergeStr) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
@@ -950,9 +957,12 @@
}
switch (GVar->getLinkage()) {
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
- case GlobalValue::CommonLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
O << "\t.globl " << name << '\n'
<< "\t.weak_definition " << name << '\n';
break;
Modified: llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -260,7 +260,7 @@
if (C->isNullValue() && !GVar->hasSection()) {
if (!GVar->isThreadLocal() &&
- (GVar->hasLocalLinkage() || GVar->mayBeOverridden())) {
+ (GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (GVar->hasLocalLinkage())
@@ -276,9 +276,12 @@
}
switch (GVar->getLinkage()) {
- case GlobalValue::CommonLinkage:
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak.
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage: // FIXME: Verify correct for weak.
+ case GlobalValue::WeakODRLinkage: // FIXME: Verify correct for weak.
// Nonnull linkonce -> weak
O << "\t.weak " << name << '\n';
break;
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Sat Mar 7 09:45:40 2009
@@ -259,7 +259,7 @@
assert(0 && "Unexpected section kind!");
}
- if (GV->mayBeOverridden())
+ if (GV->isWeakForLinker())
Flags |= SectionFlags::Linkonce;
}
@@ -310,7 +310,7 @@
TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
- if (GV->mayBeOverridden()) {
+ if (GV->isWeakForLinker()) {
std::string Name = UniqueSectionForGlobal(GV, Kind);
unsigned Flags = SectionFlagsForGlobal(GV, Name.c_str());
return getNamedSection(Name.c_str(), Flags);
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -168,8 +168,10 @@
EmitAlignment(FnAlign, F);
O << "\t.globl\t" << CurrentFnName << '\n';
break;
- case Function::LinkOnceLinkage:
- case Function::WeakLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
EmitAlignment(FnAlign, F);
if (Subtarget->isTargetDarwin()) {
O << "\t.globl\t" << CurrentFnName << '\n';
@@ -198,8 +200,7 @@
O << CurrentFnName << ":\n";
// Add some workaround for linkonce linkage on Cygwin\MinGW
if (Subtarget->isTargetCygMing() &&
- (F->getLinkage() == Function::LinkOnceLinkage ||
- F->getLinkage() == Function::WeakLinkage))
+ (F->hasLinkOnceLinkage() || F->hasWeakLinkage()))
O << "Lllvm$workaround$fake$stub$" << CurrentFnName << ":\n";
}
@@ -386,7 +387,7 @@
if (shouldPrintStub(TM, Subtarget)) {
// Link-once, declaration, or Weakly-linked global variables need
// non-lazily-resolved stubs
- if (GV->isDeclaration() || GV->mayBeOverridden()) {
+ if (GV->isDeclaration() || GV->isWeakForLinker()) {
// Dynamically-resolved functions need a stub for the function.
if (isCallOp && isa<Function>(GV)) {
// Function stubs are no longer needed for Mac OS X 10.5 and up.
@@ -816,7 +817,7 @@
}
if (!GVar->isThreadLocal() &&
- (GVar->hasLocalLinkage() || GVar->mayBeOverridden())) {
+ (GVar->hasLocalLinkage() || GVar->isWeakForLinker())) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (TAI->getLCOMMDirective() != NULL) {
@@ -855,9 +856,12 @@
}
switch (GVar->getLinkage()) {
- case GlobalValue::CommonLinkage:
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
if (Subtarget->isTargetDarwin()) {
O << "\t.globl " << name << '\n'
<< TAI->getWeakDefDirective() << name << '\n';
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -455,9 +455,12 @@
bool bCustomSegment = false;
switch (I->getLinkage()) {
- case GlobalValue::CommonLinkage:
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::CommonAnyLinkage:
+ case GlobalValue::CommonODRLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
SwitchToDataSection("");
O << name << "?\tsegment common 'COMMON'\n";
bCustomSegment = true;
Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Sat Mar 7 09:45:40 2009
@@ -51,7 +51,7 @@
// target is x86-64 or the symbol is definitely defined in the current
// translation unit.
return false;
- return !isDirectCall && (isDecl || GV->mayBeOverridden());
+ return !isDirectCall && (isDecl || GV->isWeakForLinker());
} else if (isTargetELF()) {
// Extra load is needed for all externally visible.
if (isDirectCall)
Modified: llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreAsmPrinter.cpp Sat Mar 7 09:45:40 2009
@@ -188,8 +188,10 @@
case GlobalValue::AppendingLinkage:
cerr << "AppendingLinkage is not supported by this target!\n";
abort();
- case GlobalValue::LinkOnceLinkage:
- case GlobalValue::WeakLinkage:
+ case GlobalValue::LinkOnceAnyLinkage:
+ case GlobalValue::LinkOnceODRLinkage:
+ case GlobalValue::WeakAnyLinkage:
+ case GlobalValue::WeakODRLinkage:
case GlobalValue::ExternalLinkage:
emitArrayBound(name, GV);
emitGlobalDirective(name);
@@ -266,8 +268,10 @@
case Function::ExternalLinkage:
emitGlobalDirective(CurrentFnName);
break;
- case Function::LinkOnceLinkage:
- case Function::WeakLinkage:
+ case Function::LinkOnceAnyLinkage:
+ case Function::LinkOnceODRLinkage:
+ case Function::WeakAnyLinkage:
+ case Function::WeakODRLinkage:
// TODO Use COMDAT groups for LinkOnceLinkage
O << TAI->getGlobalDirective() << CurrentFnName << "\n";
O << TAI->getWeakDefDirective() << CurrentFnName << "\n";
@@ -434,7 +438,8 @@
switch (I->getLinkage()) {
default:
assert(0 && "Unexpected linkage");
- case Function::ExternalWeakLinkage:
+ case Function::ExternalWeakAnyLinkage:
+ case Function::ExternalWeakODRLinkage:
ExtWeakSymbols.insert(I);
// fallthrough
case Function::ExternalLinkage:
Modified: llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreTargetAsmInfo.cpp Sat Mar 7 09:45:40 2009
@@ -73,7 +73,7 @@
if (const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV))
{
- if (!GVar->mayBeOverridden()) {
+ if (!GVar->isWeakForLinker()) {
switch (Kind) {
case SectionKind::RODataMergeStr:
return MergeableStringSection(GVar);
Modified: llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/IndMemRemoval.cpp Sat Mar 7 09:45:40 2009
@@ -53,7 +53,7 @@
if (Function* F = M.getFunction("free")) {
if (F->isDeclaration() && F->arg_size() == 1 && !F->use_empty()) {
Function* FN = Function::Create(F->getFunctionType(),
- GlobalValue::LinkOnceLinkage,
+ GlobalValue::LinkOnceAnyLinkage,
"free_llvm_bounce", &M);
BasicBlock* bb = BasicBlock::Create("entry",FN);
Instruction* R = ReturnInst::Create(bb);
@@ -67,7 +67,7 @@
if (Function* F = M.getFunction("malloc")) {
if (F->isDeclaration() && F->arg_size() == 1 && !F->use_empty()) {
Function* FN = Function::Create(F->getFunctionType(),
- GlobalValue::LinkOnceLinkage,
+ GlobalValue::LinkOnceAnyLinkage,
"malloc_llvm_bounce", &M);
FN->setDoesNotAlias(0);
BasicBlock* bb = BasicBlock::Create("entry",FN);
Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Sat Mar 7 09:45:40 2009
@@ -182,12 +182,9 @@
// Don't inline functions which can be redefined at link-time to mean
// something else.
- // FIXME: We allow link-once linkage since in practice all versions of
- // the function have the same body (C++ ODR) - but the LLVM definition
- // of LinkOnceLinkage doesn't require this.
- if ((Callee->mayBeOverridden() && !Callee->hasLinkOnceLinkage()) ||
- // Don't inline functions marked noinline.
- Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee))
+ if (Callee->mayBeOverridden() ||
+ // Don't inline functions marked noinline.
+ Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee))
return llvm::InlineCost::getNever();
// InlineCost - This value measures how good of an inline candidate this call
Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Sat Mar 7 09:45:40 2009
@@ -139,7 +139,7 @@
// already exists.
if (!(JBListHead = M.getGlobalVariable("llvm.sjljeh.jblist", PtrJBList))) {
JBListHead = new GlobalVariable(PtrJBList, false,
- GlobalValue::LinkOnceLinkage,
+ GlobalValue::LinkOnceAnyLinkage,
Constant::getNullValue(PtrJBList),
"llvm.sjljeh.jblist", &M);
}
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Mar 7 09:45:40 2009
@@ -1183,22 +1183,26 @@
static void PrintLinkage(GlobalValue::LinkageTypes LT, raw_ostream &Out) {
switch (LT) {
- case GlobalValue::PrivateLinkage: Out << "private "; break;
- case GlobalValue::InternalLinkage: Out << "internal "; break;
- case GlobalValue::LinkOnceLinkage: Out << "linkonce "; break;
- case GlobalValue::WeakLinkage: Out << "weak "; break;
- case GlobalValue::CommonLinkage: Out << "common "; break;
- case GlobalValue::AppendingLinkage: Out << "appending "; break;
- case GlobalValue::DLLImportLinkage: Out << "dllimport "; break;
- case GlobalValue::DLLExportLinkage: Out << "dllexport "; break;
- case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
+ case GlobalValue::PrivateLinkage: Out << "private "; break;
+ case GlobalValue::InternalLinkage: Out << "internal "; break;
+ case GlobalValue::LinkOnceAnyLinkage: Out << "linkonce "; break;
+ case GlobalValue::LinkOnceODRLinkage: Out << "linkonce_odr "; break;
+ case GlobalValue::WeakAnyLinkage: Out << "weak "; break;
+ case GlobalValue::WeakODRLinkage: Out << "weak_odr "; break;
+ case GlobalValue::CommonAnyLinkage: Out << "common "; break;
+ case GlobalValue::CommonODRLinkage: Out << "common_odr "; break;
+ case GlobalValue::AppendingLinkage: Out << "appending "; break;
+ case GlobalValue::DLLImportLinkage: Out << "dllimport "; break;
+ case GlobalValue::DLLExportLinkage: Out << "dllexport "; break;
+ case GlobalValue::ExternalWeakAnyLinkage: Out << "extern_weak "; break;
+ case GlobalValue::ExternalWeakODRLinkage: Out << "extern_weak_odr "; break;
case GlobalValue::ExternalLinkage: break;
case GlobalValue::GhostLinkage:
Out << "GhostLinkage not allowed in AsmWriter!\n";
abort();
}
}
-
+
static void PrintVisibility(GlobalValue::VisibilityTypes Vis,
raw_ostream &Out) {
Modified: llvm/trunk/utils/emacs/llvm-mode.el
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/emacs/llvm-mode.el?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/utils/emacs/llvm-mode.el (original)
+++ llvm/trunk/utils/emacs/llvm-mode.el Sat Mar 7 09:45:40 2009
@@ -27,7 +27,7 @@
;; Hex constants
'("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face)
;; Keywords
- '("\\bbegin\\b\\|\\bend\\b\\|\\btrue\\b\\|\\bfalse\\b\\|\\bzeroinitializer\\b\\|\\bdeclare\\b\\|\\bdefine\\b\\|\\bglobal\\b\\|\\bconstant\\b\\|\\bconst\\b\\|\\binternal\\b\\|\\blinkonce\\b\\|\\bweak\\b\\|\\bappending\\b\\|\\buninitialized\\b\\|\\bimplementation\\b\\|\\b\\.\\.\\.\\b\\|\\bnull\\b\\|\\bundef\\b\\|\\bto\\b\\|\\bexcept\\b\\|\\bnot\\b\\|\\btarget\\b\\|\\bendian\\b\\|\\blittle\\b\\|\\bbig\\b\\|\\bpointersize\\b\\|\\bdeplibs\\b\\|\\bvolatile\\b\\|\\bfastcc\\b\\|\\bcoldcc\\b\\|\\bcc\\b" . font-lock-keyword-face)
+ '("\\bbegin\\b\\|\\bend\\b\\|\\btrue\\b\\|\\bfalse\\b\\|\\bzeroinitializer\\b\\|\\bdeclare\\b\\|\\bdefine\\b\\|\\bglobal\\b\\|\\bconstant\\b\\|\\bconst\\b\\|\\binternal\\b\\|\\blinkonce\\b\\|\\blinkonce_odr\\b\\|\\bweak\\b\\|\\bweak_odr\\b\\|\\bappending\\b\\|\\buninitialized\\b\\|\\bimplementation\\b\\|\\b\\.\\.\\.\\b\\|\\bnull\\b\\|\\bundef\\b\\|\\bto\\b\\|\\bexcept\\b\\|\\bnot\\b\\|\\btarget\\b\\|\\bendian\\b\\|\\blittle\\b\\|\\bbig\\b\\|\\bpointersize\\b\\|\\bdeplibs\\b\\|\\bvolatile\\b\\|\\bfastcc\\b\\|\\bcoldcc\\b\\|\\bcc\\b" . font-lock-keyword-face)
;; Arithmetic and Logical Operators
'("\\badd\\b\\|\\bsub\\b\\|\\bmul\\b\\|\\bdiv\\b\\|\\brem\\b\\|\\band\\b\\|\\bor\\b\\|\\bxor\\b\\|\\bset\\(ne\\b\\|\\beq\\b\\|\\blt\\b\\|\\bgt\\b\\|\\ble\\b\\|\\bge\\b\\)" . font-lock-keyword-face)
;; Special instructions
Modified: llvm/trunk/utils/llvm.grm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm.grm?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/utils/llvm.grm (original)
+++ llvm/trunk/utils/llvm.grm Sat Mar 7 09:45:40 2009
@@ -82,15 +82,19 @@
GVInternalLinkage
::= + internal
| weak
+ | "weak_odr"
| linkonce
+ | "linkonce_odr"
| appending
| dllexport
| common
+ | "common_odr"
;
GVExternalLinkage
::= dllimport
| "extern_weak"
+ | "extern_weak_odr"
| + external
;
@@ -105,17 +109,20 @@
::= + _
| dllimport
| "extern_weak"
+ | "extern_weak_odr"
;
FunctionDefineLinkage
::= + _
| internal
| linkonce
+ | "linkonce_odr"
| weak
+ | "weak_odr"
| dllexport
;
-AliasLinkage ::= + _ | weak | internal ;
+AliasLinkage ::= + _ | weak | "weak_odr" | internal ;
OptCallingConv ::= + _ |
ccc |
Modified: llvm/trunk/utils/vim/llvm.vim
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vim/llvm.vim?rev=66339&r1=66338&r2=66339&view=diff
==============================================================================
--- llvm/trunk/utils/vim/llvm.vim (original)
+++ llvm/trunk/utils/vim/llvm.vim Sat Mar 7 09:45:40 2009
@@ -40,7 +40,8 @@
" Keywords.
syn keyword llvmKeyword define declare global constant
syn keyword llvmKeyword internal external
-syn keyword llvmKeyword linkonce weak appending common extern_weak
+syn keyword llvmKeyword linkonce linkonce_odr weak weak_odr appending
+syn keyword llvmKeyword common common_odr extern_weak extern_weak_odr
syn keyword llvmKeyword thread_local dllimport dllexport
syn keyword llvmKeyword hidden protected default
syn keyword llvmKeyword except deplibs
More information about the llvm-commits
mailing list