[PATCH] D124895: [Object] Fix updating darwin archives

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 10:46:57 PDT 2022


jyknight added a comment.

I don't think we ought to modify the archive reader like you've done, because we don't need to tell the difference between BSD/DARWIN when reading, only while writing. Thus, going through the trouble of distinguishing them in the reader is wasted work. Instead, please add a separate function, which ar and objcopy can call before constructing an ArchiveWriter, which returns the more "refined" Kind.

Also, while your goal of improving the heuristics seems reasonable, perhaps we ought to have a --archive-format option for objcopy, so that users can be explicit if they desire. (We already have --format for ar, and for the cross-compiling case it's basically required -- there's simply no other way to choose the correct behavior for archives with no files, like `llvm-ar rcs x.a`).



================
Comment at: llvm/test/tools/llvm-objcopy/MachO/Inputs/unaligned_objects.yaml:1
+#--- first-object.yaml
+--- !mach-o
----------------
This file seems to have a lot of unnecessary junk in it (e.g. actual code, lots of symbols, etc). Can it be stripped down?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124895



More information about the llvm-commits mailing list