Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Aug 1, 2024
1 parent 218d89b commit 982f071
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion elf/arch-riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@ u64 get_eflags(Context<E> &ctx) {
return ret;
}

// Returns the distance between a relocated place and a symbol.
// Scan relocations to a given shrink section.
template <>
void shrink_section(Context<E> &ctx, InputSection<E> &isec, bool use_rvc) {
Expand Down
5 changes: 3 additions & 2 deletions elf/shrink-sections.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ i64 shrink_sections<E>(Context<E> &ctx) {
return set_osec_offsets(ctx);
}

// Returns the distance between a relocated place and a symbol.
template <>
i64 compute_distance<E>(Context<E> &ctx, Symbol<E> &sym,
InputSection<E> &isec, const ElfRel<E> &rel) {
Expand All @@ -127,11 +128,11 @@ i64 compute_distance<E>(Context<E> &ctx, Symbol<E> &sym,
// instruction and an absolute symbol. Branching to an absolute
// location is extremely rare in real code, though.
if (sym.is_absolute())
return INT32_MAX;
return INT64_MAX;

// Likewise, relocations against weak undefined symbols won't be relaxed.
if (sym.esym().is_undef_weak())
return INT32_MAX;
return INT64_MAX;

// Compute a distance between the relocated place and the symbol.
i64 S = sym.get_addr(ctx);
Expand Down

0 comments on commit 982f071

Please sign in to comment.