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

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 19:51:14 PST 2018


jrtc27 requested changes to this revision.
jrtc27 added inline comments.
This revision now requires changes to proceed.


================
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);
----------------
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).


================
Comment at: lib/Target/RISCV/RISCVSubtarget.cpp:51
+unsigned
+RISCVSubtarget::classifyFunctionReference(const Module &M,
+                                          const GlobalValue *GV) const {
----------------
This can be inlined in `LowerCall`, especially once the `fno-plt` stuff is gone, as it's the only user.


================
Comment at: lib/Target/RISCV/RISCVSubtarget.cpp:56
+
+  if (M.getRtLibUseGOT())
+    return RISCVII::MO_GOT_HI;
----------------
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.


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