2014-04-22 22:57:47 +08:00
|
|
|
/* Or1k ELF support for BFD.
|
2018-01-03 13:17:27 +08:00
|
|
|
Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
2014-04-22 22:57:47 +08:00
|
|
|
|
|
|
|
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, see <http://www.gnu.org/licenses/> */
|
|
|
|
|
|
|
|
#ifndef _ELF_OR1K_H
|
|
|
|
#define _ELF_OR1K_H
|
|
|
|
|
|
|
|
#include "elf/reloc-macros.h"
|
|
|
|
|
|
|
|
/* Relocations. */
|
|
|
|
START_RELOC_NUMBERS (elf_or1k_reloc_type)
|
|
|
|
RELOC_NUMBER (R_OR1K_NONE, 0)
|
|
|
|
RELOC_NUMBER (R_OR1K_32, 1)
|
|
|
|
RELOC_NUMBER (R_OR1K_16, 2)
|
|
|
|
RELOC_NUMBER (R_OR1K_8, 3)
|
|
|
|
RELOC_NUMBER (R_OR1K_LO_16_IN_INSN, 4)
|
|
|
|
RELOC_NUMBER (R_OR1K_HI_16_IN_INSN, 5)
|
|
|
|
RELOC_NUMBER (R_OR1K_INSN_REL_26, 6)
|
|
|
|
RELOC_NUMBER (R_OR1K_GNU_VTENTRY, 7)
|
|
|
|
RELOC_NUMBER (R_OR1K_GNU_VTINHERIT, 8)
|
|
|
|
RELOC_NUMBER (R_OR1K_32_PCREL, 9)
|
|
|
|
RELOC_NUMBER (R_OR1K_16_PCREL, 10)
|
|
|
|
RELOC_NUMBER (R_OR1K_8_PCREL, 11)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOTPC_HI16, 12)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOTPC_LO16, 13)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOT16, 14)
|
|
|
|
RELOC_NUMBER (R_OR1K_PLT26, 15)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOTOFF_HI16, 16)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOTOFF_LO16, 17)
|
|
|
|
RELOC_NUMBER (R_OR1K_COPY, 18)
|
|
|
|
RELOC_NUMBER (R_OR1K_GLOB_DAT, 19)
|
|
|
|
RELOC_NUMBER (R_OR1K_JMP_SLOT, 20)
|
|
|
|
RELOC_NUMBER (R_OR1K_RELATIVE, 21)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_GD_HI16, 22)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_GD_LO16, 23)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LDM_HI16, 24)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LDM_LO16, 25)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LDO_HI16, 26)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LDO_LO16, 27)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_IE_HI16, 28)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_IE_LO16, 29)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LE_HI16, 30)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LE_LO16, 31)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_TPOFF, 32)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_DTPOFF, 33)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_DTPMOD, 34)
|
or1k: Add relocations for high-signed and low-stores
This patch adds the following target relocations:
- BFD_RELOC_HI16_S High 16-bit relocation, for used with signed
asm: ha() lower.
- BFD_RELOC_HI16_S_GOTOFF High 16-bit GOT offset relocation for local
asm: gotoffha() symbols, for use with signed lower.
- BFD_RELOC_OR1K_TLS_IE_AHI16 High 16-bit TLS relocation with initial
asm: gottpoffha() executable calculation, for use with signed
lower.
- BFD_RELOC_OR1K_TLS_LE_AHI16 High 16-bit TLS relocation for local executable
asm: tpoffha() variables, for use with signed lower.
- BFD_RELOC_OR1K_SLO16 Split lower 16-bit relocation, used with
asm: lo() OpenRISC store instructions.
- BFD_RELOC_OR1K_GOTOFF_SLO16 Split lower 16-bit GOT offset relocation for
asm: gotofflo() local symbols, used with OpenRISC store
instructions.
- BFD_RELOC_OR1K_TLS_LE_SLO16 Split lower 16-bit relocation for TLS local
asm: tpofflo() executable variables, used with OpenRISC store
instructions.
bfd/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
Stafford Horne <shorne@gmail.com>
* bfd-in2.h: Regenerated.
* elf32-or1k.c (N_ONES): New macro.
(or1k_elf_howto_table): Fix R_OR1K_PLT26 to complain on overflow.
Add definitions for R_OR1K_TLS_TPOFF, R_OR1K_TLS_DTPOFF,
R_OR1K_TLS_DTPMOD, R_OR1K_AHI16, R_OR1K_GOTOFF_AHI16,
R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16, R_OR1K_SLO16,
R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16.
(or1k_reloc_map): Add entries for BFD_RELOC_HI16_S,
BFD_RELOC_LO16_GOTOFF, BFD_RELOC_HI16_GOTOFF, BFD_RELOC_HI16_S_GOTOFF,
BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16,
BFD_RELOC_OR1K_SLO16, BFD_RELOC_OR1K_GOTOFF_SLO16,
BFD_RELOC_OR1K_TLS_LE_SLO16.
(or1k_reloc_type_lookup): Change search loop to start ad index 0 and
also check results before returning.
(or1k_reloc_name_lookup): Simplify loop to use R_OR1K_max as index
limit.
(or1k_final_link_relocate): New function.
(or1k_elf_relocate_section): Add support for new AHI and SLO
relocations. Use or1k_final_link_relocate instead of generic
_bfd_final_link_relocate.
(or1k_elf_check_relocs): Add support for new AHI and SLO relocations.
* reloc.c: Add new enums for BFD_RELOC_OR1K_SLO16,
BFD_RELOC_OR1K_GOTOFF_SLO16, BFD_RELOC_OR1K_TLS_IE_AHI16,
BFD_RELOC_OR1K_TLS_IE_AHI16, BFD_RELOC_OR1K_TLS_LE_AHI16,
BFD_RELOC_OR1K_TLS_LE_SLO16. Remove unused BFD_RELOC_OR1K_GOTOFF_HI16
and BFD_RELOC_OR1K_GOTOFF_LO16.
* libbfd.h: Regenerated.
cpu/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k.opc: Add RTYPE_ enum.
(INVALID_STORE_RELOC): New string.
(or1k_imm16_relocs): New array array.
(parse_reloc): New static function that just does the parsing.
(parse_imm16): New static function for generic parsing.
(parse_simm16): Change to just call parse_imm16.
(parse_simm16_split): New function.
(parse_uimm16): Change to call parse_imm16.
(parse_uimm16_split): New function.
* or1korbis.cpu (simm16-split): Change to use new simm16_split.
(uimm16-split): Change to use new uimm16_split.
gas/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* testsuite/gas/or1k/allinsn.d (l_ha): Add result for ha() relocation.
* testsuite/gas/or1k/allinsn.s (l_ha): Add test for ha() relocations.
* testsuite/gas/or1k/allinsn.exp: Renamed to or1k.exp.
* testsuite/gas/or1k/or1k.exp: Add reloc-2 list test.
* testsuite/gas/or1k/reloc-1.d: New file.
* testsuite/gas/or1k/reloc-1.s: New file.
* testsuite/gas/or1k/reloc-2.l: New file.
* testsuite/gas/or1k/reloc-2.s: New file.
include/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* elf/or1k.h (elf_or1k_reloc_type): Add R_OR1K_AHI16,
R_OR1K_GOTOFF_AHI16, R_OR1K_TLS_IE_AHI16, R_OR1K_TLS_LE_AHI16,
R_OR1K_SLO16, R_OR1K_GOTOFF_SLO16, R_OR1K_TLS_LE_SLO16.
ld/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* testsuite/ld-or1k/offsets1.d: New file.
* testsuite/ld-or1k/offsets1.s: New file.
* testsuite/ld-or1k/or1k.exp: New file.
opcodes/ChangeLog:
yyyy-mm-dd Richard Henderson <rth@twiddle.net>
* or1k-asm.c: Regenerate.
2018-10-05 10:41:40 +08:00
|
|
|
RELOC_NUMBER (R_OR1K_AHI16, 35)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOTOFF_AHI16, 36)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_IE_AHI16, 37)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LE_AHI16, 38)
|
|
|
|
RELOC_NUMBER (R_OR1K_SLO16, 39)
|
|
|
|
RELOC_NUMBER (R_OR1K_GOTOFF_SLO16, 40)
|
|
|
|
RELOC_NUMBER (R_OR1K_TLS_LE_SLO16, 41)
|
2014-04-22 22:57:47 +08:00
|
|
|
END_RELOC_NUMBERS (R_OR1K_max)
|
|
|
|
|
|
|
|
#define EF_OR1K_NODELAY (1UL << 0)
|
|
|
|
|
|
|
|
#endif /* _ELF_OR1K_H */
|