mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Don't emit structors for available_externally globals (PR19933)
We would previously assert here when trying to figure out the section for the global. This makes us handle the situation more gracefully since the IR isn't malformed. Differential Revision: http://reviews.llvm.org/D4022 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210215 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1349,9 +1349,14 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) {
|
||||
const TargetLoweringObjectFile &Obj = getObjFileLowering();
|
||||
const MCSymbol *KeySym = nullptr;
|
||||
const MCSection *KeySec = nullptr;
|
||||
if (S.ComdatKey) {
|
||||
KeySym = getSymbol(S.ComdatKey);
|
||||
KeySec = getObjFileLowering().SectionForGlobal(S.ComdatKey, *Mang, TM);
|
||||
if (GlobalValue *GV = S.ComdatKey) {
|
||||
if (GV->hasAvailableExternallyLinkage())
|
||||
// If the associated variable is available_externally, some other TU
|
||||
// will provide its dynamic initializer.
|
||||
continue;
|
||||
|
||||
KeySym = getSymbol(GV);
|
||||
KeySec = getObjFileLowering().SectionForGlobal(GV, *Mang, TM);
|
||||
}
|
||||
const MCSection *OutputSection =
|
||||
(isCtor ? Obj.getStaticCtorSection(S.Priority, KeySym, KeySec)
|
||||
|
Reference in New Issue
Block a user