[mips] [IAS] Allow .set assignments for already defined symbols.

Summary:
This is not possible when using the IAS for MIPS, but it is possible when using the IAS for other architectures and when using GAS for MIPS.


Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8578

llvm-svn: 234316
This commit is contained in:
Toma Tabacu 2015-04-07 13:59:39 +00:00
parent b91455b5c0
commit f25949b588
2 changed files with 19 additions and 5 deletions

View File

@ -3579,11 +3579,7 @@ bool MipsAsmParser::parseSetAssignment() {
if (Parser.parseExpression(Value))
return reportParseError("expected valid expression after comma");
// Check if the Name already exists as a symbol.
MCSymbol *Sym = getContext().LookupSymbol(Name);
if (Sym)
return reportParseError("symbol already defined");
Sym = getContext().GetOrCreateSymbol(Name);
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name);
Sym->setVariableValue(Value);
return false;

View File

@ -0,0 +1,18 @@
# RUN: llvm-mc %s -arch=mips -mcpu=mips32 -filetype=obj -o - | \
# RUN: llvm-objdump -d -r -arch=mips - | FileCheck %s
.global foo
.weak bar
.set bar, b
.set foo, b
.set foo, a
a:
nop
# CHECK-NOT: a:
# CHECK: foo:
b:
nop
# CHECK-NOT: b:
# CHECK-NOT: foo:
# CHECK: bar: