[PATCH 0/3] Allow to link objects with different versions of ISA, and fix some minor issues

Palmer Dabbelt palmer@dabbelt.com
Tue Aug 25 17:13:29 GMT 2020


On Wed, 19 Aug 2020 23:34:39 PDT (-0700), nelson.chu@sifive.com wrote:
> Hi binutils,
>
> There are three patches used to fix some minor issues when linker merging
> ELF attributes.
>
> * The first patch from Kito cheng fixs the wrong error reports when the ISA
> versions are mis-matched.  Consider the following case,
>
> $ cat a.s
> .attribute arch, "rv64i2p0_m2p0_a2p0"
> $ cat b.s
> .attribute arch, "rv64i2p0_m2p0_a3p0"
> $ riscv64-unknown-elf-as a.s -o a.o
> $ riscv64-unknown-elf-as b.s -o b.o
> $ riscv64-unknown-elf-ld -r a.o b.o
> riscv64-unknown-elf-ld: error: b.o: Mis-matched ISA version for 'm' extension. 2.0 vs 2.0
> riscv64-unknown-elf-ld: failed to merge target specific data of file b.o
>
> But the mis-matched ISA should be 'a' rather than 'm'.  This patch will fix
> the wrong message.
>
> $ riscv64-unknown-elf-ld-new -r a.o b.o
> riscv64-unknown-elf-ld: error: b.o: Mis-matched ISA version for 'a' extension. 3.0 vs 2.0
>
> * The second patch allows to link objects with different versions of ISA.
> The different ISA versions should be compatible, unless there are some known
> conflicts.  Same as what the privileged spec attributes did, report warnings
> for those different ISA versions are merged should be enough.  So the above
> mis-matched errors will be changed to warnings,
>
> $ riscv64-unknown-elf-ld-new -r a.o b.o
> riscv64-unknown-elf-ld: warning: b.o: Mis-matched ISA version 3.0 for 'a' extension, the output version is 2.0.
>
> * And the third patch just fixs typos amd do some minor cleanups when merging priv spec attributes.
>
> Thanks
> Nelson

These LGTM.  Thanks!


More information about the Binutils mailing list