State clearly that an ELF file has the wrong architecture.

Before:

  "libx.so" has unexpected e_machine: 40 (EM_ARM)

After:

  "libx.so" is for EM_X86_64 (62) instead of EM_AARCH64 (183)

Bug: N/A
Test: `LD_PRELOAD=/system/lib64/libm-x86_64.so date` on arm64
Change-Id: I5bb40c435bd22b4e11fe802615925e10db7fb631
This commit is contained in:
Elliott Hughes 2018-09-17 15:50:09 -07:00
parent 8b527f2857
commit d16cface55

View file

@ -257,8 +257,10 @@ bool ElfReader::VerifyElfHeader() {
}
if (header_.e_machine != GetTargetElfMachine()) {
DL_ERR("\"%s\" has unexpected e_machine: %d (%s)", name_.c_str(), header_.e_machine,
EM_to_string(header_.e_machine));
DL_ERR("\"%s\" is for %s (%d) instead of %s (%d)",
name_.c_str(),
EM_to_string(header_.e_machine), header_.e_machine,
EM_to_string(GetTargetElfMachine()), GetTargetElfMachine());
return false;
}