[PATCH] D97426: [lld-macho] Infer machine type from input files

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 10:58:02 PST 2021


oontvoo added inline comments.


================
Comment at: lld/MachO/Driver.cpp:148
+    // mach header, the two fields we care about have the same size & layout.
+    auto *hdr = reinterpret_cast<const mach_header_64 *>(buf);
+    return MachO::getArchitectureFromCpuType(hdr->cputype, hdr->cpusubtype);
----------------
But isn't this still technically UB? Would the UBSAN builds complain?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97426



More information about the llvm-commits mailing list