@@ -130,36 +130,47 @@ This model is similar to the medium any code model, but uses the
130130The `large` code model allows the code to address the whole RV64 address space.
131131Thus, this model is only available for RV64. By putting object addresses
132132into 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.
136133
137134NOTE: Because calculating the pool entry address must use `aupic` and
138135`addi` or `ld`, each pool entry has to be located within the range
139136between -2GiB and +2GiB from its access intructions. In general, the pool
140137is appeneded in .text section or put into .rodata section.
141138
142- NOTE: Large code model is disallowed to be used with PIC code model.
143-
144139[,asm]
145140----
146141 # Get address of a symbol
147142 # Literal pool
148143 .LCPI0:
149144 .dword symbol
150145.Ltmp0: auipc a0, %pcrel_hi(.LCPI0)
151- ld a0, %pcrel_lo(.Ltmp0)(10)
146+ ld a0, %pcrel_lo(.Ltmp0)(a0)
147+ ----
148+
149+ This model also changes the function call patterns. An external function
150+ address must be loaded from a literal pool entry, and use `jalr` to jump to
151+ the target function.
152+
153+
154+ NOTE: Same as getting address of symbol, each pool entry has to be located
155+ within the range between -2GiB and +2GiB from its access intructions. The
156+ function call can reach the whole 64-bit address space.
152157
158+ [,asm]
159+ ----
153160 # Function call
154161 # Literal pool
155162 .LCPI1:
156163 .dword function
157164.Ltmp1: auipc a0, %pcrel_hi(.LCPI1)
158165 ld a0, %pcrel_lo(.Ltmp1)(a0)
159166 jalr a0
160-
161167----
162168
169+ NOTE: Large code model is disallowed to be used with PIC code model.
170+
171+ NOTE: There will be more different code generation strategies for different
172+ usage purposes in the future.
173+
163174== Dynamic Linking
164175
165176Any functions that use registers in a way that is incompatible with
0 commit comments