[binutils-gdb] nios2: Remove binutils support for Nios II target.

Sandra Loosemore sandra@sourceware.org
Tue Nov 26 19:13:46 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e7a16d9fd65098045ef5959bf98d990f12314111

commit e7a16d9fd65098045ef5959bf98d990f12314111
Author: Sandra Loosemore <sloosemore@baylibre.com>
Date:   Tue Nov 26 19:13:07 2024 +0000

    nios2: Remove binutils support for Nios II target.
    
    The Nios II architecture has been EOL'ed by the vendor.  This patch
    removes all binutils, bfd, gas, binutils, and opcodes support for this
    target with the exception of the readelf utility.  (The ELF EM_*
    number remains valid and the relocation definitions from the Nios II
    ABI will never change in future, so retaining the readelf support
    seems consistent with its purpose as a utility that tries to parse the
    headers in any ELF file provided as an argument regardless of target.)

Diff:
---
 bfd/Makefile.am                                  |    6 +-
 bfd/Makefile.in                                  |    8 +-
 bfd/archures.c                                   |    6 -
 bfd/bfd-in2.h                                    |   58 -
 bfd/config.bfd                                   |   16 -
 bfd/configure                                    |    2 -
 bfd/configure.ac                                 |    2 -
 bfd/cpu-nios2.c                                  |   75 -
 bfd/elf-bfd.h                                    |    1 -
 bfd/elf-eh-frame.c                               |    1 -
 bfd/elf32-nios2.c                                | 6086 ----------------------
 bfd/elf32-nios2.h                                |   38 -
 bfd/libbfd.h                                     |   52 -
 bfd/reloc.c                                      |  107 -
 bfd/targets.c                                    |    5 -
 binutils/MAINTAINERS                             |    2 -
 binutils/NEWS                                    |    3 +
 configure                                        |    3 -
 configure.ac                                     |    3 -
 gas/Makefile.am                                  |    2 -
 gas/Makefile.in                                  |    6 -
 gas/NEWS                                         |    3 +
 gas/config/obj-elf.c                             |    4 -
 gas/config/tc-nios2.c                            | 4103 ---------------
 gas/config/tc-nios2.h                            |  132 -
 gas/configure.tgt                                |    2 -
 gas/doc/all.texi                                 |    1 -
 gas/doc/as.texi                                  |   31 -
 gas/doc/c-nios2.texi                             |  267 -
 gas/doc/local.mk                                 |    1 -
 gas/testsuite/gas/all/gas.exp                    |    1 -
 gas/testsuite/gas/nios2/add-r2.d                 |   18 -
 gas/testsuite/gas/nios2/add.d                    |   16 -
 gas/testsuite/gas/nios2/add.s                    |   13 -
 gas/testsuite/gas/nios2/align_fill-r2.d          |   25 -
 gas/testsuite/gas/nios2/align_fill.d             |   23 -
 gas/testsuite/gas/nios2/align_fill.s             |   20 -
 gas/testsuite/gas/nios2/align_text-r2.d          |   24 -
 gas/testsuite/gas/nios2/align_text.d             |   22 -
 gas/testsuite/gas/nios2/align_text.s             |   15 -
 gas/testsuite/gas/nios2/aligned_text-r2.d        |   24 -
 gas/testsuite/gas/nios2/and-r2.d                 |   19 -
 gas/testsuite/gas/nios2/and.d                    |   17 -
 gas/testsuite/gas/nios2/and.s                    |   13 -
 gas/testsuite/gas/nios2/andc.d                   |   17 -
 gas/testsuite/gas/nios2/andc.s                   |   12 -
 gas/testsuite/gas/nios2/bmx.d                    |   21 -
 gas/testsuite/gas/nios2/bmx.s                    |   15 -
 gas/testsuite/gas/nios2/branch-r2.d              |   23 -
 gas/testsuite/gas/nios2/branch.d                 |   21 -
 gas/testsuite/gas/nios2/branch.s                 |   15 -
 gas/testsuite/gas/nios2/break-r2.d               |   14 -
 gas/testsuite/gas/nios2/break.d                  |   12 -
 gas/testsuite/gas/nios2/break.s                  |    8 -
 gas/testsuite/gas/nios2/bret-r2.d                |   10 -
 gas/testsuite/gas/nios2/bret.d                   |    8 -
 gas/testsuite/gas/nios2/bret.s                   |    5 -
 gas/testsuite/gas/nios2/brn.d                    |   10 -
 gas/testsuite/gas/nios2/brn.s                    |    4 -
 gas/testsuite/gas/nios2/cache-r2.d               |   18 -
 gas/testsuite/gas/nios2/cache-r2.s               |   21 -
 gas/testsuite/gas/nios2/cache.d                  |   17 -
 gas/testsuite/gas/nios2/cache.s                  |   21 -
 gas/testsuite/gas/nios2/call-r2.d                |   13 -
 gas/testsuite/gas/nios2/call.d                   |   11 -
 gas/testsuite/gas/nios2/call.s                   |   13 -
 gas/testsuite/gas/nios2/call26-r2.d              |   78 -
 gas/testsuite/gas/nios2/call26.d                 |   76 -
 gas/testsuite/gas/nios2/call26.s                 |   12 -
 gas/testsuite/gas/nios2/call26_noat-r2.d         |   78 -
 gas/testsuite/gas/nios2/call26_noat.d            |   76 -
 gas/testsuite/gas/nios2/call26_noat.s            |   13 -
 gas/testsuite/gas/nios2/call_noat-r2.d           |   13 -
 gas/testsuite/gas/nios2/call_noat.d              |   11 -
 gas/testsuite/gas/nios2/call_noat.s              |   14 -
 gas/testsuite/gas/nios2/cdx_add.d                |   19 -
 gas/testsuite/gas/nios2/cdx_add.s                |   12 -
 gas/testsuite/gas/nios2/cdx_and.d                |   27 -
 gas/testsuite/gas/nios2/cdx_and.s                |   20 -
 gas/testsuite/gas/nios2/cdx_break.d              |   11 -
 gas/testsuite/gas/nios2/cdx_break.s              |    8 -
 gas/testsuite/gas/nios2/cdx_callr.d              |    9 -
 gas/testsuite/gas/nios2/cdx_callr.s              |    6 -
 gas/testsuite/gas/nios2/cdx_jmpr.d               |   11 -
 gas/testsuite/gas/nios2/cdx_jmpr.s               |    6 -
 gas/testsuite/gas/nios2/cdx_ldbu.d               |   17 -
 gas/testsuite/gas/nios2/cdx_ldbu.s               |   11 -
 gas/testsuite/gas/nios2/cdx_ldhu.d               |   17 -
 gas/testsuite/gas/nios2/cdx_ldhu.s               |   11 -
 gas/testsuite/gas/nios2/cdx_ldw.d                |   17 -
 gas/testsuite/gas/nios2/cdx_ldw.s                |   11 -
 gas/testsuite/gas/nios2/cdx_ldwsp.d              |   13 -
 gas/testsuite/gas/nios2/cdx_ldwsp.s              |    7 -
 gas/testsuite/gas/nios2/cdx_mov.d                |   17 -
 gas/testsuite/gas/nios2/cdx_mov.s                |   11 -
 gas/testsuite/gas/nios2/cdx_neg.d                |   13 -
 gas/testsuite/gas/nios2/cdx_neg.s                |    7 -
 gas/testsuite/gas/nios2/cdx_not.d                |   13 -
 gas/testsuite/gas/nios2/cdx_not.s                |    7 -
 gas/testsuite/gas/nios2/cdx_or.d                 |   13 -
 gas/testsuite/gas/nios2/cdx_or.s                 |    7 -
 gas/testsuite/gas/nios2/cdx_pop.d                |   17 -
 gas/testsuite/gas/nios2/cdx_pop.s                |   11 -
 gas/testsuite/gas/nios2/cdx_push.d               |   17 -
 gas/testsuite/gas/nios2/cdx_push.s               |   11 -
 gas/testsuite/gas/nios2/cdx_relax.d              |   22 -
 gas/testsuite/gas/nios2/cdx_relax.s              |   27 -
 gas/testsuite/gas/nios2/cdx_ret.d                |   11 -
 gas/testsuite/gas/nios2/cdx_ret.s                |    4 -
 gas/testsuite/gas/nios2/cdx_sll.d                |   21 -
 gas/testsuite/gas/nios2/cdx_sll.s                |   14 -
 gas/testsuite/gas/nios2/cdx_spaddi.d             |   13 -
 gas/testsuite/gas/nios2/cdx_spaddi.s             |    7 -
 gas/testsuite/gas/nios2/cdx_spdeci.d             |   13 -
 gas/testsuite/gas/nios2/cdx_spdeci.s             |    7 -
 gas/testsuite/gas/nios2/cdx_srl.d                |   21 -
 gas/testsuite/gas/nios2/cdx_srl.s                |   14 -
 gas/testsuite/gas/nios2/cdx_stb.d                |   21 -
 gas/testsuite/gas/nios2/cdx_stb.s                |   15 -
 gas/testsuite/gas/nios2/cdx_sth.d                |   17 -
 gas/testsuite/gas/nios2/cdx_sth.s                |   11 -
 gas/testsuite/gas/nios2/cdx_stw.d                |   21 -
 gas/testsuite/gas/nios2/cdx_stw.s                |   15 -
 gas/testsuite/gas/nios2/cdx_stwsp.d              |   13 -
 gas/testsuite/gas/nios2/cdx_stwsp.s              |    7 -
 gas/testsuite/gas/nios2/cdx_sub.d                |   19 -
 gas/testsuite/gas/nios2/cdx_sub.s                |   12 -
 gas/testsuite/gas/nios2/cdx_trap.d               |   11 -
 gas/testsuite/gas/nios2/cdx_trap.s               |    8 -
 gas/testsuite/gas/nios2/cdx_xor.d                |   13 -
 gas/testsuite/gas/nios2/cdx_xor.s                |    7 -
 gas/testsuite/gas/nios2/cmp-r2.d                 |   26 -
 gas/testsuite/gas/nios2/cmp.d                    |   24 -
 gas/testsuite/gas/nios2/cmp.s                    |   22 -
 gas/testsuite/gas/nios2/comments-r2.d            |   28 -
 gas/testsuite/gas/nios2/comments.d               |   26 -
 gas/testsuite/gas/nios2/comments.s               |   28 -
 gas/testsuite/gas/nios2/complex-r2.d             |   14 -
 gas/testsuite/gas/nios2/complex.d                |   12 -
 gas/testsuite/gas/nios2/complex.s                |    5 -
 gas/testsuite/gas/nios2/ctl-r2.d                 |   22 -
 gas/testsuite/gas/nios2/ctl.d                    |   20 -
 gas/testsuite/gas/nios2/ctl.s                    |   18 -
 gas/testsuite/gas/nios2/custom-r2.d              |   15 -
 gas/testsuite/gas/nios2/custom.d                 |   13 -
 gas/testsuite/gas/nios2/custom.s                 |    8 -
 gas/testsuite/gas/nios2/eni.d                    |   12 -
 gas/testsuite/gas/nios2/eni.s                    |    7 -
 gas/testsuite/gas/nios2/etbt-r2.d                |   12 -
 gas/testsuite/gas/nios2/etbt.d                   |   10 -
 gas/testsuite/gas/nios2/etbt.s                   |    4 -
 gas/testsuite/gas/nios2/flushda-r2.d             |   12 -
 gas/testsuite/gas/nios2/flushda.d                |   10 -
 gas/testsuite/gas/nios2/flushda.s                |    6 -
 gas/testsuite/gas/nios2/illegal.l                |   14 -
 gas/testsuite/gas/nios2/illegal.s                |   17 -
 gas/testsuite/gas/nios2/illegal_pseudoinst.l     |   35 -
 gas/testsuite/gas/nios2/illegal_pseudoinst.s     |   45 -
 gas/testsuite/gas/nios2/jmp-r2.d                 |   12 -
 gas/testsuite/gas/nios2/jmp.d                    |   10 -
 gas/testsuite/gas/nios2/jmp.s                    |    6 -
 gas/testsuite/gas/nios2/ldb-r2.d                 |  197 -
 gas/testsuite/gas/nios2/ldb-r2.s                 |  117 -
 gas/testsuite/gas/nios2/ldb.d                    |  196 -
 gas/testsuite/gas/nios2/ldb.s                    |  117 -
 gas/testsuite/gas/nios2/ldh-r2.d                 |  197 -
 gas/testsuite/gas/nios2/ldh-r2.s                 |  117 -
 gas/testsuite/gas/nios2/ldh.d                    |  196 -
 gas/testsuite/gas/nios2/ldh.s                    |  117 -
 gas/testsuite/gas/nios2/ldw-r2.d                 |  197 -
 gas/testsuite/gas/nios2/ldw-r2.s                 |  117 -
 gas/testsuite/gas/nios2/ldw.d                    |  196 -
 gas/testsuite/gas/nios2/ldw.s                    |  117 -
 gas/testsuite/gas/nios2/ldwm.d                   |   37 -
 gas/testsuite/gas/nios2/ldwm.s                   |   31 -
 gas/testsuite/gas/nios2/lineseparator-r2.d       |   12 -
 gas/testsuite/gas/nios2/lineseparator.d          |   10 -
 gas/testsuite/gas/nios2/lineseparator.s          |    4 -
 gas/testsuite/gas/nios2/movi.l                   |    6 -
 gas/testsuite/gas/nios2/movi.s                   |   21 -
 gas/testsuite/gas/nios2/movia-r2.d               |   22 -
 gas/testsuite/gas/nios2/movia.d                  |   20 -
 gas/testsuite/gas/nios2/movia.s                  |    7 -
 gas/testsuite/gas/nios2/mpx.d                    |   14 -
 gas/testsuite/gas/nios2/mpx.s                    |    9 -
 gas/testsuite/gas/nios2/mul-r2.d                 |   21 -
 gas/testsuite/gas/nios2/mul.d                    |   19 -
 gas/testsuite/gas/nios2/mul.s                    |   15 -
 gas/testsuite/gas/nios2/nios2.exp                |   29 -
 gas/testsuite/gas/nios2/nop-r2.d                 |   11 -
 gas/testsuite/gas/nios2/nop-r2.s                 |    8 -
 gas/testsuite/gas/nios2/nor-r2.d                 |   11 -
 gas/testsuite/gas/nios2/nor.d                    |    9 -
 gas/testsuite/gas/nios2/nor.s                    |    5 -
 gas/testsuite/gas/nios2/or-r2.d                  |   13 -
 gas/testsuite/gas/nios2/or.d                     |   11 -
 gas/testsuite/gas/nios2/or.s                     |    7 -
 gas/testsuite/gas/nios2/rdprs-r2.d               |   32 -
 gas/testsuite/gas/nios2/rdprs-r2.s               |   28 -
 gas/testsuite/gas/nios2/rdprs.d                  |   35 -
 gas/testsuite/gas/nios2/rdprs.s                  |   32 -
 gas/testsuite/gas/nios2/registers-r2.d           |   53 -
 gas/testsuite/gas/nios2/registers.d              |   51 -
 gas/testsuite/gas/nios2/registers.s              |   51 -
 gas/testsuite/gas/nios2/relax.d                  |   25 -
 gas/testsuite/gas/nios2/relax.s                  |    5 -
 gas/testsuite/gas/nios2/ret-r2.d                 |   10 -
 gas/testsuite/gas/nios2/ret.d                    |    8 -
 gas/testsuite/gas/nios2/ret.s                    |    5 -
 gas/testsuite/gas/nios2/rotate-r2.d              |   19 -
 gas/testsuite/gas/nios2/rotate.d                 |   17 -
 gas/testsuite/gas/nios2/rotate.s                 |   13 -
 gas/testsuite/gas/nios2/selftest.d               |   18 -
 gas/testsuite/gas/nios2/selftest.s               |  134 -
 gas/testsuite/gas/nios2/stb-r2.d                 |  197 -
 gas/testsuite/gas/nios2/stb-r2.s                 |  117 -
 gas/testsuite/gas/nios2/stb.d                    |  196 -
 gas/testsuite/gas/nios2/stb.s                    |  117 -
 gas/testsuite/gas/nios2/sth-r2.d                 |  197 -
 gas/testsuite/gas/nios2/sth-r2.s                 |  117 -
 gas/testsuite/gas/nios2/sth.d                    |  196 -
 gas/testsuite/gas/nios2/sth.s                    |  117 -
 gas/testsuite/gas/nios2/stw-r2.d                 |  197 -
 gas/testsuite/gas/nios2/stw-r2.s                 |  117 -
 gas/testsuite/gas/nios2/stw.d                    |  196 -
 gas/testsuite/gas/nios2/stw.s                    |  117 -
 gas/testsuite/gas/nios2/stwm.d                   |   35 -
 gas/testsuite/gas/nios2/stwm.s                   |   29 -
 gas/testsuite/gas/nios2/sub-r2.d                 |   12 -
 gas/testsuite/gas/nios2/sub.d                    |   10 -
 gas/testsuite/gas/nios2/sub.s                    |    4 -
 gas/testsuite/gas/nios2/sync-r2.d                |   10 -
 gas/testsuite/gas/nios2/sync.d                   |    8 -
 gas/testsuite/gas/nios2/sync.s                   |    5 -
 gas/testsuite/gas/nios2/trap-r2.d                |   12 -
 gas/testsuite/gas/nios2/trap.d                   |   10 -
 gas/testsuite/gas/nios2/trap.s                   |    6 -
 gas/testsuite/gas/nios2/tret-r2.d                |    9 -
 gas/testsuite/gas/nios2/tret.d                   |    7 -
 gas/testsuite/gas/nios2/tret.s                   |    5 -
 gas/testsuite/gas/nios2/warn_noat.l              |    5 -
 gas/testsuite/gas/nios2/warn_noat.s              |    8 -
 gas/testsuite/gas/nios2/warn_nobreak.l           |    9 -
 gas/testsuite/gas/nios2/warn_nobreak.s           |   12 -
 gas/testsuite/gas/nios2/wrpie.d                  |   20 -
 gas/testsuite/gas/nios2/wrpie.s                  |   16 -
 gas/testsuite/gas/nios2/wrprs-r2.d               |   21 -
 gas/testsuite/gas/nios2/wrprs.d                  |   19 -
 gas/testsuite/gas/nios2/wrprs.s                  |   16 -
 gas/testsuite/gas/nios2/xor-r2.d                 |   13 -
 gas/testsuite/gas/nios2/xor.d                    |   11 -
 gas/testsuite/gas/nios2/xor.s                    |    7 -
 include/opcode/nios2.h                           |  235 -
 include/opcode/nios2r1.h                         |  474 --
 include/opcode/nios2r2.h                         | 1081 ----
 ld/Makefile.am                                   |    2 -
 ld/Makefile.in                                   |    4 -
 ld/NEWS                                          |    3 +
 ld/configure.tgt                                 |    4 -
 ld/emulparams/nios2elf.sh                        |   19 -
 ld/emulparams/nios2linux.sh                      |   20 -
 ld/emultempl/nios2elf.em                         |  304 --
 ld/gen-doc.texi                                  |    1 -
 ld/ld.texi                                       |   44 -
 ld/testsuite/ld-elf/binutils.exp                 |    1 -
 ld/testsuite/ld-elf/elf.exp                      |    1 -
 ld/testsuite/ld-elf/tls.exp                      |    2 +-
 ld/testsuite/ld-elfcomm/elfcomm.exp              |    3 -
 ld/testsuite/ld-ifunc/ifunc.exp                  |    1 -
 ld/testsuite/ld-nios2/emit-relocs-1.d            |   37 -
 ld/testsuite/ld-nios2/emit-relocs-1.ld           |   20 -
 ld/testsuite/ld-nios2/emit-relocs-1a.s           |   24 -
 ld/testsuite/ld-nios2/emit-relocs-1b.s           |   18 -
 ld/testsuite/ld-nios2/gprel.d                    |   17 -
 ld/testsuite/ld-nios2/gprel.s                    |   29 -
 ld/testsuite/ld-nios2/hilo16.d                   |   13 -
 ld/testsuite/ld-nios2/hilo16.s                   |   10 -
 ld/testsuite/ld-nios2/hilo16_symbol.s            |    3 -
 ld/testsuite/ld-nios2/imm5.d                     |   13 -
 ld/testsuite/ld-nios2/imm5.s                     |    9 -
 ld/testsuite/ld-nios2/imm5_symbol.s              |    4 -
 ld/testsuite/ld-nios2/mixed1a.d                  |    9 -
 ld/testsuite/ld-nios2/mixed1a.s                  |    9 -
 ld/testsuite/ld-nios2/mixed1b.d                  |    9 -
 ld/testsuite/ld-nios2/mixed1b.s                  |    3 -
 ld/testsuite/ld-nios2/nios2.exp                  |   28 -
 ld/testsuite/ld-nios2/pcrel16.d                  |   15 -
 ld/testsuite/ld-nios2/pcrel16.s                  |    8 -
 ld/testsuite/ld-nios2/pcrel16_label.s            |    5 -
 ld/testsuite/ld-nios2/relax_call26.s             |   27 -
 ld/testsuite/ld-nios2/relax_call26_boundary.ld   |   14 -
 ld/testsuite/ld-nios2/relax_call26_boundary.s    |   29 -
 ld/testsuite/ld-nios2/relax_call26_boundary_c8.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_cc.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_d0.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_d4.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_d8.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_dc.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_f0.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_f4.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_f8.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_boundary_fc.d |    9 -
 ld/testsuite/ld-nios2/relax_call26_cache.d       |    9 -
 ld/testsuite/ld-nios2/relax_call26_cache.ld      |   13 -
 ld/testsuite/ld-nios2/relax_call26_cache.s       |   28 -
 ld/testsuite/ld-nios2/relax_call26_multi.d       |   36 -
 ld/testsuite/ld-nios2/relax_call26_multi.ld      |   14 -
 ld/testsuite/ld-nios2/relax_call26_norelax.d     |    5 -
 ld/testsuite/ld-nios2/relax_call26_shared.d      |   31 -
 ld/testsuite/ld-nios2/relax_call26_shared.ld     |   13 -
 ld/testsuite/ld-nios2/relax_callr.d              |   24 -
 ld/testsuite/ld-nios2/relax_callr.ld             |   11 -
 ld/testsuite/ld-nios2/relax_callr.s              |   17 -
 ld/testsuite/ld-nios2/relax_cjmp.d               |   38 -
 ld/testsuite/ld-nios2/relax_cjmp.s               |   32 -
 ld/testsuite/ld-nios2/relax_jmp.ld               |   11 -
 ld/testsuite/ld-nios2/relax_section.d            |   35 -
 ld/testsuite/ld-nios2/relax_section.s            |   23 -
 ld/testsuite/ld-nios2/relax_ujmp.d               |   32 -
 ld/testsuite/ld-nios2/relax_ujmp.s               |   37 -
 ld/testsuite/ld-nios2/reloc.d                    |   10 -
 ld/testsuite/ld-nios2/reloc.s                    |    9 -
 ld/testsuite/ld-nios2/reloc_symbol.s             |   24 -
 ld/testsuite/ld-nios2/s16.d                      |   12 -
 ld/testsuite/ld-nios2/s16.s                      |   16 -
 ld/testsuite/ld-nios2/s16_symbol.s               |   10 -
 ld/testsuite/ld-nios2/u16.d                      |   12 -
 ld/testsuite/ld-nios2/u16.s                      |   16 -
 ld/testsuite/ld-nios2/u16_symbol.s               |    9 -
 opcodes/Makefile.am                              |    2 -
 opcodes/Makefile.in                              |    4 -
 opcodes/configure                                |    1 -
 opcodes/configure.ac                             |    1 -
 opcodes/disassemble.c                            |    9 -
 opcodes/disassemble.h                            |    2 -
 opcodes/nios2-dis.c                              | 1044 ----
 opcodes/nios2-opc.c                              |  783 ---
 337 files changed, 12 insertions(+), 23162 deletions(-)

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 0dc733eaba9..dadbd0f7882 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -144,7 +144,6 @@ ALL_MACHINES = \
 	cpu-mt.lo \
 	cpu-nds32.lo \
 	cpu-nfp.lo \
