mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
CodeGen: Error on redefinitions instead of asserting
It's possible to have a prior definition of a symbol in module asm. Raise an error instead of crashing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224828 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -338,6 +338,9 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
||||
return;
|
||||
|
||||
GVSym->redefineIfPossible();
|
||||
if (GVSym->isDefined() || GVSym->isVariable())
|
||||
report_fatal_error("symbol '" + Twine(GVSym->getName()) +
|
||||
"' is already defined");
|
||||
|
||||
if (MAI->hasDotTypeDotSizeDirective())
|
||||
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_ELF_TypeObject);
|
||||
@@ -547,11 +550,14 @@ void AsmPrinter::EmitFunctionEntryLabel() {
|
||||
|
||||
// The function label could have already been emitted if two symbols end up
|
||||
// conflicting due to asm renaming. Detect this and emit an error.
|
||||
if (CurrentFnSym->isUndefined())
|
||||
return OutStreamer.EmitLabel(CurrentFnSym);
|
||||
if (CurrentFnSym->isVariable())
|
||||
report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
|
||||
"' is a protected alias");
|
||||
if (CurrentFnSym->isDefined())
|
||||
report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
|
||||
"' label emitted multiple times to assembly file");
|
||||
|
||||
report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
|
||||
"' label emitted multiple times to assembly file");
|
||||
return OutStreamer.EmitLabel(CurrentFnSym);
|
||||
}
|
||||
|
||||
/// emitComments - Pretty-print comments for instructions.
|
||||
|
||||
Reference in New Issue
Block a user