Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XCOFF] Add compiler version to an auxiliary symbol table entry #80162

Merged
merged 3 commits into from
Feb 6, 2024

Conversation

stephenpeckham
Copy link
Contributor

C_FILE symbols. To match the behavior of the assembler and the legacy compiler, this includes using the generic ".file" name for the C_FILE symbol and generating the actual file name in an auxiliary entry.

C_FILE symbols. To match the behavior of the assembler and the legacy
compiler, this includes using the generic ".file" name for the C_FILE
symbol and generating the actual file name in an auxiliary entry.
@stephenpeckham stephenpeckham self-assigned this Jan 31, 2024
@llvmbot llvmbot added mc Machine (object) code llvm:binary-utilities labels Jan 31, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 31, 2024

@llvm/pr-subscribers-mc

@llvm/pr-subscribers-llvm-binary-utilities

Author: None (stephenpeckham)

Changes

C_FILE symbols. To match the behavior of the assembler and the legacy compiler, this includes using the generic ".file" name for the C_FILE symbol and generating the actual file name in an auxiliary entry.


Patch is 241.78 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/80162.diff

48 Files Affected:

  • (modified) llvm/include/llvm/BinaryFormat/XCOFF.h (+1)
  • (modified) llvm/include/llvm/MC/MCAssembler.h (+11)
  • (modified) llvm/lib/MC/MCAsmStreamer.cpp (+15-10)
  • (modified) llvm/lib/MC/MCObjectStreamer.cpp (+4-1)
  • (modified) llvm/lib/MC/XCOFFObjectWriter.cpp (+64-11)
  • (modified) llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll (+4-4)
  • (modified) llvm/test/CodeGen/PowerPC/aix-extern-weak.ll (+3-4)
  • (modified) llvm/test/CodeGen/PowerPC/aix-extern.ll (+3-4)
  • (modified) llvm/test/CodeGen/PowerPC/aix-filename-c.ll (+2-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll (+2-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-filename-f.ll (+2-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll (+12-2)
  • (modified) llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll (+14-14)
  • (modified) llvm/test/CodeGen/PowerPC/aix-overflow-toc.py (+8-8)
  • (modified) llvm/test/CodeGen/PowerPC/aix-relro-section.ll (+12-12)
  • (modified) llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll (+24-24)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-ie-xcoff-reloc.ll (+94-96)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large.ll (+61-61)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc-large32.ll (+68-68)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc.ll (+54-54)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-le-xcoff-reloc32.ll (+61-61)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc-large.ll (+104-94)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-xcoff-reloc.ll (+96-97)
  • (modified) llvm/test/CodeGen/PowerPC/aix-tls-xcoff-variables.ll (+33-34)
  • (modified) llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll (+11-11)
  • (modified) llvm/test/CodeGen/PowerPC/aix-weak.ll (+3-4)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll (+15-15)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-data.ll (+17-5)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section-debug.ll (+4-4)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-exception-section.ll (+8-8)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll (+7-7)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-funcsect.ll (+78-78)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-lcomm.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-large.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll (+29-17)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-rodata.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll (+23-23)
  • (modified) llvm/test/CodeGen/PowerPC/basic-toc-data-def.ll (+10-12)
  • (modified) llvm/test/CodeGen/PowerPC/basic-toc-data-extern.ll (+16-16)
  • (modified) llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-td.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-annotations-tw.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/pgo-ref-directive.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/toc-data-const.ll (+28-28)
  • (modified) llvm/test/MC/PowerPC/aix-file-symbols.s (+8-8)
  • (modified) llvm/test/tools/llvm-objdump/XCOFF/symbol-table.test (+23-23)
diff --git a/llvm/include/llvm/BinaryFormat/XCOFF.h b/llvm/include/llvm/BinaryFormat/XCOFF.h
index 19d44a5ac57f1..bbcd8a4f29ae9 100644
--- a/llvm/include/llvm/BinaryFormat/XCOFF.h
+++ b/llvm/include/llvm/BinaryFormat/XCOFF.h
@@ -27,6 +27,7 @@ namespace XCOFF {
 
 constexpr size_t FileNamePadSize = 6;
 constexpr size_t NameSize = 8;
+constexpr size_t AuxFileEntNameSize = 14;
 constexpr size_t FileHeaderSize32 = 20;
 constexpr size_t FileHeaderSize64 = 24;
 constexpr size_t AuxFileHeaderSize32 = 72;
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index 5ae5f6d709385..4e0c627808605 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -133,6 +133,8 @@ class MCAssembler {
 
   /// List of declared file names
   std::vector<std::pair<std::string, size_t>> FileNames;
+  // Optional compiler version.
+  std::string CompilerVersion;
 
   MCDwarfLineTableParams LTParams;
 
@@ -486,6 +488,15 @@ class MCAssembler {
     FileNames.emplace_back(std::string(FileName), Symbols.size());
   }
 
+  bool setCompilerVersion(std::string CompilerVers) {
+    if (CompilerVersion.empty()) {
+      CompilerVersion = CompilerVers;
+      return true;
+    }
+    return false;
+  }
+  StringRef getCompilerVersion() { return CompilerVersion; }
+
   /// Write the necessary bundle padding to \p OS.
   /// Expects a fragment \p F containing instructions and its size \p FSize.
   void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F,
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 49668de27d67e..14a499f045edc 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -1590,17 +1590,22 @@ void MCAsmStreamer::emitFileDirective(StringRef Filename,
   assert(MAI->hasFourStringsDotFile());
   OS << "\t.file\t";
   PrintQuotedString(Filename, OS);
-  OS << ",";
-  if (!CompilerVerion.empty()) {
-    PrintQuotedString(CompilerVerion, OS);
-  }
-  if (!TimeStamp.empty()) {
-    OS << ",";
-    PrintQuotedString(TimeStamp, OS);
-  }
-  if (!Description.empty()) {
+  bool useTimeStamp = !TimeStamp.empty();
+  bool useCompilerVersion = !CompilerVerion.empty();
+  bool useDescription = !Description.empty();
+  if (useTimeStamp || useCompilerVersion || useDescription) {
     OS << ",";
-    PrintQuotedString(Description, OS);
+    if (useTimeStamp)
+      PrintQuotedString(TimeStamp, OS);
+    if (useCompilerVersion || useDescription) {
+      OS << ",";
+      if (useCompilerVersion)
+        PrintQuotedString(CompilerVerion, OS);
+      if (useDescription) {
+        OS << ",";
+        PrintQuotedString(Description, OS);
+      }
+    }
   }
   EmitEOL();
 }
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index d11ccfb5e269f..cf53ac2d04102 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -902,7 +902,10 @@ void MCObjectStreamer::emitFileDirective(StringRef Filename,
                                          StringRef TimeStamp,
                                          StringRef Description) {
   getAssembler().addFileName(Filename);
-  // TODO: add additional info to integrated assembler.
+  if (!CompilerVerion.empty())
+    getAssembler().setCompilerVersion(CompilerVerion.data());
+  // TODO: add TimeStamp and Description to .file symbol table entry
+  // with the integrated assembler.
 }
 
 void MCObjectStreamer::emitAddrsig() {
diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp
index 343e2fc877bc3..ecdba0a284b9c 100644
--- a/llvm/lib/MC/XCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/XCOFFObjectWriter.cpp
@@ -361,6 +361,8 @@ class XCOFFObjectWriter : public MCObjectWriter {
   bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
   bool nameShouldBeInStringTable(const StringRef &);
   void writeSymbolName(const StringRef &);
+  bool auxFileSymNameShouldBeInStringTable(const StringRef &);
+  void writeAuxFileSymName(const StringRef &);
 
   void writeSymbolEntryForCsectMemberLabel(const Symbol &SymbolRef,
                                            const XCOFFSection &CSectionRef,
@@ -391,7 +393,8 @@ class XCOFFObjectWriter : public MCObjectWriter {
                                            const MCAsmLayout &Layout,
                                            CInfoSymSectionEntry &CInfoSymEntry,
                                            uint64_t &CurrentAddressLocation);
-  void writeSymbolTable(const MCAsmLayout &Layout);
+  void writeSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout);
+  void writeSymbolAuxFileEntry(StringRef &Name, uint8_t ftype);
   void writeSymbolAuxDwarfEntry(uint64_t LengthOfSectionPortion,
                                 uint64_t NumberOfRelocEnt = 0);
   void writeSymbolAuxCsectEntry(uint64_t SectionOrLength,
@@ -416,7 +419,7 @@ class XCOFFObjectWriter : public MCObjectWriter {
   // *) Assigns symbol table indices.
   // *) Builds up the section header table by adding any non-empty sections to
   //    `Sections`.
-  void assignAddressesAndIndices(const MCAsmLayout &);
+  void assignAddressesAndIndices(MCAssembler &Asm, const MCAsmLayout &);
   // Called after relocations are recorded.
   void finalizeSectionInfo();
   void finalizeRelocationInfo(SectionEntry *Sec, uint64_t RelCount);
@@ -634,12 +637,20 @@ void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
   if (FileNames.empty())
     FileNames.emplace_back(".file", 0);
   for (const std::pair<std::string, size_t> &F : FileNames) {
-    if (nameShouldBeInStringTable(F.first))
+    if (auxFileSymNameShouldBeInStringTable(F.first))
       Strings.add(F.first);
   }
 
+  // Always add ".file" to the symbol table. The actual file name will be in
+  // the AUX_FILE auxiliary entry.
+  if (nameShouldBeInStringTable(".file"))
+    Strings.add(".file");
+  StringRef Vers = Asm.getCompilerVersion();
+  if (auxFileSymNameShouldBeInStringTable(Vers))
+    Strings.add(Vers);
+
   Strings.finalize();
-  assignAddressesAndIndices(Layout);
+  assignAddressesAndIndices(Asm, Layout);
 }
 
 void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
@@ -812,7 +823,7 @@ uint64_t XCOFFObjectWriter::writeObject(MCAssembler &Asm,
   writeSectionHeaderTable();
   writeSections(Asm, Layout);
   writeRelocations();
-  writeSymbolTable(Layout);
+  writeSymbolTable(Asm, Layout);
   // Write the string table.
   Strings.write(W.OS);
 
@@ -872,6 +883,36 @@ void XCOFFObjectWriter::writeSymbolAuxCsectEntry(uint64_t SectionOrLength,
   }
 }
 
+bool XCOFFObjectWriter::auxFileSymNameShouldBeInStringTable(
+    const StringRef &SymbolName) {
+  return SymbolName.size() > XCOFF::AuxFileEntNameSize;
+}
+
+void XCOFFObjectWriter::writeAuxFileSymName(const StringRef &SymbolName) {
+  // Magic, Offset or SymbolName.
+  if (auxFileSymNameShouldBeInStringTable(SymbolName)) {
+    W.write<int32_t>(0);
+    W.write<uint32_t>(Strings.getOffset(SymbolName));
+    W.OS.write_zeros(XCOFF::FileNamePadSize);
+  } else {
+    char Name[XCOFF::AuxFileEntNameSize + 1];
+    std::strncpy(Name, SymbolName.data(), XCOFF::AuxFileEntNameSize);
+    ArrayRef<char> NameRef(Name, XCOFF::AuxFileEntNameSize);
+    W.write(NameRef);
+  }
+}
+
+void XCOFFObjectWriter::writeSymbolAuxFileEntry(StringRef &Name,
+                                                uint8_t ftype) {
+  writeAuxFileSymName(Name);
+  W.write<uint8_t>(ftype);
+  W.OS.write_zeros(2);
+  if (is64Bit())
+    W.write<uint8_t>(XCOFF::AUX_FILE);
+  else
+    W.OS.write_zeros(1);
+}
+
 void XCOFFObjectWriter::writeSymbolAuxDwarfEntry(
     uint64_t LengthOfSectionPortion, uint64_t NumberOfRelocEnt) {
   writeWord(LengthOfSectionPortion);
@@ -1103,8 +1144,11 @@ void XCOFFObjectWriter::writeRelocations() {
       writeRelocation(Reloc, *DwarfSection.DwarfSect);
 }
 
-void XCOFFObjectWriter::writeSymbolTable(const MCAsmLayout &Layout) {
+void XCOFFObjectWriter::writeSymbolTable(MCAssembler &Asm,
+                                         const MCAsmLayout &Layout) {
   // Write C_FILE symbols.
+  StringRef Vers = Asm.getCompilerVersion();
+
   for (const std::pair<std::string, size_t> &F : FileNames) {
     // The n_name of a C_FILE symbol is the source file's name when no auxiliary
     // entries are present.
@@ -1133,9 +1177,15 @@ void XCOFFObjectWriter::writeSymbolTable(const MCAsmLayout &Layout) {
     else
       CpuID = XCOFF::TCPU_COM;
 
-    writeSymbolEntry(FileName, /*Value=*/0, XCOFF::ReservedSectionNum::N_DEBUG,
+    int NumberOfFileAuxEntries = 1;
+    if (!Vers.empty())
+      ++NumberOfFileAuxEntries;
+    writeSymbolEntry(".file", /*Value=*/0, XCOFF::ReservedSectionNum::N_DEBUG,
                      /*SymbolType=*/(LangID << 8) | CpuID, XCOFF::C_FILE,
-                     /*NumberOfAuxEntries=*/0);
+                     NumberOfFileAuxEntries);
+    writeSymbolAuxFileEntry(FileName, XCOFF::XFT_FN);
+    if (!Vers.empty())
+      writeSymbolAuxFileEntry(Vers, XCOFF::XFT_CV);
   }
 
   if (CInfoSymSection.Entry)
@@ -1351,9 +1401,12 @@ void XCOFFObjectWriter::addCInfoSymEntry(StringRef Name, StringRef Metadata) {
       std::make_unique<CInfoSymInfo>(Name.str(), Metadata.str()));
 }
 
-void XCOFFObjectWriter::assignAddressesAndIndices(const MCAsmLayout &Layout) {
-  // The symbol table starts with all the C_FILE symbols.
-  uint32_t SymbolTableIndex = FileNames.size();
+void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm,
+                                                  const MCAsmLayout &Layout) {
+  // The symbol table starts with all the C_FILE symbols. Each C_FILE symbol
+  // requires 1 or 2 auxiliary entries.
+  uint32_t SymbolTableIndex =
+      (2 + (Asm.getCompilerVersion().empty() ? 0 : 1)) * FileNames.size();
 
   if (CInfoSymSection.Entry)
     SymbolTableIndex++;
diff --git a/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll b/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll
index 209f0e9c38385..cac616fa40371 100644
--- a/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-alias-alignment-2.ll
@@ -58,7 +58,7 @@ define void @foo3(%struct.B %a1) {
 ; ASM-NEXT:      .vbyte     4, 34
 
 ; SYM:      SYMBOL TABLE:
-; SYM-NEXT: 00000000      df *DEBUG*	00000000 <stdin>
+; SYM-NEXT: 00000000      df *DEBUG*	00000000 .file
 ; SYM-NEXT: 00000000 l       .text	0000008a 
 ; SYM-NEXT: 00000000 g     F .text (csect: ) 	00000000 .foo1
 ; SYM-NEXT: 00000030 g     F .text (csect: ) 	00000000 .foo2
diff --git a/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll b/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll
index a1ad80481adf1..1049206003767 100644
--- a/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-alias-alignment.ll
@@ -61,7 +61,7 @@ define void @foo(i32 %a1, i32 %a2, i32 %a3) {
 ; OBJ-NEXT:        c: 4e 80 00 20  	blr
 
 ; SYM:      SYMBOL TABLE:
-; SYM-NEXT: 00000000      df *DEBUG*	00000000 <stdin>
+; SYM-NEXT: 00000000      df *DEBUG*	00000000 .file
 ; SYM-NEXT: 00000000 l       .text	00000029 
 ; SYM-NEXT: 00000000 g     F .text (csect: ) 	00000000 .foo
 ; SYM-NEXT: 0000002c l       .data	00000008 .data
diff --git a/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll b/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll
index f87184f7b4bf4..0ad229004b8a3 100644
--- a/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-available-externally-linkage-fun.ll
@@ -6,11 +6,11 @@
 
 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
 ; RUN:     -mattr=-altivec -filetype=obj -o %t.o < %s
-; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefix=OBJ %s
+; RUN: llvm-readobj --symbols %t.o | FileCheck -D#NFA=2 --check-prefix=OBJ %s
 
 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
 ; RUN:     -mattr=-altivec -filetype=obj -o %t64.o < %s
-; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefix=OBJ %s
+; RUN: llvm-readobj --symbols %t64.o | FileCheck -D#NFA=2 --check-prefix=OBJ %s
 
 define available_externally i32 @foo(i32 %a) {
 entry:
@@ -27,7 +27,7 @@ entry:
 ; OBJ-NEXT: StorageClass: C_EXT (0x2)
 ; OBJ-NEXT: NumberOfAuxEntries: 1
 ; OBJ-NEXT: CSECT Auxiliary Entry {
-; OBJ-NEXT:   Index: 2
+; OBJ-NEXT:   Index: [[#NFA+2]]
 ; OBJ-NEXT:   SectionLen: 0
 ; OBJ-NEXT:   ParameterHashIndex: 0x0
 ; OBJ-NEXT:   TypeChkSectNum: 0x0
@@ -42,7 +42,7 @@ entry:
 ; OBJ-NEXT: StorageClass: C_EXT (0x2)
 ; OBJ-NEXT: NumberOfAuxEntries: 1
 ; OBJ-NEXT: CSECT Auxiliary Entry {
-; OBJ-NEXT:   Index: 4
+; OBJ-NEXT:   Index: [[#NFA+4]]
 ; OBJ-NEXT:   SectionLen: 0
 ; OBJ-NEXT:   ParameterHashIndex: 0x0
 ; OBJ-NEXT:   TypeChkSectNum: 0x0
diff --git a/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll b/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
index 11b6827c33b1e..ea61fdb022b5c 100644
--- a/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
@@ -65,16 +65,15 @@ declare extern_weak void @foo_ext_weak(ptr)
 ; CHECKSYM:      Symbols [
 ; CHECKSYM-NEXT:   Symbol {
 ; CHECKSYM-NEXT:     Index: 0
-; CHECKSYM-NEXT:     Name: <stdin>
+; CHECKSYM-NEXT:     Name: .file
 ; CHECKSYM-NEXT:     Value (SymbolTableIndex): 0x0
 ; CHECKSYM-NEXT:     Section: N_DEBUG
 ; CHECKSYM-NEXT:     Source Language ID: TB_CPLUSPLUS (0x9)
 ; CHECKSYM32-NEXT:   CPU Version ID: TCPU_COM (0x3)
 ; CHECKSYM64-NEXT:   CPU Version ID: TCPU_PPC64 (0x2)
 ; CHECKSYM-NEXT:     StorageClass: C_FILE (0x67)
-; CHECKSYM-NEXT:     NumberOfAuxEntries: 0
-; CHECKSYM-NEXT:   }
-; CHECKSYM-NEXT:   Symbol {
+; CHECKSYM-NEXT:     NumberOfAuxEntries: 2
+; CHECKSYM:        Symbol {
 ; CHECKSYM-NEXT:     Index: [[#Index:]]
 ; CHECKSYM-NEXT:     Name: .foo_ext_weak
 ; CHECKSYM-NEXT:     Value (RelocatableAddress): 0x0
diff --git a/llvm/test/CodeGen/PowerPC/aix-extern.ll b/llvm/test/CodeGen/PowerPC/aix-extern.ll
index 905e458473905..b4366dddedb2f 100644
--- a/llvm/test/CodeGen/PowerPC/aix-extern.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-extern.ll
@@ -88,16 +88,15 @@ declare i32 @bar_extern(ptr)
 ; CHECKSYM:       Symbols [
 ; CHECKSYM-NEXT:   Symbol {
 ; CHECKSYM-NEXT:     Index: 0
-; CHECKSYM-NEXT:     Name: <stdin>
+; CHECKSYM-NEXT:     Name: .file
 ; CHECKSYM-NEXT:     Value (SymbolTableIndex): 0x0
 ; CHECKSYM-NEXT:     Section: N_DEBUG
 ; CHECKSYM-NEXT:     Source Language ID: TB_CPLUSPLUS (0x9)
 ; CHECKSYM32-NEXT:   CPU Version ID: TCPU_COM (0x3)
 ; CHECKSYM64-NEXT:   CPU Version ID: TCPU_PPC64 (0x2)
 ; CHECKSYM-NEXT:     StorageClass: C_FILE (0x67)
-; CHECKSYM-NEXT:     NumberOfAuxEntries: 0
-; CHECKSYM-NEXT:   }
-; CHECKSYM-NEXT:   Symbol {
+; CHECKSYM-NEXT:     NumberOfAuxEntries: 2
+; CHECKSYM:        Symbol {
 ; CHECKSYM-NEXT:     Index: [[#Index:]]
 ; CHECKSYM-NEXT:     Name: .bar_extern
 ; CHECKSYM-NEXT:     Value (RelocatableAddress): 0x0
diff --git a/llvm/test/CodeGen/PowerPC/aix-filename-c.ll b/llvm/test/CodeGen/PowerPC/aix-filename-c.ll
index 2adc51cc2aecc..c4202a0c58cee 100644
--- a/llvm/test/CodeGen/PowerPC/aix-filename-c.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-filename-c.ll
@@ -5,7 +5,8 @@
 
 source_filename = "1.c"
 
-; OBJ: Name: 1.c
+; OBJ: Name: .file
 ; OBJ: Source Language ID: TB_C (0x0)
 ; OBJ32: CPU Version ID: TCPU_COM (0x3)
 ; OBJ64: CPU Version ID: TCPU_PPC64 (0x2)
+; OBJ: Name: 1.c
diff --git a/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll b/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll
index 22496be1dfc88..802281b6c1eaa 100644
--- a/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-filename-cpp.ll
@@ -5,7 +5,8 @@
 
 source_filename = "1.cpp"
 
-; OBJ: Name: 1.cpp
+; OBJ: Name: .file
 ; OBJ: Source Language ID: TB_CPLUSPLUS (0x9)
 ; OBJ32: CPU Version ID: TCPU_COM (0x3)
 ; OBJ64: CPU Version ID: TCPU_PPC64 (0x2)
+; OBJ: Name: 1.cpp
diff --git a/llvm/test/CodeGen/PowerPC/aix-filename-f.ll b/llvm/test/CodeGen/PowerPC/aix-filename-f.ll
index 914c4facc3cf5..99036bde702d6 100644
--- a/llvm/test/CodeGen/PowerPC/aix-filename-f.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-filename-f.ll
@@ -5,7 +5,8 @@
 
 source_filename = "1.f95"
 
-; OBJ: Name: 1.f95
+; OBJ: Name: .file
 ; OBJ: Source Language ID: TB_Fortran (0x1)
 ; OBJ32: CPU Version ID: TCPU_COM (0x3)
 ; OBJ64: CPU Version ID: TCPU_PPC64 (0x2)
+; OBJ: Name: 1.f95
diff --git a/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll b/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
index 23fb51e944424..4cca1b4d6f7ba 100644
--- a/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
@@ -13,13 +13,23 @@ entry:
 ; CHECK-NEXT: AddressSize: 32bit
 ; CHECK:        Symbol {
 ; CHECK-NEXT:     Index: 0
-; CHECK-NEXT:     Name: <stdin>
+; CHECK-NEXT:     Name: .file
 ; CHECK-NEXT:     Value (SymbolTableIndex): 0x0
 ; CHECK-NEXT:     Section: N_DEBUG
 ; CHECK-NEXT:     Source Language ID: TB_CPLUSPLUS (0x9)
 ; CHECK-NEXT:     CPU Version ID: TCPU_COM (0x3)
 ; CHECK-NEXT:     StorageClass: C_FILE (0x67)
-; CHECK-NEXT:     NumberOfAuxEntries: 0
+; CHECK-NEXT:     NumberOfAuxEntries: 2
+; CHECK-NEXT:     File Auxiliary Entry {
+; CHECK-NEXT:       Index: 1
+; CHECK-NEXT:       Name:
+; CHECK-NEXT:       Type: XFT_FN (0x0)
+; CHECK-NEXT:     }
+; CHECK-NEXT:     File Auxiliary Entry {
+; CHECK-NEXT:       Index: 2
+; CHECK-NEXT:       Name: LLVM
+; CHECK-NEXT:       Type: XFT_CV (0x2)
+; CHECK-NEXT:     }
 ; CHECK-NEXT:   }
 ; CHECK-NEXT:   Symbol {
 ; CHECK-NEXT:     Index: [[#Index:]]
diff --git a/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll b/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
index 09aec55a5b3df..50677f36e3f7a 100644
--- a/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-llvm-intrinsic.ll
@@ -7,12 +7,12 @@
 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
 ; RUN:     -mattr=-altivec -filetype=obj -o %t.o < %s
 ; RUN: llvm-readobj --symbols %t.o | FileCheck --check-prefixes=CHECKSYM,CHECKSYM32 %s
-; RUN: llvm-objdump -r -d --symbol-description %t.o | FileCheck --check-prefixes=CHECKRELOC,CHECKRELOC32 %s
+; RUN: llvm-objdump -r -d --symbol-description %t.o | FileCheck -D#NFA=2 --check-prefixes=CHECKRELOC,CHECKRELOC32 %s
 
 ; RUN: llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff -mcpu=pwr4 \
 ; RUN:     -mattr=-altivec -filetype=obj -o %t64.o < %s
 ; RUN: llvm-readobj --symbols %t64.o | FileCheck --check-prefixes=CHECKSYM,CHECKSYM64 %s
-; RUN: llvm-objdump -r -d --symbol-description %t64.o | FileCheck --check-prefixes=CHECKRELOC,CHECKRELOC64 %s
+; RUN: llvm-objdump -r -d --symbol-description %t64.o | FileCheck -D#NFA=2 --check-prefixes=CHECKRELOC,CHECKRELOC64 %s
 
 %struct.S = type { i32, i32 }
 
@@ -40,17 +40,17 @@ declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg)
 
 ; CHECKSYM:        Symbol {
 ; CHECKSYM-NEXT:     Index: 0
-; CHECKSYM-NEXT:     Name: <stdin>
+; CHECKSYM-NEXT:     Name: .file
 ; CHECKSYM-NEXT:     Value (SymbolTableIndex): 0x0
 ; CHECKSYM-NEXT:     Section: N_DEBUG
 ; CHECKSYM-NEXT:     Source Language ID: TB_CPLUSPLUS (0x9)
 ; CHECKSYM32-NEXT:   CPU Version ID: TCPU_COM (0x3)
 ; CHECKSYM64-NEXT:   CPU Version ID: TCPU_PPC64 (0x2)
 ; CHECKSYM-NEXT:     StorageClass: C_FILE (0x67)
-; CHECKSYM-NEXT:     NumberOfAuxEntries: 0
-; CHECKSYM-NEXT:   }
-; CHECKSYM-NEXT:   Symbol {
-; CHECKSYM-NEXT:     Index: 1
+; CHECKSYM-NEXT:     NumberOfAuxEntries: 2
+; CHECKSYM:   }
+; CHECKSYM:   Symbol {
+; CHECKSYM:     Index: 3
 ; CHECKSYM32-NEXT:     Name: .___memset
 ; CHECKSYM64-NEXT:     Name: .___memset64
 ; CHECKSYM-NEXT:     Value (RelocatableAddress): 0x0
@@ -59,7 +59,7 @@ declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg)
 ; CHECKSYM-NEXT:     StorageClass: C_EXT (0x2)
 ; CHECKSYM-NEXT:     NumberOfAuxEntries: 1
 ; CHECKSYM-NEXT:     CSECT Auxiliary Entry {
-; CHECKSYM-NEXT:       Index: 2
+; CHECKSYM-NEXT:       Index: 4
 ; CHECKSYM-NEXT:       SectionLen: 0
 ; CHECKSYM-NEXT:       ParameterHashIndex: 0x0
 ; CHECKSYM-NEXT:       TypeChkSectNum: 0x0
@@ -72,19 +72,19 @@ declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg)
 ; CHECKSYM-NEXT:     }
 ; CHECKSYM-NEXT:   }
 
-; CHECKRELOC32:      00000000 (idx: 7) .bar:
-; CHECKRELOC64:      0000000000000000 (idx: 7) .bar:
+; CHECKRELOC32:      00000000 (idx: [[#NFA+7]]) .bar:
+; CHECKRELOC64:      0000000000000000 (idx: [[#NFA+7]]) .bar:
 ; CHECKRELOC-NEXT:        0: 7c 08 02 a6                        mflr 0
 ; CHECKRELOC32-NEXT:...
[truncated]

Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@stephenpeckham stephenpeckham merged commit b1acb7a into llvm:main Feb 6, 2024
3 of 4 checks passed
@jplehr
Copy link
Contributor

jplehr commented Feb 6, 2024

This introduced a spelling mistake that broke some builds.
https://lab.llvm.org/buildbot/#/builders/193/builds/46220

jplehr pushed a commit that referenced this pull request Feb 6, 2024
Fixes a typo in llvm/lib/MC/MCObjectStreamer.cpp introduced in #80162
@nico
Copy link
Contributor

nico commented Feb 6, 2024

This seems to break tests, even after the spelling fix: http://45.33.8.238/linux/130117/step_12.txt

Does that look related?

@asl
Copy link
Collaborator

asl commented Feb 6, 2024

@stephenpeckham Apparently this was merged without waiting for buildkite results or ignoring its results. Linux build failed due to obvious spelling mistakes. Will you please next time wait until CI to finish?

Thanks!

@asl
Copy link
Collaborator

asl commented Feb 6, 2024

@nico How about revert?

; SYM-NEXT: }
; SYM-NEXT: File Auxiliary Entry {
; SYM-NEXT: Index: 2
; SYM-NEXT: Name: LLVM version 18.0.0git
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably "version 18.0.0git" should be removed.

@stephenpeckham
Copy link
Contributor Author

The other failing testcase was added after my PR was created. I didn't notice the failure that occured after the merge.

@stephenpeckham
Copy link
Contributor Author

PR #80902 created. Waiting for build results

@RSilicon
Copy link
Contributor

RSilicon commented Feb 6, 2024

Okay my PR broke too but only for this build for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:binary-utilities mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants