[PATCH v2 0/9] RISC-V: Support version controling for ISA standard extensions and CSR

Nelson Chu nelson.chu@sifive.com
Fri May 29 01:02:11 GMT 2020


Hi Jim,

On Fri, May 29, 2020 at 4:09 AM Jim Wilson <jimw@sifive.com> wrote:
>
> I noticed that my riscv32-elf ld testsuite results went from 490
> passes to 345 passes after an update indicating that something major
> broke.  Bisecting took me to this patch.  Looking at the ld.log file,
> I see
>
> Executing on host: sh -c {riscv32-unknown-elf-gcc -B/home/jimw/FOSS/BINUTILS/X-\
> test-rv32-elf-new/ld/tmpdir/ld/   -L/home/jimw/FOSS/install-riscv32/riscv32-unk\
> nown-elf/lib  tmpdir/compiler11685.c -o tmpdir/compiler11685.out 2>&1}  /dev/nu\
> ll ld.tmp (timeout = 300)
> spawn [open ...]^M
> /home/jimw/FOSS/BINUTILS/X-test-rv32-elf-new/ld/tmpdir/ld/collect-ld: error: /t\
> mp/ccJmOmJk.o: conflicting priv spec version (major/minor/revision).
> /home/jimw/FOSS/BINUTILS/X-test-rv32-elf-new/ld/tmpdir/ld/collect-ld: error: /t\
> mp/ccJmOmJk.o: conflicting priv spec version (major/minor/revision).
> /home/jimw/FOSS/BINUTILS/X-test-rv32-elf-new/ld/tmpdir/ld/collect-ld: failed to\
>  merge target specific data of file /tmp/ccJmOmJk.o
> collect2: error: ld returned 1 exit status
>
> This is check_compiler_available, so any test that needs a compiler
> fails to run.
>
> Apparently object files created with this patch are not compatible
> with object files created without this patch.  The error message
> doesn't indicate exactly what the priv spec conflict is, or exactly
> which files are conflicting, so isn't very user friendly.  I had to
> rerun the linker under the debugger to see what is going on.  The old
> crt0.o file has
> Attribute Section: riscv
> File Attributes
>   Tag_RISCV_arch: "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
> and the new tmp.o created with the patch has
> Attribute Section: riscv
> File Attributes
>   Tag_RISCV_stack_align: 16-bytes
>   Tag_RISCV_arch: "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"
>   Tag_RISCV_priv_spec: 1
>   Tag_RISCV_priv_spec_minor: 11
> so it appears that absence of the new Tag_RISCV_pric_spec is
> considered a hard incompatibility.  I would argue that an object file
> without a priv spec version set should be allowed to link with any
> other object file.  it is only when you have two object files with
> priv_spec tags that indicate different versions that you should error.

Sorry I didn't notice the compatibility problem.  I will fix and send
the patch to resolve it today.  However, thanks for reporting this :)

Nelson


More information about the Binutils mailing list