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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 00:31:27 PDT 2020


ruiu 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;
----------------
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?


================
Comment at: lld/MachO/Options.td:11
+
+def version: Flag<["--"], "version">, HelpText<"Display the version number and exit">;
+
----------------
int3 wrote:
> MaskRay wrote:
> > --version uses a double-dash form while other long options use single-dash form. Can you confirm?
> hm, ld64 actually doesn't have a `version` flag at all, I was just copying lld-elf here... but I suppose it would make sense for this to be single-dash to be consistent with the other flags here (and in ld64)
It looks like ld64 does have `-v` instead of `--version` or `-version`.


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