binutils-gdb/include/elf/alpha.h

132 lines
4.7 KiB
C
Raw Normal View History

1999-05-03 09:29:11 +02:00
/* ALPHA ELF support for BFD.
2010-04-15 12:26:09 +02:00
Copyright 1996, 1998, 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
1999-05-03 09:29:11 +02:00
By Eric Youngdale, <eric@aib.com>. No processor supplement available
for this platform.
2010-04-15 12:26:09 +02:00
This file is part of BFD, the Binary File Descriptor library.
1999-05-03 09:29:11 +02:00
2010-04-15 12:26:09 +02:00
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.
1999-05-03 09:29:11 +02:00
2010-04-15 12:26:09 +02:00
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.
1999-05-03 09:29:11 +02:00
2010-04-15 12:26:09 +02:00
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. */
1999-05-03 09:29:11 +02:00
/* This file holds definitions specific to the ALPHA ELF ABI. Note
that most of this is not actually implemented by BFD. */
#ifndef _ELF_ALPHA_H
#define _ELF_ALPHA_H
/* Processor specific flags for the ELF header e_flags field. */
/* All addresses must be below 2GB. */
#define EF_ALPHA_32BIT 0x00000001
/* All relocations needed for relaxation with code movement are present. */
#define EF_ALPHA_CANRELAX 0x00000002
/* Processor specific section flags. */
/* This section must be in the global data area. */
#define SHF_ALPHA_GPREL 0x10000000
/* Section contains some sort of debugging information. The exact
format is unspecified. It's probably ECOFF symbols. */
#define SHT_ALPHA_DEBUG 0x70000001
/* Section contains register usage information. */
#define SHT_ALPHA_REGINFO 0x70000002
/* A section of type SHT_MIPS_REGINFO contains the following
structure. */
typedef struct
{
/* Mask of general purpose registers used. */
unsigned long ri_gprmask;
/* Mask of co-processor registers used. */
unsigned long ri_cprmask[4];
/* GP register value for this object file. */
long ri_gp_value;
} Elf64_RegInfo;
/* Special values for the st_other field in the symbol table. */
#define STO_ALPHA_NOPV 0x80
#define STO_ALPHA_STD_GPLOAD 0x88
2005-05-30 01:18:26 +02:00
/* Special values for Elf64_Dyn tag. */
#define DT_ALPHA_PLTRO DT_LOPROC
1999-05-03 09:29:11 +02:00
#include "elf/reloc-macros.h"
/* Alpha relocs. */
START_RELOC_NUMBERS (elf_alpha_reloc_type)
RELOC_NUMBER (R_ALPHA_NONE, 0) /* No reloc */
RELOC_NUMBER (R_ALPHA_REFLONG, 1) /* Direct 32 bit */
RELOC_NUMBER (R_ALPHA_REFQUAD, 2) /* Direct 64 bit */
RELOC_NUMBER (R_ALPHA_GPREL32, 3) /* GP relative 32 bit */
RELOC_NUMBER (R_ALPHA_LITERAL, 4) /* GP relative 16 bit w/optimization */
RELOC_NUMBER (R_ALPHA_LITUSE, 5) /* Optimization hint for LITERAL */
RELOC_NUMBER (R_ALPHA_GPDISP, 6) /* Add displacement to GP */
RELOC_NUMBER (R_ALPHA_BRADDR, 7) /* PC+4 relative 23 bit shifted */
RELOC_NUMBER (R_ALPHA_HINT, 8) /* PC+4 relative 16 bit shifted */
RELOC_NUMBER (R_ALPHA_SREL16, 9) /* PC relative 16 bit */
RELOC_NUMBER (R_ALPHA_SREL32, 10) /* PC relative 32 bit */
RELOC_NUMBER (R_ALPHA_SREL64, 11) /* PC relative 64 bit */
/* Skip 12 - 16; deprecated ECOFF relocs. */
RELOC_NUMBER (R_ALPHA_GPRELHIGH, 17) /* GP relative 32 bit, high 16 bits */
RELOC_NUMBER (R_ALPHA_GPRELLOW, 18) /* GP relative 32 bit, low 16 bits */
RELOC_NUMBER (R_ALPHA_GPREL16, 19) /* GP relative 16 bit */
/* Skip 20 - 23; deprecated ECOFF relocs. */
/* These relocations are specific to shared libraries. */
1999-05-03 09:29:11 +02:00
RELOC_NUMBER (R_ALPHA_COPY, 24) /* Copy symbol at runtime */
RELOC_NUMBER (R_ALPHA_GLOB_DAT, 25) /* Create GOT entry */
RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26) /* Create PLT entry */
RELOC_NUMBER (R_ALPHA_RELATIVE, 27) /* Adjust by program base */
2002-02-09 23:54:16 +01:00
/* Like BRADDR, but assert that the source and target object file
share the same GP value, and adjust the target address for
STO_ALPHA_STD_GPLOAD. */
RELOC_NUMBER (R_ALPHA_BRSGP, 28)
include/elf/ * alpha.h (R_ALPHA_TLSGD, R_ALPHA_TLSLDM, R_ALPHA_DTPMOD64, R_ALPHA_GOTDTPREL, R_ALPHA_DTPREL64, R_ALPHA_DTPRELHI, R_ALPHA_DTPRELLO, R_ALPHA_DTPREL16, R_ALPHA_GOTTPREL, R_ALPHA_TPREL64, R_ALPHA_TPRELHI, R_ALPHA_TPRELLO, R_ALPHA_TPREL16): New. bfd/ * elf64-alpha.c (ALPHA_ELF_LINK_HASH_LU_TLSGD, ALPHA_ELF_LINK_HASH_LU_TLSLDM, ALPHA_ELF_LINK_HASH_LU_FUNC): New. (ALPHA_ELF_GOT_ENTRY_RELOCS_DONE): Remove. (ALPHA_ELF_GOT_ENTRY_RELOCS_XLATED): Remove. (struct alpha_elf_got_entry): Add reloc_type, reloc_done, reloc_xlated. (struct alpha_elf_obj_tdata): Rename total_got_entries and n_local_got_entries to total_got_size and local_got_size. (elf64_alpha_howto, elf64_alpha_reloc_map): Update for TLS relocs. (alpha_got_entry_size): New. (elf64_alpha_relax_with_lituse): Use it. (elf64_alpha_relax_without_lituse): Likewise. (MAX_GOT_SIZE): Rename from MAX_GOT_ENTRIES. (get_got_entry): New. (elf64_alpha_check_relocs): Handle TLS relocs. Reorganize. (elf64_alpha_adjust_dynamic_symbol): Test LU_FUNC as a mask. (elf64_alpha_merge_ind_symbols): Check gotent->reloc_type. (elf64_alpha_can_merge_gots, elf64_alpha_merge_gots): Likewise. (elf64_alpha_calc_got_offsets_for_symbol): Use alpha_got_entry_size. (elf64_alpha_calc_got_offsets): Likewise. (alpha_dynamic_entries_for_reloc): New. (elf64_alpha_calc_dynrel_sizes): Use it. (elf64_alpha_size_dynamic_sections): Likewise. (elf64_alpha_relocate_section): Handle TLS relocations. * reloc.c: Add Alpha TLS relocations. * bfd-in2.h, libbfd.h: Rebuild. gas/ * expr.h (operatorT): Add O_md17..O_md32. * config/tc-alpha.c (O_lituse_tlsgd, O_lituse_tlsldm, O_tlsgd, O_tlsldm, O_gotdtprel, O_dtprelhi, O_dtprello, O_dtprel, O_gottprel, O_tprelhi, O_tprello, O_tprel): New. (USER_RELOC_P, alpha_reloc_op_tag, debug_exp): Include them. (DUMMY_RELOC_LITUSE_TLSGD, DUMMY_RELOC_LITUSE_TLSLDM): New. (LITUSE_TLSGD, LITUSE_TLSLDM): New. (struct alpha_reloc_tag): Add master, saw_tlsgd, saw_tlsld, saw_lu_tlsgd, saw_lu_tlsldm. Make multi_section_p a bit field. (md_apply_fix3): Handle TLS relocations. (alpha_force_relocation, alpha_fix_adjustable): Likewise. (alpha_adjust_symtab_relocs): Sort LITERAL relocs after the associated TLS reloc. Check lituse_tls relocs match up. (emit_insn): Handle TLS relocations. (ldX_op): Remove. gas/testsuite/ * gas/alpha/elf-tls-1.s, gas/alpha/elf-tls-1.d: New. * gas/alpha/elf-tls-2.s, gas/alpha/elf-tls-1.l: New. * gas/alpha/elf-tls-3.s, gas/alpha/elf-tls-1.l: New. * gas/alpha/alpha.exp: Run them.
2002-05-31 00:01:38 +02:00
/* Thread-Local Storage. */
RELOC_NUMBER (R_ALPHA_TLSGD, 29)
RELOC_NUMBER (R_ALPHA_TLSLDM, 30)
RELOC_NUMBER (R_ALPHA_DTPMOD64, 31)
RELOC_NUMBER (R_ALPHA_GOTDTPREL, 32)
RELOC_NUMBER (R_ALPHA_DTPREL64, 33)
RELOC_NUMBER (R_ALPHA_DTPRELHI, 34)
RELOC_NUMBER (R_ALPHA_DTPRELLO, 35)
RELOC_NUMBER (R_ALPHA_DTPREL16, 36)
RELOC_NUMBER (R_ALPHA_GOTTPREL, 37)
RELOC_NUMBER (R_ALPHA_TPREL64, 38)
RELOC_NUMBER (R_ALPHA_TPRELHI, 39)
RELOC_NUMBER (R_ALPHA_TPRELLO, 40)
RELOC_NUMBER (R_ALPHA_TPREL16, 41)
END_RELOC_NUMBERS (R_ALPHA_max)
1999-05-03 09:29:11 +02:00
#define LITUSE_ALPHA_ADDR 0
#define LITUSE_ALPHA_BASE 1
#define LITUSE_ALPHA_BYTOFF 2
#define LITUSE_ALPHA_JSR 3
#define LITUSE_ALPHA_TLSGD 4
#define LITUSE_ALPHA_TLSLDM 5
#define LITUSE_ALPHA_JSRDIRECT 6
1999-05-03 09:29:11 +02:00
#endif /* _ELF_ALPHA_H */