[ELF] Fix broken bitstream linking with lld when e_machine > 255
authorChristian Iversen <ci@iversenit.dk>
Sun, 11 Oct 2020 21:19:25 +0000 (14:19 -0700)
committerFangrui Song <i@maskray.me>
Sun, 11 Oct 2020 21:19:25 +0000 (14:19 -0700)
commita9cefc3deee04566735351c27194a9693742aadf
treeaa5561da74fe011a7a49c1c76f9df37f71375431
parent8178e41dc1a395fc0a99f945bf27fbfca871d3e5
[ELF] Fix broken bitstream linking with lld when e_machine > 255

In ELF/InputFiles.cpp, getBitcodeMachineKind() is limited to uint8_t return
type. This works as long as EM_xxx is < 256, which is true for common
architectures, but not for some newly assigned or unofficial EM_* values.

The corresponding ELF field (e_machine) can hold uint16_t.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D89185
lld/ELF/InputFiles.cpp