[llvm-objcopy] Emit error if removing symtab referenced by group section
authorGeorgy Komarov <jubnzv@gmail.com>
Mon, 29 Jun 2020 09:25:26 +0000 (10:25 +0100)
committerJames Henderson <james.henderson@sony.com>
Mon, 29 Jun 2020 09:42:03 +0000 (10:42 +0100)
commite503851d80e7a8a72e014bcb975157e828dab800
tree6028d7a43e4cfc48630f5b93128507fb6fdbb260
parent3500d9ec95741c1421d62b914bfa36aa6bbc6b4f
[llvm-objcopy] Emit error if removing symtab referenced by group section

SHT_GROUP sections contain a reference to a symbol indicating their
"signature" symbol. The symbol table containing this symbol is referred
to by the group section's sh_link field. If llvm-objcopy is instructed
to remove the symbol table, it will emit an error.

This fixes https://bugs.llvm.org/show_bug.cgi?id=46153.

Reviewed By: jhenderson, Higuoxing

Differential Revision: https://reviews.llvm.org/D82274
llvm/test/tools/llvm-objcopy/ELF/group.test
llvm/tools/llvm-objcopy/ELF/Object.cpp