Introduce new linkage types linkonce_odr, weak_odr, common_odr
authorDuncan Sands <baldrick@free.fr>
Sat, 7 Mar 2009 15:45:40 +0000 (15:45 +0000)
committerDuncan Sands <baldrick@free.fr>
Sat, 7 Mar 2009 15:45:40 +0000 (15:45 +0000)
commit667d4b8de6dea70195ff12ef39a4deebffa2f5c7
tree7c3eab01e7683698c4818410c678d6af0ebfa56b
parent0dd2a6a89f49438b239638ab147ac5746d6c32c3
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
43 files changed:
docs/LangRef.html
docs/ProgrammersManual.html
include/llvm-c/Core.h
include/llvm/GlobalValue.h
lib/Analysis/DebugInfo.cpp
lib/AsmParser/LLLexer.cpp
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLToken.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/CodeGen/AsmPrinter/DwarfWriter.cpp
lib/CodeGen/ELFWriter.cpp
lib/CodeGen/IntrinsicLowering.cpp
lib/CodeGen/MachOWriter.cpp
lib/CodeGen/SelectionDAG/TargetLowering.cpp
lib/CodeGen/ShadowStackGC.cpp
lib/ExecutionEngine/JIT/JIT.cpp
lib/Linker/LinkModules.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/CppBackend/CPPBackend.cpp
lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp
lib/Target/IA64/IA64AsmPrinter.cpp
lib/Target/Mips/MipsAsmPrinter.cpp
lib/Target/Mips/MipsTargetAsmInfo.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
lib/Target/TargetAsmInfo.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
lib/Target/X86/X86Subtarget.cpp
lib/Target/XCore/XCoreAsmPrinter.cpp
lib/Target/XCore/XCoreTargetAsmInfo.cpp
lib/Transforms/IPO/IndMemRemoval.cpp
lib/Transforms/Utils/InlineCost.cpp
lib/Transforms/Utils/LowerInvoke.cpp
lib/VMCore/AsmWriter.cpp
utils/emacs/llvm-mode.el
utils/llvm.grm
utils/vim/llvm.vim