Skip to content

Commit ddb2d08

Browse files
committed
needsThunk()
Feedback from review
1 parent 05344ee commit ddb2d08

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lld/ELF/Arch/Hexagon.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,20 @@ bool Hexagon::inBranchRange(RelType type, uint64_t src, uint64_t dst) const {
290290
bool Hexagon::needsThunk(RelExpr expr, RelType type, const InputFile *file,
291291
uint64_t branchAddr, const Symbol &s,
292292
int64_t a) const {
293-
return !ctx.target->inBranchRange(type, branchAddr, s.getVA(ctx, a));
293+
// Only check branch range for supported branch relocation types
294+
switch (type) {
295+
case R_HEX_B22_PCREL:
296+
case R_HEX_PLT_B22_PCREL:
297+
case R_HEX_GD_PLT_B22_PCREL:
298+
case R_HEX_LD_PLT_B22_PCREL:
299+
case R_HEX_B15_PCREL:
300+
case R_HEX_B13_PCREL:
301+
case R_HEX_B9_PCREL:
302+
return !ctx.target->inBranchRange(type, branchAddr, s.getVA(ctx, a));
303+
default:
304+
// For unsupported relocation types, no thunk is needed
305+
return false;
306+
}
294307
}
295308

296309
void Hexagon::relocate(uint8_t *loc, const Relocation &rel,

0 commit comments

Comments
 (0)