[PATCH] D128148: [XCOFF] write the aux header when the visibility is specified in XCOFF32.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 11:19:43 PDT 2022


DiggerLin added inline comments.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:314
   size_t auxiliaryHeaderSize() const {
-    assert(!needsAuxiliaryHeader() &&
-           "Auxiliary header support not implemented.");
-    return 0;
+    return HasVisibility && !is64Bit() ? XCOFF::AuxFileHeaderSizeShort : 0;
   }
----------------
add some comment here :
// TODO: not support 64-bit auxiliary header.


================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:783
+    return;
+  W.write<uint16_t>(0); // Magic
+  W.write<uint16_t>(
----------------
since we only implement the 32-bit auxiliary header here 
it is better to add a new function 

```
writeAuxFileHeader32() {
    W.write<uint16_t>(0); // Magic
   ... 
}  
```
and copy the code into the function.


```
 void XCOFFObjectWriter::writeAuxFileHeader() {
   if (!auxiliaryHeaderSize())
    return;
   if(!is64Bit()) 
     writeAuxFileHeader32();
  //TODO : 64-bit auxiliary header not implemented.   
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128148



More information about the llvm-commits mailing list