Skip to content

Commit 8adccf2

Browse files
committed
arcv: Add a section about picolibc_perf.ld
Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
1 parent b03a8fb commit 8adccf2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/arcv/building-picolibc.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,29 @@ Note that all `-mtune` values for ARC-V assume that fast unaligned access is sup
197197
(`__riscv_misaligned_fast == 1`) by targets. This assumption may be overwritten by
198198
`-mstrict-align` when building an application or toolchain libraries itself.
199199

200+
## Using a linker script optimized for performance
201+
202+
The default Picolibc linker script places `.rodata` section right after code
203+
sections. However, this approach may lead to decrease in performance since
204+
addressing through a global pointer may not be available for `.rodata` in this
205+
case.
206+
207+
If safety of read only regions is not a priority in a particular case,
208+
`picolibc_perf.ld` linker script may be used to increase performance:
209+
210+
```
211+
$ riscv64-snps-elf-gcc \
212+
-march=rv32imafc \
213+
-mabi=ilp32f \
214+
-mtune=arc-v-rhx-100-series \
215+
-specs=picolibc.specs \
216+
-T picolibc_perf.ld \
217+
--crt0=semihost \
218+
--oslib=semihost \
219+
example.c -o example.elf
220+
```
221+
222+
This linker script places `.rodata` in a data region.
200223

201224
## Migrating from Newlib
202225

0 commit comments

Comments
 (0)