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

Toma Tabacu toma.tabacu at imgtec.com
Tue Mar 24 04:01:23 PDT 2015


Hi dsanders,

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.

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
@@ -3585,11 +3585,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,16 @@
+# 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 foo, a
+  .set bar, b
+a:
+  nop
+# CHECK-NOT: a:
+# CHECK: foo:
+
+b:
+  nop
+# CHECK-NOT: b:
+# CHECK: bar:

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8578.22550.patch
Type: text/x-patch
Size: 1126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150324/98f7fd1f/attachment.bin>


More information about the llvm-commits mailing list