Skip to content

Commit

Permalink
RISC-V: Reduce effective linker relaxation passses
Browse files Browse the repository at this point in the history
Commit 43025f0 ("RISC-V: Improve link time complexity.") reduced the
time complexity of the linker relaxation but some code portions did not
reflect this change.

This commit fixes a comment describing each relaxation pass and reduces
actual number of passes for the RISC-V linker relaxation from 3 to 2.
Though it does not change the functionality, it marginally improves the
performance while linking large programs (with many relocations).

bfd/ChangeLog:

	* elfnn-riscv.c (_bfd_riscv_relax_section): Fix a comment to
	reflect current roles of each relaxation pass.

ld/ChangeLog:

	* emultempl/riscvelf.em: Reduce the number of linker relaxation
	passes from 3 to 2.
  • Loading branch information
a4lg committed Feb 10, 2023
1 parent 80aa664 commit 779b250
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions bfd/elfnn-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4754,9 +4754,9 @@ bfd_elfNN_riscv_set_data_segment_info (struct bfd_link_info *info,

/* Relax a section.
Pass 0: Shortens code sequences for LUI/CALL/TPREL/PCREL relocs.
Pass 1: Deletes the bytes that PCREL relaxation in pass 0 made obsolete.
Pass 2: Which cannot be disabled, handles code alignment directives. */
Pass 0: Shortens code sequences for LUI/CALL/TPREL/PCREL relocs and
deletes the obsolete bytes.
Pass 1: Which cannot be disabled, handles code alignment directives. */

static bool
_bfd_riscv_relax_section (bfd *abfd, asection *sec,
Expand Down
2 changes: 1 addition & 1 deletion ld/emultempl/riscvelf.em
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ riscv_elf_before_allocation (void)
ENABLE_RELAXATION;
}

link_info.relax_pass = 3;
link_info.relax_pass = 2;
}

static void
Expand Down

0 comments on commit 779b250

Please sign in to comment.