[lld] [LLD][COFF][NFC] Use is64Bit in Baserel::getDefaultType. (PR #107378)
Jacek Caban via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 04:01:34 PDT 2024
https://github.com/cjacek created https://github.com/llvm/llvm-project/pull/107378
In preparation for ARM64EC support. Also make it static.
>From be963961f3fc98ec9ea782cfced1057a4e98f8a2 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Thu, 5 Sep 2024 12:57:04 +0200
Subject: [PATCH] [LLD][COFF][NFC] Use is64Bit in Baserel::getDefaultType.
And make it static.
---
lld/COFF/Chunks.cpp | 11 +----------
lld/COFF/Chunks.h | 2 +-
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index 386012e3ce8237..060eb6c32004d2 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -1000,16 +1000,7 @@ void BaserelChunk::writeTo(uint8_t *buf) const {
}
uint8_t Baserel::getDefaultType(llvm::COFF::MachineTypes machine) {
- switch (machine) {
- case AMD64:
- case ARM64:
- return IMAGE_REL_BASED_DIR64;
- case I386:
- case ARMNT:
- return IMAGE_REL_BASED_HIGHLOW;
- default:
- llvm_unreachable("unknown machine type");
- }
+ return is64Bit(machine) ? IMAGE_REL_BASED_DIR64 : IMAGE_REL_BASED_HIGHLOW;
}
MergeChunk::MergeChunk(uint32_t alignment)
diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h
index 8ccd05b21af7b5..30e5b538c352ea 100644
--- a/lld/COFF/Chunks.h
+++ b/lld/COFF/Chunks.h
@@ -713,7 +713,7 @@ class Baserel {
Baserel(uint32_t v, uint8_t ty) : rva(v), type(ty) {}
explicit Baserel(uint32_t v, llvm::COFF::MachineTypes machine)
: Baserel(v, getDefaultType(machine)) {}
- uint8_t getDefaultType(llvm::COFF::MachineTypes machine);
+ static uint8_t getDefaultType(llvm::COFF::MachineTypes machine);
uint32_t rva;
uint8_t type;
More information about the llvm-commits
mailing list