forked from OSchip/llvm-project
[BOLT] Reject processing of PIE binaries
Summary: Check if the input binary ELF type. Reject any binary not of ET_EXEC type, including position-independent executables (PIEs). Also print the first function containing PIC jump table. (cherry picked from FBD8707274)
This commit is contained in:
parent
edc0cb1121
commit
a6a37995d9
|
@ -1407,7 +1407,7 @@ void BinaryFunction::postProcessJumpTables() {
|
|||
if (JT.Type == JumpTable::JTT_PIC && opts::JumpTables == JTS_BASIC) {
|
||||
opts::JumpTables = JTS_MOVE;
|
||||
outs() << "BOLT-INFO: forcing -jump-tables=move as PIC jump table was "
|
||||
"detected\n";
|
||||
"detected in function " << *this << '\n';
|
||||
}
|
||||
for (unsigned I = 0; I < JT.OffsetEntries.size(); ++I) {
|
||||
auto Offset = JT.OffsetEntries[I];
|
||||
|
|
|
@ -804,6 +804,11 @@ void RewriteInstance::discoverStorage() {
|
|||
exit(1);
|
||||
}
|
||||
auto Obj = ELF64LEFile->getELFFile();
|
||||
if (Obj->getHeader()->e_type != ELF::ET_EXEC) {
|
||||
errs() << "BOLT-ERROR: only non-PIE ELF executables are supported at the "
|
||||
"moment.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
EntryPoint = Obj->getHeader()->e_entry;
|
||||
|
||||
|
|
Loading…
Reference in New Issue