aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WindowsResource.cpp
diff options
context:
space:
mode:
authorJacek Caban <jacek@codeweavers.com>2024-04-03 13:28:23 +0200
committerGitHub <noreply@github.com>2024-04-03 13:28:23 +0200
commit5c1544c95394b79b377c7137ac34e3e63b6d5ee5 (patch)
tree973109c2713fcc581c719dc17c05f0904cfb30af /llvm/lib/Object/WindowsResource.cpp
parent0356d0cfdc5cc7173533c2ad6c2ea8ad342f1acc (diff)
downloadllvm-5c1544c95394b79b377c7137ac34e3e63b6d5ee5.zip
llvm-5c1544c95394b79b377c7137ac34e3e63b6d5ee5.tar.gz
llvm-5c1544c95394b79b377c7137ac34e3e63b6d5ee5.tar.bz2
[Object][COFF][NFC] Introduce getMachineArchType helper. (#87370)
It's a common pattern that we have a machine type, but we don't care which ARM64* platform we're dealing with. We already have isAnyArm64 for that, but it does not fit cases where we use a switch statement. With this helper, it's easy to simplify such cases by using Triple::ArchType instead of machine type.
Diffstat (limited to 'llvm/lib/Object/WindowsResource.cpp')
-rw-r--r--llvm/lib/Object/WindowsResource.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Object/WindowsResource.cpp b/llvm/lib/Object/WindowsResource.cpp
index 61ca49e..983c8e3 100644
--- a/llvm/lib/Object/WindowsResource.cpp
+++ b/llvm/lib/Object/WindowsResource.cpp
@@ -12,6 +12,7 @@
#include "llvm/Object/WindowsResource.h"
#include "llvm/Object/COFF.h"
+#include "llvm/Object/WindowsMachineFlag.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/ScopedPrinter.h"
@@ -978,19 +979,17 @@ void WindowsResourceCOFFWriter::writeFirstSectionRelocations() {
reinterpret_cast<coff_relocation *>(BufferStart + CurrentOffset);
Reloc->VirtualAddress = RelocationAddresses[i];
Reloc->SymbolTableIndex = NextSymbolIndex++;
- switch (MachineType) {
- case COFF::IMAGE_FILE_MACHINE_ARMNT:
+ switch (getMachineArchType(MachineType)) {
+ case Triple::thumb:
Reloc->Type = COFF::IMAGE_REL_ARM_ADDR32NB;
break;
- case COFF::IMAGE_FILE_MACHINE_AMD64:
+ case Triple::x86_64:
Reloc->Type = COFF::IMAGE_REL_AMD64_ADDR32NB;
break;
- case COFF::IMAGE_FILE_MACHINE_I386:
+ case Triple::x86:
Reloc->Type = COFF::IMAGE_REL_I386_DIR32NB;
break;
- case COFF::IMAGE_FILE_MACHINE_ARM64:
- case COFF::IMAGE_FILE_MACHINE_ARM64EC:
- case COFF::IMAGE_FILE_MACHINE_ARM64X:
+ case Triple::aarch64:
Reloc->Type = COFF::IMAGE_REL_ARM64_ADDR32NB;
break;
default: