1999-05-03 15:29:11 +08:00
|
|
|
/* ELF support for BFD.
|
2001-03-14 10:27:44 +08:00
|
|
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
2010-01-19 21:50:25 +08:00
|
|
|
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
2000-02-22 15:34:57 +08:00
|
|
|
Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
Written by Fred Fish @ Cygnus Support, from information published
|
|
|
|
in "UNIX System V Release 4, Programmers Guide: ANSI C and
|
|
|
|
Programming Support Tools".
|
|
|
|
|
2003-04-15 16:51:55 +08:00
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-04-15 16:51:55 +08: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
|
2010-04-15 18:26:09 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2003-04-15 16:51:55 +08:00
|
|
|
(at your option) any later version.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-04-15 16:51:55 +08: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 15:29:11 +08:00
|
|
|
|
2003-04-15 16:51:55 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2010-04-15 18:26:09 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* This file is part of ELF support for BFD, and contains the portions
|
|
|
|
that are common to both the internal and external representations.
|
|
|
|
For example, ELFMAG0 is the byte 0x7F in both the internal (in-memory)
|
2003-04-15 16:51:55 +08:00
|
|
|
and external (in-file) representations. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifndef _ELF_COMMON_H
|
|
|
|
#define _ELF_COMMON_H
|
|
|
|
|
2003-04-15 16:51:55 +08:00
|
|
|
/* Fields in e_ident[]. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_MAG0 0 /* File identification byte 0 index */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFMAG0 0x7F /* Magic number byte 0 */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_MAG1 1 /* File identification byte 1 index */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFMAG1 'E' /* Magic number byte 1 */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_MAG2 2 /* File identification byte 2 index */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFMAG2 'L' /* Magic number byte 2 */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_MAG3 3 /* File identification byte 3 index */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFMAG3 'F' /* Magic number byte 3 */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_CLASS 4 /* File class */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFCLASSNONE 0 /* Invalid class */
|
|
|
|
#define ELFCLASS32 1 /* 32-bit objects */
|
|
|
|
#define ELFCLASS64 2 /* 64-bit objects */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_DATA 5 /* Data encoding */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFDATANONE 0 /* Invalid data encoding */
|
|
|
|
#define ELFDATA2LSB 1 /* 2's complement, little endian */
|
|
|
|
#define ELFDATA2MSB 2 /* 2's complement, big endian */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_VERSION 6 /* File version */
|
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EI_OSABI 7 /* Operating System/ABI indication */
|
|
|
|
#define ELFOSABI_NONE 0 /* UNIX System V ABI */
|
|
|
|
#define ELFOSABI_HPUX 1 /* HP-UX operating system */
|
|
|
|
#define ELFOSABI_NETBSD 2 /* NetBSD */
|
|
|
|
#define ELFOSABI_LINUX 3 /* GNU/Linux */
|
|
|
|
#define ELFOSABI_HURD 4 /* GNU/Hurd */
|
|
|
|
#define ELFOSABI_SOLARIS 6 /* Solaris */
|
|
|
|
#define ELFOSABI_AIX 7 /* AIX */
|
|
|
|
#define ELFOSABI_IRIX 8 /* IRIX */
|
|
|
|
#define ELFOSABI_FREEBSD 9 /* FreeBSD */
|
|
|
|
#define ELFOSABI_TRU64 10 /* TRU64 UNIX */
|
|
|
|
#define ELFOSABI_MODESTO 11 /* Novell Modesto */
|
|
|
|
#define ELFOSABI_OPENBSD 12 /* OpenBSD */
|
|
|
|
#define ELFOSABI_OPENVMS 13 /* OpenVMS */
|
|
|
|
#define ELFOSABI_NSK 14 /* Hewlett-Packard Non-Stop Kernel */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define ELFOSABI_AROS 15 /* AROS */
|
2009-11-28 11:18:00 +08:00
|
|
|
#define ELFOSABI_FENIXOS 16 /* FenixOS */
|
bfd:
* Makefile.am (ALL_MACHINES): Add cpu-tic6x.lo.
(ALL_MACHINES_CFILES): Add cpu-tic6x.c.
(BFD32_BACKENDS): Add elf32-tic6x.lo.
(BFD32_BACKENDS_CFILES): Add elf32-tic6x.c.
* Makefile.in: Regenerate.
* archures.c (bfd_arch_tic6x, bfd_tic6x_arch): New.
(bfd_archures_list): Update.
* config.bfd (tic6x-*-elf): New.
* configure.in (bfd_elf32_tic6x_be_vec, bfd_elf32_tic6x_le_vec):
New.
* configure: Regenerate.
* cpu-tic6x.c, elf32-tic6x.c: New.
* reloc.c (BFD_RELOC_C6000_PCR_S21, BFD_RELOC_C6000_PCR_S12,
BFD_RELOC_C6000_PCR_S10, BFD_RELOC_C6000_PCR_S7,
BFD_RELOC_C6000_ABS_S16, BFD_RELOC_C6000_ABS_L16,
BFD_RELOC_C6000_ABS_H16, BFD_RELOC_C6000_SBR_U15_B,
BFD_RELOC_C6000_SBR_U15_H, BFD_RELOC_C6000_SBR_U15_W,
BFD_RELOC_C6000_SBR_S16, BFD_RELOC_C6000_SBR_L16_B,
BFD_RELOC_C6000_SBR_L16_H, BFD_RELOC_C6000_SBR_L16_W,
BFD_RELOC_C6000_SBR_H16_B, BFD_RELOC_C6000_SBR_H16_H,
BFD_RELOC_C6000_SBR_H16_W, BFD_RELOC_C6000_SBR_GOT_U15_W,
BFD_RELOC_C6000_SBR_GOT_L16_W, BFD_RELOC_C6000_SBR_GOT_H16_W,
BFD_RELOC_C6000_DSBT_INDEX, BFD_RELOC_C6000_PREL31,
BFD_RELOC_C6000_COPY, BFD_RELOC_C6000_ALIGN,
BFD_RELOC_C6000_FPHEAD, BFD_RELOC_C6000_NOCMP): New.
* targets.c (bfd_elf32_tic6x_be_vec, bfd_elf32_tic6x_le_vec): New.
(_bfd_target_vector): Update.
* bfd-in2.h, libbfd.h: Regenerate.
binutils:
* MAINTAINERS: Add self as TI C6X maintainer.
* NEWS: Add news entry for TI C6X support.
* readelf.c: Include elf/tic6x.h.
(guess_is_rela): Handle EM_TI_C6000.
(dump_relocations): Likewise.
(get_tic6x_dynamic_type): New.
(get_dynamic_type): Call it.
(get_machine_flags): Handle EF_C6000_REL.
(get_osabi_name): Handle machine-specific values only for relevant
machines. Handle C6X values.
(get_tic6x_segment_type): New.
(get_segment_type): Call it.
(get_tic6x_section_type_name): New.
(get_section_type_name): Call it.
(is_32bit_abs_reloc, is_16bit_abs_reloc, is_none_reloc): Handle
EM_TI_C6000.
gas:
* Makefile.am (TARGET_CPU_CFILES): Add config/tc-tic6x.c.
(TARGET_CPU_HFILES): Add config/tc-tic6x.h.
* Makefile.in: Regenerate.
* NEWS: Add news entry for TI C6X support.
* app.c (do_scrub_chars): Handle "||^" for TI C6X. Handle
TC_PREDICATE_START_CHAR and TC_PREDICATE_END_CHAR. Keep spaces in
operands if TC_KEEP_OPERAND_SPACES.
* configure.tgt (tic6x-*-*): New.
* config/tc-ia64.h (TC_PREDICATE_START_CHAR,
TC_PREDICATE_END_CHAR): Define.
* config/tc-tic6x.c, config/tc-tic6x.h: New.
* doc/Makefile.am (CPU_DOCS): Add c-tic6x.texi.
* doc/Makefile.in: Regenerate.
* doc/all.texi (TIC6X): Define.
* doc/as.texinfo: Add TI C6X documentation. Include c-tic6x.texi.
* doc/c-tic6x.texi: New.
gas/testsuite:
* gas/tic6x: New directory and testcases.
include:
* dis-asm.h (print_insn_tic6x): Declare.
include/elf:
* common.h (ELFOSABI_C6000_ELFABI, ELFOSABI_C6000_LINUX): Define.
* tic6x.h: New.
include/opcode:
* tic6x-control-registers.h, tic6x-insn-formats.h,
tic6x-opcode-table.h, tic6x.h: New.
ld:
* Makefile.am (ALL_EMULATIONS): Add eelf32_tic6x_be.o and
eelf32_tic6x_le.o.
(eelf32_tic6x_be.c, eelf32_tic6x_le.c): New.
* NEWS: Add news entry for TI C6X support.
* configure.tgt (tic6x-*-*): New.
* emulparams/elf32_tic6x_be.sh, emulparams/elf32_tic6x_le.sh: New.
ld/testsuite:
* ld-elf/flags1.d, ld-elf/merge.d: XFAIL for tic6x-*-*.
* ld-elf/sec-to-seg.exp: Set B_test_same_seg to 0 for tic6x-*-*.
* ld-tic6x: New directory and testcases.
opcodes:
* Makefile.am (TARGET_LIBOPCODES_CFILES): Add tic6x-dis.c.
* Makefile.in: Regenerate.
* configure.in (bfd_tic6x_arch): New.
* configure: Regenerate.
* disassemble.c (ARCH_tic6x): Define if ARCH_all.
(disassembler): Handle TI C6X.
* tic6x-dis.c: New.
2010-03-26 05:12:36 +08:00
|
|
|
#define ELFOSABI_C6000_ELFABI 64 /* Bare-metal TMS320C6000 */
|
|
|
|
#define ELFOSABI_C6000_LINUX 65 /* Linux TMS320C6000 */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ELFOSABI_ARM 97 /* ARM */
|
|
|
|
#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
|
|
|
|
|
|
|
|
#define EI_ABIVERSION 8 /* ABI version */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EI_PAD 9 /* Start of padding bytes */
|
|
|
|
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Values for e_type, which identifies the object file type. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define ET_NONE 0 /* No file type */
|
|
|
|
#define ET_REL 1 /* Relocatable file */
|
|
|
|
#define ET_EXEC 2 /* Executable file */
|
|
|
|
#define ET_DYN 3 /* Shared object file */
|
|
|
|
#define ET_CORE 4 /* Core file */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define ET_LOOS 0xFE00 /* Operating system-specific */
|
|
|
|
#define ET_HIOS 0xFEFF /* Operating system-specific */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define ET_LOPROC 0xFF00 /* Processor-specific */
|
|
|
|
#define ET_HIPROC 0xFFFF /* Processor-specific */
|
|
|
|
|
2000-11-28 05:52:56 +08:00
|
|
|
/* Values for e_machine, which identifies the architecture. These numbers
|
2008-06-09 22:07:18 +08:00
|
|
|
are officially assigned by registry@sco.com. See below for a list of
|
2000-11-28 05:52:56 +08:00
|
|
|
ad-hoc numbers used during initial development. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_NONE 0 /* No machine */
|
|
|
|
#define EM_M32 1 /* AT&T WE 32100 */
|
|
|
|
#define EM_SPARC 2 /* SUN SPARC */
|
|
|
|
#define EM_386 3 /* Intel 80386 */
|
|
|
|
#define EM_68K 4 /* Motorola m68k family */
|
|
|
|
#define EM_88K 5 /* Motorola m88k family */
|
|
|
|
#define EM_486 6 /* Intel 80486 *//* Reserved for future use */
|
|
|
|
#define EM_860 7 /* Intel 80860 */
|
|
|
|
#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
|
|
|
|
#define EM_S370 9 /* IBM System/370 */
|
|
|
|
#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian (Oct 4 1999 Draft) Deprecated */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res011 11 /* Reserved */
|
|
|
|
#define EM_res012 12 /* Reserved */
|
|
|
|
#define EM_res013 13 /* Reserved */
|
|
|
|
#define EM_res014 14 /* Reserved */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_PARISC 15 /* HPPA */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res016 16 /* Reserved */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_VPP550 17 /* Fujitsu VPP500 */
|
|
|
|
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
|
|
|
|
#define EM_960 19 /* Intel 80960 */
|
|
|
|
#define EM_PPC 20 /* PowerPC */
|
|
|
|
#define EM_PPC64 21 /* 64-bit PowerPC */
|
|
|
|
#define EM_S390 22 /* IBM S/390 */
|
2006-10-25 14:49:21 +08:00
|
|
|
#define EM_SPU 23 /* Sony/Toshiba/IBM SPU */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res024 24 /* Reserved */
|
|
|
|
#define EM_res025 25 /* Reserved */
|
|
|
|
#define EM_res026 26 /* Reserved */
|
|
|
|
#define EM_res027 27 /* Reserved */
|
|
|
|
#define EM_res028 28 /* Reserved */
|
|
|
|
#define EM_res029 29 /* Reserved */
|
|
|
|
#define EM_res030 30 /* Reserved */
|
|
|
|
#define EM_res031 31 /* Reserved */
|
|
|
|
#define EM_res032 32 /* Reserved */
|
|
|
|
#define EM_res033 33 /* Reserved */
|
|
|
|
#define EM_res034 34 /* Reserved */
|
|
|
|
#define EM_res035 35 /* Reserved */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_V800 36 /* NEC V800 series */
|
|
|
|
#define EM_FR20 37 /* Fujitsu FR20 */
|
|
|
|
#define EM_RH32 38 /* TRW RH32 */
|
|
|
|
#define EM_MCORE 39 /* Motorola M*Core */ /* May also be taken by Fujitsu MMA */
|
|
|
|
#define EM_RCE 39 /* Old name for MCore */
|
|
|
|
#define EM_ARM 40 /* ARM */
|
|
|
|
#define EM_OLD_ALPHA 41 /* Digital Alpha */
|
2003-04-24 05:09:04 +08:00
|
|
|
#define EM_SH 42 /* Renesas (formerly Hitachi) / SuperH SH */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
|
|
|
|
#define EM_TRICORE 44 /* Siemens Tricore embedded processor */
|
|
|
|
#define EM_ARC 45 /* ARC Cores */
|
2003-04-15 16:51:55 +08:00
|
|
|
#define EM_H8_300 46 /* Renesas (formerly Hitachi) H8/300 */
|
|
|
|
#define EM_H8_300H 47 /* Renesas (formerly Hitachi) H8/300H */
|
|
|
|
#define EM_H8S 48 /* Renesas (formerly Hitachi) H8S */
|
|
|
|
#define EM_H8_500 49 /* Renesas (formerly Hitachi) H8/500 */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_IA_64 50 /* Intel IA-64 Processor */
|
|
|
|
#define EM_MIPS_X 51 /* Stanford MIPS-X */
|
|
|
|
#define EM_COLDFIRE 52 /* Motorola Coldfire */
|
|
|
|
#define EM_68HC12 53 /* Motorola M68HC12 */
|
|
|
|
#define EM_MMA 54 /* Fujitsu Multimedia Accelerator */
|
|
|
|
#define EM_PCP 55 /* Siemens PCP */
|
|
|
|
#define EM_NCPU 56 /* Sony nCPU embedded RISC processor */
|
|
|
|
#define EM_NDR1 57 /* Denso NDR1 microprocesspr */
|
|
|
|
#define EM_STARCORE 58 /* Motorola Star*Core processor */
|
|
|
|
#define EM_ME16 59 /* Toyota ME16 processor */
|
|
|
|
#define EM_ST100 60 /* STMicroelectronics ST100 processor */
|
|
|
|
#define EM_TINYJ 61 /* Advanced Logic Corp. TinyJ embedded processor */
|
|
|
|
#define EM_X86_64 62 /* Advanced Micro Devices X86-64 processor */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_PDSP 63 /* Sony DSP Processor */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_PDP10 64 /* Digital Equipment Corp. PDP-10 */
|
|
|
|
#define EM_PDP11 65 /* Digital Equipment Corp. PDP-11 */
|
|
|
|
#define EM_FX66 66 /* Siemens FX66 microcontroller */
|
|
|
|
#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 bit microcontroller */
|
|
|
|
#define EM_ST7 68 /* STMicroelectronics ST7 8-bit microcontroller */
|
|
|
|
#define EM_68HC16 69 /* Motorola MC68HC16 Microcontroller */
|
|
|
|
#define EM_68HC11 70 /* Motorola MC68HC11 Microcontroller */
|
|
|
|
#define EM_68HC08 71 /* Motorola MC68HC08 Microcontroller */
|
|
|
|
#define EM_68HC05 72 /* Motorola MC68HC05 Microcontroller */
|
|
|
|
#define EM_SVX 73 /* Silicon Graphics SVx */
|
|
|
|
#define EM_ST19 74 /* STMicroelectronics ST19 8-bit cpu */
|
|
|
|
#define EM_VAX 75 /* Digital VAX */
|
|
|
|
#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
|
|
|
|
#define EM_JAVELIN 77 /* Infineon Technologies 32-bit embedded cpu */
|
|
|
|
#define EM_FIREPATH 78 /* Element 14 64-bit DSP processor */
|
|
|
|
#define EM_ZSP 79 /* LSI Logic's 16-bit DSP processor */
|
|
|
|
#define EM_MMIX 80 /* Donald Knuth's educational 64-bit processor */
|
|
|
|
#define EM_HUANY 81 /* Harvard's machine-independent format */
|
|
|
|
#define EM_PRISM 82 /* SiTera Prism */
|
|
|
|
#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */
|
|
|
|
#define EM_FR30 84 /* Fujitsu FR30 */
|
|
|
|
#define EM_D10V 85 /* Mitsubishi D10V */
|
|
|
|
#define EM_D30V 86 /* Mitsubishi D30V */
|
|
|
|
#define EM_V850 87 /* NEC v850 */
|
2003-04-23 00:22:26 +08:00
|
|
|
#define EM_M32R 88 /* Renesas M32R (formerly Mitsubishi M32R) */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_MN10300 89 /* Matsushita MN10300 */
|
|
|
|
#define EM_MN10200 90 /* Matsushita MN10200 */
|
|
|
|
#define EM_PJ 91 /* picoJava */
|
|
|
|
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
|
|
|
|
#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
|
|
|
|
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_VIDEOCORE 95 /* Alphamosaic VideoCore processor */
|
|
|
|
#define EM_TMM_GPP 96 /* Thompson Multimedia General Purpose Processor */
|
|
|
|
#define EM_NS32K 97 /* National Semiconductor 32000 series */
|
|
|
|
#define EM_TPC 98 /* Tenor Network TPC processor */
|
|
|
|
#define EM_SNP1K 99 /* Trebia SNP 1000 processor */
|
|
|
|
#define EM_ST200 100 /* STMicroelectronics ST200 microcontroller */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_IP2K 101 /* Ubicom IP2022 micro controller */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_MAX 102 /* MAX Processor */
|
2004-03-30 22:04:32 +08:00
|
|
|
#define EM_CR 103 /* National Semiconductor CompactRISC */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_F2MC16 104 /* Fujitsu F2MC16 */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define EM_MSP430 105 /* TI msp430 micro controller */
|
2005-09-30 23:12:52 +08:00
|
|
|
#define EM_BLACKFIN 106 /* ADI Blackfin */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_SE_C33 107 /* S1C33 Family of Seiko Epson processors */
|
|
|
|
#define EM_SEP 108 /* Sharp embedded microprocessor */
|
|
|
|
#define EM_ARCA 109 /* Arca RISC Microprocessor */
|
|
|
|
#define EM_UNICORE 110 /* Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University */
|
|
|
|
#define EM_EXCESS 111 /* eXcess: 16/32/64-bit configurable embedded CPU */
|
|
|
|
#define EM_DXP 112 /* Icera Semiconductor Inc. Deep Execution Processor */
|
2006-01-10 01:21:17 +08:00
|
|
|
#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */
|
2004-07-08 01:28:53 +08:00
|
|
|
#define EM_CRX 114 /* National Semiconductor CRX */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_XGATE 115 /* Motorola XGATE embedded processor */
|
|
|
|
#define EM_C166 116 /* Infineon C16x/XC16x processor */
|
|
|
|
#define EM_M16C 117 /* Renesas M16C series microprocessors */
|
|
|
|
#define EM_DSPIC30F 118 /* Microchip Technology dsPIC30F Digital Signal Controller */
|
|
|
|
#define EM_CE 119 /* Freescale Communication Engine RISC core */
|
2008-06-13 03:49:48 +08:00
|
|
|
#define EM_M32C 120 /* Renesas M32C series microprocessors */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res121 121 /* Reserved */
|
|
|
|
#define EM_res122 122 /* Reserved */
|
|
|
|
#define EM_res123 123 /* Reserved */
|
|
|
|
#define EM_res124 124 /* Reserved */
|
|
|
|
#define EM_res125 125 /* Reserved */
|
|
|
|
#define EM_res126 126 /* Reserved */
|
|
|
|
#define EM_res127 127 /* Reserved */
|
|
|
|
#define EM_res128 128 /* Reserved */
|
|
|
|
#define EM_res129 129 /* Reserved */
|
|
|
|
#define EM_res130 130 /* Reserved */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_TSK3000 131 /* Altium TSK3000 core */
|
|
|
|
#define EM_RS08 132 /* Freescale RS08 embedded processor */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res133 133 /* Reserved */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_ECOG2 134 /* Cyan Technology eCOG2 microprocessor */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define EM_SCORE 135 /* Sunplus Score */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_SCORE7 135 /* Sunplus S+core7 RISC processor */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_DSP24 136 /* New Japan Radio (NJR) 24-bit DSP Processor */
|
|
|
|
#define EM_VIDEOCORE3 137 /* Broadcom VideoCore III processor */
|
|
|
|
#define EM_LATTICEMICO32 138 /* RISC processor for Lattice FPGA architecture */
|
|
|
|
#define EM_SE_C17 139 /* Seiko Epson C17 family */
|
2009-11-28 11:18:00 +08:00
|
|
|
#define EM_TI_C6000 140 /* Texas Instruments TMS320C6000 DSP family */
|
|
|
|
#define EM_TI_C2000 141 /* Texas Instruments TMS320C2000 DSP family */
|
|
|
|
#define EM_TI_C5500 142 /* Texas Instruments TMS320C55x DSP family */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res143 143 /* Reserved */
|
|
|
|
#define EM_res144 144 /* Reserved */
|
|
|
|
#define EM_res145 145 /* Reserved */
|
|
|
|
#define EM_res146 146 /* Reserved */
|
|
|
|
#define EM_res147 147 /* Reserved */
|
|
|
|
#define EM_res148 148 /* Reserved */
|
|
|
|
#define EM_res149 149 /* Reserved */
|
|
|
|
#define EM_res150 150 /* Reserved */
|
|
|
|
#define EM_res151 151 /* Reserved */
|
|
|
|
#define EM_res152 152 /* Reserved */
|
|
|
|
#define EM_res153 153 /* Reserved */
|
|
|
|
#define EM_res154 154 /* Reserved */
|
|
|
|
#define EM_res155 155 /* Reserved */
|
|
|
|
#define EM_res156 156 /* Reserved */
|
|
|
|
#define EM_res157 157 /* Reserved */
|
|
|
|
#define EM_res158 158 /* Reserved */
|
|
|
|
#define EM_res159 159 /* Reserved */
|
2008-06-12 20:44:01 +08:00
|
|
|
#define EM_MMDSP_PLUS 160 /* STMicroelectronics 64bit VLIW Data Signal Processor */
|
|
|
|
#define EM_CYPRESS_M8C 161 /* Cypress M8C microprocessor */
|
|
|
|
#define EM_R32C 162 /* Renesas R32C series microprocessors */
|
|
|
|
#define EM_TRIMEDIA 163 /* NXP Semiconductors TriMedia architecture family */
|
|
|
|
#define EM_QDSP6 164 /* QUALCOMM DSP6 Processor */
|
|
|
|
#define EM_8051 165 /* Intel 8051 and variants */
|
|
|
|
#define EM_STXP7X 166 /* STMicroelectronics STxP7x family */
|
|
|
|
#define EM_NDS32 167 /* Andes Technology compact code size embedded RISC processor family */
|
|
|
|
#define EM_ECOG1 168 /* Cyan Technology eCOG1X family */
|
|
|
|
#define EM_ECOG1X 168 /* Cyan Technology eCOG1X family */
|
|
|
|
#define EM_MAXQ30 169 /* Dallas Semiconductor MAXQ30 Core Micro-controllers */
|
|
|
|
#define EM_XIMO16 170 /* New Japan Radio (NJR) 16-bit DSP Processor */
|
|
|
|
#define EM_MANIK 171 /* M2000 Reconfigurable RISC Microprocessor */
|
|
|
|
#define EM_CRAYNV2 172 /* Cray Inc. NV2 vector architecture */
|
|
|
|
#define EM_RX 173 /* Renesas RX family */
|
|
|
|
#define EM_METAG 174 /* Imagination Technologies META processor architecture */
|
|
|
|
#define EM_MCST_ELBRUS 175 /* MCST Elbrus general purpose hardware architecture */
|
|
|
|
#define EM_ECOG16 176 /* Cyan Technology eCOG16 family */
|
2008-06-18 19:03:03 +08:00
|
|
|
#define EM_CR16 177 /* National Semiconductor CompactRISC 16-bit processor */
|
2009-04-02 01:30:35 +08:00
|
|
|
#define EM_ETPU 178 /* Freescale Extended Time Processing Unit */
|
|
|
|
#define EM_SLE9X 179 /* Infineon Technologies SLE9X core */
|
2009-07-25 22:58:58 +08:00
|
|
|
#define EM_L1OM 180 /* Intel L1OM */
|
2009-04-02 01:30:35 +08:00
|
|
|
#define EM_INTEL181 181 /* Reserved by Intel */
|
|
|
|
#define EM_INTEL182 182 /* Reserved by Intel */
|
2009-08-09 21:42:26 +08:00
|
|
|
#define EM_res183 183 /* Reserved by ARM */
|
|
|
|
#define EM_res184 184 /* Reserved by ARM */
|
|
|
|
#define EM_AVR32 185 /* Atmel Corporation 32-bit microprocessor family */
|
|
|
|
#define EM_STM8 186 /* STMicroeletronics STM8 8-bit microcontroller */
|
|
|
|
#define EM_TILE64 187 /* Tilera TILE64 multicore architecture family */
|
|
|
|
#define EM_TILEPRO 188 /* Tilera TILEPro multicore architecture family */
|
|
|
|
#define EM_MICROBLAZE 189 /* Xilinx MicroBlaze 32-bit RISC soft processor core */
|
2009-11-28 11:18:00 +08:00
|
|
|
#define EM_CUDA 190 /* NVIDIA CUDA architecture */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* If it is necessary to assign new unofficial EM_* values, please pick large
|
|
|
|
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
|
|
|
|
with official or non-GNU unofficial values.
|
|
|
|
|
|
|
|
NOTE: Do not just increment the most recent number by one.
|
|
|
|
Somebody else somewhere will do exactly the same thing, and you
|
2000-11-28 05:52:56 +08:00
|
|
|
will have a collision. Instead, pick a random number.
|
|
|
|
|
|
|
|
Normally, each entity or maintainer responsible for a machine with an
|
2008-06-09 22:07:18 +08:00
|
|
|
unofficial e_machine number should eventually ask registry@sco.com for
|
2003-01-17 09:32:46 +08:00
|
|
|
an officially blessed number to be added to the list above. */
|
2000-11-28 05:52:56 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* Old version of Sparc v9, from before the ABI;
|
|
|
|
This should be removed shortly. */
|
|
|
|
#define EM_OLD_SPARCV9 11
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Old version of PowerPC, this should be removed shortly. */
|
2006-02-17 22:36:28 +08:00
|
|
|
#define EM_PPC_OLD 17
|
2001-02-10 08:58:38 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* picoJava */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define EM_PJ_OLD 99
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2008-06-18 19:03:03 +08:00
|
|
|
/* Old, unofficial value for National Semiconductor CompactRISC - CR16 */
|
|
|
|
#define EM_CR16_OLD 115
|
2008-06-12 20:44:01 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* AVR magic number. Written in the absense of an ABI. */
|
|
|
|
#define EM_AVR_OLD 0x1057
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* MSP430 magic number. Written in the absense of everything. */
|
|
|
|
#define EM_MSP430_OLD 0x1059
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* Morpho MT. Written in the absense of an ABI. */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define EM_MT 0x2530
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* FR30 magic number - no EABI available. */
|
|
|
|
#define EM_CYGNUS_FR30 0x3330
|
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* OpenRISC magic number. Written in the absense of an ABI. */
|
2001-09-14 05:02:21 +08:00
|
|
|
#define EM_OPENRISC_OLD 0x3426
|
2001-04-24 23:08:16 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* DLX magic number. Written in the absense of an ABI. */
|
2002-05-28 22:08:47 +08:00
|
|
|
#define EM_DLX 0x5aa5
|
|
|
|
|
2002-06-19 05:15:57 +08:00
|
|
|
/* FRV magic number - no EABI available??. */
|
|
|
|
#define EM_CYGNUS_FRV 0x5441
|
2002-07-17 22:18:37 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* Infineon Technologies 16-bit microcontroller with C166-V2 core. */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define EM_XC16X 0x4688
|
2006-02-17 22:36:28 +08:00
|
|
|
|
|
|
|
/* D10V backend magic number. Written in the absence of an ABI. */
|
|
|
|
#define EM_CYGNUS_D10V 0x7650
|
|
|
|
|
|
|
|
/* D30V backend magic number. Written in the absence of an ABI. */
|
|
|
|
#define EM_CYGNUS_D30V 0x7676
|
|
|
|
|
|
|
|
/* Ubicom IP2xxx; Written in the absense of an ABI. */
|
2003-05-21 08:55:15 +08:00
|
|
|
#define EM_IP2K_OLD 0x8217
|
2002-07-17 22:18:37 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* (Deprecated) Temporary number for the OpenRISC processor. */
|
|
|
|
#define EM_OR32 0x8472
|
2005-06-08 05:10:08 +08:00
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define EM_CYGNUS_POWERPC 0x9025
|
2006-02-17 22:36:28 +08:00
|
|
|
|
|
|
|
/* Alpha backend magic number. Written in the absence of an ABI. */
|
|
|
|
#define EM_ALPHA 0x9026
|
|
|
|
|
|
|
|
/* Cygnus M32R ELF backend. Written in the absence of an ABI. */
|
|
|
|
#define EM_CYGNUS_M32R 0x9041
|
|
|
|
|
|
|
|
/* V850 backend magic number. Written in the absense of an ABI. */
|
|
|
|
#define EM_CYGNUS_V850 0x9080
|
|
|
|
|
|
|
|
/* old S/390 backend magic number. Written in the absence of an ABI. */
|
|
|
|
#define EM_S390_OLD 0xa390
|
2002-12-31 03:25:13 +08:00
|
|
|
|
2006-01-10 01:21:17 +08:00
|
|
|
/* Old, unofficial value for Xtensa. */
|
|
|
|
#define EM_XTENSA_OLD 0xabc7
|
|
|
|
|
2006-02-17 22:36:28 +08:00
|
|
|
#define EM_XSTORMY16 0xad45
|
|
|
|
|
|
|
|
/* mn10200 and mn10300 backend magic numbers.
|
|
|
|
Written in the absense of an ABI. */
|
|
|
|
#define EM_CYGNUS_MN10300 0xbeef
|
|
|
|
#define EM_CYGNUS_MN10200 0xdead
|
|
|
|
|
|
|
|
/* Renesas M32C and M16C. */
|
2008-06-13 03:49:48 +08:00
|
|
|
#define EM_M32C_OLD 0xFEB0
|
2006-02-17 22:36:28 +08:00
|
|
|
|
2003-01-14 00:37:47 +08:00
|
|
|
/* Vitesse IQ2000. */
|
2003-01-04 02:03:18 +08:00
|
|
|
#define EM_IQ2000 0xFEBA
|
2003-04-01 23:50:31 +08:00
|
|
|
|
2006-01-10 01:21:17 +08:00
|
|
|
/* NIOS magic number - no EABI available. */
|
|
|
|
#define EM_NIOS32 0xFEBB
|
2003-04-01 23:50:31 +08:00
|
|
|
|
2007-02-06 03:15:07 +08:00
|
|
|
#define EM_CYGNUS_MEP 0xF00D /* Toshiba MeP */
|
|
|
|
|
2009-04-16 23:39:48 +08:00
|
|
|
#define EM_MOXIE 0xFEED /* Moxie */
|
|
|
|
|
2009-03-02 18:33:08 +08:00
|
|
|
/* Old Sunplus S+core7 backend magic number. Written in the absence of an ABI. */
|
|
|
|
#define EM_SCORE_OLD 95
|
|
|
|
|
Add support for Xilinx MicroBlaze processor.
* bfd/Makefile.am: Add cpu-microblaze.{lo,c}, elf32-microblaze.{lo,c}.
* bfd/Makefile.in: Same.
* bfd/archures.c: Add bfd_arch_microblaze.
* bfd/bfd-in2.h: Regenerate.
* bfd/config.bfd: Add microblaze target.
* bfd/configure: Add bfd_elf32_microblaze_vec target.
* bfd/configure.in: Same.
* bfd/cpu-microblaze.c: New.
* bfd/elf32-microblaze.c: New.
* bfd/libbfd-in.h: Add prototype _bfd_dwarf2_fixup_section_debug_loc().
* bfd/libbfd.h: Regenerate.
* bfd/reloc.c: Add MICROBLAZE relocations.
* bfd/section.c: Add struct relax_table and relax_count to section.
* bfd/targets.c: Add bfd_elf32_microblaze_vec.
* binutils/MAINTAINERS: Add self as maintainer.
* binutils/readelf.c: Include elf/microblaze.h, add EM_MICROBLAZE &
EM_MICROBLAZE_OLD to guess_is_rela(), dump_relocations(),
get_machine_name().
* config.sub: Add microblaze target.
* configure: Same.
* configure.ac: Same.
* gas/Makefile.am: add microblaze to CPU_TYPES, config/tc-microblaze.c to
TARGET_CPU_CFILES, config/tc-microblaze.h to TARGET_CPU_HFILES, add
DEP_microblaze_elf target.
* gas/Makefile.in: Same.
* gas/config/tc-microblaze.c: Add MicroBlaze assembler.
* gas/config/tc-microblaze.h: Add header for tc-microblaze.c.
* gas/configure: Add microblaze target.
* gas/configure.in: Same.
* gas/configure.tgt: Same.
* gas/doc/Makefile.am: Add c-microblaze.texi to CPU_DOCS.
* gas/doc/Makefile.in: Same.
* gas/doc/all.texi: Set MICROBLAZE.
* gas/doc/as.texinfo: Add MicroBlaze doc links.
* gas/doc/c-microblaze.texi: New MicroBlaze docs.
* include/dis-asm.h: Decl print_insn_microblaze().
* include/elf/common.h: Define EM_MICROBLAZE & EM_MICROBLAZE_OLD.
* include/elf/microblaze.h: New reloc definitions.
* ld/Makefile.am: Add eelf32mb_linux.o, eelf32microblaze.o to
ALL_EMULATIONS, targets.
* ld/Makefile.in: Same.
* ld/configure.tgt: Add microblaze*-linux*, microblaze* targets.
* ld/emulparams/elf32mb_linux.sh: New.
* ld/emulparams/elf32microblaze.sh. New.
* ld/scripttempl/elfmicroblaze.sc: New.
* opcodes/Makefile.am: Add microblaze-opc.h to HFILES, microblaze-dis.c to
CFILES, microblaze-dis.lo to ALL_MACHINES, targets.
* opcodes/Makefile.in: Same.
* opcodes/configure: Add bfd_microblaze_arch target.
* opcodes/configure.in: Same.
* opcodes/disassemble.c: Define ARCH_microblaze, return
print_insn_microblaze().
* opcodes/microblaze-dis.c: New MicroBlaze disassembler.
* opcodes/microblaze-opc.h: New MicroBlaze opcode definitions.
* opcodes/microblaze-opcm.h: New MicroBlaze opcode types.
2009-08-07 01:38:04 +08:00
|
|
|
#define EM_MICROBLAZE_OLD 0xbaab /* Old MicroBlaze */
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* See the above comment before you add a new EM_* value here. */
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Values for e_version. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define EV_NONE 0 /* Invalid ELF version */
|
|
|
|
#define EV_CURRENT 1 /* Current version */
|
|
|
|
|
2010-01-19 21:50:25 +08:00
|
|
|
/* Value for e_phnum. */
|
|
|
|
#define PN_XNUM 0xffff /* Extended numbering */
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Values for program header, p_type field. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
#define PT_NULL 0 /* Program header table entry unused */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define PT_LOAD 1 /* Loadable program segment */
|
|
|
|
#define PT_DYNAMIC 2 /* Dynamic linking information */
|
|
|
|
#define PT_INTERP 3 /* Program interpreter */
|
|
|
|
#define PT_NOTE 4 /* Auxiliary information */
|
|
|
|
#define PT_SHLIB 5 /* Reserved, unspecified semantics */
|
|
|
|
#define PT_PHDR 6 /* Entry for header table itself */
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 21:12:53 +08:00
|
|
|
#define PT_TLS 7 /* Thread local storage segment */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define PT_LOOS 0x60000000 /* OS-specific */
|
|
|
|
#define PT_HIOS 0x6fffffff /* OS-specific */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define PT_LOPROC 0x70000000 /* Processor-specific */
|
|
|
|
#define PT_HIPROC 0x7FFFFFFF /* Processor-specific */
|
|
|
|
|
2004-05-12 01:08:38 +08:00
|
|
|
#define PT_GNU_EH_FRAME (PT_LOOS + 0x474e550) /* Frame unwind information */
|
2004-10-08 21:55:11 +08:00
|
|
|
#define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */
|
2007-08-17 02:49:42 +08:00
|
|
|
#define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */
|
2004-05-12 01:08:38 +08:00
|
|
|
#define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */
|
2001-12-13 19:09:34 +08:00
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Program segment permissions, in program header p_flags field. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define PF_X (1 << 0) /* Segment is executable */
|
|
|
|
#define PF_W (1 << 1) /* Segment is writable */
|
|
|
|
#define PF_R (1 << 2) /* Segment is readable */
|
1999-12-29 02:40:48 +08:00
|
|
|
/* #define PF_MASKOS 0x0F000000 *//* OS-specific reserved bits */
|
|
|
|
#define PF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define PF_MASKPROC 0xF0000000 /* Processor-specific reserved bits */
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Values for section header, sh_type field. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define SHT_NULL 0 /* Section header table entry unused */
|
|
|
|
#define SHT_PROGBITS 1 /* Program specific (private) data */
|
|
|
|
#define SHT_SYMTAB 2 /* Link editing symbol table */
|
|
|
|
#define SHT_STRTAB 3 /* A string table */
|
|
|
|
#define SHT_RELA 4 /* Relocation entries with addends */
|
|
|
|
#define SHT_HASH 5 /* A symbol hash table */
|
|
|
|
#define SHT_DYNAMIC 6 /* Information for dynamic linking */
|
|
|
|
#define SHT_NOTE 7 /* Information that marks file */
|
|
|
|
#define SHT_NOBITS 8 /* Section occupies no space in file */
|
|
|
|
#define SHT_REL 9 /* Relocation entries, no addends */
|
|
|
|
#define SHT_SHLIB 10 /* Reserved, unspecified semantics */
|
|
|
|
#define SHT_DYNSYM 11 /* Dynamic linking symbol table */
|
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
#define SHT_INIT_ARRAY 14 /* Array of ptrs to init functions */
|
|
|
|
#define SHT_FINI_ARRAY 15 /* Array of ptrs to finish functions */
|
2000-11-23 07:19:15 +08:00
|
|
|
#define SHT_PREINIT_ARRAY 16 /* Array of ptrs to pre-init funcs */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define SHT_GROUP 17 /* Section contains a section group */
|
2000-11-23 07:19:15 +08:00
|
|
|
#define SHT_SYMTAB_SHNDX 18 /* Indicies for SHN_XINDEX entries */
|
1999-12-29 02:40:48 +08:00
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
#define SHT_LOOS 0x60000000 /* First of OS specific semantics */
|
|
|
|
#define SHT_HIOS 0x6fffffff /* Last of OS specific semantics */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2009-03-21 07:37:51 +08:00
|
|
|
#define SHT_GNU_INCREMENTAL_INPUTS 0x6fff4700 /* incremental build data */
|
bfd:
* elf-attrs.c: New.
* Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo.
(BFD32_BACKENDS_CFILES): Add elf-attrs.c.
(elf-attrs.lo): Generate dependencies.
* Makefile.in: Regenerate.
* configure.in (elf): Add elf-attrs.lo.
* configure: Regenerate.
* elf-bfd.h (struct elf_backend_data): Add entries for object
attributes.
(NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list,
OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST,
Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility):
New.
(struct elf_obj_tdata): Add entries for object attributes.
(elf_known_obj_attributes, elf_other_obj_attributes,
elf_known_obj_attributes_proc, elf_other_obj_attributes_proc):
New.
(bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents,
bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int,
bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string,
bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat,
bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup,
_bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type,
_bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New.
* elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes.
(bfd_section_from_shdr): Handle attributes sections.
* elflink.c (bfd_elf_final_link): Handle attributes sections.
* elfxx-target.h (elf_backend_obj_attrs_vendor,
elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type,
elf_backend_obj_attrs_section_type): New.
(elfNN_bed): Update.
* elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute,
aeabi_attribute_list): Remove.
(struct elf32_arm_obj_tdata): Remove object attributes fields.
(check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2,
elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes):
Update for new object attributes interfaces.
(uleb128_size, is_default_attr, eabi_attr_size,
elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute,
elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link,
elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int,
elf32_arm_add_eabi_attr_int, attr_strdup,
elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat,
copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved
to generic code in elf-attrs.c.
(elf32_arm_obj_attrs_arg_type): New.
(elf32_arm_fake_sections): Do not handle .ARM.attributes.
(elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES.
(bfd_elf32_bfd_final_link): Remove.
(elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section,
elf_backend_obj_attrs_arg_type,
elf_backend_obj_attrs_section_type): New.
* elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object
attributes.
* elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise.
* elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise.
* elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise.
* elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise.
* elf32-sh.c (sh_elf_copy_private_data): Likewise.
* elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise.
binutils:
* readelf.c (display_gnu_attribute): New.
(process_arm_specific): Rearrange as process_attributes.
(process_arm_specific): Replace by wrapper of process_attributes.
gas:
* as.c (create_obj_attrs_section): New.
(main): Call create_obj_attrs_section for ELF.
* read.c (s_gnu_attribute, skip_whitespace, skip_past_char,
skip_past_comma, s_vendor_attribute): New.
(potable): Add gnu_attribute for ELF.
* read.h (s_vendor_attribute): Declare.
* config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper
round s_vendor_attribute.
(aeabi_set_public_attributes): Update for new attributes
interfaces.
(arm_md_end): Remove attributes contents setting now done
generically.
include/elf:
* arm.h (elf32_arm_add_eabi_attr_int,
elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat,
elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents,
elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section,
Tag_Symbol, Tag_compatibility): Remove.
* common.h (SHT_GNU_ATTRIBUTES): Define.
ld:
* emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes.
(ATTRS_SECTIONS): Define.
* scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc,
scripttempl/elf_chaos.sc, scripttempl/elfi370.sc,
scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-30 00:29:17 +08:00
|
|
|
#define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes */
|
include/
* bfdlink.h (struct bfd_link_info): Add emit_hash and
emit_gnu_hash bitfields.
include/elf/
* common.h (SHT_GNU_HASH, DT_GNU_HASH): Define.
ld/
* scripttempl/elf.sc: Add .gnu.hash section.
* emultempl/elf32.em (OPTION_HASH_STYLE): Define.
(gld${EMULATION_NAME}_add_options): Register --hash-style option.
(gld${EMULATION_NAME}_handle_option): Handle it.
(gld${EMULATION_NAME}_list_options): Document it.
* ldmain.c (main): Initialize emit_hash and emit_gnu_hash.
* ld.texinfo: Document --hash-style option.
bfd/
* elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH.
(bfd_section_from_shdr, elf_fake_sections, assign_section_numbers):
Handle SHT_GNU_HASH.
(special_sections_g): Include .gnu.hash section.
(bfd_elf_gnu_hash): New function.
* elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes.
(struct elf_backend_data): Add elf_hash_symbol method.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash
only if info->emit_hash, create .gnu.hash section if
info->emit_gnu_hash.
(struct collect_gnu_hash_codes): New type.
(elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms,
_bfd_elf_hash_symbol): New functions.
(compute_bucket_count): Don't compute HASHCODES array, instead add
that and NSYMS as arguments. Use bed->s->sizeof_hash_entry
instead of bed->s->arch_size / 8. Fix .hash size estimation.
When not optimizing, use the number of hashed symbols rather than
dynsymcount.
(bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash,
and ADD DT_GNU_HASH if info->emit_gnu_hash.
(bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash,
adjust compute_bucket_count caller. Create and populate .gnu.hash
section if info->emit_gnu_hash.
(elf_link_output_extsym): Only populate .hash section if
finfo->hash_sec != NULL.
(bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH.
* elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined.
(elfNN_bed): Add elf_backend_hash_symbol.
* elf64-x86-64.c (elf64_x86_64_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
* elf32-i386.c (elf_i386_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
binutils/
* readelf.c (get_dynamic_type): Handle DT_GNU_HASH.
(get_section_type_name): Handle SHT_GNU_HASH.
(dynamic_info_DT_GNU_HASH): New variable.
(process_dynamic_section): Handle DT_GNU_HASH.
(process_symbol_table): Print also DT_GNU_HASH histogram.
ld/testsuite/
* ld-powerpc/tlsso32.r: Adjust.
* ld-powerpc/tlsso32.d: Adjust.
* ld-powerpc/tlsso32.g: Adjust.
* ld-powerpc/tlsso.r: Adjust.
* ld-powerpc/tlsso.g: Adjust.
* ld-powerpc/tlstocso.g: Adjust.
2006-07-11 05:40:25 +08:00
|
|
|
#define SHT_GNU_HASH 0x6ffffff6 /* GNU style symbol hash table */
|
2002-07-10 23:28:34 +08:00
|
|
|
#define SHT_GNU_LIBLIST 0x6ffffff7 /* List of prelink dependencies */
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* The next three section types are defined by Solaris, and are named
|
|
|
|
SHT_SUNW*. We use them in GNU code, so we also define SHT_GNU*
|
|
|
|
versions. */
|
|
|
|
#define SHT_SUNW_verdef 0x6ffffffd /* Versions defined by file */
|
|
|
|
#define SHT_SUNW_verneed 0x6ffffffe /* Versions needed by file */
|
|
|
|
#define SHT_SUNW_versym 0x6fffffff /* Symbol versions */
|
|
|
|
|
|
|
|
#define SHT_GNU_verdef SHT_SUNW_verdef
|
|
|
|
#define SHT_GNU_verneed SHT_SUNW_verneed
|
|
|
|
#define SHT_GNU_versym SHT_SUNW_versym
|
|
|
|
|
|
|
|
#define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */
|
|
|
|
#define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */
|
|
|
|
#define SHT_LOUSER 0x80000000 /* Application-specific semantics */
|
1999-12-29 02:40:48 +08:00
|
|
|
/* #define SHT_HIUSER 0x8FFFFFFF *//* Application-specific semantics */
|
|
|
|
#define SHT_HIUSER 0xFFFFFFFF /* New value, defined in Oct 4, 1999 Draft */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Values for section header, sh_flags field. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define SHF_WRITE (1 << 0) /* Writable data during execution */
|
|
|
|
#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
|
|
|
|
#define SHF_EXECINSTR (1 << 2) /* Executable machine instructions */
|
1999-12-29 02:40:48 +08:00
|
|
|
#define SHF_MERGE (1 << 4) /* Data in this section can be merged */
|
|
|
|
#define SHF_STRINGS (1 << 5) /* Contains null terminated character strings */
|
|
|
|
#define SHF_INFO_LINK (1 << 6) /* sh_info holds section header table index */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define SHF_LINK_ORDER (1 << 7) /* Preserve section ordering when linking */
|
2000-11-23 07:19:15 +08:00
|
|
|
#define SHF_OS_NONCONFORMING (1 << 8) /* OS specific processing required */
|
|
|
|
#define SHF_GROUP (1 << 9) /* Member of a section group */
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 21:12:53 +08:00
|
|
|
#define SHF_TLS (1 << 10) /* Thread local storage section */
|
1999-12-29 02:40:48 +08:00
|
|
|
|
|
|
|
/* #define SHF_MASKOS 0x0F000000 *//* OS-specific semantics */
|
|
|
|
#define SHF_MASKOS 0x0FF00000 /* New value, Oct 4, 1999 Draft */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SHF_MASKPROC 0xF0000000 /* Processor-specific semantics */
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Values of note segment descriptor types for core files. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
|
|
|
|
#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
|
|
|
|
#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
|
1999-09-01 00:56:26 +08:00
|
|
|
#define NT_TASKSTRUCT 4 /* Contains copy of task struct */
|
2003-05-21 08:55:15 +08:00
|
|
|
#define NT_AUXV 6 /* Contains copy of Elfxx_auxv_t */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define NT_PRXFPREG 0x46e62b7f /* Contains a user_xfpregs_struct; */
|
1999-12-29 02:40:48 +08:00
|
|
|
/* note name must be "LINUX". */
|
2007-10-18 17:57:04 +08:00
|
|
|
#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
|
|
|
|
/* note name must be "LINUX". */
|
2008-07-21 13:33:37 +08:00
|
|
|
#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
|
|
|
|
/* note name must be "LINUX". */
|
2010-02-02 20:37:40 +08:00
|
|
|
#define NT_X86_XSTATE 0x202 /* x86 XSAVE extended state */
|
|
|
|
/* note name must be "LINUX". */
|
2009-12-19 00:21:51 +08:00
|
|
|
#define NT_S390_HIGH_GPRS 0x300 /* S/390 upper halves of GPRs */
|
|
|
|
/* note name must be "LINUX". */
|
bfd/
2010-02-09 Michael Holzheu <holzheu@de.ibm.com>
* elf-bfd.h (elfcore_write_s390_timer, elfcore_write_s390_todcmp,
elfcore_write_s390_todpreg, elfcore_write_s390_ctrs,
elfcore_write_s390_prefix): New.
* elf.c (elfcore_write_s390_timer, elfcore_write_s390_todcmp,
elfcore_write_s390_todpreg, elfcore_write_s390_ctrs,
elfcore_write_s390_prefix): New.
(elfcore_grok_note): Handle NT_S390_TIMER, NT_S390_TODCMP,
NT_S390_TODPREG, NT_S390_CTRS and NT_S390_PREFIX.
(elfcore_write_register_note): Handle .reg-s390-timer,
.reg-s390-todcmp, .reg-s390-todpreg, .reg-s390-ctrs,
.reg-s390-prefix section.
binutils/
2010-02-09 Michael Holzheu <holzheu@de.ibm.com>
* readelf.c (get_note_type): Handle NT_S390_TIMER, NT_S390_TODCMP,
NT_S390_TODPREG, NT_S390_CTRS and NT_S390_PREFIX.
include/elf/
2010-02-09 Michael Holzheu <holzheu@de.ibm.com>
* common.h (NT_S390_TIMER, NT_S390_TODCMP, NT_S390_TODPREG,
NT_S390_CTRS and NT_S390_PREFIX): Define.
2010-02-09 20:14:43 +08:00
|
|
|
#define NT_S390_TIMER 0x301 /* S390 timer */
|
|
|
|
/* note name must be "LINUX". */
|
|
|
|
#define NT_S390_TODCMP 0x302 /* S390 TOD clock comparator */
|
|
|
|
/* note name must be "LINUX". */
|
|
|
|
#define NT_S390_TODPREG 0x303 /* S390 TOD programmable register */
|
|
|
|
/* note name must be "LINUX". */
|
|
|
|
#define NT_S390_CTRS 0x304 /* S390 control registers */
|
|
|
|
/* note name must be "LINUX". */
|
|
|
|
#define NT_S390_PREFIX 0x305 /* S390 prefix register */
|
|
|
|
/* note name must be "LINUX". */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Note segments for core files on dir-style procfs systems. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define NT_PSTATUS 10 /* Has a struct pstatus */
|
|
|
|
#define NT_FPREGS 12 /* Has a struct fpregset */
|
|
|
|
#define NT_PSINFO 13 /* Has a struct psinfo */
|
|
|
|
#define NT_LWPSTATUS 16 /* Has a struct lwpstatus_t */
|
|
|
|
#define NT_LWPSINFO 17 /* Has a struct lwpsinfo_t */
|
2000-01-11 02:51:33 +08:00
|
|
|
#define NT_WIN32PSTATUS 18 /* Has a struct win32_pstatus */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2002-01-10 02:59:11 +08:00
|
|
|
|
|
|
|
/* Note segments for core files on NetBSD systems. Note name
|
|
|
|
must start with "NetBSD-CORE". */
|
|
|
|
|
|
|
|
#define NT_NETBSDCORE_PROCINFO 1 /* Has a struct procinfo */
|
|
|
|
#define NT_NETBSDCORE_FIRSTMACH 32 /* start of machdep note types */
|
|
|
|
|
2009-03-18 23:57:17 +08:00
|
|
|
|
|
|
|
/* Note segments for core files on OpenBSD systems. Note name is
|
|
|
|
"OpenBSD". */
|
|
|
|
|
|
|
|
#define NT_OPENBSD_PROCINFO 10
|
|
|
|
#define NT_OPENBSD_AUXV 11
|
|
|
|
#define NT_OPENBSD_REGS 20
|
|
|
|
#define NT_OPENBSD_FPREGS 21
|
|
|
|
#define NT_OPENBSD_XFPREGS 22
|
|
|
|
#define NT_OPENBSD_WCOOKIE 23
|
|
|
|
|
|
|
|
|
2007-08-25 21:20:41 +08:00
|
|
|
/* Note segments for core files on SPU systems. Note name
|
|
|
|
must start with "SPU/". */
|
|
|
|
|
|
|
|
#define NT_SPU 1
|
2002-01-10 02:59:11 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Values of note segment descriptor types for object files. */
|
|
|
|
|
|
|
|
#define NT_VERSION 1 /* Contains a version string. */
|
2001-11-15 21:19:10 +08:00
|
|
|
#define NT_ARCH 2 /* Contains an architecture string. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-10 05:17:42 +08:00
|
|
|
/* Values for notes in non-core files using name "GNU". */
|
2002-05-08 22:28:37 +08:00
|
|
|
|
|
|
|
#define NT_GNU_ABI_TAG 1
|
2007-07-10 05:17:42 +08:00
|
|
|
#define NT_GNU_HWCAP 2 /* Used by ld.so and kernel vDSO. */
|
|
|
|
#define NT_GNU_BUILD_ID 3 /* Generated by ld --build-id. */
|
2008-03-25 12:58:21 +08:00
|
|
|
#define NT_GNU_GOLD_VERSION 4 /* Generated by gold. */
|
2007-07-10 05:17:42 +08:00
|
|
|
|
|
|
|
/* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */
|
2002-05-08 22:28:37 +08:00
|
|
|
#define GNU_ABI_TAG_LINUX 0
|
|
|
|
#define GNU_ABI_TAG_HURD 1
|
|
|
|
#define GNU_ABI_TAG_SOLARIS 2
|
2003-06-13 21:07:51 +08:00
|
|
|
#define GNU_ABI_TAG_FREEBSD 3
|
|
|
|
#define GNU_ABI_TAG_NETBSD 4
|
2002-05-08 22:28:37 +08:00
|
|
|
|
|
|
|
/* Values for NetBSD .note.netbsd.ident notes. Note name is "NetBSD". */
|
|
|
|
|
|
|
|
#define NT_NETBSD_IDENT 1
|
|
|
|
|
2004-01-20 02:28:58 +08:00
|
|
|
/* Values for OpenBSD .note.openbsd.ident notes. Note name is "OpenBSD". */
|
|
|
|
|
|
|
|
#define NT_OPENBSD_IDENT 1
|
|
|
|
|
2002-05-08 22:28:37 +08:00
|
|
|
/* Values for FreeBSD .note.ABI-tag notes. Note name is "FreeBSD". */
|
|
|
|
|
|
|
|
#define NT_FREEBSD_ABI_TAG 1
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* These three macros disassemble and assemble a symbol table st_info field,
|
|
|
|
which contains the symbol binding and symbol type. The STB_ and STT_
|
2000-11-23 07:19:15 +08:00
|
|
|
defines identify the binding and type. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define ELF_ST_BIND(val) (((unsigned int)(val)) >> 4)
|
|
|
|
#define ELF_ST_TYPE(val) ((val) & 0xF)
|
|
|
|
#define ELF_ST_INFO(bind,type) (((bind) << 4) + ((type) & 0xF))
|
|
|
|
|
1999-12-29 02:40:48 +08:00
|
|
|
/* The 64bit and 32bit versions of these macros are identical, but
|
|
|
|
the ELF spec defines them, so here they are. */
|
|
|
|
#define ELF32_ST_BIND ELF_ST_BIND
|
|
|
|
#define ELF32_ST_TYPE ELF_ST_TYPE
|
|
|
|
#define ELF32_ST_INFO ELF_ST_INFO
|
|
|
|
#define ELF64_ST_BIND ELF_ST_BIND
|
|
|
|
#define ELF64_ST_TYPE ELF_ST_TYPE
|
|
|
|
#define ELF64_ST_INFO ELF_ST_INFO
|
|
|
|
|
2000-02-23 03:59:40 +08:00
|
|
|
/* This macro disassembles and assembles a symbol's visibility into
|
2007-03-07 18:18:56 +08:00
|
|
|
the st_other field. The STV_ defines specify the actual visibility. */
|
1999-12-29 02:40:48 +08:00
|
|
|
|
|
|
|
#define ELF_ST_VISIBILITY(v) ((v) & 0x3)
|
2000-02-23 03:56:41 +08:00
|
|
|
/* The remaining bits in the st_other field are not currently used.
|
|
|
|
They should be set to zero. */
|
1999-12-29 02:40:48 +08:00
|
|
|
|
|
|
|
#define ELF32_ST_VISIBILITY ELF_ST_VISIBILITY
|
|
|
|
#define ELF64_ST_VISIBILITY ELF_ST_VISIBILITY
|
|
|
|
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
#define STN_UNDEF 0 /* Undefined symbol index */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define STB_LOCAL 0 /* Symbol not visible outside obj */
|
|
|
|
#define STB_GLOBAL 1 /* Symbol visible outside obj */
|
|
|
|
#define STB_WEAK 2 /* Like globals, lower precedence */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define STB_LOOS 10 /* OS-specific semantics */
|
2009-07-23 21:00:30 +08:00
|
|
|
#define STB_GNU_UNIQUE 10 /* Symbol is unique in namespace */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define STB_HIOS 12 /* OS-specific semantics */
|
2009-02-24 09:43:49 +08:00
|
|
|
#define STB_LOPROC 13 /* Processor-specific semantics */
|
|
|
|
#define STB_HIPROC 15 /* Processor-specific semantics */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define STT_NOTYPE 0 /* Symbol type is unspecified */
|
|
|
|
#define STT_OBJECT 1 /* Symbol is a data object */
|
|
|
|
#define STT_FUNC 2 /* Symbol is a code object */
|
|
|
|
#define STT_SECTION 3 /* Symbol associated with a section */
|
|
|
|
#define STT_FILE 4 /* Symbol gives a file name */
|
1999-12-29 02:40:48 +08:00
|
|
|
#define STT_COMMON 5 /* An uninitialised common block */
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 21:12:53 +08:00
|
|
|
#define STT_TLS 6 /* Thread local data object */
|
2008-08-04 07:20:42 +08:00
|
|
|
#define STT_RELC 8 /* Complex relocation expression */
|
|
|
|
#define STT_SRELC 9 /* Signed Complex relocation expression */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define STT_LOOS 10 /* OS-specific semantics */
|
2009-04-30 23:47:13 +08:00
|
|
|
#define STT_GNU_IFUNC 10 /* Symbol is an indirect code object */
|
2003-01-17 09:32:46 +08:00
|
|
|
#define STT_HIOS 12 /* OS-specific semantics */
|
2009-02-24 09:43:49 +08:00
|
|
|
#define STT_LOPROC 13 /* Processor-specific semantics */
|
|
|
|
#define STT_HIPROC 15 /* Processor-specific semantics */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
1999-12-29 02:40:48 +08:00
|
|
|
/* The following constants control how a symbol may be accessed once it has
|
|
|
|
become part of an executable or shared library. */
|
2003-05-21 08:55:15 +08:00
|
|
|
|
1999-12-29 02:40:48 +08:00
|
|
|
#define STV_DEFAULT 0 /* Visibility is specified by binding type */
|
|
|
|
#define STV_INTERNAL 1 /* OS specific version of STV_HIDDEN */
|
|
|
|
#define STV_HIDDEN 2 /* Can only be seen inside currect component */
|
|
|
|
#define STV_PROTECTED 3 /* Treat as STB_LOCAL inside current component */
|
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Relocation info handling macros. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define ELF32_R_SYM(i) ((i) >> 8)
|
|
|
|
#define ELF32_R_TYPE(i) ((i) & 0xff)
|
|
|
|
#define ELF32_R_INFO(s,t) (((s) << 8) + ((t) & 0xff))
|
|
|
|
|
|
|
|
#define ELF64_R_SYM(i) ((i) >> 32)
|
|
|
|
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
|
2004-06-19 10:21:14 +08:00
|
|
|
#define ELF64_R_INFO(s,t) (((bfd_vma) (s) << 31 << 1) + (bfd_vma) (t))
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-11-23 07:19:15 +08:00
|
|
|
/* Dynamic section tags. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define DT_NULL 0
|
|
|
|
#define DT_NEEDED 1
|
|
|
|
#define DT_PLTRELSZ 2
|
|
|
|
#define DT_PLTGOT 3
|
|
|
|
#define DT_HASH 4
|
|
|
|
#define DT_STRTAB 5
|
|
|
|
#define DT_SYMTAB 6
|
|
|
|
#define DT_RELA 7
|
|
|
|
#define DT_RELASZ 8
|
|
|
|
#define DT_RELAENT 9
|
|
|
|
#define DT_STRSZ 10
|
|
|
|
#define DT_SYMENT 11
|
|
|
|
#define DT_INIT 12
|
|
|
|
#define DT_FINI 13
|
|
|
|
#define DT_SONAME 14
|
|
|
|
#define DT_RPATH 15
|
|
|
|
#define DT_SYMBOLIC 16
|
|
|
|
#define DT_REL 17
|
|
|
|
#define DT_RELSZ 18
|
|
|
|
#define DT_RELENT 19
|
|
|
|
#define DT_PLTREL 20
|
|
|
|
#define DT_DEBUG 21
|
|
|
|
#define DT_TEXTREL 22
|
|
|
|
#define DT_JMPREL 23
|
2003-01-17 09:32:46 +08:00
|
|
|
#define DT_BIND_NOW 24
|
|
|
|
#define DT_INIT_ARRAY 25
|
|
|
|
#define DT_FINI_ARRAY 26
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DT_INIT_ARRAYSZ 27
|
|
|
|
#define DT_FINI_ARRAYSZ 28
|
2003-01-17 09:32:46 +08:00
|
|
|
#define DT_RUNPATH 29
|
|
|
|
#define DT_FLAGS 30
|
2007-04-26 14:59:55 +08:00
|
|
|
#define DT_ENCODING 32
|
2000-01-12 01:53:33 +08:00
|
|
|
#define DT_PREINIT_ARRAY 32
|
1999-12-29 02:40:48 +08:00
|
|
|
#define DT_PREINIT_ARRAYSZ 33
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-01-12 01:53:33 +08:00
|
|
|
/* Note, the Oct 4, 1999 draft of the ELF ABI changed the values
|
|
|
|
for DT_LOOS and DT_HIOS. Some implementations however, use
|
2003-01-17 09:32:46 +08:00
|
|
|
values outside of the new range (see below). */
|
2000-01-12 01:53:33 +08:00
|
|
|
#define OLD_DT_LOOS 0x60000000
|
2003-01-17 09:32:46 +08:00
|
|
|
#define DT_LOOS 0x6000000d
|
2003-12-06 13:32:21 +08:00
|
|
|
#define DT_HIOS 0x6ffff000
|
2003-01-17 09:32:46 +08:00
|
|
|
#define OLD_DT_HIOS 0x6fffffff
|
2000-01-12 01:53:33 +08:00
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
#define DT_LOPROC 0x70000000
|
|
|
|
#define DT_HIPROC 0x7fffffff
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2009-05-28 01:05:53 +08:00
|
|
|
/* The next 2 dynamic tag ranges, integer value range (DT_VALRNGLO to
|
|
|
|
DT_VALRNGHI) and virtual address range (DT_ADDRRNGLO to DT_ADDRRNGHI),
|
|
|
|
are used on Solaris. We support them everywhere. Note these values
|
|
|
|
lie outside of the (new) range for OS specific values. This is a
|
|
|
|
deliberate special case and we maintain it for backwards compatability.
|
|
|
|
*/
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DT_VALRNGLO 0x6ffffd00
|
2002-07-10 23:28:34 +08:00
|
|
|
#define DT_GNU_PRELINKED 0x6ffffdf5
|
|
|
|
#define DT_GNU_CONFLICTSZ 0x6ffffdf6
|
|
|
|
#define DT_GNU_LIBLISTSZ 0x6ffffdf7
|
2000-07-20 02:22:41 +08:00
|
|
|
#define DT_CHECKSUM 0x6ffffdf8
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DT_PLTPADSZ 0x6ffffdf9
|
|
|
|
#define DT_MOVEENT 0x6ffffdfa
|
|
|
|
#define DT_MOVESZ 0x6ffffdfb
|
2000-07-20 02:02:31 +08:00
|
|
|
#define DT_FEATURE 0x6ffffdfc
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DT_POSFLAG_1 0x6ffffdfd
|
|
|
|
#define DT_SYMINSZ 0x6ffffdfe
|
|
|
|
#define DT_SYMINENT 0x6ffffdff
|
|
|
|
#define DT_VALRNGHI 0x6ffffdff
|
|
|
|
|
|
|
|
#define DT_ADDRRNGLO 0x6ffffe00
|
include/
* bfdlink.h (struct bfd_link_info): Add emit_hash and
emit_gnu_hash bitfields.
include/elf/
* common.h (SHT_GNU_HASH, DT_GNU_HASH): Define.
ld/
* scripttempl/elf.sc: Add .gnu.hash section.
* emultempl/elf32.em (OPTION_HASH_STYLE): Define.
(gld${EMULATION_NAME}_add_options): Register --hash-style option.
(gld${EMULATION_NAME}_handle_option): Handle it.
(gld${EMULATION_NAME}_list_options): Document it.
* ldmain.c (main): Initialize emit_hash and emit_gnu_hash.
* ld.texinfo: Document --hash-style option.
bfd/
* elf.c (_bfd_elf_print_private_bfd_data): Handle DT_GNU_HASH.
(bfd_section_from_shdr, elf_fake_sections, assign_section_numbers):
Handle SHT_GNU_HASH.
(special_sections_g): Include .gnu.hash section.
(bfd_elf_gnu_hash): New function.
* elf-bfd.h (bfd_elf_gnu_hash, _bfd_elf_hash_symbol): New prototypes.
(struct elf_backend_data): Add elf_hash_symbol method.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Create .hash
only if info->emit_hash, create .gnu.hash section if
info->emit_gnu_hash.
(struct collect_gnu_hash_codes): New type.
(elf_collect_gnu_hash_codes, elf_renumber_gnu_hash_syms,
_bfd_elf_hash_symbol): New functions.
(compute_bucket_count): Don't compute HASHCODES array, instead add
that and NSYMS as arguments. Use bed->s->sizeof_hash_entry
instead of bed->s->arch_size / 8. Fix .hash size estimation.
When not optimizing, use the number of hashed symbols rather than
dynsymcount.
(bfd_elf_size_dynamic_sections): Only add DT_HASH if info->emit_hash,
and ADD DT_GNU_HASH if info->emit_gnu_hash.
(bfd_elf_size_dynsym_hash_dynstr): Size .hash only if info->emit_hash,
adjust compute_bucket_count caller. Create and populate .gnu.hash
section if info->emit_gnu_hash.
(elf_link_output_extsym): Only populate .hash section if
finfo->hash_sec != NULL.
(bfd_elf_final_link): Adjust assertion. Handle DT_GNU_HASH.
* elfxx-target.h (elf_backend_hash_symbol): Define if not yet defined.
(elfNN_bed): Add elf_backend_hash_symbol.
* elf64-x86-64.c (elf64_x86_64_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
* elf32-i386.c (elf_i386_hash_symbol): New function.
(elf_backend_hash_symbol): Define.
binutils/
* readelf.c (get_dynamic_type): Handle DT_GNU_HASH.
(get_section_type_name): Handle SHT_GNU_HASH.
(dynamic_info_DT_GNU_HASH): New variable.
(process_dynamic_section): Handle DT_GNU_HASH.
(process_symbol_table): Print also DT_GNU_HASH histogram.
ld/testsuite/
* ld-powerpc/tlsso32.r: Adjust.
* ld-powerpc/tlsso32.d: Adjust.
* ld-powerpc/tlsso32.g: Adjust.
* ld-powerpc/tlsso.r: Adjust.
* ld-powerpc/tlsso.g: Adjust.
* ld-powerpc/tlstocso.g: Adjust.
2006-07-11 05:40:25 +08:00
|
|
|
#define DT_GNU_HASH 0x6ffffef5
|
include/elf/ChangeLog:
Introduce TLS descriptors for i386 and x86_64.
* common.h (DT_TLSDESC_GOT, DT_TLSDESC_PLT): New.
* i386.h (R_386_TLS_GOTDESC, R_386_TLS_DESC_CALL, R_386_TLS_DESC):
New.
* x86-64.h (R_X86_64_GOTPC32_TLSDESC, R_X86_64_TLSDESC_CALL,
R_X86_64_TLSDESC): New.
bfd/ChangeLog:
Introduce TLS descriptors for i386 and x86_64.
* reloc.c (BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC,
BFD_RELOC_386_TLS_DESC_CALL, BFD_RELOC_X86_64_GOTPC32_TLSDESC,
BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL): New.
* libbfd.h, bfd-in2.h: Rebuilt.
* elf32-i386.c (elf_howto_table): New relocations.
(R_386_tls): Adjust.
(elf_i386_reloc_type_lookup): Map new relocations.
(GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
(GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
(struct elf_i386_link_hash_entry): Add tlsdesc_got field.
(struct elf_i386_obj_tdata): Add local_tlsdesc_gotent field.
(elf_i386_local_tlsdesc_gotent): New macro.
(struct elf_i386_link_hash_table): Add sgotplt_jump_table_size.
(elf_i386_compute_jump_table_size): New macro.
(link_hash_newfunc): Initialize tlsdesc_got.
(elf_i386_link_hash_table_create): Set sgotplt_jump_table_size.
(elf_i386_tls_transition): Handle R_386_TLS_GOTDESC and
R_386_TLS_DESC_CALL.
(elf_i386_check_relocs): Likewise. Allocate space for
local_tlsdesc_gotent.
(elf_i386_gc_sweep_hook): Handle R_386_TLS_GOTDESC and
R_386_TLS_DESC_CALL.
(allocate_dynrelocs): Count function PLT relocations. Reserve
space for TLS descriptors and relocations.
(elf_i386_size_dynamic_sections): Reserve space for TLS
descriptors and relocations. Set up sgotplt_jump_table_size.
Don't zero reloc_count in srelplt.
(elf_i386_always_size_sections): New. Set up _TLS_MODULE_BASE_.
(elf_i386_relocate_section): Handle R_386_TLS_GOTDESC and
R_386_TLS_DESC_CALL.
(elf_i386_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
(elf_backend_always_size_sections): Define.
* elf64-x86-64.c (x86_64_elf_howto): Add R_X86_64_GOTPC32_TLSDESC,
R_X86_64_TLSDESC, R_X86_64_TLSDESC_CALL.
(R_X86_64_standard): Adjust.
(x86_64_reloc_map): Map new relocs.
(elf64_x86_64_rtype_to_howto): New, split out of...
(elf64_x86_64_info_to_howto): ... this function, and...
(elf64_x86_64_reloc_type_lookup): ... use it to map elf_reloc_val.
(GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P): New macros.
(GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): New macros.
(struct elf64_x86_64_link_hash_entry): Add tlsdesc_got field.
(struct elf64_x86_64_obj_tdata): Add local_tlsdesc_gotent field.
(elf64_x86_64_local_tlsdesc_gotent): New macro.
(struct elf64_x86_64_link_hash_table): Add tlsdesc_plt,
tlsdesc_got and sgotplt_jump_table_size fields.
(elf64_x86_64_compute_jump_table_size): New macro.
(link_hash_newfunc): Initialize tlsdesc_got.
(elf64_x86_64_link_hash_table_create): Initialize new fields.
(elf64_x86_64_tls_transition): Handle R_X86_64_GOTPC32_TLSDESC and
R_X86_64_TLSDESC_CALL.
(elf64_x86_64_check_relocs): Likewise. Allocate space for
local_tlsdesc_gotent.
(elf64_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPC32_TLSDESC and
R_X86_64_TLSDESC_CALL.
(allocate_dynrelocs): Count function PLT relocations. Reserve
space for TLS descriptors and relocations.
(elf64_x86_64_size_dynamic_sections): Reserve space for TLS
descriptors and relocations. Set up sgotplt_jump_table_size,
tlsdesc_plt and tlsdesc_got. Make room for them. Don't zero
reloc_count in srelplt. Add dynamic entries for DT_TLSDESC_PLT
and DT_TLSDESC_GOT.
(elf64_x86_64_always_size_sections): New. Set up
_TLS_MODULE_BASE_.
(elf64_x86_64_relocate_section): Handle R_386_TLS_GOTDESC and
R_386_TLS_DESC_CALL.
(elf64_x86_64_finish_dynamic_symbol): Use GOT_TLS_GD_ANY_P.
(elf64_x86_64_finish_dynamic_sections): Set DT_TLSDESC_PLT and
DT_TLSDESC_GOT. Set up TLS descriptor lazy resolver PLT entry.
(elf_backend_always_size_sections): Define.
binutils/ChangeLog:
Introduce TLS descriptors for i386 and x86_64.
* readelf.c (get_dynamic_type): Handle DT_TLSDESC_GOT and
DT_TLSDESC_PLT.
gas/ChangeLog:
Introduce TLS descriptors for i386 and x86_64.
* config/tc-i386.c (tc_i386_fix_adjustable): Handle
BFD_RELOC_386_TLS_GOTDESC, BFD_RELOC_386_TLS_DESC_CALL,
BFD_RELOC_X86_64_GOTPC32_TLSDESC, BFD_RELOC_X86_64_TLSDESC_CALL.
(optimize_disp): Emit fix up for BFD_RELOC_386_TLS_DESC_CALL and
BFD_RELOC_X86_64_TLSDESC_CALL immediately, and clear the
displacement bits.
(build_modrm_byte): Set up zero modrm for TLS desc calls.
(lex_got): Handle @tlsdesc and @tlscall.
(md_apply_fix, tc_gen_reloc): Handle the new relocations.
ld/testsuite/ChangeLog:
Introduce TLS descriptors for i386 and x86_64.
* ld-i386/i386.exp: Run on x86_64-*-linux* and amd64-*-linux*.
Add new tests.
* ld-i386/pcrel16.d: Add -melf_i386.
* ld-i386/pcrel8.d: Likewise.
* ld-i386/tlsbindesc.dd: New.
* ld-i386/tlsbindesc.rd: New.
* ld-i386/tlsbindesc.s: New.
* ld-i386/tlsbindesc.sd: New.
* ld-i386/tlsbindesc.td: New.
* ld-i386/tlsdesc.dd: New.
* ld-i386/tlsdesc.rd: New.
* ld-i386/tlsdesc.s: New.
* ld-i386/tlsdesc.sd: New.
* ld-i386/tlsdesc.td: New.
* ld-i386/tlsgdesc.dd: New.
* ld-i386/tlsgdesc.rd: New.
* ld-i386/tlsgdesc.s: New.
* ld-x86-64/x86-64.exp: Run new tests.
* ld-x86-64/tlsbindesc.dd: New.
* ld-x86-64/tlsbindesc.rd: New.
* ld-x86-64/tlsbindesc.s: New.
* ld-x86-64/tlsbindesc.sd: New.
* ld-x86-64/tlsbindesc.td: New.
* ld-x86-64/tlsdesc.dd: New.
* ld-x86-64/tlsdesc.pd: New.
* ld-x86-64/tlsdesc.rd: New.
* ld-x86-64/tlsdesc.s: New.
* ld-x86-64/tlsdesc.sd: New.
* ld-x86-64/tlsdesc.td: New.
* ld-x86-64/tlsgdesc.dd: New.
* ld-x86-64/tlsgdesc.rd: New.
* ld-x86-64/tlsgdesc.s: New.
2006-01-19 05:07:51 +08:00
|
|
|
#define DT_TLSDESC_PLT 0x6ffffef6
|
|
|
|
#define DT_TLSDESC_GOT 0x6ffffef7
|
2002-07-10 23:28:34 +08:00
|
|
|
#define DT_GNU_CONFLICT 0x6ffffef8
|
|
|
|
#define DT_GNU_LIBLIST 0x6ffffef9
|
2000-07-20 02:02:31 +08:00
|
|
|
#define DT_CONFIG 0x6ffffefa
|
|
|
|
#define DT_DEPAUDIT 0x6ffffefb
|
|
|
|
#define DT_AUDIT 0x6ffffefc
|
|
|
|
#define DT_PLTPAD 0x6ffffefd
|
|
|
|
#define DT_MOVETAB 0x6ffffefe
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DT_SYMINFO 0x6ffffeff
|
|
|
|
#define DT_ADDRRNGHI 0x6ffffeff
|
|
|
|
|
|
|
|
#define DT_RELACOUNT 0x6ffffff9
|
|
|
|
#define DT_RELCOUNT 0x6ffffffa
|
|
|
|
#define DT_FLAGS_1 0x6ffffffb
|
|
|
|
#define DT_VERDEF 0x6ffffffc
|
|
|
|
#define DT_VERDEFNUM 0x6ffffffd
|
|
|
|
#define DT_VERNEED 0x6ffffffe
|
|
|
|
#define DT_VERNEEDNUM 0x6fffffff
|
|
|
|
|
|
|
|
/* This tag is a GNU extension to the Solaris version scheme. */
|
|
|
|
#define DT_VERSYM 0x6ffffff0
|
|
|
|
|
|
|
|
#define DT_LOPROC 0x70000000
|
|
|
|
#define DT_HIPROC 0x7fffffff
|
|
|
|
|
|
|
|
/* These section tags are used on Solaris. We support them
|
|
|
|
everywhere, and hope they do not conflict. */
|
|
|
|
|
|
|
|
#define DT_AUXILIARY 0x7ffffffd
|
|
|
|
#define DT_USED 0x7ffffffe
|
|
|
|
#define DT_FILTER 0x7fffffff
|
|
|
|
|
2000-07-20 02:02:31 +08:00
|
|
|
|
|
|
|
/* Values used in DT_FEATURE .dynamic entry. */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DTF_1_PARINIT 0x00000001
|
2000-07-20 02:22:41 +08:00
|
|
|
/* From
|
2000-07-20 02:02:31 +08:00
|
|
|
|
|
|
|
http://docs.sun.com:80/ab2/coll.45.13/LLM/@Ab2PageView/21165?Ab2Lang=C&Ab2Enc=iso-8859-1
|
|
|
|
|
2000-07-20 02:22:41 +08:00
|
|
|
DTF_1_CONFEXP is the same as DTF_1_PARINIT. It is a typo. The value
|
2000-11-23 07:19:15 +08:00
|
|
|
defined here is the same as the one in <sys/link.h> on Solaris 8. */
|
2000-07-20 02:02:31 +08:00
|
|
|
#define DTF_1_CONFEXP 0x00000002
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
/* Flag values used in the DT_POSFLAG_1 .dynamic entry. */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DF_P1_LAZYLOAD 0x00000001
|
|
|
|
#define DF_P1_GROUPPERM 0x00000002
|
|
|
|
|
2000-07-19 08:33:45 +08:00
|
|
|
/* Flag value in in the DT_FLAGS_1 .dynamic entry. */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define DF_1_NOW 0x00000001
|
|
|
|
#define DF_1_GLOBAL 0x00000002
|
|
|
|
#define DF_1_GROUP 0x00000004
|
|
|
|
#define DF_1_NODELETE 0x00000008
|
|
|
|
#define DF_1_LOADFLTR 0x00000010
|
|
|
|
#define DF_1_INITFIRST 0x00000020
|
|
|
|
#define DF_1_NOOPEN 0x00000040
|
|
|
|
#define DF_1_ORIGIN 0x00000080
|
|
|
|
#define DF_1_DIRECT 0x00000100
|
|
|
|
#define DF_1_TRANS 0x00000200
|
|
|
|
#define DF_1_INTERPOSE 0x00000400
|
2000-07-20 02:43:35 +08:00
|
|
|
#define DF_1_NODEFLIB 0x00000800
|
2000-07-20 02:02:31 +08:00
|
|
|
#define DF_1_NODUMP 0x00001000
|
|
|
|
#define DF_1_CONLFAT 0x00002000
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
/* Flag values for the DT_FLAGS entry. */
|
1999-12-29 02:40:48 +08:00
|
|
|
#define DF_ORIGIN (1 << 0)
|
|
|
|
#define DF_SYMBOLIC (1 << 1)
|
|
|
|
#define DF_TEXTREL (1 << 2)
|
|
|
|
#define DF_BIND_NOW (1 << 3)
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 21:12:53 +08:00
|
|
|
#define DF_STATIC_TLS (1 << 4)
|
1999-12-29 02:40:48 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* These constants are used for the version number of a Elf32_Verdef
|
|
|
|
structure. */
|
|
|
|
|
|
|
|
#define VER_DEF_NONE 0
|
|
|
|
#define VER_DEF_CURRENT 1
|
|
|
|
|
|
|
|
/* These constants appear in the vd_flags field of a Elf32_Verdef
|
2010-03-06 05:04:59 +08:00
|
|
|
structure.
|
|
|
|
|
|
|
|
Cf. the Solaris Linker and Libraries Guide, Ch. 7, Object File Format,
|
|
|
|
Versioning Sections, for a description:
|
|
|
|
|
|
|
|
http://docs.sun.com/app/docs/doc/819-0690/chapter6-93046?l=en&a=view */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define VER_FLG_BASE 0x1
|
|
|
|
#define VER_FLG_WEAK 0x2
|
2010-03-06 05:04:59 +08:00
|
|
|
#define VER_FLG_INFO 0x4
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* These special constants can be found in an Elf32_Versym field. */
|
|
|
|
|
|
|
|
#define VER_NDX_LOCAL 0
|
|
|
|
#define VER_NDX_GLOBAL 1
|
|
|
|
|
|
|
|
/* These constants are used for the version number of a Elf32_Verneed
|
|
|
|
structure. */
|
|
|
|
|
|
|
|
#define VER_NEED_NONE 0
|
|
|
|
#define VER_NEED_CURRENT 1
|
|
|
|
|
|
|
|
/* This flag appears in a Versym structure. It means that the symbol
|
|
|
|
is hidden, and is only visible with an explicit version number.
|
|
|
|
This is a GNU extension. */
|
|
|
|
|
|
|
|
#define VERSYM_HIDDEN 0x8000
|
|
|
|
|
|
|
|
/* This is the mask for the rest of the Versym information. */
|
|
|
|
|
|
|
|
#define VERSYM_VERSION 0x7fff
|
|
|
|
|
|
|
|
/* This is a special token which appears as part of a symbol name. It
|
|
|
|
indictes that the rest of the name is actually the name of a
|
|
|
|
version node, and is not part of the actual name. This is a GNU
|
|
|
|
extension. For example, the symbol name `stat@ver2' is taken to
|
|
|
|
mean the symbol `stat' in version `ver2'. */
|
|
|
|
|
|
|
|
#define ELF_VER_CHR '@'
|
|
|
|
|
|
|
|
/* Possible values for si_boundto. */
|
2000-11-23 07:19:15 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
|
|
|
|
#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
|
|
|
|
#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
|
|
|
|
|
|
|
|
/* Possible bitmasks for si_flags. */
|
2000-11-23 07:19:15 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
|
|
|
|
#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
|
|
|
|
#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
|
2000-11-23 07:19:15 +08:00
|
|
|
#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy loaded */
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Syminfo version values. */
|
2000-11-23 07:19:15 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define SYMINFO_NONE 0
|
|
|
|
#define SYMINFO_CURRENT 1
|
|
|
|
#define SYMINFO_NUM 2
|
|
|
|
|
2003-01-17 09:32:46 +08:00
|
|
|
/* Section Group Flags. */
|
2000-11-23 07:19:15 +08:00
|
|
|
|
|
|
|
#define GRP_COMDAT 0x1 /* A COMDAT group */
|
|
|
|
|
2003-05-21 08:55:15 +08:00
|
|
|
/* Auxv a_type values. */
|
|
|
|
|
|
|
|
#define AT_NULL 0 /* End of vector */
|
|
|
|
#define AT_IGNORE 1 /* Entry should be ignored */
|
|
|
|
#define AT_EXECFD 2 /* File descriptor of program */
|
|
|
|
#define AT_PHDR 3 /* Program headers for program */
|
|
|
|
#define AT_PHENT 4 /* Size of program header entry */
|
|
|
|
#define AT_PHNUM 5 /* Number of program headers */
|
|
|
|
#define AT_PAGESZ 6 /* System page size */
|
|
|
|
#define AT_BASE 7 /* Base address of interpreter */
|
|
|
|
#define AT_FLAGS 8 /* Flags */
|
|
|
|
#define AT_ENTRY 9 /* Entry point of program */
|
|
|
|
#define AT_NOTELF 10 /* Program is not ELF */
|
|
|
|
#define AT_UID 11 /* Real uid */
|
|
|
|
#define AT_EUID 12 /* Effective uid */
|
|
|
|
#define AT_GID 13 /* Real gid */
|
|
|
|
#define AT_EGID 14 /* Effective gid */
|
|
|
|
#define AT_CLKTCK 17 /* Frequency of times() */
|
|
|
|
#define AT_PLATFORM 15 /* String identifying platform. */
|
|
|
|
#define AT_HWCAP 16 /* Machine dependent hints about
|
|
|
|
processor capabilities. */
|
|
|
|
#define AT_FPUCW 18 /* Used FPU control word. */
|
|
|
|
#define AT_DCACHEBSIZE 19 /* Data cache block size. */
|
|
|
|
#define AT_ICACHEBSIZE 20 /* Instruction cache block size. */
|
|
|
|
#define AT_UCACHEBSIZE 21 /* Unified cache block size. */
|
|
|
|
#define AT_IGNOREPPC 22 /* Entry should be ignored */
|
2004-01-29 10:41:18 +08:00
|
|
|
#define AT_SECURE 23 /* Boolean, was exec setuid-like? */
|
2008-11-13 23:07:54 +08:00
|
|
|
#define AT_BASE_PLATFORM 24 /* String identifying real platform,
|
|
|
|
may differ from AT_PLATFORM. */
|
2009-03-16 17:45:33 +08:00
|
|
|
#define AT_RANDOM 25 /* Address of 16 random bytes. */
|
2008-11-13 23:07:54 +08:00
|
|
|
#define AT_EXECFN 31 /* Filename of executable. */
|
2003-05-21 08:55:15 +08:00
|
|
|
/* Pointer to the global system page used for system calls and other
|
|
|
|
nice things. */
|
|
|
|
#define AT_SYSINFO 32
|
2004-01-21 Roland McGrath <roland@redhat.com>
* common.h (AT_SUN_UID, AT_SUN_RUID, AT_SUN_GID): New macros.
(AT_SUN_RGID, AT_SUN_LDELF, AT_SUN_LDSHDR, AT_SUN_LDNAME,
AT_SUN_LPAGESZ, AT_SUN_PLATFORM, AT_SUN_HWCAP, AT_SUN_IFLUSH,
AT_SUN_CPU, AT_SUN_EMUL_ENTRY, AT_SUN_EMUL_EXECFD,
AT_SUN_EXECNAME) AT_SUN_MMU, AT_SUN_LDDATA): Likewise.
2004-01-29 08:37:41 +08:00
|
|
|
#define AT_SYSINFO_EHDR 33 /* Pointer to ELF header of system-supplied DSO. */
|
|
|
|
|
|
|
|
#define AT_SUN_UID 2000 /* Effective user ID. */
|
|
|
|
#define AT_SUN_RUID 2001 /* Real user ID. */
|
|
|
|
#define AT_SUN_GID 2002 /* Effective group ID. */
|
|
|
|
#define AT_SUN_RGID 2003 /* Real group ID. */
|
|
|
|
#define AT_SUN_LDELF 2004 /* Dynamic linker's ELF header. */
|
|
|
|
#define AT_SUN_LDSHDR 2005 /* Dynamic linker's section headers. */
|
|
|
|
#define AT_SUN_LDNAME 2006 /* String giving name of dynamic linker. */
|
|
|
|
#define AT_SUN_LPAGESZ 2007 /* Large pagesize. */
|
|
|
|
#define AT_SUN_PLATFORM 2008 /* Platform name string. */
|
|
|
|
#define AT_SUN_HWCAP 2009 /* Machine dependent hints about
|
|
|
|
processor capabilities. */
|
|
|
|
#define AT_SUN_IFLUSH 2010 /* Should flush icache? */
|
|
|
|
#define AT_SUN_CPU 2011 /* CPU name string. */
|
|
|
|
#define AT_SUN_EMUL_ENTRY 2012 /* COFF entry point address. */
|
|
|
|
#define AT_SUN_EMUL_EXECFD 2013 /* COFF executable file descriptor. */
|
|
|
|
#define AT_SUN_EXECNAME 2014 /* Canonicalized file name given to execve. */
|
|
|
|
#define AT_SUN_MMU 2015 /* String for name of MMU module. */
|
|
|
|
#define AT_SUN_LDDATA 2016 /* Dynamic linker's data segment address. */
|
2008-01-17 06:01:42 +08:00
|
|
|
#define AT_SUN_AUXFLAGS 2017 /* AF_SUN_ flags passed from the kernel. */
|
2004-01-21 Roland McGrath <roland@redhat.com>
* common.h (AT_SUN_UID, AT_SUN_RUID, AT_SUN_GID): New macros.
(AT_SUN_RGID, AT_SUN_LDELF, AT_SUN_LDSHDR, AT_SUN_LDNAME,
AT_SUN_LPAGESZ, AT_SUN_PLATFORM, AT_SUN_HWCAP, AT_SUN_IFLUSH,
AT_SUN_CPU, AT_SUN_EMUL_ENTRY, AT_SUN_EMUL_EXECFD,
AT_SUN_EXECNAME) AT_SUN_MMU, AT_SUN_LDDATA): Likewise.
2004-01-29 08:37:41 +08:00
|
|
|
|
2003-05-21 08:55:15 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif /* _ELF_COMMON_H */
|