File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,41 @@ This model is similar to the medium any code model, but uses the
125125 l[w|d] a0, a0, %pcrel_lo(.Ltmp3)
126126----
127127
128+ === Large code model
129+
130+ The `large` code model allows the code to address the whole RV64 address space.
131+ Thus, this model is only available for RV64. By putting object addresses
132+ into literal pools, a 64-bit address literal can be loaded from the pool.
133+ This model also changes the function call patterns. An external function
134+ address must be loaded from a literal pool entry, and use `jalr` to jump to
135+ the target function.
136+
137+ NOTE: Because calculating the pool entry address must use `aupic` and
138+ `addi` or `ld`, each pool entry has to be located within the range
139+ between -2GiB and +2GiB from its access intructions. In general, the pool
140+ is appeneded in .text section or put into .rodata section.
141+
142+ NOTE: Large code model is disallowed using with PIC code model.
143+
144+ [,asm]
145+ ----
146+ # Get address of a symbol
147+ # Literal pool
148+ .LCPI0:
149+ .dword symbol
150+ .Ltmp0: auipc a0, %pcrel_hi(.LCPI0)
151+ ld a0, %pcrel_lo(.Ltmp0)(10)
152+
153+ # Function call
154+ # Literal pool
155+ .LCPI1:
156+ .dword function
157+ .Ltmp1: auipc a0, %pcrel_hi(.LCPI1)
158+ ld a0, %pcrel_lo(.Ltmp1)(a0)
159+ jalr a0
160+
161+ ----
162+
128163== Dynamic Linking
129164
130165Any functions that use registers in a way that is incompatible with
You can’t perform that action at this time.
0 commit comments