This permits arbitrary CSRs to be addressed without requiring additional
mappings in opcode/riscv-opc.h. For unnamed CSRs, the disassembler now
prints hexadecimal addresses instead of substituting "unknown".
Match the generic syscall interface derived from <asm-generic/unistd.h>,
which assigns a separate syscall number to each socket operation rather
than multiplexing through socketcall(2).
v0-1 are removed; arguments are now returned in a0-1. Registers are
renumbered so that s0-1 and a0-5 map to x8-15 to simplify the RVC ISA.
(These are the most popular 8 registers besides x0 and sp.)
There are a few reasons for this. First, the ABI requires that these
instructions be emulated if not implemented in HW. Second, the userspace
emulation library wasn't markedly faster than the kernel's. Third, the
multilib explosion was becoming intractible.
Ultimately, the plan is to replace illegal instructions with jumps to
userspace emulation routines, which will achieve reasonable performance
portably (without multilibs). This support is forthcoming.
This allows the local-exec model to be used for any non-PIC TLS reference,
even if it cannot be proven at compile time that the access binds locally.
It essentially obviates the need for IE -> LE relaxations.
Previously, we had multiple low-part PC-relative relocs, e.g.
R_RISCV_GOT_LO12 and R_RISCV_TLS_GD_LO12. But since these are indirect
relocs and enough info is encoded in the high part, they are redundant.
Now, we only have two: R_RISCV_PCREL_LO12_I and R_RISCV_PCREL_LO12_S.
For example, the following PIC code adds TLS variables x and y:
.L1: auipc a0, %tls_ie_pcrel_hi(x)
.L2: auipc a1, %tls_ie_pcrel_hi(y)
ld a0, %pcrel_lo(.L1)(a0)
ld a1, %pcrel_lo(.L2)(a1)
ld a0, 0(a0)
ld a1, 0(a1)
add a0, a0, a1
The new BFD port is primarily based upon TILE-Gx, which is conveniently
simple and vanilla. We no longer have dynamic REL relocations, and the
GOT no longer needs to be sorted a la MIPS. So GNU-style shared object
hashes are now supported.
Note that there are probably a few lingering issues.
First of all, never spill symbolic addresses to the constant pool. This
creates costly dynamic relocations while providing little benefit.
Second, due to a bug, we were failing to elide the GOT for local symbol
references with nonzero offsets.
The low part uses an indirect relocation to the high part to determine
how to fill itself in. For example:
.L1:
auipc t0, %pcrel_hi(foo)
[unrelated code]
addi t0, t0, %pcrel_lo(.L1)
will correctly load &foo into t0.