[PATCH] D134250: [ObjectYAML] Support chained fixups, dyld exports trie, data in code
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 20:12:19 PDT 2022
Higuoxing added a comment.
I'm not familiar with Mach-O object files. I can only give some minor suggestions on your codes.
================
Comment at: llvm/lib/ObjectYAML/MachOEmitter.cpp:610
+void MachOWriter::writeChainedFixups(raw_ostream &OS) {
+ for (const auto Data : Obj.LinkEdit.ChainedFixups) {
+ OS.write(reinterpret_cast<const char *>(&Data),
----------------
Since `Obj.LinkEdit.ChainedFixups` is an array of bytes. You can simply serialize it using
```
if (Obj.LinkEdit.ChainedFixups.size() > 0)
OS.write(reinterpret_case<const char *>(Obj.LinkEdit.ChainedFixups.data()),
Obj.LinkEdit.ChainedFixups.size());
```
================
Comment at: llvm/lib/ObjectYAML/MachOEmitter.cpp:617
+void MachOWriter::writeDyldExportsTrie(raw_ostream &OS) {
+ for (const auto Data : Obj.LinkEdit.DyldExportsTrie) {
+ OS.write(reinterpret_cast<const char *>(&Data),
----------------
Ditto.
================
Comment at: llvm/lib/ObjectYAML/MachOEmitter.cpp:624
+void MachOWriter::writeDataInCode(raw_ostream &OS) {
+ for (const auto Data : Obj.LinkEdit.DataInCode) {
+ OS.write(reinterpret_cast<const char *>(&Data),
----------------
Ditto.
================
Comment at: llvm/tools/obj2yaml/macho2yaml.cpp:673
+ MachO::data_in_code_entry DICE = Obj.getDataInCodeTableEntry(DIC.dataoff, Idx);
+ uint8_t *Bytes = static_cast<uint8_t *>(static_cast<void *>(&DICE));
+ for (size_t Jdx = 0; Jdx < sizeof(MachO::data_in_code_entry); Jdx++) {
----------------
Why not using `reinterpret_case<>` here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134250/new/
https://reviews.llvm.org/D134250
More information about the llvm-commits
mailing list