[patch, committed] Nios II large-GOT support

Sandra Loosemore sandra@codesourcery.com
Mon Feb 3 16:47:00 GMT 2014


The published Nios II ABI restricts the GOT to 64K maximum because it 
uses 16-bit relocations for GOT-relative addressing.  There's a note 
saying that new relocations might be added in the future to remove that 
restriction...  and here they are.  :-)  This project was undertaken in 
cooperation with Altera and they have agreed to document the new 
relocations in future versions of the ABI specification.

The new relocations are similar to the existing lo/hiadj pairs used to 
represent 32-bit constants in other contexts.  Referring to the code 
examples in the existing ABI documentation, the large-GOT equivalent of

addi r3, r22, %got(x)       # R_NIOS2_GOT16

is

movhi r3, %got_hiadj(x)     # R_NIOS2_GOT_HA
addi r3, r3, %got_lo(x)     # R_NIOS2_GOT_LO
add r3, r3, r22

and

ldw r3, %call(fun)(r22)     # R_NIOS2_CALL16 fun
callr r3

becomes

movhi r3, %call_hiadj(x)     # R_NIOS2_CALL_HA
addi r3, r3, %call_lo(x)     # R_NIOS2_CALL_LO
add r3, r3, r22
ldw r3, 0(r3)
callr r3

This patch doesn't include any testcases for the new relocations; we 
tested it in conjunction with a GCC patch that makes it emit the 
large-GOT code sequences with -fPIC.  We'll be posting the GCC part in 
due course.

-Sandra

-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-biggot.log
Type: text/x-log
Size: 1028 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20140203/26dc95fe/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-biggot.patch
Type: text/x-patch
Size: 12079 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20140203/26dc95fe/attachment-0001.bin>


More information about the Binutils mailing list