[PATCH] D79625: [PowerPC] Extend .reloc directive on PowerPC

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 25 04:14:35 PDT 2020


stefanp added inline comments.


================
Comment at: llvm/lib/MC/MCExpr.cpp:325
   case VK_PPC_NOTOC: return "notoc";
+  case VK_PPC_LINKER_OPT: return "ppclinkeropt";
   case VK_COFF_IMGREL32: return "IMGREL";
----------------
amyk wrote:
> I noticed for other PPC VariantKinds, we don't put the ppc part in the string. Is there a reason why we call it `ppclinkeropt` instead of just `linkeropt`? Is it since linkeropt might sound too generic?
This variant kind is a little bit different from the others. Other variant kinds use the string when generating assembly output files. For example when we use VK_PPC_GOT_PCREL we actually output `symbol at got@pcrel` into the assembly file. This string has to match what gcc does when it emits the symbol and relocation in the output. In the case of VK_PPC_LINKER_OPT we won't be doing that. The string "ppclinkeropt" should never get printed to the assembly file so it doesn't really matter what we name it as long as it is consistent in LLVM. I used the "ppc" prefix for it because the strings needs to be unique (see `getVariantKindForName`) and as a result I figured it would be less likely to conflict with a future string.


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

https://reviews.llvm.org/D79625





More information about the llvm-commits mailing list