[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/26400] New: Internal error when using .offset with jumps in RIS
From: |
rswarbrick at gmail dot com |
Subject: |
[Bug gas/26400] New: Internal error when using .offset with jumps in RISC-V as |
Date: |
Mon, 17 Aug 2020 11:53:52 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=26400
Bug ID: 26400
Summary: Internal error when using .offset with jumps in RISC-V
as
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: rswarbrick at gmail dot com
Target Milestone: ---
If you try to assemble the following code with riscv32-unknown-elf-as:
.offset 0
jal x0, 100
then you get an internal error:
> rv.asm: Assembler messages:
> rv.asm:2: Internal error in frag_new at
> /home/vsts/work/1/s/build/gcc/.build/riscv32-unknown-elf/src/binutils/gas/frags.c:169.
> Please report this bug.
I've reproduced this with the head of master from today (53d5a2a), but the
relevant code is all pretty old, so I would expect the same behaviour from
almost any version.
As far as I can understand it, the problem is that add_relaxed_insn() (from
tc-riscv.c) calls frag_var(). It seems that this function finishes off the
(currently empty) fragment that will contain the jump instruction and adds 8
bytes of padding for it. It then starts a new fragment, but the calculated
address (calculated in frag_now_fix_octets) is still zero because we're in an
absolute section and nothing got incremented.
I'm willing to believe that the assembly code is just Doing It Wrong, but the
internal error isn't great.
I don't know whether the correct fix is to increment `abs_section_offset` after
finishing off the fragment for the JAL instruction or whether it's just to
generate a helpful error message ("Don't mix jumps and .offset", or similar).
--
You are receiving this mail because:
You are on the CC list for the bug.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug gas/26400] New: Internal error when using .offset with jumps in RISC-V as,
rswarbrick at gmail dot com <=