Template patchELFPHDRTable, rewriteNoteSections, markGnuRelroSections, and discoverStorage to support both ELF32LE and ELF64LE binaries. Previously these functions were hardcoded for ELF64LE, causing crashes when processing 32-bit ELF binaries. The RewriteInstance constructor now accepts ELF32LE objects in addition to ELF64LE. The ELF_FUNCTION macro is reused (and moved earlier in the header) to dispatch to the correct template instantiation. These changes are preparation for adding support to hexagon architecture in Bolt.
13 lines
594 B
Plaintext
13 lines
594 B
Plaintext
## Verify that BOLT accepts ELF32LE binaries and does not reject them with
|
|
## the old "Only 64-bit LE ELF binaries are supported" error.
|
|
## The binary uses EM_ARM which has no BOLT target support, so BOLT will fail
|
|
## with "Unrecognized machine in ELF file" -- that is expected. The point is
|
|
## that ELF32 parsing infrastructure works and does not reject the file
|
|
## outright.
|
|
|
|
RUN: yaml2obj %p/Inputs/elf32-basic.yaml -o %t.exe
|
|
RUN: not llvm-bolt %t.exe -o /dev/null 2>&1 | FileCheck %s
|
|
|
|
CHECK-NOT: Only 64-bit LE ELF binaries are supported
|
|
CHECK: BOLT-ERROR: Unrecognized machine in ELF file
|