2013-02-07 00:22:26 +01:00
|
|
|
/* Altera Nios II ELF support for BFD.
|
|
|
|
Copyright (C) 2012, 2013 Free Software Foundation, Inc.
|
|
|
|
Contributed by Nigel Gray (ngray@altera.com).
|
|
|
|
Contributed by Mentor Graphics, Inc.
|
|
|
|
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA. */
|
|
|
|
|
|
|
|
|
|
|
|
/* This file holds definitions specific to the Altera Nios II ELF ABI. Note
|
|
|
|
that most of this is not actually implemented by BFD. */
|
|
|
|
|
|
|
|
#ifndef _ELF_NIOS2_H
|
|
|
|
#define _ELF_NIOS2_H
|
|
|
|
|
|
|
|
#include "elf/reloc-macros.h"
|
|
|
|
|
|
|
|
/* The order of these numbers must match the order in
|
|
|
|
the elf_nios2_howto_table_rel table for the lookup
|
|
|
|
function to work properly. */
|
|
|
|
|
|
|
|
START_RELOC_NUMBERS (elf_nios2_reloc_type)
|
|
|
|
RELOC_NUMBER (R_NIOS2_NONE, 0)
|
|
|
|
RELOC_NUMBER (R_NIOS2_S16, 1)
|
|
|
|
RELOC_NUMBER (R_NIOS2_U16, 2)
|
|
|
|
RELOC_NUMBER (R_NIOS2_PCREL16, 3)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CALL26, 4)
|
|
|
|
RELOC_NUMBER (R_NIOS2_IMM5, 5)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CACHE_OPX, 6)
|
|
|
|
RELOC_NUMBER (R_NIOS2_IMM6, 7)
|
|
|
|
RELOC_NUMBER (R_NIOS2_IMM8, 8)
|
|
|
|
RELOC_NUMBER (R_NIOS2_HI16, 9)
|
|
|
|
RELOC_NUMBER (R_NIOS2_LO16, 10)
|
|
|
|
RELOC_NUMBER (R_NIOS2_HIADJ16, 11)
|
|
|
|
RELOC_NUMBER (R_NIOS2_BFD_RELOC_32, 12)
|
|
|
|
RELOC_NUMBER (R_NIOS2_BFD_RELOC_16, 13)
|
|
|
|
RELOC_NUMBER (R_NIOS2_BFD_RELOC_8, 14)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GPREL, 15)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GNU_VTINHERIT, 16)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GNU_VTENTRY, 17)
|
|
|
|
RELOC_NUMBER (R_NIOS2_UJMP, 18)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CJMP, 19)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CALLR, 20)
|
|
|
|
RELOC_NUMBER (R_NIOS2_ALIGN, 21)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GOT16, 22)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CALL16, 23)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GOTOFF_LO, 24)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GOTOFF_HA, 25)
|
|
|
|
RELOC_NUMBER (R_NIOS2_PCREL_LO, 26)
|
|
|
|
RELOC_NUMBER (R_NIOS2_PCREL_HA, 27)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_GD16, 28)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_LDM16, 29)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_LDO16, 30)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_IE16, 31)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_LE16, 32)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_DTPMOD, 33)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_DTPREL, 34)
|
|
|
|
RELOC_NUMBER (R_NIOS2_TLS_TPREL, 35)
|
|
|
|
RELOC_NUMBER (R_NIOS2_COPY, 36)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GLOB_DAT, 37)
|
|
|
|
RELOC_NUMBER (R_NIOS2_JUMP_SLOT, 38)
|
|
|
|
RELOC_NUMBER (R_NIOS2_RELATIVE, 39)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GOTOFF, 40)
|
Nios II CALL26 linker relaxation
2014-01-30 Sandra Loosemore <sandra@codesourcery.com>
bfd/
* bfd-in2.h: Update from reloc.c.
* elf32-nios2.c: Include elf32-nios2.h.
(elf_nios2_howto_table_rel): Add entry for R_NIOS2_CALL26_NOAT.
(nios2_reloc_map): Likewise.
(enum elf32_nios2_stub_type): Declare.
(struct elf32_nios2_stub_hash_entry): Declare.
(nios2_stub_hash_entry, nios2_stub_hash_lookup): New macros.
(struct elf32_nios2_link_hash_entry): Add hsh_cache field.
(struct elf32_nios2_link_hash_table): Add new fields bstab,
stub_bfd, add_stub_section, layout_sections_again, stub_group,
bfd_count, top_index, input_list, all_local_syms.
(nios2_call26_stub_entry): New.
(nios2_elf32_install_imm16): Move up in file.
(nios2_elf32_install_data): Move up in file.
(hiadj): Move up in file.
(stub_hash_newfunc): New.
(link_hash_newfunc): Initialize hsh_cache field.
(STUB_SUFFIX): New.
(nios2_stub_name): New.
(nios2_get_stub_entry): New.
(nios2_add_stub): New.
(nios2_elf32_setup_section_lists): New.
(nios2_elf32_next_input_section): New.
(CALL26_SEGMENT): New.
(MAX_STUB_SECTION_SIZE): New.
(group_sections): New.
(nios2_type_of_stub): New.
(nios2_build_one_stub): New.
(nios2_size_one_stub): New.
(get_local_syms): New.
(nios2_elf32_size_stubs): New.
(nios2_elf32_build_stubs): New.
(nios2_elf32_do_call26_relocate): Correct CALL26 overflow test.
(nios2_elf32_relocate_section): Handle R_NIOS2_CALL26_NOAT. Add
trampolines for R_NIOS2_CALL26 stubs.
(nios2_elf32_check_relocs): Handle R_NIOS2_CALL26_NOAT.
(nios2_elf32_gc_sweep_hook): Likewise.
(nios2_elf32_link_hash_table_create): Initialize the stub hash table.
(nios2_elf32_link_hash_table_free): New.
(bfd_elf32_bfd_link_hash_table_free): Define.
* elf32-nios2.h: New file.
* libbfd.h: Update from reloc.c.
* reloc.c (BFD_RELOC_NIOS2_CALL26_NOAT): New.
gas/
* config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT.
(nios2_assemble_args_m): Likewise.
(md_assemble): Likewise.
gas/testsuite/
* gas/nios2/call26_noat.d: New.
* gas/nios2/call26_noat.s: New.
* gas/nios2/call_noat.d: New.
* gas/nios2/call_noat.s: New.
include/elf/
* nios2.h (elf_nios2_reloc_type): Add R_NIOS2_CALL26_NOAT.
ld/
* Makefile.am (enios2elf.c, enios2linux.c): Update dependencies.
* Makefile.in: Regenerated.
* emulparams/nios2elf.sh (EXTRA_EM_FILE): Set.
* emulparams/nios2linux.sh (EXTRA_EM_FILE): Set.
* emultempl/nios2elf.em: New file.
* gen-doc.texi (NIOSII): Set.
* ld.texinfo (NIOSII): Set.
ld/testsuite/
* ld-nios2/relax_call26.s: New.
* ld-nios2/relax_call26_boundary.ld: New.
* ld-nios2/relax_call26_boundary.s: New.
* ld-nios2/relax_call26_boundary_c8.d: New.
* ld-nios2/relax_call26_boundary_cc.d: New.
* ld-nios2/relax_call26_boundary_d0.d: New.
* ld-nios2/relax_call26_boundary_d4.d: New.
* ld-nios2/relax_call26_boundary_d8.d: New.
* ld-nios2/relax_call26_boundary_dc.d: New.
* ld-nios2/relax_call26_boundary_f0.d: New.
* ld-nios2/relax_call26_boundary_f4.d: New.
* ld-nios2/relax_call26_boundary_f8.d: New.
* ld-nios2/relax_call26_boundary_fc.d: New.
* ld-nios2/relax_call26_cache.d: New.
* ld-nios2/relax_call26_cache.ld: New.
* ld-nios2/relax_call26_cache.s: New.
* ld-nios2/relax_call26_multi.d: New.
* ld-nios2/relax_call26_multi.ld: New.
* ld-nios2/relax_call26_norelax.d: New.
* ld-nios2/relax_call26_shared.d: New.
* ld-nios2/relax_call26_shared.ld: New.
2014-01-31 02:47:07 +01:00
|
|
|
RELOC_NUMBER (R_NIOS2_CALL26_NOAT, 41)
|
2014-02-03 17:42:42 +01:00
|
|
|
RELOC_NUMBER (R_NIOS2_GOT_LO, 42)
|
|
|
|
RELOC_NUMBER (R_NIOS2_GOT_HA, 43)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CALL_LO, 44)
|
|
|
|
RELOC_NUMBER (R_NIOS2_CALL_HA, 45)
|
|
|
|
RELOC_NUMBER (R_NIOS2_ILLEGAL, 46)
|
2013-02-07 00:22:26 +01:00
|
|
|
END_RELOC_NUMBERS (R_NIOS2_maxext)
|
|
|
|
|
|
|
|
/* Processor-specific section flags. */
|
|
|
|
|
|
|
|
/* This is used to mark gp-relative sections. */
|
|
|
|
#define SHF_NIOS2_GPREL 0x10000000
|
|
|
|
|
|
|
|
/* Processor-specific dynamic array tags. */
|
|
|
|
|
|
|
|
/* Address of _gp. */
|
|
|
|
#define DT_NIOS2_GP 0x70000002
|
|
|
|
|
|
|
|
#endif /* _ELF_NIOS2_H */
|