Skip to content

Commit

Permalink
[LLD][COFF][NFC] Use is64Bit in Baserel::getDefaultType. (#107378)
Browse files Browse the repository at this point in the history
In preparation for ARM64EC support. Also make it static.
  • Loading branch information
cjacek authored Sep 5, 2024
1 parent 0ba7818 commit 233ed51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions lld/COFF/Chunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lld/COFF/Chunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 233ed51

Please sign in to comment.