[PATCH] D120861: [XCOFF][1/3] support fileHeader and sectionHeaders in 64-bit XCOFF.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 13:52:47 PST 2022


DiggerLin added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:755
     }
 
+    writeWord(Sec->Size);                    // s_size
----------------
    if (!IsDwarf) {
      writeWord(Sec->Address); // s_paddr = s_vaddr
      writeWord(Sec->Address);
    } else {
      writeWord(0);
      writeWord(0);
    }

change to 


```
writeWord(IsDwarf? Sec->Address:0);
writeWord(IsDwarf? Sec->Address:0);
```




================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:758
+    writeWord(Sec->FileOffsetToData);        // s_scnptr
+    writeWord(Sec->FileOffsetToRelocations); // s_relptr
+    writeWord(0);                            // s_lnnoptr. Not supported yet.
----------------
from line 756 ~ 758 , all the field name are self_explain, we amy not need comments from them .


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:764
+      W.write<uint32_t>(0);         // s_nlnno. Not supported yet.
+      W.write<int32_t>(Sec->Flags); // s_flags
+      W.OS.write_zeros(4);
----------------
ditto


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:767
+    } else {
+      W.write<uint16_t>(Sec->RelocationCount); // s_nreloc
+      W.write<uint16_t>(0);                    // s_nlnno. Not supported yet.
----------------
ditto for comment.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:769
+      W.write<uint16_t>(0);                    // s_nlnno. Not supported yet.
+      W.write<int32_t>(Sec->Flags);            // s_flags
+    }
----------------
ditto for comment.


================
Comment at: llvm/test/CodeGen/PowerPC/aix-available-externally-linkage.ll:14
 
-; RUN: not --crash llc -verify-machineinstrs -mtriple powerpc64-ibm-aix-xcoff \
-; RUN:     -mcpu=pwr4 -mattr=-altivec -filetype=obj -o %t.o 2>&1 < %s | \
-; RUN:   FileCheck --check-prefix=XCOFF64 %s
-; XCOFF64: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
+;; FIXME: currently only fileHeader and sectionHeaders are supported in XCOFF64.
 
----------------
 I do not think there is anything to remind us to delete the  ";; FIXME:..." in later patch and and add 64bit object file test. 
maybe we can add writeSymbolEntry for 64 bit in the patch  , and using 

```
 if (TargetObjectWriter->is64Bit())
    report_fatal_error("64-bit XCOFF object files are not supported yet.");
```
in the function.
 
and then you do not need to modify all the test cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120861



More information about the llvm-commits mailing list