summaryrefslogtreecommitdiff
path: root/lld/ELF
diff options
context:
space:
mode:
authorBen Shi <powerman1st@163.com>2023-03-30 11:34:19 +0800
committerBen Shi <powerman1st@163.com>2023-03-30 11:35:07 +0800
commitf1f6ca582e2295465e27a79662d6807342abd9dd (patch)
tree22534ac22ae102208af513f0de493357547d18f6 /lld/ELF
parent1f5e9a3502119f93cfc3a7cf67f43300f759997e (diff)
downloadllvm-f1f6ca582e2295465e27a79662d6807342abd9dd.tar.gz
[lld][ELF][NFC] Simplify method "Thunk *elf::addThunk()"
Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D147124
Diffstat (limited to 'lld/ELF')
-rw-r--r--lld/ELF/Thunks.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp
index d193fb676142..37896d9483d1 100644
--- a/lld/ELF/Thunks.cpp
+++ b/lld/ELF/Thunks.cpp
@@ -1313,20 +1313,18 @@ Thunk *elf::addThunk(const InputSection &isec, Relocation &rel) {
Symbol &s = *rel.sym;
int64_t a = rel.addend;
- if (config->emachine == EM_AARCH64)
+ switch (config->emachine) {
+ case EM_AARCH64:
return addThunkAArch64(rel.type, s, a);
-
- if (config->emachine == EM_ARM)
+ case EM_ARM:
return addThunkArm(rel.type, s, a);
-
- if (config->emachine == EM_MIPS)
+ case EM_MIPS:
return addThunkMips(rel.type, s);
-
- if (config->emachine == EM_PPC)
+ case EM_PPC:
return addThunkPPC32(isec, rel, s);
-
- if (config->emachine == EM_PPC64)
+ case EM_PPC64:
return addThunkPPC64(rel.type, s, a);
-
- llvm_unreachable("add Thunk only supported for ARM, Mips and PowerPC");
+ default:
+ llvm_unreachable("add Thunk only supported for ARM, Mips and PowerPC");
+ }
}