la vs lla

1,965 views
Skip to first unread message

Michael Clark

unread,
Dec 14, 2016, 2:28:28 PM12/14/16
to RISC-V SW Dev
Just to confirm my intuition as I am not sure if it is documented anywhere:

LA load address
LLA load label address
LA.TLS.GD load address, thread-local, global-dynamic
LA.TLS.IE load address, thread-local, initial-exec
LI load immediate

I’m trying to figure out how the relocations are handled. This is partially complete of the assembler pseudo instructions that expand to many instructions. The relocation information may not be completely correct … yet.

lla,la     slli,addi              rd,symbol   # (R_RISCV_PCREL_LO12_I)                       ; Global constant
lla,la     lui,{addi,addiw}       rd,symbol   # (R_RISCV_PCREL_LO12_I)                       ; Global PIC symbol
la         auipc,{ld,lw}          rd,symbol   # (R_RISCV_GOT_HI20,     R_RISCV_PCREL_LO12_I) ; Local PIC or non-PIC symbol
lla,la     auipc,addi             rd,symbol   # (R_RISCV_PCREL_HI20,   R_RISCV_PCREL_LO12_I) ; Local PIC symbol
la.tls.gd  auipc,addi             rd,symbol   # (R_RISCV_TLS_GD_HI20,  R_RISCV_PCREL_LO12_I) ; TLS model global dynamic
la.tls.ie  auipc,{addi,addiw}     rd,symbol   # (R_RISCV_TLS_GOT_HI20, R_RISCV_PCREL_LO12_I) ; TLS model initial exec
li         {lui,slli,addi,addiw}  rd,rs1


Is it such that any word size relocation has two entries, one for the upper 20-bits and one for the lower 12-bits?

In any case I can do some reversing of the object files…

Michael.

Stefan O'Rear

unread,
Dec 14, 2016, 2:36:07 PM12/14/16
to Michael Clark, RISC-V SW Dev
I'm not sure, and "do reversing, then document it" is one of the
things I'm currently on the hook for.

At the least you're missing TAIL and CALL.

-s

Nicolás Ojeda Bär

unread,
Dec 15, 2016, 4:13:58 AM12/15/16
to Michael Clark, RISC-V SW Dev
Hi Clark,

I will just mention in case it is of use that there is a list of
assembly pseudo instruction in Chapter 21 of the RISC-V spec. It is
not fully fleshed out yet, but it was useful to me when writing the
native code compiler backend for OCaml.

Cheers,
Nicolas
> --
> You received this message because you are subscribed to the Google Groups
> "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sw-dev+un...@groups.riscv.org.
> To post to this group, send email to sw-...@groups.riscv.org.
> Visit this group at
> https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
> To view this discussion on the web visit
> https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/DACDC144-AA79-4064-B484-F82E7B13A9EE%40mac.com.

Michael Clark

unread,
Dec 16, 2016, 3:16:01 PM12/16/16
to Nicolás Ojeda Bär, RISC-V SW Dev
Hi Nicolas,

On 15 Dec 2016, at 10:13 PM, Nicolás Ojeda Bär <n.oj...@gmail.com> wrote:

Hi Clark,

I will just mention in case it is of use that there is a list of
assembly pseudo instruction in Chapter 21 of the RISC-V spec.  It is
not fully fleshed out yet, but it was useful to me when writing the
native code compiler backend for OCaml.

I’ve read through the list of pseudos in the RISC-V spec, however I’m presently interested in the pseudos that are not yet listed in the spec. The undocumented pseudos seem to be mostly related to thread-local storage and addresses (LA,LLA). I am maintaining a table of metadata and constraints that can be used for converting pseudo-instructions to and from regular RISC-V instructions. I have not yet found a way to express metadata for relocations which I am looking at presently. The relocations in this list may not be accurate (consider them working notes):


Michael.

Sebastian Huber

unread,
May 29, 2018, 6:00:50 AM5/29/18
to RISC-V SW Dev, n.oj...@gmail.com
The "lla" pseudo instruction is emitted by GCC and not documented in "The RISC-V Instruction Set Manual, Volume I: User-Level ISA, Document Version 2.2".

Tommy Murphy

unread,
May 29, 2018, 6:27:39 AM5/29/18
to RISC-V SW Dev, n.oj...@gmail.com
On Tuesday, 29 May 2018 11:00:50 UTC+1, Sebastian Huber wrote:
The "lla" pseudo instruction is emitted by GCC and not documented in "The RISC-V Instruction Set Manual, Volume I: User-Level ISA, Document Version 2.2".

You probably should log that omission here:

Jim Wilson

unread,
May 29, 2018, 1:17:01 PM5/29/18
to Tommy Murphy, RISC-V SW Dev, n.oj...@gmail.com
On Tue, May 29, 2018 at 3:27 AM, Tommy Murphy <tommy_...@hotmail.com> wrote:
> On Tuesday, 29 May 2018 11:00:50 UTC+1, Sebastian Huber wrote:
>>
>> The "lla" pseudo instruction is emitted by GCC and not documented in "The
>> RISC-V Instruction Set Manual, Volume I: User-Level ISA, Document Version
>> 2.2".

Our assembler documentation could use some work, but it is hard to
find volunteers for such a task. lla is mentioned in the RISC-V
reader, and in the gas sources (search for M_LLA im
config/tc-riscv.c).

lla is "load local address". It expands to auipc/addi, where auipc
gets the upper bits of the address and addi gets the lower bits of the
address. la is "load address". la expands to auipc/l[wd] for a got
load when pic, and expands to auipc/addi same as lla when non-pic.

Jim
Reply all
Reply to author
Forward
0 new messages