Skip to content

Commit 6ec3b46

Browse files
committed
Remove useless cast and update a comment.
llvm-svn: 293089
1 parent 470f070 commit 6ec3b46

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lld/ELF/Target.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -512,17 +512,15 @@ void X86TargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,
512512
uint64_t Val) const {
513513
checkInt<32>(Loc, Val, Type);
514514

515-
// R_386_PC16/R_386_16/R_386_PC8/R_386_8 are not part of the current i386
516-
// psABI. They are used by 16-bit x86 objects, like boot loaders.
517-
if (Type == R_386_8 || Type == R_386_PC8) {
518-
*Loc = (uint8_t)Val;
519-
return;
520-
}
521-
if (Type == R_386_16 || Type == R_386_PC16) {
515+
// R_386_{PC,}{8,16} are not part of the i386 psABI, but they are
516+
// being used for some 16-bit programs such as boot loaders, so
517+
// we want to support them.
518+
if (Type == R_386_8 || Type == R_386_PC8)
519+
*Loc = Val;
520+
else if (Type == R_386_16 || Type == R_386_PC16)
522521
write16le(Loc, Val);
523-
return;
524-
}
525-
write32le(Loc, Val);
522+
else
523+
write32le(Loc, Val);
526524
}
527525

528526
void X86TargetInfo::relaxTlsGdToLe(uint8_t *Loc, uint32_t Type,

0 commit comments

Comments
 (0)