OSDN Git Service

[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual...
authorFangrui Song <maskray@google.com>
Wed, 15 May 2019 02:35:32 +0000 (02:35 +0000)
committerFangrui Song <maskray@google.com>
Wed, 15 May 2019 02:35:32 +0000 (02:35 +0000)
commitd7a1a7be424d4437453b109ce2c1ee82e7277a20
treec05107a6013687009809bd70a373529f96140425
parent6ed90ce6aeed0df189a1474d2e08aca572b148d4
[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual format

The 3-field form was introduced by D3499 in 2014 and the legacy 2-field
form was planned to be removed in LLVM 4.0

For the textual format, this patch migrates the existing 2-field form to
use the 3-field form and deletes the compatibility code.
test/Verifier/global-ctors-2.ll checks we have a friendly error message.

For bitcode, lib/IR/AutoUpgrade UpgradeGlobalVariables will upgrade the
2-field form (add i8* null as the third field).

Reviewed By: rnk, dexonsmith

Differential Revision: https://reviews.llvm.org/D61547

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360742 91177308-0d34-0410-b5e6-96231b3b80d8
60 files changed:
docs/LangRef.rst
docs/ReleaseNotes.rst
include/llvm/IR/AutoUpgrade.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/IR/AutoUpgrade.cpp
lib/IR/Verifier.cpp
lib/Transforms/Utils/ModuleUtils.cpp
test/Bitcode/metadata-2.ll
test/Bitcode/upgrade-global-ctors.ll
test/Bitcode/upgrade-global-dtors.ll [new file with mode: 0644]
test/Bitcode/upgrade-global-dtors.ll.bc [new file with mode: 0644]
test/CodeGen/AArch64/init-array.ll
test/CodeGen/ARM/ctor_order.ll
test/CodeGen/ARM/ctors_dtors.ll
test/CodeGen/Mips/init-array.ll
test/CodeGen/PowerPC/pr17354.ll
test/CodeGen/RISCV/init-array.ll
test/CodeGen/SPARC/2008-10-10-InlineAsmMemoryOperand.ll
test/CodeGen/X86/2007-06-04-X86-64-CtorAsmBugs.ll
test/CodeGen/X86/2011-08-29-InitOrder.ll
test/CodeGen/X86/init-priority.ll
test/CodeGen/X86/negate-add-zero.ll
test/DebugInfo/COFF/asan-module-ctor.ll
test/DebugInfo/COFF/asan-module-without-functions.ll
test/DebugInfo/Generic/incorrect-variable-debugloc.ll
test/DebugInfo/X86/cu-ranges-odr.ll
test/DebugInfo/X86/dbg_value_direct.ll
test/DebugInfo/X86/debug-ranges-offset.ll
test/DebugInfo/X86/generate-odr-hash.ll
test/Feature/global_pv.ll
test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll [deleted file]
test/Linker/ctors5.ll [deleted file]
test/Linker/global_ctors.ll [deleted file]
test/MC/ARM/cxx-global-constructor.ll
test/Transforms/GlobalDCE/global_ctors.ll
test/Transforms/GlobalDCE/global_ctors_integration.ll
test/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll
test/Transforms/GlobalOpt/2007-06-04-PackedStruct.ll
test/Transforms/GlobalOpt/2010-10-19-WeakOdr.ll
test/Transforms/GlobalOpt/2011-04-09-EmptyGlobalCtors.ll
test/Transforms/GlobalOpt/assume.ll
test/Transforms/GlobalOpt/constantfold-initializers.ll
test/Transforms/GlobalOpt/crash.ll
test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll
test/Transforms/GlobalOpt/ctor-list-opt-inbounds.ll
test/Transforms/GlobalOpt/cxx-dtor.ll
test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
test/Transforms/GlobalOpt/int_sideeffect.ll
test/Transforms/GlobalOpt/invariant-nodatalayout.ll
test/Transforms/GlobalOpt/invariant.group.ll
test/Transforms/GlobalOpt/invariant.ll
test/Transforms/GlobalOpt/invoke.ll
test/Transforms/GlobalOpt/memset-null.ll
test/Transforms/GlobalOpt/undef-init.ll
test/Transforms/ObjCARC/apelim.ll
test/Transforms/ObjCARC/comdat-ipo.ll
test/Transforms/ThinLTOBitcodeWriter/unsplittable.ll
test/Verifier/global-ctors-2.ll [new file with mode: 0644]