[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:50 PDT 2020


alexshap marked an inline comment 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
----------------
alexshap wrote:
> alexshap wrote:
> > 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
> typo: this particular test is ...
clang -fno-exceptions -fno-unwind-tables -c a.o seems to work (to get rid of eh_frame, __compact_unwind), I'll trim down the test tomorrow.


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