[PATCH] D75382: [lld] Initial commit for new Mach-O backend

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 01:04:20 PDT 2020


int3 marked an inline comment as done.
int3 added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:106
+    isec->data = {buf + sec.offset, sec.size};
+    isec->align = 1 << sec.align;
+    isec->flags = sec.flags;
----------------
ruiu wrote:
> int3 wrote:
> > MaskRay wrote:
> > > What if sec.align is >= 32 ?
> > I haven't found the logic in ld64 that handles this, but some experimentation (creating object files with high alignments using yaml2obj and then passing it to ld64) suggests it does applies `mod 256` to `sec.align` w/o emitting warnings or anything. Obviously 2 ** 256 is still ridiculously large, and ultimately `ld64` emits a 2GB object file, so it looks like some silent overflows are happening.
> > 
> > I'm leaning towards applying `mod 32` here and emitting a warning.
> `mod 32` seems a bit too arbitrary, so how about always setting `isec->align` to `sec.align` with a warning if `sec.align` is too large?
how do you propose we align the addresses for sections with large `align` values?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75382





More information about the llvm-commits mailing list