-	cpu-nios2.lo \
 	cpu-ns32k.lo \
 	cpu-or1k.lo \
 	cpu-pdp11.lo \
@@ -228,7 +227,6 @@ ALL_MACHINES_CFILES = \
 	cpu-mt.c \
 	cpu-nds32.c \
 	cpu-nfp.c \
-	cpu-nios2.c \
 	cpu-ns32k.c \
 	cpu-or1k.c \
 	cpu-pdp11.c \
@@ -333,7 +331,6 @@ BFD32_BACKENDS = \
 	elf32-msp430.lo \
 	elf32-mt.lo \
 	elf32-nds32.lo \
-	elf32-nios2.lo \
 	elf32-or1k.lo \
 	elf32-pj.lo \
 	elf32-ppc.lo \
@@ -468,7 +465,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-msp430.c \
 	elf32-mt.c \
 	elf32-nds32.c \
-	elf32-nios2.c \
 	elf32-or1k.c \
 	elf32-pj.c \
 	elf32-ppc.c \
@@ -708,7 +704,7 @@ SOURCE_HFILES = \
 	ecoff-bfd.h ecoffswap.h \
 	elf32-arm.h elf32-avr.h elf32-bfin.h elf32-cr16.h elf32-csky.h \
 	elf32-dlx.h elf32-hppa.h elf32-m68hc1x.h elf32-m68k.h \
-	elf32-metag.h elf32-nds32.h elf32-nios2.h elf32-ppc.h \
+	elf32-metag.h elf32-nds32.h elf32-ppc.h \
 	elf32-rx.h elf32-score.h elf32-sh-relocs.h elf32-spu.h \
 	elf32-tic6x.h elf32-tilegx.h elf32-tilepro.h elf32-v850.h \
 	elf64-hppa.h elf64-ppc.h elf64-tilegx.h \
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 38364f4b2ba..a781e2b8959 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -610,7 +610,6 @@ ALL_MACHINES = \
 	cpu-mt.lo \
 	cpu-nds32.lo \
 	cpu-nfp.lo \
-	cpu-nios2.lo \
 	cpu-ns32k.lo \
 	cpu-or1k.lo \
 	cpu-pdp11.lo \
@@ -694,7 +693,6 @@ ALL_MACHINES_CFILES = \
 	cpu-mt.c \
 	cpu-nds32.c \
 	cpu-nfp.c \
-	cpu-nios2.c \
 	cpu-ns32k.c \
 	cpu-or1k.c \
 	cpu-pdp11.c \
@@ -800,7 +798,6 @@ BFD32_BACKENDS = \
 	elf32-msp430.lo \
 	elf32-mt.lo \
 	elf32-nds32.lo \
-	elf32-nios2.lo \
 	elf32-or1k.lo \
 	elf32-pj.lo \
 	elf32-ppc.lo \
@@ -935,7 +932,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-msp430.c \
 	elf32-mt.c \
 	elf32-nds32.c \
-	elf32-nios2.c \
 	elf32-or1k.c \
 	elf32-pj.c \
 	elf32-ppc.c \
