[llvm] f5dd9dd - Remove support for 10.4 Tiger from AsmPrinter

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 00:34:08 PST 2022


Author: Guillaume Chatelet
Date: 2022-11-28T08:31:49Z
New Revision: f5dd9dda63d14323dca56b634c968ca9b1b5a686

URL: https://github.com/llvm/llvm-project/commit/f5dd9dda63d14323dca56b634c968ca9b1b5a686
DIFF: https://github.com/llvm/llvm-project/commit/f5dd9dda63d14323dca56b634c968ca9b1b5a686.diff

LOG: Remove support for 10.4 Tiger from AsmPrinter

I stumbled on this while trying to tighten Alignment in MCStreamer (D138705).
>From the [wikipedia page](https://en.wikipedia.org/wiki/Mac_OS_X_Tiger), last release of MacOSX Tiger was released 15 years ago and is not supported anymore by Apple.

Relevant commit : https://github.com/llvm/llvm-project/commit/9f06f911d197577b80d208a167980833b4fb9ad5#diff-17b326b45ef392288420bed274616afa7df81b27576c96723b3c25f5198dc398

Differential Revision: https://reviews.llvm.org/D138707

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCObjectFileInfo.h
    llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/lib/MC/MCObjectFileInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h
index 30276f70e5fd0..2ac18a28805db 100644
--- a/llvm/include/llvm/MC/MCObjectFileInfo.h
+++ b/llvm/include/llvm/MC/MCObjectFileInfo.h
@@ -27,10 +27,6 @@ class MCSection;
 
 class MCObjectFileInfo {
 protected:
-  /// True if .comm supports alignment.  This is a hack for as long as we
-  /// support 10.4 Tiger, whose assembler doesn't support alignment on comm.
-  bool CommDirectiveSupportsAlignment = false;
-
   /// True if target object file supports a weak_definition of constant 0 for an
   /// omitted EH frame.
   bool SupportsWeakOmittedEHFrame = false;
@@ -257,10 +253,6 @@ class MCObjectFileInfo {
     return OmitDwarfIfHaveCompactUnwind;
   }
 
-  bool getCommDirectiveSupportsAlignment() const {
-    return CommDirectiveSupportsAlignment;
-  }
-
   unsigned getFDEEncoding() const { return FDECFIEncoding; }
 
   unsigned getCompactUnwindDwarfEHFrameOnly() const {

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5238030a48775..414bed41d80f2 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -744,10 +744,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
   if (GVKind.isCommon()) {
     if (Size == 0) Size = 1;   // .comm Foo, 0 is undefined, avoid it.
     // .comm _foo, 42, 4
-    const bool SupportsAlignment =
-        getObjFileLowering().getCommDirectiveSupportsAlignment();
-    OutStreamer->emitCommonSymbol(GVSym, Size,
-                                  SupportsAlignment ? Alignment.value() : 0);
+    OutStreamer->emitCommonSymbol(GVSym, Size, Alignment.value());
     return;
   }
 
@@ -788,10 +785,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
     // .local _foo
     OutStreamer->emitSymbolAttribute(GVSym, MCSA_Local);
     // .comm _foo, 42, 4
-    const bool SupportsAlignment =
-        getObjFileLowering().getCommDirectiveSupportsAlignment();
-    OutStreamer->emitCommonSymbol(GVSym, Size,
-                                  SupportsAlignment ? Alignment.value() : 0);
+    OutStreamer->emitCommonSymbol(GVSym, Size, Alignment.value());
     return;
   }
 

diff  --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 57839473205f9..00213efb36c5e 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -80,10 +80,6 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) {
 
   FDECFIEncoding = dwarf::DW_EH_PE_pcrel;
 
-  // .comm doesn't support alignment before Leopard.
-  if (T.isMacOSX() && T.isMacOSXVersionLT(10, 5))
-    CommDirectiveSupportsAlignment = false;
-
   TextSection // .text
     = Ctx->getMachOSection("__TEXT", "__text",
                            MachO::S_ATTR_PURE_INSTRUCTIONS,
@@ -556,8 +552,6 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) {
   // and to set the ISA selection bit for calls accordingly.
   const bool IsThumb = T.getArch() == Triple::thumb;
 
-  CommDirectiveSupportsAlignment = true;
-
   // COFF
   BSSSection = Ctx->getCOFFSection(
       ".bss", COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA |
@@ -1035,7 +1029,6 @@ void MCObjectFileInfo::initMCObjectFileInfo(MCContext &MCCtx, bool PIC,
   Ctx = &MCCtx;
 
   // Common.
-  CommDirectiveSupportsAlignment = true;
   SupportsWeakOmittedEHFrame = true;
   SupportsCompactUnwindWithoutEHFrame = false;
   OmitDwarfIfHaveCompactUnwind = false;


        


More information about the llvm-commits mailing list