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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 27 09:20:08 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
+
+# ERROR-NOSYM: section '.gfids$y' does not have the corresponding symbol or the symbol has unexpected format
----------------
MaskRay wrote:

Ensure the `error: ` prefix is added. If there is a filename, use `error: [[FILE]]: section ... ` with `FileCheck ... -DFILE=%1.in.o`

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


More information about the llvm-commits mailing list