@@ -1172,7 +1168,7 @@ SOURCE_HFILES = \
 	ecoff-bfd.h ecoffswap.h \
 	elf32-arm.h elf32-avr.h elf32-bfin.h elf32-cr16.h elf32-csky.h \
 	elf32-dlx.h elf32-hppa.h elf32-m68hc1x.h elf32-m68k.h \
-	elf32-metag.h elf32-nds32.h elf32-nios2.h elf32-ppc.h \
+	elf32-metag.h elf32-nds32.h elf32-ppc.h \
 	elf32-rx.h elf32-score.h elf32-sh-relocs.h elf32-spu.h \
 	elf32-tic6x.h elf32-tilegx.h elf32-tilepro.h elf32-v850.h \
 	elf64-hppa.h elf64-ppc.h elf64-tilegx.h \
@@ -1524,7 +1520,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-mt.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-nds32.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-nfp.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-nios2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ns32k.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-or1k.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pdp11.Plo@am__quote@
@@ -1614,7 +1609,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-msp430.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-mt.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-nds32.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-nios2.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-or1k.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-pj.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-ppc.Plo@am__quote@
diff --git a/bfd/archures.c b/bfd/archures.c
index c4decc59e4a..5c104af6ef3 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -536,10 +536,6 @@ DESCRIPTION
 .#define bfd_mach_aarch64_8R	1
 .#define bfd_mach_aarch64_ilp32	32
 .#define bfd_mach_aarch64_llp64 64
-.  bfd_arch_nios2,     {* Nios II.  *}
-.#define bfd_mach_nios2		0
-.#define bfd_mach_nios2r1	1
-.#define bfd_mach_nios2r2	2
 .  bfd_arch_visium,    {* Visium.  *}
 .#define bfd_mach_visium	1
 .  bfd_arch_wasm32,    {* WebAssembly.  *}
@@ -681,7 +677,6 @@ extern const bfd_arch_info_type bfd_msp430_arch;
 extern const bfd_arch_info_type bfd_mt_arch;
 extern const bfd_arch_info_type bfd_nds32_arch;
 extern const bfd_arch_info_type bfd_nfp_arch;
-extern const bfd_arch_info_type bfd_nios2_arch;
 extern const bfd_arch_info_type bfd_ns32k_arch;
 extern const bfd_arch_info_type bfd_or1k_arch;
 extern const bfd_arch_info_type bfd_pdp11_arch;
@@ -770,7 +765,6 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_mt_arch,
     &bfd_nds32_arch,
     &bfd_nfp_arch,
-    &bfd_nios2_arch,
     &bfd_ns32k_arch,
     &bfd_or1k_arch,
     &bfd_pdp11_arch,
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 3b047d922f3..092a6587c1c 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1802,10 +1802,6 @@ enum bfd_architecture
 #define bfd_mach_aarch64_8R    1
 #define bfd_mach_aarch64_ilp32 32
 #define bfd_mach_aarch64_llp64 64
-  bfd_arch_nios2,     /* Nios II.  */
-#define bfd_mach_nios2         0
-#define bfd_mach_nios2r1       1
-#define bfd_mach_nios2r2       2
   bfd_arch_visium,    /* Visium.  */
 #define bfd_mach_visium        1
   bfd_arch_wasm32,    /* WebAssembly.  */
@@ -6164,60 +6160,6 @@ enum bfd_reloc_code_real
   BFD_RELOC_MSP430_SET_ULEB128,
   BFD_RELOC_MSP430_SUB_ULEB128,
 
-  /* Relocations used by the Altera Nios II core.  */
-  BFD_RELOC_NIOS2_S16,
-  BFD_RELOC_NIOS2_U16,
-  BFD_RELOC_NIOS2_CALL26,
-  BFD_RELOC_NIOS2_IMM5,
-  BFD_RELOC_NIOS2_CACHE_OPX,
-  BFD_RELOC_NIOS2_IMM6,
-  BFD_RELOC_NIOS2_IMM8,
-  BFD_RELOC_NIOS2_HI16,
-  BFD_RELOC_NIOS2_LO16,
-  BFD_RELOC_NIOS2_HIADJ16,
-  BFD_RELOC_NIOS2_GPREL,
-  BFD_RELOC_NIOS2_UJMP,
-  BFD_RELOC_NIOS2_CJMP,
-  BFD_RELOC_NIOS2_CALLR,
-  BFD_RELOC_NIOS2_ALIGN,
-  BFD_RELOC_NIOS2_GOT16,
-  BFD_RELOC_NIOS2_CALL16,
-  BFD_RELOC_NIOS2_GOTOFF_LO,
-  BFD_RELOC_NIOS2_GOTOFF_HA,
-  BFD_RELOC_NIOS2_PCREL_LO,
-  BFD_RELOC_NIOS2_PCREL_HA,
-  BFD_RELOC_NIOS2_TLS_GD16,
-  BFD_RELOC_NIOS2_TLS_LDM16,
-  BFD_RELOC_NIOS2_TLS_LDO16,
-  BFD_RELOC_NIOS2_TLS_IE16,
-  BFD_RELOC_NIOS2_TLS_LE16,
-  BFD_RELOC_NIOS2_TLS_DTPMOD,
-  BFD_RELOC_NIOS2_TLS_DTPREL,
-  BFD_RELOC_NIOS2_TLS_TPREL,
-  BFD_RELOC_NIOS2_COPY,
-  BFD_RELOC_NIOS2_GLOB_DAT,
-  BFD_RELOC_NIOS2_JUMP_SLOT,
-  BFD_RELOC_NIOS2_RELATIVE,
-  BFD_RELOC_NIOS2_GOTOFF,
-  BFD_RELOC_NIOS2_CALL26_NOAT,
-  BFD_RELOC_NIOS2_GOT_LO,
-  BFD_RELOC_NIOS2_GOT_HA,
-  BFD_RELOC_NIOS2_CALL_LO,
-  BFD_RELOC_NIOS2_CALL_HA,
-  BFD_RELOC_NIOS2_R2_S12,
-  BFD_RELOC_NIOS2_R2_I10_1_PCREL,
-  BFD_RELOC_NIOS2_R2_T1I7_1_PCREL,
-  BFD_RELOC_NIOS2_R2_T1I7_2,
-  BFD_RELOC_NIOS2_R2_T2I4,
-  BFD_RELOC_NIOS2_R2_T2I4_1,
-  BFD_RELOC_NIOS2_R2_T2I4_2,
-  BFD_RELOC_NIOS2_R2_X1I7_2,
-  BFD_RELOC_NIOS2_R2_X2L5,
-  BFD_RELOC_NIOS2_R2_F1I5_2,
-  BFD_RELOC_NIOS2_R2_L5I4X1,
-  BFD_RELOC_NIOS2_R2_T1X1I6,
-  BFD_RELOC_NIOS2_R2_T1X1I6_2,
-
   /* PRU LDI 16-bit unsigned data-memory relocation.  */
   BFD_RELOC_PRU_U16,
 
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6553aac1e99..e2b09a2a92e 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -204,7 +204,6 @@ m68*)		 targ_archs=bfd_m68k_arch ;;
 microblaze*)	 targ_archs=bfd_microblaze_arch ;;
 mips*)		 targ_archs=bfd_mips_arch ;;
 nds32*)		 targ_archs=bfd_nds32_arch ;;
-nios2*)          targ_archs=bfd_nios2_arch ;;
 or1k*|or1knd*)	 targ_archs=bfd_or1k_arch ;;
 pdp11*)		 targ_archs=bfd_pdp11_arch ;;
 pj*)		 targ_archs="bfd_pj_arch bfd_i386_arch";;
@@ -1070,21 +1069,6 @@ case "${targ}" in
     targ_underscore=yes
     ;;
 
-  nios2eb-*-*)
-    targ_defvec=nios2_elf32_be_vec
-    targ_selvecs=nios2_elf32_le_vec
-    ;;
-
-  nios2el-*-*)
-    targ_defvec=nios2_elf32_le_vec
-    targ_selvecs=nios2_elf32_be_vec
-    ;;
-
-  nios2-*-*)
-    targ_defvec=nios2_elf32_le_vec
-    targ_selvecs=nios2_elf32_be_vec
-    ;;
-
   or1k-*-elf | or1k-*-linux* | or1k-*-rtems*)
     targ_defvec=or1k_elf32_vec
     ;;
diff --git a/bfd/configure b/bfd/configure
index b50cb7571d8..2db9f76b9eb 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15977,8 +15977,6 @@ do
     nds32_elf32_linux_be_vec)	 tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
     nds32_elf32_linux_le_vec)	 tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
     nfp_elf64_vec)		 tb="$tb elf64-nfp.lo elf64.lo $elf" ;;
-    nios2_elf32_be_vec)		 tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
-    nios2_elf32_le_vec)		 tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
     ns32k_aout_pc532mach_vec)	 tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
     ns32k_aout_pc532nbsd_vec)	 tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
     or1k_elf32_vec)		 tb="$tb elf32-or1k.lo elf32.lo $elf" ;;
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 6bcfd1b7368..465a7463d48 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -563,8 +563,6 @@ do
     nds32_elf32_linux_be_vec)	 tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
     nds32_elf32_linux_le_vec)	 tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
     nfp_elf64_vec)		 tb="$tb elf64-nfp.lo elf64.lo $elf" ;;
-    nios2_elf32_be_vec)		 tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
-    nios2_elf32_le_vec)		 tb="$tb elf32-nios2.lo elf32.lo $elf" ;;
     ns32k_aout_pc532mach_vec)	 tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
     ns32k_aout_pc532nbsd_vec)	 tb="$tb ns32knetbsd.lo aout-ns32k.lo" ;;
     or1k_elf32_vec)		 tb="$tb elf32-or1k.lo elf32.lo $elf" ;;
diff --git a/bfd/cpu-nios2.c b/bfd/cpu-nios2.c
deleted file mode 100644
index 4b81b3ec9f5..00000000000
--- a/bfd/cpu-nios2.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* BFD support for the Altera Nios II processor.
-   Copyright (C) 2012-2024 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.  */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-
-static const bfd_arch_info_type *
-nios2_compatible (const bfd_arch_info_type *a,
-		  const bfd_arch_info_type *b)
-{
-  if (a->arch != b->arch)
-    return NULL;
-
-  if (a->bits_per_word != b->bits_per_word)
-    return NULL;
-
-  if (a->mach == bfd_mach_nios2)
-    return a;
-  else if (b->mach == bfd_mach_nios2)
-    return b;
-  else if (a->mach != b->mach)
-    return NULL;
-
-  return a;
-}
-
-#define N(NUMBER, PRINT, DEFAULT, NEXT)			\
-  {							\
-    32, /* Bits in a word.  */				\
-    32, /* Bits in an address.  */			\
-    8,	/* Bits in a byte.  */				\
-    bfd_arch_nios2,					\
-    NUMBER,						\
-    "nios2",						\
-    PRINT,						\
-    3,							\
-    DEFAULT,						\
-    nios2_compatible,					\
-    bfd_default_scan,					\
-    bfd_arch_default_fill,				\
-    NEXT,						\
-    0 /* Maximum offset of a reloc from the start of an insn.  */ \
-  }
-
-#define NIOS2R1_NEXT &arch_info_struct[0]
-#define NIOS2R2_NEXT &arch_info_struct[1]
-
-static const bfd_arch_info_type arch_info_struct[2] =
-{
-  N (bfd_mach_nios2r1, "nios2:r1", false, NIOS2R2_NEXT),
-  N (bfd_mach_nios2r2, "nios2:r2", false, NULL),
-};
-
-const bfd_arch_info_type bfd_nios2_arch =
-  N (bfd_mach_nios2, "nios2", true, NIOS2R1_NEXT);
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 96cf11936ae..b756e73736e 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -558,7 +558,6 @@ enum elf_target_id
   MIPS_ELF_DATA,
   MN10300_ELF_DATA,
   NDS32_ELF_DATA,
-  NIOS2_ELF_DATA,
   OR1K_ELF_DATA,
   PPC32_ELF_DATA,
   PPC64_ELF_DATA,
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index ebe162f2e5f..6e0da8c4dd8 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -2145,7 +2145,6 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
 			/* Fall thru */
 		      case bfd_arch_frv:
 		      case bfd_arch_i386:
