[PATCH] D79864: [PowerPC] Add linker opt for PC Relative GOT indirect accesses

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 10:19:22 PDT 2020


stefanp added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp:230
+  // fixup can be added.
+  LabelSym = getContext().getOrCreateSymbol(SymExpr->getSymbol().getName());
+  if (Inst.getOpcode() == PPC::PLDpc)
----------------
efriedma wrote:
> Isn't `getContext().getOrCreateSymbol(SymExpr->getSymbol().getName());` equivalent to `SymExpr->getSymbol()`?
Unfortunately it is not the same thing. 
In the case of `SymExpr->getSymbol()` we get a `const MCSymbol&` while in the case of  `getContext().getOrCreateSymbol(SymExpr->getSymbol().getName());` we get an `MCSymbol*`. The problem is that I call `emitLabel` and that requires a `MCSymbol*`. The `const` doesn't let me call that function and I don't want to const cast or something like that.

There may, however, still be a better way to do this. I just don't know what that is.


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

https://reviews.llvm.org/D79864





More information about the llvm-commits mailing list