[llvm] [SystemZ][z/OS] Implement executePostLayoutBinding for GOFFObjectWriter (PR #67868)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 11:14:47 PDT 2023


================
@@ -1296,6 +1298,41 @@ void SystemZAsmPrinter::emitPPA1(MCSymbol *FnEndSym) {
                                       4);
 }
 
+void SystemZAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
+  if (TM.getTargetTriple().isOSzOS()) {
+    auto *Sym = cast<MCSymbolGOFF>(getSymbol(GV));
+    Sym->setExecutable(GOFF::ESD_EXE_DATA);
+  }
+
+  return AsmPrinter::emitGlobalVariable(GV);
+}
+
+const MCExpr *SystemZAsmPrinter::lowerConstant(const Constant *CV) {
+  const Triple &TargetTriple = TM.getTargetTriple();
+  if (TargetTriple.isOSzOS()) {
+    const GlobalAlias *GA = dyn_cast<GlobalAlias>(CV);
+    const GlobalVariable *GV = dyn_cast<GlobalVariable>(CV);
+    const Function *FV = dyn_cast<Function>(CV);
+    bool IsFunc = !GV && (FV || (GA && isa<Function>(GA->getAliaseeObject())));
----------------
diggerlin wrote:

 A Constant can not be GlobalVariable , GlobalAlias ,Function at same time, do we need `!GV` here?

https://github.com/llvm/llvm-project/pull/67868


More information about the llvm-commits mailing list