mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-26 22:19:02 +00:00
Fix PR7054 - Assertion `Symbol->isUndefined() && "Cannot define a symbol twice!"' failed.
Users can write broken code that emits the same label twice with asm renaming, detect this and emit a fatal backend error instead of aborting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -408,7 +408,13 @@ void AsmPrinter::EmitFunctionHeader() {
|
||||
/// EmitFunctionEntryLabel - Emit the label that is the entrypoint for the
|
||||
/// function. This can be overridden by targets as required to do custom stuff.
|
||||
void AsmPrinter::EmitFunctionEntryLabel() {
|
||||
OutStreamer.EmitLabel(CurrentFnSym);
|
||||
// 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);
|
||||
|
||||
report_fatal_error("'" + Twine(CurrentFnSym->getName()) +
|
||||
"' label emitted multiple times to assembly file");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user