[lld] a9cefc3 - [ELF] Fix broken bitstream linking with lld when e_machine > 255
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 11 14:19:55 PDT 2020
Author: Christian Iversen
Date: 2020-10-11T14:19:25-07:00
New Revision: a9cefc3deee04566735351c27194a9693742aadf
URL: https://github.com/llvm/llvm-project/commit/a9cefc3deee04566735351c27194a9693742aadf
DIFF: https://github.com/llvm/llvm-project/commit/a9cefc3deee04566735351c27194a9693742aadf.diff
LOG: [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
Added:
Modified:
lld/ELF/InputFiles.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index bd079b41ac90..e35b837f848c 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -1517,7 +1517,7 @@ static ELFKind getBitcodeELFKind(const Triple &t) {
return t.isArch64Bit() ? ELF64BEKind : ELF32BEKind;
}
-static uint8_t getBitcodeMachineKind(StringRef path, const Triple &t) {
+static uint16_t getBitcodeMachineKind(StringRef path, const Triple &t) {
switch (t.getArch()) {
case Triple::aarch64:
return EM_AARCH64;
More information about the llvm-commits
mailing list