From 1c2de46353b80e9e5b4d80d5edab00a42b8ba77d Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Mon, 3 Feb 2014 08:42:42 -0800 Subject: Nios II large-GOT relocations 2014-02-03 Sandra Loosemore include/elf/ * nios2.h (R_NIOS2_GOT_LO, R_NIOS2_GOT_HA): New. (R_NIOS2_CALL_LO, R_NIOS2_CALL_HA): New. (R_NIOS2_ILLEGAL): Adjust. gas/ * config/tc-nios2.c (md_apply_fix): Test for new relocs. (nios2_special_reloc): Add %call_lo, %call_hiadj, %got_lo, %got_hiadj relocation operators. Sort table and add comment to explain ordering. (nios2_fix_adjustable): Test for new relocs. * doc/c-nios2.texi (Nios II Relocations): Document new relocation operators. bfd/ * reloc.c (BFD_RELOC_NIOS2_GOT_LO, BFD_RELOC_NIOS2_GOT_HA): New. (BFD_RELOC_NIOS2_CALL_LO, BFD_RELOC_NIOS2_CALL_HA): New. * libbfd.h: Regenerated. * bfd-in2.h: Regenerated. * elf32-nios2.c (elf_nios2_howto_table_rel): Add new relocations. (nios2_reloc_map): Likewise. (GOT_USED, CALL_USED): Renamed from GOT16_USED and CALL16_USED. Fixed all references. (nios2_elf32_relocate_section): Add new relocations. (nios2_elf32_check_relocs): Likewise. (nios2_elf32_gc_sweep_hook): Likewise. --- gas/ChangeLog | 10 ++++++++++ gas/config/tc-nios2.c | 24 ++++++++++++++++++++---- gas/doc/c-nios2.texi | 8 ++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index a3f0f03..19d4025 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2014-02-03 Sandra Loosemore + + * config/tc-nios2.c (md_apply_fix): Test for new relocs. + (nios2_special_reloc): Add %call_lo, %call_hiadj, %got_lo, + %got_hiadj relocation operators. Sort table and add comment + to explain ordering. + (nios2_fix_adjustable): Test for new relocs. + * doc/c-nios2.texi (Nios II Relocations): Document new relocation + operators. + 2014-01-30 Sandra Loosemore * config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT. diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c index eb81b35..3d52048 100644 --- a/gas/config/tc-nios2.c +++ b/gas/config/tc-nios2.c @@ -1139,7 +1139,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) || fixP->fx_r_type == BFD_RELOC_NIOS2_U16 || fixP->fx_r_type == BFD_RELOC_16_PCREL || fixP->fx_r_type == BFD_RELOC_NIOS2_CALL26 - || fixP->fx_r_type == BFD_RELOC_NIOS2_CALL26_NOAT || fixP->fx_r_type == BFD_RELOC_NIOS2_IMM5 || fixP->fx_r_type == BFD_RELOC_NIOS2_CACHE_OPX || fixP->fx_r_type == BFD_RELOC_NIOS2_IMM6 @@ -1165,6 +1164,11 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) || fixP->fx_r_type == BFD_RELOC_NIOS2_TLS_LE16 || fixP->fx_r_type == BFD_RELOC_NIOS2_GOTOFF || fixP->fx_r_type == BFD_RELOC_NIOS2_TLS_DTPREL + || fixP->fx_r_type == BFD_RELOC_NIOS2_CALL26_NOAT + || fixP->fx_r_type == BFD_RELOC_NIOS2_GOT_LO + || fixP->fx_r_type == BFD_RELOC_NIOS2_GOT_HA + || fixP->fx_r_type == BFD_RELOC_NIOS2_CALL_LO + || fixP->fx_r_type == BFD_RELOC_NIOS2_CALL_HA /* Add other relocs here as we generate them. */ )); @@ -1301,21 +1305,28 @@ struct nios2_special_relocS bfd_reloc_code_real_type reloc_type; }; +/* This table is sorted so that prefix strings are listed after the longer + strings that include them -- e.g., %got after %got_hiadj, etc. */ + struct nios2_special_relocS nios2_special_reloc[] = { {"%hiadj", BFD_RELOC_NIOS2_HIADJ16}, {"%hi", BFD_RELOC_NIOS2_HI16}, {"%lo", BFD_RELOC_NIOS2_LO16}, {"%gprel", BFD_RELOC_NIOS2_GPREL}, + {"%call_lo", BFD_RELOC_NIOS2_CALL_LO}, + {"%call_hiadj", BFD_RELOC_NIOS2_CALL_HA}, {"%call", BFD_RELOC_NIOS2_CALL16}, {"%gotoff_lo", BFD_RELOC_NIOS2_GOTOFF_LO}, {"%gotoff_hiadj", BFD_RELOC_NIOS2_GOTOFF_HA}, + {"%gotoff", BFD_RELOC_NIOS2_GOTOFF}, + {"%got_hiadj", BFD_RELOC_NIOS2_GOT_HA}, + {"%got_lo", BFD_RELOC_NIOS2_GOT_LO}, + {"%got", BFD_RELOC_NIOS2_GOT16}, {"%tls_gd", BFD_RELOC_NIOS2_TLS_GD16}, {"%tls_ldm", BFD_RELOC_NIOS2_TLS_LDM16}, {"%tls_ldo", BFD_RELOC_NIOS2_TLS_LDO16}, {"%tls_ie", BFD_RELOC_NIOS2_TLS_IE16}, {"%tls_le", BFD_RELOC_NIOS2_TLS_LE16}, - {"%gotoff", BFD_RELOC_NIOS2_GOTOFF}, - {"%got", BFD_RELOC_NIOS2_GOT16} }; #define NIOS2_NUM_SPECIAL_RELOCS \ @@ -2824,7 +2835,12 @@ nios2_fix_adjustable (fixS *fixp) || fixp->fx_r_type == BFD_RELOC_NIOS2_TLS_DTPMOD || fixp->fx_r_type == BFD_RELOC_NIOS2_TLS_DTPREL || fixp->fx_r_type == BFD_RELOC_NIOS2_TLS_TPREL - || fixp->fx_r_type == BFD_RELOC_NIOS2_GOTOFF) + || fixp->fx_r_type == BFD_RELOC_NIOS2_GOTOFF + || fixp->fx_r_type == BFD_RELOC_NIOS2_GOT_LO + || fixp->fx_r_type == BFD_RELOC_NIOS2_GOT_HA + || fixp->fx_r_type == BFD_RELOC_NIOS2_CALL_LO + || fixp->fx_r_type == BFD_RELOC_NIOS2_CALL_HA + ) return 0; return 1; diff --git a/gas/doc/c-nios2.texi b/gas/doc/c-nios2.texi index 1d45dd2..0ba6b9b 100644 --- a/gas/doc/c-nios2.texi +++ b/gas/doc/c-nios2.texi @@ -131,7 +131,11 @@ fastint: @end smallexample @cindex @code{call} directive, Nios II +@cindex @code{call_lo} directive, Nios II +@cindex @code{call_hiadj} directive, Nios II @cindex @code{got} directive, Nios II +@cindex @code{got_lo} directive, Nios II +@cindex @code{got_hiadj} directive, Nios II @cindex @code{gotoff} directive, Nios II @cindex @code{gotoff_lo} directive, Nios II @cindex @code{gotoff_hiadj} directive, Nios II @@ -141,7 +145,11 @@ fastint: @cindex @code{tls_ldm} directive, Nios II @cindex @code{tls_ldo} directive, Nios II @item %call(@var{expression}) +@item %call_lo(@var{expression}) +@item %call_hiadj(@var{expression}) @itemx %got(@var{expression}) +@itemx %got_lo(@var{expression}) +@itemx %got_hiadj(@var{expression}) @itemx %gotoff(@var{expression}) @itemx %gotoff_lo(@var{expression}) @itemx %gotoff_hiadj(@var{expression}) -- cgit v1.1