[PATCH] D78474: [llvm-objcopy][MachO] Make --remove-section clean up dead symbols

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 20 02:06:47 PDT 2020


alexshap marked 2 inline comments as done.
alexshap added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/MachO/remove-section-error.test:98
+        reserved3:       0x00000000
+        content:         1400000000000000017A520001781001100C070890010000240000001C000000B0FFFFFFFFFFFFFF0C0000000000000000410E108602430D0600000000000000
+  - cmd:             LC_VERSION_MIN_MACOSX
----------------
jhenderson wrote:
> I know that mach-o yaml2obj requires very noisy output, but I'm guessing you don't need eh_frame data at least? Similarly, is there anything else you can remove?
it's kinda hard to remove things from here because it's tedious and error-prone to manually recalculate (e.g. harder than for ELF) the offsets specified in various places (e.g. in the load commands) and still get a valid binary (so that it can be parsed by llvm-readobj/llvm-objdump/otool).

this is particular test is based on a real world binary:
   a.c: 
       __attribute__((section("__DATA,C"))) int a = 2;
       int f() { return a; }
   clang -c a.c -o a.o


================
Comment at: llvm/tools/llvm-objcopy/MachO/Object.cpp:1
 #include "Object.h"
 #include "../llvm-objcopy.h"
----------------
jhenderson wrote:
> Could you fix the missing licence header please? Can be a separate change, no review needed.
sure, will do


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78474





More information about the llvm-commits mailing list