[PATCH] [mips] [IAS] Allow .set assignments for already defined symbols.
Toma Tabacu
toma.tabacu at imgtec.com
Tue Apr 7 03:33:14 PDT 2015
Added the requested test case.
http://reviews.llvm.org/D8578
Files:
lib/Target/Mips/AsmParser/MipsAsmParser.cpp
test/MC/Mips/set-defined-symbol.s
Index: lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -3579,11 +3579,7 @@
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;
Index: test/MC/Mips/set-defined-symbol.s
===================================================================
--- /dev/null
+++ test/MC/Mips/set-defined-symbol.s
@@ -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:
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8578.23319.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150407/a6ab6468/attachment.bin>
More information about the llvm-commits
mailing list