Add EM_RISCV as recognized value for ELF e_machine

`dump_syms` fails to write symbol file without knowing how to convert
the ELF `e_machine` field to a string.

Use "riscv" as the value because ELF `e_machine` does not distinguish
between 32 bit and 64 bit RISC-V.

Test: run `dump_syms` on the libc++ that's shipped with the Clang
toolchain, or any other riscv binary: `./dump_syms -r -n libc++.so -o
Fuchsia <clang_path>/lib/riscv64-unknown-fuchsia/libc++.so.2.0`
Bug: fuchsia:124084
Change-Id: Ic04db96ec3d3d484350bdd0b90c9dfb70d7f7eb2
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4376828
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Thomas Gales 2023-03-28 19:09:16 +00:00 committed by Mike Frysinger
parent c179ddaa58
commit b0dc1f3529

View file

@ -1022,6 +1022,7 @@ const char* ElfArchitecture(const typename ElfClass::Ehdr* elf_header) {
case EM_SPARC: return "sparc"; case EM_SPARC: return "sparc";
case EM_SPARCV9: return "sparcv9"; case EM_SPARCV9: return "sparcv9";
case EM_X86_64: return "x86_64"; case EM_X86_64: return "x86_64";
case EM_RISCV: return "riscv";
default: return NULL; default: return NULL;
} }
} }