[llvm] [ELF][Objcopy] Dont corrupt symbol table when `--update-section` is called for ELF files (PR #170462)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 08:21:34 PST 2025


https://github.com/jh7370 commented:

Rather than a gtest test, this is probably better off being tested by a lit test that runs the whole llvm-objcopy process. There are plenty of examples at llvm/test/tools/llvm-objcopy/ELF. You can take the suggested test input I provided in the issue, run llvm-objcopy --update-section and then use llvm-readobj to dump the symbols to show that the section indexes are correct. You should probably also show the section list and contents are correct still too. There's no need to use a sanitizer - the issues with linking you saw in the ticket were caused by the corrupted symbol table that your new test will spot without the fix.

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


More information about the llvm-commits mailing list