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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 2 11:03:21 PST 2021


int3 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);
----------------
oontvoo wrote:
> But isn't this still technically UB? Would the UBSAN builds complain?
> 
hm, why would it be UB?

In any case, per the other comments, I'm going to kill all this `inferMachineType` logic and just have things specified explicitly.


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