[PATCH] D47136: [Sparc] Add support for 13-bit PIC

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 07:47:15 PDT 2018


jyknight added a comment.

It doesn't look like we can parse the textual asm produced by this. E.g.:

test.s:

  ld      [%i0+x], %i0
  .common x,4,4

Then running `llvm-mc -filetype=obj -position-independent -triple sparc -o test.o test.s` hits an assert in `SparcMCCodeEmitter::getMachineOpValue` at `SparcMCCodeEmitter.cpp:152`, because it got parsed as a `<MCOperand Expr:(x)>`, not as a SparcMCExpr with the VK_SPARC_GOT13 kind, as it should.

Same failure, actually, without the -position-independent, too, actually, should've parsed as VK_SPARC_13. But at least we don't ever actually generate that on output.



================
Comment at: lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp:61
   case VK_Sparc_GOT10:    OS << "%lo("; break;
+  case VK_Sparc_GOT13:    closeParen = false; break;
   case VK_Sparc_WPLT30:   closeParen = false; break;
----------------
Strange that this doesn't print %got13. But, checking with gcc and gnu as, they don't support it. So, great, more magic just like %got22, %got10, %pc22, and %pc10.


Repository:
  rL LLVM

https://reviews.llvm.org/D47136





More information about the llvm-commits mailing list