[PATCH] D69188: [llvm-objcopy] Preserve .ARM.attributes section when stripping files

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 03:08:50 PDT 2019


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/ELF/strip-preserve-arm-attributes.test:6-9
+# RUN: llvm-objcopy --strip-all %t %t2
+# RUN: llvm-readobj --sections %t2 | FileCheck %s
+# RUN: llvm-objcopy --strip-all-gnu %t %t3
+# RUN: llvm-readobj --sections %t3 | FileCheck %s
----------------
thieta wrote:
> jhenderson wrote:
> > Since the original issue was with llvm-strip, it probably makes sense to include llvm-strip invocations to test this. Probably the best thing to do would be to run llvm-strip and llvm-strip --strip-all-gnu and then cmp the output with the corresponding llvm-objcopy output.
> I think I understood what you mean - but just to make sure you meant something like this right:
> 
> ```
>  # RUN: yaml2obj %s > %t
> -# RUN: llvm-objcopy --strip-all %t %t2
> +# RUN: llvm-strip %t %t2
>  # RUN: llvm-readobj --sections %t2 | FileCheck %s
> -# RUN: llvm-objcopy --strip-all-gnu %t %t3
> +# RUN: llvm-strip --strip-all-gnu %t %t3
>  # RUN: llvm-readobj --sections %t3 | FileCheck %s
> +# RUN: llvm-objcopy --strip-all %t %t4
> +# RUN: cmp %t4 %t2
> +# RUN: llvm-objcopy --strip-all-gnu %t %t5
> +# RUN: cmp %t5 %t3```
That works. Or you can just add the llvm-strip ones afterwards instead:

```
# RUN: yaml2obj %s > %t
# RUN: llvm-objcopy --strip-all %t %t2
# RUN: llvm-readobj --sections %t2 | FileCheck %s
# RUN: llvm-objcopy --strip-all-gnu %t %t3
# RUN: llvm-readobj --sections %t3 | FileCheck %s
# RUN: llvm-strip %t -o %t4
# RUN: cmp %t4 %t2
# RUN: llvm-strip --strip-all-gnu %t -o %t5
# RUN: cmp %t5 %t3
```

As a note, llvm-strip strips files inline unless the -o option is specified. Thus `llvm-objcopy %t %t2 ` copies %t to %t2, whereas `llvm-strip %t %t2` strips both %t and %t2.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69188





More information about the llvm-commits mailing list