[PATCH] D55304: [RISCV, WIP] Lower calls through GOT and PLT

Lewis Revill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 09:22:44 PST 2018


lewis-revill marked 2 inline comments as done.
lewis-revill added inline comments.


================
Comment at: lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:1108
 
-  MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
-  Res = MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_None, getContext());
+  if (Identifier.consume_back("@plt")) {
+    MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
----------------
jrtc27 wrote:
> Do we want to be parsing the `@plt` for things other than `call`/`tail`? `PseudoLLA` also takes a `bare_symbol` but `@plt` isn't valid. Currently we parse `bar at plt` as a valid bare symbol; however, GNU as will reject it with `illegal operands` (as I understand it, this is because it doesn't treat `@` as part of a valid identifier).
Hmm, probably a good idea. I guess I'd have to add yet another operand type in `RISCVInstrInfo`. Checking `Operands[0]` for "call" or "tail" seems a bit hacky to me, but maybe it's a reasonable approach?


================
Comment at: lib/Target/RISCV/RISCVSubtarget.cpp:56
+
+  if (M.getRtLibUseGOT())
+    return RISCVII::MO_GOT_HI;
----------------
jrtc27 wrote:
> This seems to be X86-specific in LLVM; do we really need this in RISC-V? Clang's `test/CodeGen/noplt.c` gives a normal `call foo at plt` when compiled with `riscv64-linux-gnu-gcc -fpic -fno-plt`, so I would remove this and the related code.
OK, that makes things a lot simpler for `LowerCall` then. Is there no case where calls need to be lowered using GOT?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55304/new/

https://reviews.llvm.org/D55304





More information about the llvm-commits mailing list