Skip to content

Commit

Permalink
RISC-V: Allow merging 'H' extension
Browse files Browse the repository at this point in the history
Because riscv_merge_std_ext function did not merge the 'H' extension, linked
executables lacked 'H' extension when multiple objects are merged.

This issue is found while building OpenSBI with 'H' extension (resulting
ELF files did not contain "h1p0" in "Tag_RISCV_arch" even if *all* linked
object files contained it).

This commit adds 'h' to standard_exts variable to merge 'H' extension.

bfd/ChangeLog:

	* elfnn-riscv.c (riscv_merge_std_ext): Add 'H' extension merging.

ld/ChangeLog:

	* testsuite/ld-riscv-elf/attr-merge-arch-02.d: Test merging of 'H'
	and 'Zicsr' extensions.
	* testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise.
  • Loading branch information
a4lg committed Nov 28, 2022
1 parent 2dc5f50 commit 1a6342e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bfd/elfnn-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3427,7 +3427,7 @@ riscv_merge_std_ext (bfd *ibfd,
struct riscv_subset_t **pin,
struct riscv_subset_t **pout)
{
const char *standard_exts = "mafdqlcbjtpvn";
const char *standard_exts = "mafdqlcbjtpvnh";
const char *p;
struct riscv_subset_t *in = *pin;
struct riscv_subset_t *out = *pout;
Expand Down
2 changes: 1 addition & 1 deletion ld/testsuite/ld-riscv-elf/attr-merge-arch-02.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

Attribute Section: riscv
File Attributes
Tag_RISCV_arch: "rv32i2p1_a2p0"
Tag_RISCV_arch: "rv32i2p1_a2p0_h1p0_zicsr2p0"
2 changes: 1 addition & 1 deletion ld/testsuite/ld-riscv-elf/attr-merge-arch-02a.s
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.attribute arch, "rv32i2p1_a2p0"
.attribute arch, "rv32i2p1_a2p0_h1p0_zicsr2p0"

0 comments on commit 1a6342e

Please sign in to comment.