https://github.com/tltao updated 
https://github.com/llvm/llvm-project/pull/169362

>From c7f24718e30e42c036fc51414ff850dea14d445a Mon Sep 17 00:00:00 2001
From: Amy Kwan <[email protected]>
Date: Tue, 6 Jan 2026 00:40:04 -0500
Subject: [PATCH 1/7] [NFC][SystemZ] Update insert() API of the
 AssociatedDataAreaTable class

This patch updates the insert() calls of the AssociatedDataAreaTable class
to return a pair of <const MCSymbol *, uint32_t> instead of just a uint32_t.
This API change of including the MCSymbol is needed in subsequent patches
to come.
---
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 28 ++++++++++++-------
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.h   |  9 +++---
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index 444bc578a3fab..b36605ec54374 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -170,13 +170,14 @@ void SystemZAsmPrinter::emitCallInformation(CallType CT) {
                      .addReg(SystemZMC::GR64Regs[static_cast<unsigned>(CT)]));
 }
 
-uint32_t SystemZAsmPrinter::AssociatedDataAreaTable::insert(const MCSymbol 
*Sym,
-                                                            unsigned SlotKind) 
{
+std::pair<const MCSymbol *, uint32_t>
+SystemZAsmPrinter::AssociatedDataAreaTable::insert(const MCSymbol *Sym,
+                                                   unsigned SlotKind) {
   auto Key = std::make_pair(Sym, SlotKind);
-  auto It = Displacements.find(Key);
+  auto *It = Displacements.find(Key);
 
   if (It != Displacements.end())
-    return (*It).second;
+    return std::pair(Sym, (*It).second);
 
   // Determine length of descriptor.
   uint32_t Length;
@@ -193,14 +194,15 @@ uint32_t 
SystemZAsmPrinter::AssociatedDataAreaTable::insert(const MCSymbol *Sym,
   Displacements[std::make_pair(Sym, SlotKind)] = NextDisplacement;
   NextDisplacement += Length;
 
-  return Displacement;
+  return std::pair(Sym, Displacement);
 }
 
-uint32_t
+std::pair<const MCSymbol *, uint32_t>
 SystemZAsmPrinter::AssociatedDataAreaTable::insert(const MachineOperand MO) {
   MCSymbol *Sym;
   if (MO.getType() == MachineOperand::MO_GlobalAddress) {
     const GlobalValue *GV = MO.getGlobal();
+    assert(GV->hasName() && "Cannot put unnamed value in ADA");
     Sym = MO.getParent()->getMF()->getTarget().getSymbol(GV);
     assert(Sym && "No symbol");
   } else if (MO.getType() == MachineOperand::MO_ExternalSymbol) {
@@ -347,7 +349,9 @@ void SystemZAsmPrinter::emitInstruction(const MachineInstr 
*MI) {
   case SystemZ::ADA_ENTRY: {
     const SystemZSubtarget &Subtarget = MF->getSubtarget<SystemZSubtarget>();
     const SystemZInstrInfo *TII = Subtarget.getInstrInfo();
-    uint32_t Disp = ADATable.insert(MI->getOperand(1));
+    const MCSymbol *Sym;
+    uint32_t Disp;
+    std::tie(Sym, Disp) = ADATable.insert(MI->getOperand(1));
     Register TargetReg = MI->getOperand(0).getReg();
 
     Register ADAReg = MI->getOperand(2).getReg();
@@ -1562,13 +1566,17 @@ void SystemZAsmPrinter::emitPPA1(MCSymbol *FnEndSym) {
     OutStreamer->AddComment("Flags");
     OutStreamer->emitInt32(0); // LSDA field is a WAS offset
     OutStreamer->AddComment("Personality routine");
-    OutStreamer->emitInt64(ADATable.insert(
-        PersonalityRoutine, SystemZII::MO_ADA_INDIRECT_FUNC_DESC));
+    // Store only offset of function descriptor
+    OutStreamer->emitInt64(
+        ADATable
+            .insert(PersonalityRoutine, SystemZII::MO_ADA_INDIRECT_FUNC_DESC)
+            .second);
+    // Store only offset of LSDA
     OutStreamer->AddComment("LSDA location");
     MCSymbol *GCCEH = MF->getContext().getOrCreateSymbol(
         Twine("GCC_except_table") + Twine(MF->getFunctionNumber()));
     OutStreamer->emitInt64(
-        ADATable.insert(GCCEH, SystemZII::MO_ADA_DATA_SYMBOL_ADDR));
+        ADATable.insert(GCCEH, SystemZII::MO_ADA_DATA_SYMBOL_ADDR).second);
   }
 
   // Emit name length and name optional section (0x01 of flags 4)
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
index cb101e472824f..0611179ee7262 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
@@ -73,16 +73,17 @@ class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public 
AsmPrinter {
 
     /// @brief Add a function descriptor to the ADA.
     /// @param MI Pointer to an ADA_ENTRY instruction.
-    /// @return The displacement of the descriptor into the ADA.
-    uint32_t insert(const MachineOperand MO);
+    /// @return The symbol and displacement of the descriptor into the ADA.
+    std::pair<const MCSymbol *, uint32_t> insert(const MachineOperand MO);
 
     /// @brief Get the displacement into associated data area (ADA) for a name.
     /// If no  displacement is already associated with the name, assign one and
     /// return it.
     /// @param Sym The symbol for which the displacement should be returned.
     /// @param SlotKind The ADA type.
-    /// @return The displacement of the descriptor into the ADA.
-    uint32_t insert(const MCSymbol *Sym, unsigned SlotKind);
+    /// @return The symbol and displacement of the descriptor into the ADA.
+    std::pair<const MCSymbol *, uint32_t> insert(const MCSymbol *Sym,
+                                                 unsigned SlotKind);
 
     /// Get the table of GOFF displacements.  This is 'const' since it should
     /// never be modified by anything except the APIs on this class.

>From 231ff105f4ae91f3d0c94180ffae15f9a8922252 Mon Sep 17 00:00:00 2001
From: Tony Tao <[email protected]>
Date: Wed, 19 Nov 2025 19:55:35 +0000
Subject: [PATCH 2/7] Implement emitGlobalVariable and lowerConstant

---
 clang/lib/Lex/HeaderMap.cpp                   |  1 +
 llvm/lib/Support/VirtualOutputBackends.cpp    |  1 +
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 73 +++++++++++++++++++
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.h   |  2 +
 4 files changed, 77 insertions(+)

diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp
index a7b670f00ac6e..588b32ee9ca8e 100644
--- a/clang/lib/Lex/HeaderMap.cpp
+++ b/clang/lib/Lex/HeaderMap.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/SystemZ/zOSSupport.h"
 #include <cstring>
 #include <memory>
 #include <optional>
diff --git a/llvm/lib/Support/VirtualOutputBackends.cpp 
b/llvm/lib/Support/VirtualOutputBackends.cpp
index d7a91dfa1471f..30cd42aa72558 100644
--- a/llvm/lib/Support/VirtualOutputBackends.cpp
+++ b/llvm/lib/Support/VirtualOutputBackends.cpp
@@ -285,6 +285,7 @@ Error 
OnDiskOutputFile::tryToCreateTemporary(std::optional<int> &FD) {
 
   return createDirectoriesOnDemand(OutputPath, Config, [&]() -> Error {
     int NewFD;
+               sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
     SmallString<128> UniquePath;
     sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
     if (std::error_code EC =
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index b36605ec54374..e50d4933c0e83 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -1117,6 +1117,24 @@ void SystemZAsmPrinter::emitEndOfAsmFile(Module &M) {
   if (TT.isOSzOS()) {
     emitADASection();
     emitIDRLSection(M);
+    // Emit EXTRN declarations.
+    OutStreamer->pushSection();
+    for (auto &GO : M.global_objects()) {
+      if (GO.isDeclaration()) {
+        MCSymbol *Sym = TM.getSymbol(&GO);
+        OutStreamer->emitSymbolAttribute(Sym, GO.hasExternalWeakLinkage()
+                                                  ? MCSA_WeakReference
+                                                  : MCSA_Global);
+        OutStreamer->emitSymbolAttribute(Sym, isa<Function>(GO) ? MCSA_Code
+                                                                : MCSA_Data);
+        llvm::dbgs() << "TONY emitting " << Sym->getName() << "\n";
+      }
+    }
+    OutStreamer->switchSection(
+        static_cast<MCSectionGOFF *>(getObjFileLowering().getTextSection())
+            ->getParent());
+    getTargetStreamer()->emitExterns();
+    OutStreamer->popSection();
   }
   emitAttributes(M);
 }
@@ -1712,6 +1730,61 @@ void SystemZAsmPrinter::emitPPA2(Module &M) {
   OutStreamer->popSection();
 }
 
+void SystemZAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
+  if (TM.getTargetTriple().isOSzOS()) {
+    auto *Sym = getSymbol(GV);
+    OutStreamer->emitSymbolAttribute(Sym, MCSA_Data);
+  }
+
+  AsmPrinter::emitGlobalVariable(GV);
+}
+
+const MCExpr *SystemZAsmPrinter::lowerConstant(const Constant *CV,
+                                               const Constant *BaseCV,
+                                               uint64_t Offset) {
+  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())));
+
+    MCSymbol *Sym = NULL;
+
+    if (GA)
+      Sym = getSymbol(GA);
+    else if (IsFunc)
+      Sym = getSymbol(FV);
+    else if (GV)
+      Sym = getSymbol(GV);
+
+    if (IsFunc) {
+      OutStreamer->emitSymbolAttribute(Sym, MCSA_Code);
+      if (FV->hasExternalLinkage()) {
+        return MCSpecifierExpr::create(MCSymbolRefExpr::create(Sym, 
OutContext),
+                                       SystemZ::S_VCon, OutContext);
+      }
+      // Trigger creation of function descriptor in ADA for internal
+      // functions.
+      unsigned Disp = ADATable.insert(Sym, SystemZII::MO_ADA_DIRECT_FUNC_DESC);
+      return MCBinaryExpr::createAdd(
+          MCSpecifierExpr::create(
+              MCSymbolRefExpr::create(
+                  getObjFileLowering().getADASection()->getBeginSymbol(),
+                  OutContext),
+              SystemZ::S_None, OutContext),
+          MCConstantExpr::create(Disp, OutContext), OutContext);
+    }
+    if (Sym) {
+      OutStreamer->emitSymbolAttribute(Sym, MCSA_Data);
+      return MCSymbolRefExpr::create(Sym, OutContext);
+    }
+  }
+
+  return AsmPrinter::lowerConstant(CV);
+}
+
 void SystemZAsmPrinter::emitFunctionEntryLabel() {
   const SystemZSubtarget &Subtarget = MF->getSubtarget<SystemZSubtarget>();
 
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
index 0611179ee7262..31a9402df51a3 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
@@ -131,6 +131,8 @@ class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public 
AsmPrinter {
   void emitFunctionEntryLabel() override;
   void emitFunctionBodyEnd() override;
   void emitStartOfAsmFile(Module &M) override;
+  void emitGlobalVariable(const GlobalVariable *GV) override;
+  const MCExpr *lowerConstant(const Constant *CV, const Constant *BaseCV = 
nullptr, uint64_t Offset = 0) override;
 
 private:
   void emitCallInformation(CallType CT);

>From cda080610f47b121d785835935760eb9de3facd6 Mon Sep 17 00:00:00 2001
From: Tony Tao <[email protected]>
Date: Wed, 19 Nov 2025 19:57:30 +0000
Subject: [PATCH 3/7] undo accdiental commit

---
 llvm/lib/Support/VirtualOutputBackends.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Support/VirtualOutputBackends.cpp 
b/llvm/lib/Support/VirtualOutputBackends.cpp
index 30cd42aa72558..a4701cd79dfce 100644
--- a/llvm/lib/Support/VirtualOutputBackends.cpp
+++ b/llvm/lib/Support/VirtualOutputBackends.cpp
@@ -285,11 +285,10 @@ Error 
OnDiskOutputFile::tryToCreateTemporary(std::optional<int> &FD) {
 
   return createDirectoriesOnDemand(OutputPath, Config, [&]() -> Error {
     int NewFD;
-               sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
     SmallString<128> UniquePath;
     sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
     if (std::error_code EC =
-            sys::fs::createUniqueFile(ModelPath, NewFD, UniquePath, OF))
+            sys::fs::createUniqueFile(ModelPath, NewFD, UniquePath))
       return make_error<TempFileOutputError>(ModelPath, OutputPath, EC);
 
     if (Config.getDiscardOnSignal())
@@ -333,7 +332,13 @@ Error OnDiskOutputFile::initializeFile(std::optional<int> 
&FD) {
   // Not using a temporary file. Open the final output file.
   return createDirectoriesOnDemand(OutputPath, Config, [&]() -> Error {
     int NewFD;
-    sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
+    sys::fs::OpenFlags OF = sys::fs::OF_None;
+    if (Config.getTextWithCRLF())
+      OF |= sys::fs::OF_TextWithCRLF;
+    else if (Config.getText())
+      OF |= sys::fs::OF_Text;
+    if (Config.getAppend())
+      OF |= sys::fs::OF_Append;
     if (std::error_code EC = sys::fs::openFileForWrite(
             OutputPath, NewFD, sys::fs::CD_CreateAlways, OF))
       return convertToOutputError(OutputPath, EC);

>From 8a3a7e050a9f052abca2ef9d245a51e106cf5cb5 Mon Sep 17 00:00:00 2001
From: Tony Tao <[email protected]>
Date: Fri, 21 Nov 2025 13:58:15 -0500
Subject: [PATCH 4/7] implement more features

---
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 34 +++++++++++++++++++
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.h   |  1 +
 2 files changed, 35 insertions(+)

diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index e50d4933c0e83..f84d8554f7adf 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -377,6 +377,8 @@ void SystemZAsmPrinter::emitInstruction(const MachineInstr 
*MI) {
       Disp = 0;
       Op = Op0;
     }
+    OutStreamer->AddComment(Twine("Loading from ADA at offset ")
+                        .concat(utostr(Disp)));
     EmitToStreamer(*OutStreamer, MCInstBuilder(Op)
                                      .addReg(TargetReg)
                                      .addReg(ADAReg)
@@ -1785,6 +1787,38 @@ const MCExpr *SystemZAsmPrinter::lowerConstant(const 
Constant *CV,
   return AsmPrinter::lowerConstant(CV);
 }
 
+void SystemZAsmPrinter::emitGlobalAlias(const Module &M, const GlobalAlias 
&GA) {
+  if (!TM.getTargetTriple().isOSzOS()) {
+    AsmPrinter::emitGlobalAlias(M, GA);
+    return;
+  }
+
+  MCSymbol *Name = getSymbol(&GA);
+  bool IsFunc = isa<Function>(GA.getAliasee()->stripPointerCasts());
+
+  if (GA.hasExternalLinkage() || !MAI->getWeakRefDirective())
+    OutStreamer->emitSymbolAttribute(Name, MCSA_Global);
+  else if (GA.hasWeakLinkage() || GA.hasLinkOnceLinkage())
+    OutStreamer->emitSymbolAttribute(Name, MCSA_WeakReference);
+  else
+    assert(GA.hasLocalLinkage() && "Invalid alias linkage");
+
+  emitVisibility(Name, GA.getVisibility());
+
+  const MCExpr *Expr;
+
+  // For XPLINK, create a VCON relocation in case of a function, and
+  // a direct reference else.
+  MCSymbol *Sym = getSymbol(GA.getAliaseeObject());
+  if (IsFunc)
+    Expr = MCSpecifierExpr::create(MCSymbolRefExpr::create(Sym, OutContext),
+                                   SystemZ::S_VCon, OutContext);
+  else
+    Expr = MCSymbolRefExpr::create(Sym, OutContext);
+
+  OutStreamer->emitAssignment(Name, Expr);
+}
+
 void SystemZAsmPrinter::emitFunctionEntryLabel() {
   const SystemZSubtarget &Subtarget = MF->getSubtarget<SystemZSubtarget>();
 
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
index 31a9402df51a3..ab2a9754cfac1 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
@@ -132,6 +132,7 @@ class LLVM_LIBRARY_VISIBILITY SystemZAsmPrinter : public 
AsmPrinter {
   void emitFunctionBodyEnd() override;
   void emitStartOfAsmFile(Module &M) override;
   void emitGlobalVariable(const GlobalVariable *GV) override;
+  void emitGlobalAlias(const Module &M, const GlobalAlias &GA) override;
   const MCExpr *lowerConstant(const Constant *CV, const Constant *BaseCV = 
nullptr, uint64_t Offset = 0) override;
 
 private:

>From fc589d236c1acd11b5642d50bcf35d7c6dbcb028 Mon Sep 17 00:00:00 2001
From: Tony Tao <[email protected]>
Date: Mon, 24 Nov 2025 11:52:05 -0500
Subject: [PATCH 5/7] Syntax fix and remove comment

---
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index f84d8554f7adf..ce6905ecf8563 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -1129,7 +1129,6 @@ void SystemZAsmPrinter::emitEndOfAsmFile(Module &M) {
                                                   : MCSA_Global);
         OutStreamer->emitSymbolAttribute(Sym, isa<Function>(GO) ? MCSA_Code
                                                                 : MCSA_Data);
-        llvm::dbgs() << "TONY emitting " << Sym->getName() << "\n";
       }
     }
     OutStreamer->switchSection(

>From 4de4d1506adb3572df963c1b1d0144cda999f76a Mon Sep 17 00:00:00 2001
From: Tony Tao <[email protected]>
Date: Mon, 5 Jan 2026 14:52:43 -0500
Subject: [PATCH 6/7] undo commit fix

---
 clang/lib/Lex/HeaderMap.cpp                |  1 -
 llvm/lib/Support/VirtualOutputBackends.cpp | 10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp
index 588b32ee9ca8e..a7b670f00ac6e 100644
--- a/clang/lib/Lex/HeaderMap.cpp
+++ b/clang/lib/Lex/HeaderMap.cpp
@@ -18,7 +18,6 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/SystemZ/zOSSupport.h"
 #include <cstring>
 #include <memory>
 #include <optional>
diff --git a/llvm/lib/Support/VirtualOutputBackends.cpp 
b/llvm/lib/Support/VirtualOutputBackends.cpp
index a4701cd79dfce..d7a91dfa1471f 100644
--- a/llvm/lib/Support/VirtualOutputBackends.cpp
+++ b/llvm/lib/Support/VirtualOutputBackends.cpp
@@ -288,7 +288,7 @@ Error 
OnDiskOutputFile::tryToCreateTemporary(std::optional<int> &FD) {
     SmallString<128> UniquePath;
     sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
     if (std::error_code EC =
-            sys::fs::createUniqueFile(ModelPath, NewFD, UniquePath))
+            sys::fs::createUniqueFile(ModelPath, NewFD, UniquePath, OF))
       return make_error<TempFileOutputError>(ModelPath, OutputPath, EC);
 
     if (Config.getDiscardOnSignal())
@@ -332,13 +332,7 @@ Error OnDiskOutputFile::initializeFile(std::optional<int> 
&FD) {
   // Not using a temporary file. Open the final output file.
   return createDirectoriesOnDemand(OutputPath, Config, [&]() -> Error {
     int NewFD;
-    sys::fs::OpenFlags OF = sys::fs::OF_None;
-    if (Config.getTextWithCRLF())
-      OF |= sys::fs::OF_TextWithCRLF;
-    else if (Config.getText())
-      OF |= sys::fs::OF_Text;
-    if (Config.getAppend())
-      OF |= sys::fs::OF_Append;
+    sys::fs::OpenFlags OF = generateFlagsFromConfig(Config);
     if (std::error_code EC = sys::fs::openFileForWrite(
             OutputPath, NewFD, sys::fs::CD_CreateAlways, OF))
       return convertToOutputError(OutputPath, EC);

>From 29e544a8f6a46a4b922eaf9b2773c2675e76fed5 Mon Sep 17 00:00:00 2001
From: Tony Tao <[email protected]>
Date: Tue, 6 Jan 2026 15:40:12 -0500
Subject: [PATCH 7/7] Update MCSymbolAttr enum

---
 llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp 
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index ce6905ecf8563..da637e0b7434b 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -1127,14 +1127,13 @@ void SystemZAsmPrinter::emitEndOfAsmFile(Module &M) {
         OutStreamer->emitSymbolAttribute(Sym, GO.hasExternalWeakLinkage()
                                                   ? MCSA_WeakReference
                                                   : MCSA_Global);
-        OutStreamer->emitSymbolAttribute(Sym, isa<Function>(GO) ? MCSA_Code
-                                                                : MCSA_Data);
+        OutStreamer->emitSymbolAttribute(Sym, isa<Function>(GO) ? 
MCSA_ELF_TypeFunction
+                                                                : 
MCSA_ELF_TypeObject);
       }
     }
     OutStreamer->switchSection(
         static_cast<MCSectionGOFF *>(getObjFileLowering().getTextSection())
             ->getParent());
-    getTargetStreamer()->emitExterns();
     OutStreamer->popSection();
   }
   emitAttributes(M);
@@ -1734,7 +1733,7 @@ void SystemZAsmPrinter::emitPPA2(Module &M) {
 void SystemZAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
   if (TM.getTargetTriple().isOSzOS()) {
     auto *Sym = getSymbol(GV);
-    OutStreamer->emitSymbolAttribute(Sym, MCSA_Data);
+    OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeObject);
   }
 
   AsmPrinter::emitGlobalVariable(GV);
@@ -1761,7 +1760,7 @@ const MCExpr *SystemZAsmPrinter::lowerConstant(const 
Constant *CV,
       Sym = getSymbol(GV);
 
     if (IsFunc) {
-      OutStreamer->emitSymbolAttribute(Sym, MCSA_Code);
+      OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeFunction);
       if (FV->hasExternalLinkage()) {
         return MCSpecifierExpr::create(MCSymbolRefExpr::create(Sym, 
OutContext),
                                        SystemZ::S_VCon, OutContext);
@@ -1778,7 +1777,7 @@ const MCExpr *SystemZAsmPrinter::lowerConstant(const 
Constant *CV,
           MCConstantExpr::create(Disp, OutContext), OutContext);
     }
     if (Sym) {
-      OutStreamer->emitSymbolAttribute(Sym, MCSA_Data);
+      OutStreamer->emitSymbolAttribute(Sym, MCSA_ELF_TypeObject);
       return MCSymbolRefExpr::create(Sym, OutContext);
     }
   }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to