[llvm] [llvm-objcopy][ELF] Add an option to remove notes (PR #118739)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 01:08:33 PST 2025


================
@@ -0,0 +1,47 @@
+# RUN: yaml2obj --docnum=1 %s -o %t1
+# RUN: llvm-objcopy --remove-note=1 %t1 %t1o 2>&1 | FileCheck %s --check-prefix=NOTE_SEGMENT
+# NOTE_SEGMENT: warning: note segments are not supported
+# NOTE_SEGMENT-NOT: note segments are not supported
+
+--- !ELF
+FileHeader:
+  Class:          ELFCLASS64
+  Data:           ELFDATA2LSB
+  Type:           ET_EXEC
+  Machine:        EM_X86_64
+ProgramHeaders:
+  - Type:         PT_NOTE
+    FirstSec:     .data0
+    LastSec:      .data0
+  - Type:         PT_NOTE
+    FirstSec:     .data1
+    LastSec:      .data1
+Sections:
+  - Name:         .data0
+    Type:         SHT_PROGBITS
----------------
jh7370 wrote:

You can more closely simulate the "real thing" by changing this type value to `Fill`. This is a special kind of "Section" in yaml2obj that doesn't appear in the section header table. 

https://github.com/llvm/llvm-project/pull/118739


More information about the llvm-commits mailing list