[llvm] [llvm-objcopy][COFF] Update .symidx values after stripping (PR #153322)

Evgenii Kudriashov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 18:59:52 PDT 2025


================
@@ -0,0 +1,225 @@
+## Bail out if a section consisting of symidx is invalid.
+## It includes both: an unexpected format for patching section data and
+## updating the checksum, as well as data validity.
+## Essentially, the expected format is a definitive symbol with a zero offset
+## linked to the section. Valid data consists of a sequence of symbol indices
+## that remain in the symbol table even after stripping.
+
+## In this case, the symbol .gfids$y is not present at all.
+
+# RUN: yaml2obj %s --docnum=1 -o %t1.in.o
+# RUN: not llvm-objcopy --strip-debug %t1.in.o %t1.out.o 2>&1 | FileCheck %s --check-prefix=ERROR-NOSYM -DFILE=%t1.out.o
+
+# ERROR-NOSYM: error: '[[FILE]]': section '.gfids$y' does not have the corresponding symbol or the symbol has unexpected format
+
+--- !COFF
+header:
+  Machine:         IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [  ]
+sections:
+  - Name:            .text
+    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+    Alignment:       4
+    SectionData:     488D0500000000488D0D00000000488D0500000000488D0500000000
----------------
e-kud wrote:

Reduced tests more

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


More information about the llvm-commits mailing list