[llvm] [llvm-objcopy][ELF] Add an option to remove notes (PR #118739)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 01:32:15 PST 2024
================
@@ -0,0 +1,98 @@
+# RUN: not llvm-objcopy --remove-note= - 2>&1 | FileCheck %s --check-prefix=ERR-NOTYPEID
+# RUN: not llvm-objcopy --remove-note=/1 - 2>&1 | FileCheck %s --check-prefix=ERR-EMPTYNAME
+# RUN: not llvm-objcopy --remove-note=CORE/1/2 - 2>&1 | FileCheck %s --check-prefix=ERR-INVNUM1
+# RUN: not llvm-objcopy --remove-note=Notanumber - 2>&1 | FileCheck %s --check-prefix=ERR-INVNUM2
+# RUN: not llvm-objcopy --remove-note=CORE/Notanumber - 2>&1 | FileCheck %s --check-prefix=ERR-INVNUM2
+
+# ERR-NOTYPEID: error: bad format for --remove-note, missing type_id
+# ERR-EMPTYNAME: error: bad format for --remove-note, note name is empty
+# ERR-INVNUM1: error: bad note type_id for --remove-note: '1/2'
+# ERR-INVNUM2: error: bad note type_id for --remove-note: 'Notanumber'
+
+# RUN: yaml2obj -D ALIGN=8 %s -o - \
+# RUN: | llvm-objcopy --remove-note=0x01 --remove-note=DUMMY/0x02 --remove-note=CORE/0x03 - - \
+# RUN: | llvm-readobj --segments --sections --notes - \
----------------
jh7370 wrote:
It is much more common to write to a file on disk and then execute llvm-readobj on that. This makes it possible to post-mortem debug the created object file. Chaining like this makes it impossible to look at the object file if the test fails.
Equally, we tend to have yaml2obj write to an object file on disk - this makes it easier to manually rerun the test because you don't need to execute the yaml2obj command again.
https://github.com/llvm/llvm-project/pull/118739
More information about the llvm-commits
mailing list