-		      case bfd_arch_nios2:
 			BFD_ASSERT (htab->hgot != NULL
 				    && ((htab->hgot->root.type
 					 == bfd_link_hash_defined)
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
deleted file mode 100644
index f6580af9519..00000000000
--- a/bfd/elf32-nios2.c
+++ /dev/null
@@ -1,6086 +0,0 @@
-/* 32-bit ELF support for Nios II.
-   Copyright (C) 2012-2024 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 handles Altera Nios II ELF targets.  */
-
-#include "sysdep.h"
-#include "bfd.h"
-#include "libbfd.h"
-#include "bfdlink.h"
-#include "genlink.h"
-#include "elf-bfd.h"
-#include "elf/nios2.h"
-#include "opcode/nios2.h"
-#include "elf32-nios2.h"
-#include "libiberty.h"
-
-/* Use RELA relocations.  */
-#ifndef USE_RELA
-#define USE_RELA
-#endif
-
-#ifdef USE_REL
-#undef USE_REL
-#endif
-
-/* Forward declarations.  */
-static bfd_reloc_status_type nios2_elf32_ignore_reloc
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_hi16_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_lo16_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_hiadj16_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_pcrel_lo16_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_pcrel_hiadj16_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_pcrel16_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_call26_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_gprel_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_ujmp_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_cjmp_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-static bfd_reloc_status_type nios2_elf32_callr_relocate
-  (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
-
-/* Target vector.  */
-extern const bfd_target nios2_elf32_le_vec;
-extern const bfd_target nios2_elf32_be_vec;
-
-/* Offset of tp and dtp pointers from start of TLS block.  */
-#define TP_OFFSET	0x7000
-#define DTP_OFFSET	0x8000
-
-/* The relocation tables used for SHT_REL sections.  There are separate
-   tables for R1 and R2 encodings.  */
-static reloc_howto_type elf_nios2_r1_howto_table_rel[] = {
-  /* No relocation.  */
-  HOWTO (R_NIOS2_NONE,		/* type */
-	 0,			/* rightshift */
-	 0,			/* size */
-	 0,			/* bitsize */
-	 false,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_dont,	/* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_NIOS2_NONE",	/* name */
-	 false,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0,			/* dst_mask */
-	 false),		/* pcrel_offset */
-
-  /* 16-bit signed immediate relocation.  */
-  HOWTO (R_NIOS2_S16,		/* type */
-	 0,			/* rightshift */
-	 4,			/* size */
-	 16,			/* bitsize */
-	 false,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_signed,	/* complain on overflow */
-	 bfd_elf_generic_reloc,	/* special function */
-	 "R_NIOS2_S16",		/* name */
-	 false,			/* partial_inplace */
-	 0x003fffc0,		/* src_mask */
-	 0x003fffc0,		/* dest_mask */
-	 false),		/* pcrel_offset */
-
-  /* 16-bit unsigned immediate relocation.  */
-  HOWTO (R_NIOS2_U16,		/* type */
-	 0,			/* rightshift */
-	 4,			/* size */
-	 16,			/* bitsize */
-	 false,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_unsigned,	/* complain on overflow */
-	 bfd_elf_generic_reloc,	/* special function */
-	 "R_NIOS2_U16",		/* name */
-	 false,			/* partial_inplace */
-	 0x003fffc0,		/* src_mask */
-	 0x003fffc0,		/* dest_mask */
-	 false),		/* pcrel_offset */
-
-  HOWTO (R_NIOS2_PCREL16,	/* type */
-	 0,			/* rightshift */
-	 4,			/* size */
-	 16,			/* bitsize */
-	 true,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_signed,	/* complain on overflow */
-	 nios2_elf32_pcrel16_relocate,	/* special function */
-	 "R_NIOS2_PCREL16",	/* name */
-	 false,			/* partial_inplace */
-	 0x003fffc0,		/* src_mask */
-	 0x003fffc0,		/* dest_mask */
-	 true),			/* pcrel_offset */
-
-  HOWTO (R_NIOS2_CALL26,	/* type */
-	 2,			/* rightshift */
-	 4,			/* size */
-	 26,			/* bitsize */
-	 false,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_dont,	/* complain on overflow */
-	 nios2_elf32_call26_relocate,	/* special function */
-	 "R_NIOS2_CALL26",	/* name */
-	 false,			/* partial_inplace */
-	 0xffffffc0,		/* src_mask */
-	 0xffffffc0,		/* dst_mask */
-	 false),		/* pcrel_offset */
-
-  HOWTO (R_NIOS2_IMM5,
-	 0,
-	 4,
-	 5,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_IMM5",
-	 false,
-	 0x000007c0,
-	 0x000007c0,
-	 false),
-
-  HOWTO (R_NIOS2_CACHE_OPX,
-	 0,
-	 4,
-	 5,
-	 false,
-	 22,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CACHE_OPX",
-	 false,
-	 0x07c00000,
-	 0x07c00000,
-	 false),
-
-  HOWTO (R_NIOS2_IMM6,
-	 0,
-	 4,
-	 6,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_IMM6",
-	 false,
-	 0x00000fc0,
-	 0x00000fc0,
-	 false),
-
-  HOWTO (R_NIOS2_IMM8,
-	 0,
-	 4,
-	 8,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_IMM8",
-	 false,
-	 0x00003fc0,
-	 0x00003fc0,
-	 false),
-
-  HOWTO (R_NIOS2_HI16,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_hi16_relocate,
-	 "R_NIOS2_HI16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_LO16,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_lo16_relocate,
-	 "R_NIOS2_LO16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_HIADJ16,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_hiadj16_relocate,
-	 "R_NIOS2_HIADJ16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_BFD_RELOC_32,
-	 0,
-	 4,			/* long */
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_BFD_RELOC32",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_BFD_RELOC_16,
-	 0,
-	 2,			/* short */
-	 16,
-	 false,
-	 0,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_BFD_RELOC16",
-	 false,
-	 0x0000ffff,
-	 0x0000ffff,
-	 false),
-
-  HOWTO (R_NIOS2_BFD_RELOC_8,
-	 0,
-	 1,			/* byte */
-	 8,
-	 false,
-	 0,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_BFD_RELOC8",
-	 false,
-	 0x000000ff,
-	 0x000000ff,
-	 false),
-
-  HOWTO (R_NIOS2_GPREL,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_gprel_relocate,
-	 "R_NIOS2_GPREL",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_GNU_VTINHERIT,
-	 0,
-	 4,
-	 0,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 NULL,
-	 "R_NIOS2_GNU_VTINHERIT",
-	 false,
-	 0,
-	 0,
-	 false),
-
-  HOWTO (R_NIOS2_GNU_VTENTRY,
-	 0,
-	 4,
-	 0,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 _bfd_elf_rel_vtable_reloc_fn,
-	 "R_NIOS2_GNU_VTENTRY",
-	 false,
-	 0,
-	 0,
-	 false),
-
-  HOWTO (R_NIOS2_UJMP,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_ujmp_relocate,
-	 "R_NIOS2_UJMP",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_CJMP,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_cjmp_relocate,
-	 "R_NIOS2_CJMP",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_CALLR,
-	 0,
-	 4,
-	 32,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_callr_relocate,
-	 "R_NIOS2_CALLR",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_ALIGN,
-	 0,
-	 4,
-	 0,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 nios2_elf32_ignore_reloc,
-	 "R_NIOS2_ALIGN",
-	 false,
-	 0,
-	 0,
-	 true),
-
-
-  HOWTO (R_NIOS2_GOT16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOT16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_CALL16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CALL16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_GOTOFF_LO,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOTOFF_LO",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_GOTOFF_HA,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOTOFF_HA",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_PCREL_LO,
-	 0,
-	 4,
-	 16,
-	 true,
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_pcrel_lo16_relocate,
-	 "R_NIOS2_PCREL_LO",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 true),
-
-  HOWTO (R_NIOS2_PCREL_HA,
-	 0,
-	 4,
-	 16,
-	 false, /* This is a PC-relative relocation, but we need to subtract
-		   PC ourselves before the HIADJ.  */
-	 6,
-	 complain_overflow_dont,
-	 nios2_elf32_pcrel_hiadj16_relocate,
-	 "R_NIOS2_PCREL_HA",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 true),
-
-  HOWTO (R_NIOS2_TLS_GD16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_GD16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_LDM16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_LDM16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_LDO16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_LDO16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_IE16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_IE16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_LE16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_LE16",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_DTPMOD,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_DTPMOD",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_DTPREL,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_DTPREL",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_TPREL,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_TPREL",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_COPY,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_COPY",
-	 false,
-	 0,
-	 0,
-	 false),
-
-  HOWTO (R_NIOS2_GLOB_DAT,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GLOB_DAT",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_JUMP_SLOT,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_JUMP_SLOT",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_RELATIVE,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_RELATIVE",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_GOTOFF,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOTOFF",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_CALL26_NOAT,	/* type */
-	 2,			/* rightshift */
-	 4,			/* size */
-	 26,			/* bitsize */
-	 false,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_dont,	/* complain on overflow */
-	 nios2_elf32_call26_relocate,	/* special function */
-	 "R_NIOS2_CALL26_NOAT",	/* name */
-	 false,			/* partial_inplace */
-	 0xffffffc0,		/* src_mask */
-	 0xffffffc0,		/* dst_mask */
-	 false),		/* pcrel_offset */
-
-  HOWTO (R_NIOS2_GOT_LO,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOT_LO",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_GOT_HA,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOT_HA",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_CALL_LO,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CALL_LO",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-  HOWTO (R_NIOS2_CALL_HA,
-	 0,
-	 4,
-	 16,
-	 false,
-	 6,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CALL_HA",
-	 false,
-	 0x003fffc0,
-	 0x003fffc0,
-	 false),
-
-/* Add other relocations here.  */
-};
-
-static reloc_howto_type elf_nios2_r2_howto_table_rel[] = {
-  /* No relocation.  */
-  HOWTO (R_NIOS2_NONE,		/* type */
-	 0,			/* rightshift */
-	 0,			/* size */
-	 0,			/* bitsize */
-	 false,			/* pc_relative */
-	 0,			/* bitpos */
-	 complain_overflow_dont,	/* complain_on_overflow */
-	 bfd_elf_generic_reloc,	/* special_function */
-	 "R_NIOS2_NONE",	/* name */
-	 false,			/* partial_inplace */
-	 0,			/* src_mask */
-	 0,			/* dst_mask */
-	 false),		/* pcrel_offset */
-
-  /* 16-bit signed immediate relocation.  */
-  HOWTO (R_NIOS2_S16,		/* type */
-	 0,			/* rightshift */
-	 4,			/* size */
-	 16,			/* bitsize */
-	 false,			/* pc_relative */
-	 16,			/* bitpos */
-	 complain_overflow_signed,	/* complain on overflow */
-	 bfd_elf_generic_reloc,	/* special function */
-	 "R_NIOS2_S16",		/* name */
-	 false,			/* partial_inplace */
-	 0xffff0000,		/* src_mask */
-	 0xffff0000,		/* dest_mask */
-	 false),		/* pcrel_offset */
-
-  /* 16-bit unsigned immediate relocation.  */
-  HOWTO (R_NIOS2_U16,		/* type */
-	 0,			/* rightshift */
-	 4,			/* size */
-	 16,			/* bitsize */
-	 false,			/* pc_relative */
-	 16,			/* bitpos */
-	 complain_overflow_unsigned,	/* complain on overflow */
-	 bfd_elf_generic_reloc,	/* special function */
-	 "R_NIOS2_U16",		/* name */
-	 false,			/* partial_inplace */
-	 0xffff0000,		/* src_mask */
-	 0xffff0000,		/* dest_mask */
-	 false),		/* pcrel_offset */
-
-  HOWTO (R_NIOS2_PCREL16,	/* type */
-	 0,			/* rightshift */
-	 4,			/* size */
-	 16,			/* bitsize */
-	 true,			/* pc_relative */
-	 16,			/* bitpos */
-	 complain_overflow_signed,	/* complain on overflow */
-	 nios2_elf32_pcrel16_relocate,	/* special function */
-	 "R_NIOS2_PCREL16",	/* name */
-	 false,			/* partial_inplace */
-	 0xffff0000,		/* src_mask */
-	 0xffff0000,		/* dest_mask */
-	 true),			/* pcrel_offset */
-
-  HOWTO (R_NIOS2_CALL26,	/* type */
-	 2,			/* rightshift */
-	 4,			/* size */
-	 26,			/* bitsize */
-	 false,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_dont,	/* complain on overflow */
-	 nios2_elf32_call26_relocate,	/* special function */
-	 "R_NIOS2_CALL26",	/* name */
-	 false,			/* partial_inplace */
-	 0xffffffc0,		/* src_mask */
-	 0xffffffc0,		/* dst_mask */
-	 false),		/* pcrel_offset */
-
-  HOWTO (R_NIOS2_IMM5,
-	 0,
-	 4,
-	 5,
-	 false,
-	 21,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_IMM5",
-	 false,
-	 0x03e00000,
-	 0x03e00000,
-	 false),
-
-  HOWTO (R_NIOS2_CACHE_OPX,
-	 0,
-	 4,
-	 5,
-	 false,
-	 11,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CACHE_OPX",
-	 false,
-	 0x0000f800,
-	 0x0000f800,
-	 false),
-
-  HOWTO (R_NIOS2_IMM6,
-	 0,
-	 4,
-	 6,
-	 false,
-	 26,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_IMM6",
-	 false,
-	 0xfc000000,
-	 0xfc000000,
-	 false),
-
-  HOWTO (R_NIOS2_IMM8,
-	 0,
-	 4,
-	 8,
-	 false,
-	 24,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_IMM8",
-	 false,
-	 0xff000000,
-	 0xff000000,
-	 false),
-
-  HOWTO (R_NIOS2_HI16,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_hi16_relocate,
-	 "R_NIOS2_HI16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_LO16,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_lo16_relocate,
-	 "R_NIOS2_LO16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_HIADJ16,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_hiadj16_relocate,
-	 "R_NIOS2_HIADJ16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_BFD_RELOC_32,
-	 0,
-	 4,			/* long */
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_BFD_RELOC32",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_BFD_RELOC_16,
-	 0,
-	 2,			/* short */
-	 16,
-	 false,
-	 0,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_BFD_RELOC16",
-	 false,
-	 0x0000ffff,
-	 0x0000ffff,
-	 false),
-
-  HOWTO (R_NIOS2_BFD_RELOC_8,
-	 0,
-	 1,			/* byte */
-	 8,
-	 false,
-	 0,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_BFD_RELOC8",
-	 false,
-	 0x000000ff,
-	 0x000000ff,
-	 false),
-
-  HOWTO (R_NIOS2_GPREL,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_gprel_relocate,
-	 "R_NIOS2_GPREL",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_GNU_VTINHERIT,
-	 0,
-	 4,
-	 0,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 NULL,
-	 "R_NIOS2_GNU_VTINHERIT",
-	 false,
-	 0,
-	 0,
-	 false),
-
-  HOWTO (R_NIOS2_GNU_VTENTRY,
-	 0,
-	 4,
-	 0,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 _bfd_elf_rel_vtable_reloc_fn,
-	 "R_NIOS2_GNU_VTENTRY",
-	 false,
-	 0,
-	 0,
-	 false),
-
-  HOWTO (R_NIOS2_UJMP,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_ujmp_relocate,
-	 "R_NIOS2_UJMP",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_CJMP,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_cjmp_relocate,
-	 "R_NIOS2_CJMP",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_CALLR,
-	 0,
-	 4,
-	 32,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_callr_relocate,
-	 "R_NIOS2_CALLR",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_ALIGN,
-	 0,
-	 4,
-	 0,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 nios2_elf32_ignore_reloc,
-	 "R_NIOS2_ALIGN",
-	 false,
-	 0,
-	 0,
-	 true),
-
-  HOWTO (R_NIOS2_GOT16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOT16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_CALL16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CALL16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_GOTOFF_LO,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOTOFF_LO",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_GOTOFF_HA,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOTOFF_HA",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_PCREL_LO,
-	 0,
-	 4,
-	 16,
-	 true,
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_pcrel_lo16_relocate,
-	 "R_NIOS2_PCREL_LO",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 true),
-
-  HOWTO (R_NIOS2_PCREL_HA,
-	 0,
-	 4,
-	 16,
-	 false, /* This is a PC-relative relocation, but we need to subtract
-		   PC ourselves before the HIADJ.  */
-	 16,
-	 complain_overflow_dont,
-	 nios2_elf32_pcrel_hiadj16_relocate,
-	 "R_NIOS2_PCREL_HA",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 true),
-
-  HOWTO (R_NIOS2_TLS_GD16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_GD16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_LDM16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_LDM16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_LDO16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_LDO16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_IE16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_IE16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_LE16,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_bitfield,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_LE16",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_DTPMOD,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_DTPMOD",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_DTPREL,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_DTPREL",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_TLS_TPREL,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_TLS_TPREL",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_COPY,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_COPY",
-	 false,
-	 0,
-	 0,
-	 false),
-
-  HOWTO (R_NIOS2_GLOB_DAT,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GLOB_DAT",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_JUMP_SLOT,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_JUMP_SLOT",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_RELATIVE,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_RELATIVE",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_GOTOFF,
-	 0,
-	 4,
-	 32,
-	 false,
-	 0,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOTOFF",
-	 false,
-	 0xffffffff,
-	 0xffffffff,
-	 false),
-
-  HOWTO (R_NIOS2_CALL26_NOAT,	/* type */
-	 2,			/* rightshift */
-	 4,			/* size */
-	 26,			/* bitsize */
-	 false,			/* pc_relative */
-	 6,			/* bitpos */
-	 complain_overflow_dont,	/* complain on overflow */
-	 nios2_elf32_call26_relocate,	/* special function */
-	 "R_NIOS2_CALL26_NOAT",	/* name */
-	 false,			/* partial_inplace */
-	 0xffffffc0,		/* src_mask */
-	 0xffffffc0,		/* dst_mask */
-	 false),		/* pcrel_offset */
-
-  HOWTO (R_NIOS2_GOT_LO,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOT_LO",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_GOT_HA,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_GOT_HA",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_CALL_LO,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CALL_LO",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_CALL_HA,
-	 0,
-	 4,
-	 16,
-	 false,
-	 16,
-	 complain_overflow_dont,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_CALL_HA",
-	 false,
-	 0xffff0000,
-	 0xffff0000,
-	 false),
-
-  HOWTO (R_NIOS2_R2_S12,
-	 0,
-	 4,
-	 12,
-	 false,
-	 16,
-	 complain_overflow_signed,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_S12",
-	 false,
-	 0x0fff0000,
-	 0x0fff0000,
-	 false),
-
-  HOWTO (R_NIOS2_R2_I10_1_PCREL,
-	 1,
-	 2,
-	 10,
-	 true,
-	 6,
-	 complain_overflow_signed,
-	 bfd_elf_generic_reloc,		/* FIXME? */
-	 "R_NIOS2_R2_I10_1_PCREL",
-	 false,
-	 0xffc0,
-	 0xffc0,
-	 true),
-
-  HOWTO (R_NIOS2_R2_T1I7_1_PCREL,
-	 1,
-	 2,
-	 7,
-	 true,
-	 9,
-	 complain_overflow_signed,
-	 bfd_elf_generic_reloc,		/* FIXME? */
-	 "R_NIOS2_R2_T1I7_1_PCREL",
-	 false,
-	 0xfe00,
-	 0xfe00,
-	 true),
-
-  HOWTO (R_NIOS2_R2_T1I7_2,
-	 2,
-	 2,
-	 7,
-	 false,
-	 9,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_T1I7_2",
-	 false,
-	 0xfe00,
-	 0xfe00,
-	 false),
-
-  HOWTO (R_NIOS2_R2_T2I4,
-	 0,
-	 2,
-	 4,
-	 false,
-	 12,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_T2I4",
-	 false,
-	 0xf000,
-	 0xf000,
-	 false),
-
-  HOWTO (R_NIOS2_R2_T2I4_1,
-	 1,
-	 2,
-	 4,
-	 false,
-	 12,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_T2I4_1",
-	 false,
-	 0xf000,
-	 0xf000,
-	 false),
-
-  HOWTO (R_NIOS2_R2_T2I4_2,
-	 2,
-	 2,
-	 4,
-	 false,
-	 12,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_T2I4_2",
-	 false,
-	 0xf000,
-	 0xf000,
-	 false),
-
-  HOWTO (R_NIOS2_R2_X1I7_2,
-	 2,
-	 2,
-	 7,
-	 false,
-	 6,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_X1I7_2",
-	 false,
-	 0x1fc0,
-	 0x1fc0,
-	 false),
-
-  HOWTO (R_NIOS2_R2_X2L5,
-	 0,
-	 2,
-	 5,
-	 false,
-	 6,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_X2L5",
-	 false,
-	 0x07c0,
-	 0x07c0,
-	 false),
-
-  HOWTO (R_NIOS2_R2_F1I5_2,
-	 2,
-	 2,
-	 5,
-	 false,
-	 6,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_F1L5_2",
-	 false,
-	 0x07c0,
-	 0x07c0,
-	 false),
-
-  HOWTO (R_NIOS2_R2_L5I4X1,
-	 2,
-	 2,
-	 4,
-	 false,
-	 6,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_L5I4X1",
-	 false,
-	 0x03c0,
-	 0x03c0,
-	 false),
-
-  HOWTO (R_NIOS2_R2_T1X1I6,
-	 0,
-	 2,
-	 6,
-	 false,
-	 9,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_T1X1I6",
-	 false,
-	 0x7e00,
-	 0x7e00,
-	 false),
-
-  HOWTO (R_NIOS2_R2_T1X1I6_2,
-	 2,
-	 4,
-	 6,
-	 false,
-	 9,
-	 complain_overflow_unsigned,
-	 bfd_elf_generic_reloc,
-	 "R_NIOS2_R2_T1I1X6_2",
-	 false,
-	 0x7e00,
-	 0x7e00,
-	 false),
-
-/* Add other relocations here.  */
-};
-
-static unsigned char elf_code_to_howto_index[R_NIOS2_ILLEGAL + 1];
-
-
-/* Return true if producing output for a R2 BFD.  */
-#define BFD_IS_R2(abfd) (bfd_get_mach (abfd) == bfd_mach_nios2r2)
-
-/* Return the howto for relocation RTYPE.  */
-static reloc_howto_type *
-lookup_howto (unsigned int rtype, bfd *abfd)
-{
-  static int initialized = 0;
-  int i;
-  /* R2 relocations are a superset of R1, so use that for the lookup
-     table.  */
-  int r1_howto_tbl_size = (int) ARRAY_SIZE (elf_nios2_r1_howto_table_rel);
-  int r2_howto_tbl_size = (int) ARRAY_SIZE (elf_nios2_r2_howto_table_rel);
-
-  if (!initialized)
-    {
-      initialized = 1;
-      memset (elf_code_to_howto_index, 0xff,
-	      sizeof (elf_code_to_howto_index));
-      for (i = 0; i < r2_howto_tbl_size; i++)
-	{
-	  elf_code_to_howto_index[elf_nios2_r2_howto_table_rel[i].type] = i;
-	  if (i < r1_howto_tbl_size)
-	    BFD_ASSERT (elf_nios2_r2_howto_table_rel[i].type
-			== elf_nios2_r1_howto_table_rel[i].type);
-	}
-    }
-
-  if (rtype > R_NIOS2_ILLEGAL)
-    return NULL;
-  i = elf_code_to_howto_index[rtype];
-  if (BFD_IS_R2 (abfd))
-    {
-      if (i >= r2_howto_tbl_size)
-	return NULL;
-      return elf_nios2_r2_howto_table_rel + i;
-    }
-  else
-    {
-      if (i >= r1_howto_tbl_size)
-	return NULL;
-      return elf_nios2_r1_howto_table_rel + i;
-    }
-}
-
-/* Map for converting BFD reloc types to Nios II reloc types.  */
-struct elf_reloc_map
-{
-  bfd_reloc_code_real_type bfd_val;
-  enum elf_nios2_reloc_type elf_val;
-};
-
-static const struct elf_reloc_map nios2_reloc_map[] =
-{
-  {BFD_RELOC_NONE, R_NIOS2_NONE},
-  {BFD_RELOC_NIOS2_S16, R_NIOS2_S16},
-  {BFD_RELOC_NIOS2_U16, R_NIOS2_U16},
-  {BFD_RELOC_16_PCREL, R_NIOS2_PCREL16},
-  {BFD_RELOC_NIOS2_CALL26, R_NIOS2_CALL26},
-  {BFD_RELOC_NIOS2_IMM5, R_NIOS2_IMM5},
-  {BFD_RELOC_NIOS2_CACHE_OPX, R_NIOS2_CACHE_OPX},
-  {BFD_RELOC_NIOS2_IMM6, R_NIOS2_IMM6},
-  {BFD_RELOC_NIOS2_IMM8, R_NIOS2_IMM8},
-  {BFD_RELOC_NIOS2_HI16, R_NIOS2_HI16},
-  {BFD_RELOC_NIOS2_LO16, R_NIOS2_LO16},
-  {BFD_RELOC_NIOS2_HIADJ16, R_NIOS2_HIADJ16},
-  {BFD_RELOC_32, R_NIOS2_BFD_RELOC_32},
-  {BFD_RELOC_16, R_NIOS2_BFD_RELOC_16},
-  {BFD_RELOC_8, R_NIOS2_BFD_RELOC_8},
-  {BFD_RELOC_NIOS2_GPREL, R_NIOS2_GPREL},
-  {BFD_RELOC_VTABLE_INHERIT, R_NIOS2_GNU_VTINHERIT},
-  {BFD_RELOC_VTABLE_ENTRY, R_NIOS2_GNU_VTENTRY},
-  {BFD_RELOC_NIOS2_UJMP, R_NIOS2_UJMP},
-  {BFD_RELOC_NIOS2_CJMP, R_NIOS2_CJMP},
-  {BFD_RELOC_NIOS2_CALLR, R_NIOS2_CALLR},
-  {BFD_RELOC_NIOS2_ALIGN, R_NIOS2_ALIGN},
-  {BFD_RELOC_NIOS2_GOT16, R_NIOS2_GOT16},
-  {BFD_RELOC_NIOS2_CALL16, R_NIOS2_CALL16},
-  {BFD_RELOC_NIOS2_GOTOFF_LO, R_NIOS2_GOTOFF_LO},
-  {BFD_RELOC_NIOS2_GOTOFF_HA, R_NIOS2_GOTOFF_HA},
-  {BFD_RELOC_NIOS2_PCREL_LO, R_NIOS2_PCREL_LO},
-  {BFD_RELOC_NIOS2_PCREL_HA, R_NIOS2_PCREL_HA},
-  {BFD_RELOC_NIOS2_TLS_GD16, R_NIOS2_TLS_GD16},
-  {BFD_RELOC_NIOS2_TLS_LDM16, R_NIOS2_TLS_LDM16},
-  {BFD_RELOC_NIOS2_TLS_LDO16, R_NIOS2_TLS_LDO16},
-  {BFD_RELOC_NIOS2_TLS_IE16, R_NIOS2_TLS_IE16},
-  {BFD_RELOC_NIOS2_TLS_LE16, R_NIOS2_TLS_LE16},
-  {BFD_RELOC_NIOS2_TLS_DTPMOD, R_NIOS2_TLS_DTPMOD},
-  {BFD_RELOC_NIOS2_TLS_DTPREL, R_NIOS2_TLS_DTPREL},
-  {BFD_RELOC_NIOS2_TLS_TPREL, R_NIOS2_TLS_TPREL},
-  {BFD_RELOC_NIOS2_COPY, R_NIOS2_COPY},
-  {BFD_RELOC_NIOS2_GLOB_DAT, R_NIOS2_GLOB_DAT},
-  {BFD_RELOC_NIOS2_JUMP_SLOT, R_NIOS2_JUMP_SLOT},
-  {BFD_RELOC_NIOS2_RELATIVE, R_NIOS2_RELATIVE},
-  {BFD_RELOC_NIOS2_GOTOFF, R_NIOS2_GOTOFF},
-  {BFD_RELOC_NIOS2_CALL26_NOAT, R_NIOS2_CALL26_NOAT},
-  {BFD_RELOC_NIOS2_GOT_LO, R_NIOS2_GOT_LO},
-  {BFD_RELOC_NIOS2_GOT_HA, R_NIOS2_GOT_HA},
-  {BFD_RELOC_NIOS2_CALL_LO, R_NIOS2_CALL_LO},
-  {BFD_RELOC_NIOS2_CALL_HA, R_NIOS2_CALL_HA},
-  {BFD_RELOC_NIOS2_R2_S12, R_NIOS2_R2_S12},
-  {BFD_RELOC_NIOS2_R2_I10_1_PCREL, R_NIOS2_R2_I10_1_PCREL},
-  {BFD_RELOC_NIOS2_R2_T1I7_1_PCREL, R_NIOS2_R2_T1I7_1_PCREL},
-  {BFD_RELOC_NIOS2_R2_T1I7_2, R_NIOS2_R2_T1I7_2},
-  {BFD_RELOC_NIOS2_R2_T2I4, R_NIOS2_R2_T2I4},
-  {BFD_RELOC_NIOS2_R2_T2I4_1, R_NIOS2_R2_T2I4_1},
-  {BFD_RELOC_NIOS2_R2_T2I4_2, R_NIOS2_R2_T2I4_2},
-  {BFD_RELOC_NIOS2_R2_X1I7_2, R_NIOS2_R2_X1I7_2},
-  {BFD_RELOC_NIOS2_R2_X2L5, R_NIOS2_R2_X2L5},
-  {BFD_RELOC_NIOS2_R2_F1I5_2, R_NIOS2_R2_F1I5_2},
-  {BFD_RELOC_NIOS2_R2_L5I4X1, R_NIOS2_R2_L5I4X1},
-  {BFD_RELOC_NIOS2_R2_T1X1I6, R_NIOS2_R2_T1X1I6},
-  {BFD_RELOC_NIOS2_R2_T1X1I6_2, R_NIOS2_R2_T1X1I6_2},
-};
-
-enum elf32_nios2_stub_type
-{
-  nios2_stub_call26_before,
-  nios2_stub_call26_after,
-  nios2_stub_none
-};
-
-struct elf32_nios2_stub_hash_entry
-{
-  /* Base hash table entry structure.  */
-  struct bfd_hash_entry bh_root;
-
-  /* The stub section.  */
-  asection *stub_sec;
-
-  /* Offset within stub_sec of the beginning of this stub.  */
-  bfd_vma stub_offset;
-
-  /* Given the symbol's value and its section we can determine its final
-     value when building the stubs (so the stub knows where to jump.  */
-  bfd_vma target_value;
-  asection *target_section;
-
-  enum elf32_nios2_stub_type stub_type;
-
-  /* The symbol table entry, if any, that this was derived from.  */
-  struct elf32_nios2_link_hash_entry *hh;
-
-  /* And the reloc addend that this was derived from.  */
-  bfd_vma addend;
-
-  /* Where this stub is being called from, or, in the case of combined
-     stub sections, the first input section in the group.  */
-  asection *id_sec;
-};
-
-#define nios2_stub_hash_entry(ent) \
-  ((struct elf32_nios2_stub_hash_entry *)(ent))
-
-#define nios2_stub_hash_lookup(table, string, create, copy) \
-  ((struct elf32_nios2_stub_hash_entry *) \
-   bfd_hash_lookup ((table), (string), (create), (copy)))
-
-
-/* Nios II ELF linker hash entry.  */
-
-struct elf32_nios2_link_hash_entry
-{
-  struct elf_link_hash_entry root;
-
-  /* A pointer to the most recently used stub hash entry against this
-     symbol.  */
-  struct elf32_nios2_stub_hash_entry *hsh_cache;
-
-#define GOT_UNKNOWN	0
-#define GOT_NORMAL	1
-#define GOT_TLS_GD	2
-#define GOT_TLS_IE	4
-  unsigned char tls_type;
-
-  /* We need to detect and take special action for symbols which are only
-     referenced with %call() and not with %got().  Such symbols do not need
-     a dynamic GOT reloc in shared objects, only a dynamic PLT reloc.  Lazy
-     linking will not work if the dynamic GOT reloc exists.
-     To check for this condition efficiently, we compare got_types_used against
-     CALL_USED, meaning
-     (got_types_used & (GOT_USED | CALL_USED)) == CALL_USED.
-  */
-#define GOT_USED	1
-#define CALL_USED	2
-  unsigned char got_types_used;
-};
-
-#define elf32_nios2_hash_entry(ent) \
-  ((struct elf32_nios2_link_hash_entry *) (ent))
-
-/* Get the Nios II elf linker hash table from a link_info structure.  */
-#define elf32_nios2_hash_table(info) \
-  ((struct elf32_nios2_link_hash_table *) ((info)->hash))
-
-/* Nios II ELF linker hash table.  */
-struct elf32_nios2_link_hash_table
-  {
-    /* The main hash table.  */
-    struct elf_link_hash_table root;
-
-    /* The stub hash table.  */
-    struct bfd_hash_table bstab;
-
-    /* Linker stub bfd.  */
-    bfd *stub_bfd;
-
-    /* Linker call-backs.  */
-    asection * (*add_stub_section) (const char *, asection *, bool);
-    void (*layout_sections_again) (void);
-
-    /* Array to keep track of which stub sections have been created, and
-       information on stub grouping.  */
-    struct map_stub
-    {
-      /* These are the section to which stubs in the group will be
-	 attached.  */
-      asection *first_sec, *last_sec;
-      /* The stub sections.  There might be stubs inserted either before
-	 or after the real section.*/
-      asection *first_stub_sec, *last_stub_sec;
-    } *stub_group;
-
-    /* Assorted information used by nios2_elf32_size_stubs.  */
-    unsigned int bfd_count;
-    unsigned int top_index;
-    asection **input_list;
-    Elf_Internal_Sym **all_local_syms;
-
-    /* Short-cuts to get to dynamic linker sections.  */
-    asection *sbss;
-
-    /* GOT pointer symbol _gp_got.  */
-    struct elf_link_hash_entry *h_gp_got;
-
-    union {
-      bfd_signed_vma refcount;
-      bfd_vma offset;
-    } tls_ldm_got;
-
-    bfd_vma res_n_size;
-  };
-
-struct nios2_elf32_obj_tdata
-{
-  struct elf_obj_tdata root;
-
-  /* tls_type for each local got entry.  */
-  char *local_got_tls_type;
-
-  /* TRUE if TLS GD relocs have been seen for this object.  */
-  bool has_tlsgd;
-};
-
-#define elf32_nios2_tdata(abfd) \
-  ((struct nios2_elf32_obj_tdata *) (abfd)->tdata.any)
-
-#define elf32_nios2_local_got_tls_type(abfd) \
-  (elf32_nios2_tdata (abfd)->local_got_tls_type)
-
-/* The name of the dynamic interpreter.  This is put in the .interp
-   section.  */
-#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
-
-/* PLT implementation for position-dependent code.  */
-static const bfd_vma nios2_plt_entry[] = { /* .PLTn: */
-  0x03c00034,	/* movhi r15, %hiadj(plt_got_slot_address) */
-  0x7bc00017,	/* ldw r15, %lo(plt_got_slot_address)(r15) */
-  0x7800683a	/* jmp r15 */
-};
-
-static const bfd_vma nios2_plt0_entry[] = { /* .PLTresolve */
-  0x03800034,	/* movhi r14, %hiadj(res_0) */
-  0x73800004,	/* addi r14, r14, %lo(res_0) */
-  0x7b9fc83a,	/* sub r15, r15, r14 */
-  0x03400034,	/* movhi r13, %hiadj(_GLOBAL_OFFSET_TABLE_) */
-  0x6b800017,	/* ldw r14, %lo(_GLOBAL_OFFSET_TABLE_+4)(r13) */
-  0x6b400017,	/* ldw r13, %lo(_GLOBAL_OFFSET_TABLE_+8)(r13) */
-  0x6800683a	/* jmp r13 */
-};
-
-/* PLT implementation for position-independent code.  */
-static const bfd_vma nios2_so_plt_entry[] = { /* .PLTn */
-  0x03c00034,	/* movhi r15, %hiadj(index * 4) */
-  0x7bc00004,	/* addi r15, r15, %lo(index * 4) */
-  0x00000006	/* br .PLTresolve */
-};
-
-static const bfd_vma nios2_so_plt0_entry[] = { /* .PLTresolve */
-  0x001ce03a,	/* nextpc r14 */
-  0x03400034,	/* movhi r13, %hiadj(_GLOBAL_OFFSET_TABLE_) */
-  0x6b9b883a,	/* add r13, r13, r14 */
-  0x6b800017,	/* ldw r14, %lo(_GLOBAL_OFFSET_TABLE_+4)(r13) */
-  0x6b400017,	/* ldw r13, %lo(_GLOBAL_OFFSET_TABLE_+8)(r13) */
-  0x6800683a	/* jmp r13 */
-};
-
-/* CALL26 stub.  */
-static const bfd_vma nios2_call26_stub_entry[] = {
-  0x00400034,	/* orhi at, r0, %hiadj(dest) */
-  0x08400004,	/* addi at, at, %lo(dest) */
-  0x0800683a	/* jmp at */
-};
-
-/* Install 16-bit immediate value VALUE at offset OFFSET into section SEC.  */
-static void
-nios2_elf32_install_imm16 (asection *sec, bfd_vma offset, bfd_vma value)
-{
-  bfd_vma word = bfd_get_32 (sec->owner, sec->contents + offset);
-
-  bfd_put_32 (sec->owner, word | ((value & 0xffff) << 6),
-	      sec->contents + offset);
-}
-
-/* Install COUNT 32-bit values DATA starting at offset OFFSET into
-   section SEC. */
-static void
-nios2_elf32_install_data (asection *sec, const bfd_vma *data, bfd_vma offset,
-			  int count)
-{
-  while (count--)
-    {
-      bfd_put_32 (sec->owner, *data, sec->contents + offset);
-      offset += 4;
-      ++data;
-    }
-}
-
-/* The usual way of loading a 32-bit constant into a Nios II register is to
-   load the high 16 bits in one instruction and then add the low 16 bits with
-   a signed add. This means that the high halfword needs to be adjusted to
-   compensate for the sign bit of the low halfword. This function returns the
-   adjusted high halfword for a given 32-bit constant.  */
-static
-bfd_vma hiadj (bfd_vma symbol_value)
-{
-  return ((symbol_value + 0x8000) >> 16) & 0xffff;
-}
-
-/* Implement elf_backend_grok_prstatus:
-   Support for core dump NOTE sections.  */
-static bool
-nios2_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
-{
-  int offset;
-  size_t size;
-
-  switch (note->descsz)
-    {
-    default:
-      return false;
-
-    case 212:	      /* Linux/Nios II */
-      /* pr_cursig */
-      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
-
-      /* pr_pid */
-      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
-
-      /* pr_reg */
-      offset = 72;
-      size = 136;
-
-      break;
-    }
-
-  /* Make a ".reg/999" section.  */
-  return _bfd_elfcore_make_pseudosection (abfd, ".reg",
-					  size, note->descpos + offset);
-}
-
-/* Implement elf_backend_grok_psinfo.  */
-static bool
-nios2_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
-{
-  switch (note->descsz)
-    {
-    default:
-      return false;
-
-    case 124:	      /* Linux/Nios II elf_prpsinfo */
-      elf_tdata (abfd)->core->program
-	= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-      elf_tdata (abfd)->core->command
-	= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
-    }
-
-  /* Note that for some reason, a spurious space is tacked
-     onto the end of the args in some (at least one anyway)
-     implementations, so strip it off if it exists.  */
-
-  {
-    char *command = elf_tdata (abfd)->core->command;
-    int n = strlen (command);
-
-    if (0 < n && command[n - 1] == ' ')
-      command[n - 1] = '\0';
-  }
-
-  return true;
-}
-
-/* Assorted hash table functions.  */
-
-/* Initialize an entry in the stub hash table.  */
-static struct bfd_hash_entry *
-stub_hash_newfunc (struct bfd_hash_entry *entry,
-		   struct bfd_hash_table *table,
-		   const char *string)
-{
-  /* Allocate the structure if it has not already been allocated by a
-     subclass.  */
-  if (entry == NULL)
-    {
-      entry = bfd_hash_allocate (table,
-				 sizeof (struct elf32_nios2_stub_hash_entry));
-      if (entry == NULL)
-	return entry;
-    }
-
-  /* Call the allocation method of the superclass.  */
-  entry = bfd_hash_newfunc (entry, table, string);
-  if (entry != NULL)
-    {
-      struct elf32_nios2_stub_hash_entry *hsh;
-
-      /* Initialize the local fields.  */
-      hsh = (struct elf32_nios2_stub_hash_entry *) entry;
-      hsh->stub_sec = NULL;
-      hsh->stub_offset = 0;
-      hsh->target_value = 0;
-      hsh->target_section = NULL;
-      hsh->stub_type = nios2_stub_none;
-      hsh->hh = NULL;
-      hsh->id_sec = NULL;
-    }
-
-  return entry;
-}
-
-/* Create an entry in a Nios II ELF linker hash table.  */
-static struct bfd_hash_entry *
-link_hash_newfunc (struct bfd_hash_entry *entry,
-		   struct bfd_hash_table *table, const char *string)
-{
-  /* Allocate the structure if it has not already been allocated by a
-     subclass.  */
-  if (entry == NULL)
-    {
-      entry = bfd_hash_allocate (table,
-				 sizeof (struct elf32_nios2_link_hash_entry));
-      if (entry == NULL)
-	return entry;
-    }
-
-  /* Call the allocation method of the superclass.  */
-  entry = _bfd_elf_link_hash_newfunc (entry, table, string);
-  if (entry)
-    {
-      struct elf32_nios2_link_hash_entry *eh;
-
-      eh = (struct elf32_nios2_link_hash_entry *) entry;
-      eh->hsh_cache = NULL;
-      eh->tls_type = GOT_UNKNOWN;
-      eh->got_types_used = 0;
-    }
-
-  return entry;
-}
-
-/* Section name for stubs is the associated section name plus this
-   string.  */
-#define STUB_SUFFIX ".stub"
-
-/* Build a name for an entry in the stub hash table.  */
-static char *
-nios2_stub_name (const asection *input_section,
-		 const asection *sym_sec,
-		 const struct elf32_nios2_link_hash_entry *hh,
-		 const Elf_Internal_Rela *rel,
-		 enum elf32_nios2_stub_type stub_type)
-{
-  char *stub_name;
-  bfd_size_type len;
-  char stubpos = (stub_type == nios2_stub_call26_before) ? 'b' : 'a';
-
-  if (hh)
-    {
-      len = 8 + 1 + 1 + 1+ strlen (hh->root.root.root.string) + 1 + 8 + 1;
-      stub_name = bfd_malloc (len);
-      if (stub_name != NULL)
-	{
-	  sprintf (stub_name, "%08x_%c_%s+%x",
-		   input_section->id & 0xffffffff,
-		   stubpos,
-		   hh->root.root.root.string,
-		   (int) rel->r_addend & 0xffffffff);
-	}
-    }
-  else
-    {
-      len = 8 + 1 + 1 + 1+ 8 + 1 + 8 + 1 + 8 + 1;
-      stub_name = bfd_malloc (len);
-      if (stub_name != NULL)
-	{
-	  sprintf (stub_name, "%08x_%c_%x:%x+%x",
-		   input_section->id & 0xffffffff,
-		   stubpos,
-		   sym_sec->id & 0xffffffff,
-		   (int) ELF32_R_SYM (rel->r_info) & 0xffffffff,
-		   (int) rel->r_addend & 0xffffffff);
-	}
-    }
-  return stub_name;
-}
-
-/* Look up an entry in the stub hash.  Stub entries are cached because
-   creating the stub name takes a bit of time.  */
-static struct elf32_nios2_stub_hash_entry *
-nios2_get_stub_entry (const asection *input_section,
-		      const asection *sym_sec,
-		      struct elf32_nios2_link_hash_entry *hh,
-		      const Elf_Internal_Rela *rel,
-		      struct elf32_nios2_link_hash_table *htab,
-		      enum elf32_nios2_stub_type stub_type)
-{
-  struct elf32_nios2_stub_hash_entry *hsh;
-  const asection *id_sec;
-
-  /* If this input section is part of a group of sections sharing one
-     stub section, then use the id of the first/last section in the group,
-     depending on the stub section placement relative to the group.
-     Stub names need to include a section id, as there may well be
-     more than one stub used to reach say, printf, and we need to
-     distinguish between them.  */
-  if (stub_type == nios2_stub_call26_before)
-    id_sec = htab->stub_group[input_section->id].first_sec;
-  else
-    id_sec = htab->stub_group[input_section->id].last_sec;
-
-  if (hh != NULL && hh->hsh_cache != NULL
-      && hh->hsh_cache->hh == hh
-      && hh->hsh_cache->id_sec == id_sec
-      && hh->hsh_cache->stub_type == stub_type)
-    {
-      hsh = hh->hsh_cache;
-    }
-  else
-    {
-      char *stub_name;
-
-      stub_name = nios2_stub_name (id_sec, sym_sec, hh, rel, stub_type);
-      if (stub_name == NULL)
-	return NULL;
-
-      hsh = nios2_stub_hash_lookup (&htab->bstab,
-				    stub_name, false, false);
-
-      if (hh != NULL)
-	hh->hsh_cache = hsh;
-
-      free (stub_name);
-    }
-
-  return hsh;
-}
-
-/* Add a new stub entry to the stub hash.  Not all fields of the new
-   stub entry are initialised.  */
-static struct elf32_nios2_stub_hash_entry *
-nios2_add_stub (const char *stub_name,
-		asection *section,
-		struct elf32_nios2_link_hash_table *htab,
-		enum elf32_nios2_stub_type stub_type)
-{
-  asection *link_sec;
-  asection *stub_sec;
-  asection **secptr, **linkptr;
-  struct elf32_nios2_stub_hash_entry *hsh;
-  bool afterp;
-
-  if (stub_type == nios2_stub_call26_before)
-    {
-      link_sec = htab->stub_group[section->id].first_sec;
-      secptr = &(htab->stub_group[section->id].first_stub_sec);
-      linkptr = &(htab->stub_group[link_sec->id].first_stub_sec);
-      afterp = false;
-    }
-  else
-    {
-      link_sec = htab->stub_group[section->id].last_sec;
-      secptr = &(htab->stub_group[section->id].last_stub_sec);
-      linkptr = &(htab->stub_group[link_sec->id].last_stub_sec);
-      afterp = true;
-    }
-  stub_sec = *secptr;
-  if (stub_sec == NULL)
-    {
-      stub_sec = *linkptr;
-      if (stub_sec == NULL)
-	{
-	  size_t namelen;
-	  bfd_size_type len;
-	  char *s_name;
-
-	  namelen = strlen (link_sec->name);
-	  len = namelen + sizeof (STUB_SUFFIX);
-	  s_name = bfd_alloc (htab->stub_bfd, len);
-	  if (s_name == NULL)
-	    return NULL;
-
-	  memcpy (s_name, link_sec->name, namelen);
-	  memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
-
-	  stub_sec = (*htab->add_stub_section) (s_name, link_sec, afterp);
-	  if (stub_sec == NULL)
-	    return NULL;
-	  *linkptr = stub_sec;
-	}
-      *secptr = stub_sec;
-    }
-
-  /* Enter this entry into the linker stub hash table.  */
-  hsh = nios2_stub_hash_lookup (&htab->bstab, stub_name,
-				true, false);
-  if (hsh == NULL)
-    {
-      /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: cannot create stub entry %s"),
-			  section->owner,
-			  stub_name);
-      return NULL;
-    }
-
-  hsh->stub_sec = stub_sec;
-  hsh->stub_offset = 0;
-  hsh->id_sec = link_sec;
-  return hsh;
-}
-
-/* Set up various things so that we can make a list of input sections
-   for each output section included in the link.  Returns -1 on error,
-   0 when no stubs will be needed, and 1 on success.  */
-int
-nios2_elf32_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
-{
-  bfd *input_bfd;
-  unsigned int bfd_count;
-  unsigned int top_id, top_index;
-  asection *section;
-  asection **input_list, **list;
-  size_t amt;
-  struct elf32_nios2_link_hash_table *htab = elf32_nios2_hash_table (info);
-
-  /* Count the number of input BFDs and find the top input section id.  */
-  for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
-       input_bfd != NULL;
-       input_bfd = input_bfd->link.next)
-    {
-      bfd_count += 1;
-      for (section = input_bfd->sections;
-	   section != NULL;
-	   section = section->next)
-	{
-	  if (top_id < section->id)
-	    top_id = section->id;
-	}
-    }
-
-  htab->bfd_count = bfd_count;
-
-  amt = sizeof (struct map_stub) * (top_id + 1);
-  htab->stub_group = bfd_zmalloc (amt);
-  if (htab->stub_group == NULL)
-    return -1;
-
-  /* We can't use output_bfd->section_count here to find the top output
-     section index as some sections may have been removed, and
-     strip_excluded_output_sections doesn't renumber the indices.  */
-  for (section = output_bfd->sections, top_index = 0;
-       section != NULL;
-       section = section->next)
-    {
-      if (top_index < section->index)
-	top_index = section->index;
-    }
-
-  htab->top_index = top_index;
-  amt = sizeof (asection *) * (top_index + 1);
-  input_list = bfd_malloc (amt);
-  htab->input_list = input_list;
-  if (input_list == NULL)
-    return -1;
-
-  /* For sections we aren't interested in, mark their entries with a
-     value we can check later.  */
-  list = input_list + top_index;
-  do
-    *list = bfd_abs_section_ptr;
-  while (list-- != input_list);
-
-  for (section = output_bfd->sections;
-       section != NULL;
-       section = section->next)
-    {
-      /* FIXME: This is a bit of hack. Currently our .ctors and .dtors
-       * have PC relative relocs in them but no code flag set.  */
-      if (((section->flags & SEC_CODE) != 0) ||
-	  strcmp(".ctors", section->name) ||
-	  strcmp(".dtors", section->name))
-	input_list[section->index] = NULL;
-    }
-
-  return 1;
-}
-
-/* The linker repeatedly calls this function for each input section,
-   in the order that input sections are linked into output sections.
-   Build lists of input sections to determine groupings between which
-   we may insert linker stubs.  */
-void
-nios2_elf32_next_input_section (struct bfd_link_info *info, asection *isec)
-{
-  struct elf32_nios2_link_hash_table *htab = elf32_nios2_hash_table (info);
-
-  if (isec->output_section->index <= htab->top_index)
-    {
-      asection **list = htab->input_list + isec->output_section->index;
-      if (*list != bfd_abs_section_ptr)
-	{
-	  /* Steal the last_sec pointer for our list.
-	     This happens to make the list in reverse order,
-	     which is what we want.  */
-	  htab->stub_group[isec->id].last_sec = *list;
-	  *list = isec;
-	}
-    }
-}
-
-/* Segment mask for CALL26 relocation relaxation.  */
-#define CALL26_SEGMENT(x) ((x) & 0xf0000000)
-
-/* Fudge factor for approximate maximum size of all stubs that might
-   be inserted by the linker.  This does not actually limit the number
-   of stubs that might be inserted, and only affects strategy for grouping
-   and placement of stubs.  Perhaps this should be computed based on number
-   of relocations seen, or be specifiable on the command line.  */
-#define MAX_STUB_SECTION_SIZE 0xffff
-
-/* See whether we can group stub sections together.  Grouping stub
-   sections may result in fewer stubs.  More importantly, we need to
-   put all .init* and .fini* stubs at the end of the .init or
-   .fini output sections respectively, because glibc splits the
-   _init and _fini functions into multiple parts.  Putting a stub in
-   the middle of a function is not a good idea.
-   Rather than computing groups of a maximum fixed size, for Nios II
-   CALL26 relaxation it makes more sense to compute the groups based on
-   sections that fit within a 256MB address segment.  Also do not allow
-   a group to span more than one output section, since different output
-   sections might correspond to different memory banks on a bare-metal
-   target, etc.  */
-static void
-group_sections (struct elf32_nios2_link_hash_table *htab)
-{
-  asection **list = htab->input_list + htab->top_index;
-  do
-    {
-      /* The list is in reverse order so we'll search backwards looking
-	 for the first section that begins in the same memory segment,
-	 marking sections along the way to point at the tail for this
-	 group.  */
-      asection *tail = *list;
-      if (tail == bfd_abs_section_ptr)
-	continue;
-      while (tail != NULL)
-	{
-	  bfd_vma start = tail->output_section->vma + tail->output_offset;
-	  bfd_vma end = start + tail->size;
-	  bfd_vma segment = CALL26_SEGMENT (end);
-	  asection *prev;
-
-	  if (segment != CALL26_SEGMENT (start)
-	      || segment != CALL26_SEGMENT (end + MAX_STUB_SECTION_SIZE))
-	    /* This section spans more than one memory segment, or is
-	       close enough to the end of the segment that adding stub
-	       sections before it might cause it to move so that it
-	       spans memory segments, or that stubs added at the end of
-	       this group might overflow into the next memory segment.
-	       Put it in a group by itself to localize the effects.  */
-	    {
-	      prev = htab->stub_group[tail->id].last_sec;
-	      htab->stub_group[tail->id].last_sec = tail;
-	      htab->stub_group[tail->id].first_sec = tail;
-	    }
-	  else
-	    /* Collect more sections for this group.  */
-	    {
-	      asection *curr, *first;
-	      for (curr = tail; ; curr = prev)
-		{
-		  prev = htab->stub_group[curr->id].last_sec;
-		  if (!prev
-		      || tail->output_section != prev->output_section
-		      || (CALL26_SEGMENT (prev->output_section->vma
-					  + prev->output_offset)
-			  != segment))
-		    break;
-		}
-	      first = curr;
-	      for (curr = tail; ; curr = prev)
-		{
-		  prev = htab->stub_group[curr->id].last_sec;
-		  htab->stub_group[curr->id].last_sec = tail;
-		  htab->stub_group[curr->id].first_sec = first;
-		  if (curr == first)
-		    break;
-		}
-	    }
-
-	  /* Reset tail for the next group.  */
-	  tail = prev;
-	}
-    }
-  while (list-- != htab->input_list);
-  free (htab->input_list);
-}
-
-/* Determine the type of stub needed, if any, for a call.  */
-static enum elf32_nios2_stub_type
-nios2_type_of_stub (asection *input_sec,
-		    const Elf_Internal_Rela *rel,
-		    struct elf32_nios2_link_hash_entry *hh,
-		    struct elf32_nios2_link_hash_table *htab,
-		    bfd_vma destination,
-		    struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
-  bfd_vma location, segment, start, end;
-  asection *s0, *s1, *s;
-
-  if (hh != NULL &&
-      !(hh->root.root.type == bfd_link_hash_defined
-	|| hh->root.root.type == bfd_link_hash_defweak))
-    return nios2_stub_none;
-
-  /* Determine where the call point is.  */
-  location = (input_sec->output_section->vma
-	      + input_sec->output_offset + rel->r_offset);
-  segment = CALL26_SEGMENT (location);
-
-  /* Nios II CALL and JMPI instructions can transfer control to addresses
-     within the same 256MB segment as the PC.  */
-  if (segment == CALL26_SEGMENT (destination))
-    return nios2_stub_none;
-
-  /* Find the start and end addresses of the stub group.  Also account for
-     any already-created stub sections for this group.  Note that for stubs
-     in the end section, only the first instruction of the last stub
-     (12 bytes long) needs to be within range.  */
-  s0 = htab->stub_group[input_sec->id].first_sec;
-  s = htab->stub_group[s0->id].first_stub_sec;
-  if (s != NULL && s->size > 0)
-    start = s->output_section->vma + s->output_offset;
-  else
-    start = s0->output_section->vma + s0->output_offset;
-
-  s1 = htab->stub_group[input_sec->id].last_sec;
-  s = htab->stub_group[s1->id].last_stub_sec;
-  if (s != NULL && s->size > 0)
-    end = s->output_section->vma + s->output_offset + s->size - 8;
-  else
-    end = s1->output_section->vma + s1->output_offset + s1->size;
-
-  BFD_ASSERT (start < end);
-  BFD_ASSERT (start <= location);
-  BFD_ASSERT (location < end);
-
-  /* Put stubs at the end of the group unless that is not a valid
-     location and the beginning of the group is.  It might be that
-     neither the beginning nor end works if we have an input section
-     so large that it spans multiple segment boundaries.  In that
-     case, punt; the end result will be a relocation overflow error no
-     matter what we do here.
-
-     Note that adding stubs pushes up the addresses of all subsequent
-     sections, so that stubs allocated on one pass through the
-     relaxation loop may not be valid on the next pass.  (E.g., we may
-     allocate a stub at the beginning of the section on one pass and
-     find that the call site has been bumped into the next memory
-     segment on the next pass.)  The important thing to note is that
-     we never try to reclaim the space allocated to such unused stubs,
-     so code size and section addresses can only increase with each
-     iteration.  Accounting for the start and end addresses of the
-     already-created stub sections ensures that when the algorithm
-     converges, it converges accurately, with the entire appropriate
-     stub section accessible from the call site and not just the
-     address at the start or end of the stub group proper.  */
-
-  if (segment == CALL26_SEGMENT (end))
-    return nios2_stub_call26_after;
-  else if (segment == CALL26_SEGMENT (start))
-    return nios2_stub_call26_before;
-  else
-    /* Perhaps this should be a dedicated error code.  */
-    return nios2_stub_none;
-}
-
-static bool
-nios2_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_UNUSED)
-{
-  struct elf32_nios2_stub_hash_entry *hsh
-    = (struct elf32_nios2_stub_hash_entry *) gen_entry;
-  asection *stub_sec = hsh->stub_sec;
-  bfd_vma sym_value;
-  struct bfd_link_info *info;
-
-  info = (struct bfd_link_info *) in_arg;
-
-  /* Fail if the target section could not be assigned to an output
-     section.  The user should fix his linker script.  */
-  if (hsh->target_section->output_section == NULL
-      && info->non_contiguous_regions)
-    info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output section. "
-			      "Retry without --enable-non-contiguous-regions.\n"),
-			    hsh->target_section);
-
-  /* Make a note of the offset within the stubs for this entry.  */
-  hsh->stub_offset = stub_sec->size;
-
-  switch (hsh->stub_type)
-    {
-    case nios2_stub_call26_before:
-    case nios2_stub_call26_after:
-      /* A call26 stub looks like:
-	   orhi at, %hiadj(dest)
-	   addi at, at, %lo(dest)
-	   jmp at
-	 Note that call/jmpi instructions can't be used in PIC code
-	 so there is no reason for the stub to be PIC, either.  */
-      sym_value = (hsh->target_value
-		   + hsh->target_section->output_offset
-		   + hsh->target_section->output_section->vma
-		   + hsh->addend);
-
-      nios2_elf32_install_data (stub_sec, nios2_call26_stub_entry,
-				hsh->stub_offset, 3);
-      nios2_elf32_install_imm16 (stub_sec, hsh->stub_offset,
-				 hiadj (sym_value));
-      nios2_elf32_install_imm16 (stub_sec, hsh->stub_offset + 4,
-				 sym_value);
-      stub_sec->size += 12;
-      break;
-    default:
-      BFD_FAIL ();
-      return false;
-    }
-
-  return true;
-}
-
-/* As above, but don't actually build the stub.  Just bump offset so
-   we know stub section sizes.  */
-static bool
-nios2_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_UNUSED)
-{
-  struct elf32_nios2_stub_hash_entry *hsh
-    = (struct elf32_nios2_stub_hash_entry *) gen_entry;
-
-  switch (hsh->stub_type)
-    {
-    case nios2_stub_call26_before:
-    case nios2_stub_call26_after:
-      hsh->stub_sec->size += 12;
-      break;
-    default:
-      BFD_FAIL ();
-      return false;
-    }
-  return true;
-}
-
-/* Read in all local syms for all input bfds.
-   Returns -1 on error, 0 otherwise.  */
-
-static int
-get_local_syms (bfd *output_bfd ATTRIBUTE_UNUSED, bfd *input_bfd,
-		struct bfd_link_info *info)
-{
-  unsigned int bfd_indx;
-  Elf_Internal_Sym *local_syms, **all_local_syms;
-  struct elf32_nios2_link_hash_table *htab = elf32_nios2_hash_table (info);
-
-  /* We want to read in symbol extension records only once.  To do this
-     we need to read in the local symbols in parallel and save them for
-     later use; so hold pointers to the local symbols in an array.  */
-  size_t amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count;
-  all_local_syms = bfd_zmalloc (amt);
-  htab->all_local_syms = all_local_syms;
-  if (all_local_syms == NULL)
-    return -1;
-
-  /* Walk over all the input BFDs, swapping in local symbols.  */
-  for (bfd_indx = 0;
-       input_bfd != NULL;
-       input_bfd = input_bfd->link.next, bfd_indx++)
-    {
-      Elf_Internal_Shdr *symtab_hdr;
-
-      /* We'll need the symbol table in a second.  */
-      symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-      if (symtab_hdr->sh_info == 0)
-	continue;
-
-      /* We need an array of the local symbols attached to the input bfd.  */
-      local_syms = (Elf_Internal_Sym *) symtab_hdr->contents;
-      if (local_syms == NULL)
-	{
-	  local_syms = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
-					     symtab_hdr->sh_info, 0,
-					     NULL, NULL, NULL);
-	  /* Cache them for elf_link_input_bfd.  */
-	  symtab_hdr->contents = (unsigned char *) local_syms;
-	}
-      if (local_syms == NULL)
-	return -1;
-
-      all_local_syms[bfd_indx] = local_syms;
-    }
-
-  return 0;
-}
-
-/* Determine and set the size of the stub section for a final link.  */
-bool
-nios2_elf32_size_stubs (bfd *output_bfd, bfd *stub_bfd,
-			struct bfd_link_info *info,
-			asection *(*add_stub_section) (const char *,
-						       asection *, bool),
-			void (*layout_sections_again) (void))
-{
-  bool stub_changed = false;
-  struct elf32_nios2_link_hash_table *htab = elf32_nios2_hash_table (info);
-
-  /* Stash our params away.  */
-  htab->stub_bfd = stub_bfd;
-  htab->add_stub_section = add_stub_section;
-  htab->layout_sections_again = layout_sections_again;
-
-  /* FIXME: We only compute the section groups once.  This could cause
-     problems if adding a large stub section causes following sections,
-     or parts of them, to move into another segment.  However, this seems
-     to be consistent with the way other back ends handle this....  */
-  group_sections (htab);
-
-  if (get_local_syms (output_bfd, info->input_bfds, info))
-    {
-      if (htab->all_local_syms)
-	goto error_ret_free_local;
-      return false;
-    }
-
-  while (1)
-    {
-      bfd *input_bfd;
-      unsigned int bfd_indx;
-      asection *stub_sec;
-
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
-	   input_bfd != NULL;
-	   input_bfd = input_bfd->link.next, bfd_indx++)
-	{
-	  Elf_Internal_Shdr *symtab_hdr;
-	  asection *section;
-	  Elf_Internal_Sym *local_syms;
-
-	  /* We'll need the symbol table in a second.  */
-	  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
-	  if (symtab_hdr->sh_info == 0)
-	    continue;
-
-	  local_syms = htab->all_local_syms[bfd_indx];
-
-	  /* Walk over each section attached to the input bfd.  */
-	  for (section = input_bfd->sections;
-	       section != NULL;
-	       section = section->next)
-	    {
-	      Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
-
-	      /* If there aren't any relocs, then there's nothing more
-		 to do.  */
-	      if ((section->flags & SEC_RELOC) == 0
-		  || section->reloc_count == 0)
-		continue;
-
-	      /* If this section is a link-once section that will be
-		 discarded, then don't create any stubs.  */
-	      if (section->output_section == NULL
-		  || section->output_section->owner != output_bfd)
-		continue;
-
-	      /* Get the relocs.  */
-	      internal_relocs
-		= _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
-					     info->keep_memory);
-	      if (internal_relocs == NULL)
-		goto error_ret_free_local;
-
-	      /* Now examine each relocation.  */
-	      irela = internal_relocs;
-	      irelaend = irela + section->reloc_count;
-	      for (; irela < irelaend; irela++)
-		{
-		  unsigned int r_type, r_indx;
-		  enum elf32_nios2_stub_type stub_type;
-		  struct elf32_nios2_stub_hash_entry *hsh;
-		  asection *sym_sec;
-		  bfd_vma sym_value;
-		  bfd_vma destination;
-		  struct elf32_nios2_link_hash_entry *hh;
-		  char *stub_name;
-		  const asection *id_sec;
-
-		  r_type = ELF32_R_TYPE (irela->r_info);
-		  r_indx = ELF32_R_SYM (irela->r_info);
-
-		  if (r_type >= (unsigned int) R_NIOS2_ILLEGAL)
-		    {
-		      bfd_set_error (bfd_error_bad_value);
-		    error_ret_free_internal:
-		      if (elf_section_data (section)->relocs == NULL)
-			free (internal_relocs);
-		      goto error_ret_free_local;
-		    }
-
-		  /* Only look for stubs on CALL and JMPI instructions.  */
-		  if (r_type != (unsigned int) R_NIOS2_CALL26)
-		    continue;
-
-		  /* Now determine the call target, its name, value,
-		     section.  */
-		  sym_sec = NULL;
-		  sym_value = 0;
-		  destination = 0;
-		  hh = NULL;
-		  if (r_indx < symtab_hdr->sh_info)
-		    {
-		      /* It's a local symbol.  */
-		      Elf_Internal_Sym *sym;
-		      Elf_Internal_Shdr *hdr;
-		      unsigned int shndx;
-
-		      sym = local_syms + r_indx;
-		      if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
-			sym_value = sym->st_value;
-		      shndx = sym->st_shndx;
-		      if (shndx < elf_numsections (input_bfd))
-			{
-			  hdr = elf_elfsections (input_bfd)[shndx];
-			  sym_sec = hdr->bfd_section;
-			  destination = (sym_value + irela->r_addend
-					 + sym_sec->output_offset
-					 + sym_sec->output_section->vma);
-			}
-		    }
-		  else
-		    {
-		      /* It's an external symbol.  */
-		      int e_indx;
-
-		      e_indx = r_indx - symtab_hdr->sh_info;
-		      hh = ((struct elf32_nios2_link_hash_entry *)
-			    elf_sym_hashes (input_bfd)[e_indx]);
-
-		      while (hh->root.root.type == bfd_link_hash_indirect
-			     || hh->root.root.type == bfd_link_hash_warning)
-			hh = ((struct elf32_nios2_link_hash_entry *)
-			      hh->root.root.u.i.link);
-
-		      if (hh->root.root.type == bfd_link_hash_defined
-			  || hh->root.root.type == bfd_link_hash_defweak)
-			{
-			  sym_sec = hh->root.root.u.def.section;
-			  sym_value = hh->root.root.u.def.value;
-
-			  if (sym_sec->output_section != NULL)
-			    destination = (sym_value + irela->r_addend
-					   + sym_sec->output_offset
-					   + sym_sec->output_section->vma);
-			  else
-			    continue;
-			}
-		      else if (hh->root.root.type == bfd_link_hash_undefweak)
-			{
-			  if (! bfd_link_pic (info))
-			    continue;
-			}
-		      else if (hh->root.root.type == bfd_link_hash_undefined)
-			{
-			  if (! (info->unresolved_syms_in_objects == RM_IGNORE
-				 && (ELF_ST_VISIBILITY (hh->root.other)
-				     == STV_DEFAULT)))
-			    continue;
-			}
-		      else
-			{
-			  bfd_set_error (bfd_error_bad_value);
-			  goto error_ret_free_internal;
-			}
-		    }
-
-		  /* Determine what (if any) linker stub is needed.  */
-		  stub_type = nios2_type_of_stub (section, irela, hh, htab,
-						  destination, info);
-		  if (stub_type == nios2_stub_none)
-		    continue;
-
-		  /* Support for grouping stub sections.  */
-		  if (stub_type == nios2_stub_call26_before)
-		    id_sec = htab->stub_group[section->id].first_sec;
-		  else
-		    id_sec = htab->stub_group[section->id].last_sec;
-
-		  /* Get the name of this stub.  */
-		  stub_name = nios2_stub_name (id_sec, sym_sec, hh, irela,
-					       stub_type);
-		  if (!stub_name)
-		    goto error_ret_free_internal;
-
-		  hsh = nios2_stub_hash_lookup (&htab->bstab,
-						stub_name,
-						false, false);
-		  if (hsh != NULL)
-		    {
-		      /* The proper stub has already been created.  */
-		      free (stub_name);
-		      continue;
-		    }
-
-		  hsh = nios2_add_stub (stub_name, section, htab, stub_type);
-		  if (hsh == NULL)
-		    {
-		      free (stub_name);
-		      goto error_ret_free_internal;
-		    }
-		  hsh->target_value = sym_value;
-		  hsh->target_section = sym_sec;
-		  hsh->stub_type = stub_type;
-		  hsh->hh = hh;
-		  hsh->addend = irela->r_addend;
-		  stub_changed = true;
-		}
-
-	      /* We're done with the internal relocs, free them.  */
-	      if (elf_section_data (section)->relocs == NULL)
-[...]

[diff truncated at 100000 bytes]


More information about the Binutils-cvs mailing list