[llvm] [llvm-objcopy] Add --gap-fill and --pad-to options (PR #65815)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 01:52:53 PDT 2023


================
@@ -0,0 +1,34 @@
+# RUN: yaml2obj %s >%t
+
+# Test gap fill with all allocatable output sections
+# RUN: llvm-objcopy -O binary --gap-fill=0xe9 %t %t-filled
+# RUN: od -v -Ax -t x1 %t-filled | FileCheck --match-full-lines %s
+# CHECK: 000000 aa bb cc dd e9 e9 e9 e9 11 22 33 44
+
+--- !ELF
+FileHeader:
+  Class:           ELFCLASS32
+  Data:            ELFDATA2LSB
+  Type:            ET_EXEC
+  Machine:         EM_HEXAGON
+Sections:
+  - Name:            .bss
+    Type:            SHT_NOBITS
+    Flags:           [ SHF_ALLOC, SHF_WRITE ]
+    Address:         0x0104
+    AddressAlign:    0x0001
+    Size:            4
+  - Name:            .section1
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_WRITE ]
+    Address:         0x0108
+    AddressAlign:    0x0001
+    Content:         '11223344'
+  - Name:            .section3
+    Type:            SHT_PROGBITS
+    Flags:           [ SHF_ALLOC, SHF_WRITE ]
+    Address:         0x0100
+    AddressAlign:    0x0001
+    Content:         'AABBCCDD'
+...
+
----------------
jh7370 wrote:

Nit: files should end with exactly one \n. It looks like this file might have a double one.

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


More information about the llvm-commits mailing list