summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-19 17:55:09 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-19 17:55:09 +0000
commit3019d4d5ab7e3e99dcbc39463f6887c0d5ea1bba (patch)
tree818eeab6636fa670d410783a642d3da24b289337 /misc
parentfba48036d54d157add306013d8aac832e6cc52ad (diff)
downloadnuttx-3019d4d5ab7e3e99dcbc39463f6887c0d5ea1bba.tar.gz
nuttx-3019d4d5ab7e3e99dcbc39463f6887c0d5ea1bba.tar.bz2
nuttx-3019d4d5ab7e3e99dcbc39463f6887c0d5ea1bba.zip
thunks should not use GOT address
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1910 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc')
-rw-r--r--misc/buildroot/toolchain/nxflat/arm/arch.h388
-rw-r--r--misc/buildroot/toolchain/nxflat/arm/dyncall_skeleton.def40
-rw-r--r--misc/buildroot/toolchain/nxflat/ldnxflat.c320
-rw-r--r--misc/buildroot/toolchain/nxflat/reloc-macros.h189
-rw-r--r--misc/buildroot/toolchain/nxflat/thumb2/arch.h386
-rw-r--r--misc/buildroot/toolchain/nxflat/thumb2/dyncall_skeleton.def40
6 files changed, 793 insertions, 570 deletions
diff --git a/misc/buildroot/toolchain/nxflat/arm/arch.h b/misc/buildroot/toolchain/nxflat/arm/arch.h
index 61ace0dd4..83f25655a 100644
--- a/misc/buildroot/toolchain/nxflat/arm/arch.h
+++ b/misc/buildroot/toolchain/nxflat/arm/arch.h
@@ -1,157 +1,303 @@
/***********************************************************************
* xflat/tools/arm/arch.h
- * ARM ELF support for BFD.
+ * ARM thumb2 ELF support for BFD.
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
- * Derived from XFLAT:
+ * Simply lifted with minimal change from the BFD, binutils 2.19.1:
*
- * Copyright (c) 2006, Cadenux, LLC. All rights reserved.
- * Copyright (c) 2006, Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
- *
- * Which simply lifted it from the BFD:
+ * Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ * Free Software Foundation, Inc.
*
- * Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
* This file is part of BFD, the Binary File Descriptor library.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*
***********************************************************************/
-#ifndef _ELF_ARM_H
-#define _ELF_ARM_H
+#ifndef _TOOLCHAIN_NXFLAT_ARM_ARCH_H
+#define _TOOLCHAIN_NXFLAT_ARM_ARCH_H
#include "reloc-macros.h"
+/* Inform ldnxflat that this is 32-bit ARM code */
+
+#define NXFLAT_ARM 1
+#undef NXFLAT_THUMB2
+
/* Processor specific flags for the ELF header e_flags field. */
-#define EF_ARM_RELEXEC 0x01
-#define EF_ARM_HASENTRY 0x02
-#define EF_INTERWORK 0x04
-#define EF_APCS_26 0x08
-#define EF_APCS_FLOAT 0x10
-#define EF_PIC 0x20
-#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
-#define EF_NEW_ABI 0x80
-#define EF_OLD_ABI 0x100
-#define EF_SOFT_FLOAT 0x200
-#define EF_VFP_FLOAT 0x400
+#define EF_ARM_RELEXEC 0x01
+#define EF_ARM_HASENTRY 0x02
+#define EF_ARM_INTERWORK 0x04
+#define EF_ARM_APCS_26 0x08
+#define EF_ARM_APCS_FLOAT 0x10
+#define EF_ARM_PIC 0x20
+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use. */
+#define EF_ARM_NEW_ABI 0x80
+#define EF_ARM_OLD_ABI 0x100
+#define EF_ARM_SOFT_FLOAT 0x200
+#define EF_ARM_VFP_FLOAT 0x400
+#define EF_ARM_MAVERICK_FLOAT 0x800
+
+/* Frame unwind information */
+#define PT_ARM_EXIDX (PT_LOPROC + 1)
/* Other constants defined in the ARM ELF spec. version B-01. */
-#define EF_SYMSARESORTED 0x04 /* NB conflicts with EF_INTERWORK */
-#define EF_DYNSYMSUSESEGIDX 0x08 /* NB conflicts with EF_APCS26 */
-#define EF_MAPSYMSFIRST 0x10 /* NB conflicts with EF_APCS_FLOAT */
-#define EF_EABIMASK 0xFF000000
+#define EF_ARM_SYMSARESORTED 0x04 /* NB conflicts with EF_INTERWORK */
+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 /* NB conflicts with EF_APCS26 */
+#define EF_ARM_MAPSYMSFIRST 0x10 /* NB conflicts with EF_APCS_FLOAT */
+#define EF_ARM_EABIMASK 0xFF000000
-#define EF_EABI_VERSION(flags) ((flags) & EF_EABIMASK)
-#define EF_EABI_UNKNOWN 0x00000000
-#define EF_EABI_VER1 0x01000000
-#define EF_EABI_VER2 0x02000000
+/* Constants defined in AAELF. */
+#define EF_ARM_BE8 0x00800000
+#define EF_ARM_LE8 0x00400000
+
+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN 0x00000000
+#define EF_ARM_EABI_VER1 0x01000000
+#define EF_ARM_EABI_VER2 0x02000000
+#define EF_ARM_EABI_VER3 0x03000000
+#define EF_ARM_EABI_VER4 0x04000000
+#define EF_ARM_EABI_VER5 0x05000000
/* Local aliases for some flags to match names used by COFF port. */
-#define F_INTERWORK EF_INTERWORK
-#define F_APCS26 EF_APCS_26
-#define F_APCS_FLOAT EF_APCS_FLOAT
-#define F_PIC EF_PIC
-#define F_SOFT_FLOAT EF_SOFT_FLOAT
-#define F_VFP_FLOAT EF_VFP_FLOAT
+#define F_INTERWORK EF_ARM_INTERWORK
+#define F_APCS26 EF_ARM_APCS_26
+#define F_APCS_FLOAT EF_ARM_APCS_FLOAT
+#define F_PIC EF_ARM_PIC
+#define F_SOFT_FLOAT EF_ARM_SOFT_FLOAT
+#define F_VFP_FLOAT EF_ARM_VFP_FLOAT
+
+/* Additional symbol types for Thumb. */
+#define STT_ARM_TFUNC 13 /* A Thumb function. */
+#define STT_ARM_16BIT 15 /* A Thumb label. */
-/* Additional symbol types for Thumb */
-#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
-#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
+/* Additional section types. */
+#define SHT_ARM_EXIDX 0x70000001 /* Section holds ARM unwind info. */
+#define SHT_ARM_PREEMPTMAP 0x70000002 /* Section pre-emption details. */
+#define SHT_ARM_ATTRIBUTES 0x70000003 /* Section holds attributes. */
-/* ARM-specific values for sh_flags */
-#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */
-#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */
+/* ARM-specific values for sh_flags. */
+#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */
+#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */
/* ARM-specific program header flags. */
-#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */
-#define PF_ARM_PI 0x20000000 /* Segment is position-independent. */
-#define PF_ARM_ABS 0x40000000 /* Segment must be loaded at its base address. */
+#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */
+#define PF_ARM_PI 0x20000000 /* Segment is position-independent. */
+#define PF_ARM_ABS 0x40000000 /* Segment must be loaded at its base address. */
+
+/* Values for the Tag_CPU_arch EABI attribute. */
+#define TAG_CPU_ARCH_PRE_V4 0
+#define TAG_CPU_ARCH_V4 1
+#define TAG_CPU_ARCH_V4T 2
+#define TAG_CPU_ARCH_V5T 3
+#define TAG_CPU_ARCH_V5TE 4
+#define TAG_CPU_ARCH_V5TEJ 5
+#define TAG_CPU_ARCH_V6 6
+#define TAG_CPU_ARCH_V6KZ 7
+#define TAG_CPU_ARCH_V6T2 8
+#define TAG_CPU_ARCH_V6K 9
+#define TAG_CPU_ARCH_V7 10
/* Relocation types. */
START_RELOC_NUMBERS (elf_arm_reloc_type)
- RELOC_NUMBER (R_ARM_NONE, 0)
- RELOC_NUMBER (R_ARM_PC24, 1)
- RELOC_NUMBER (R_ARM_ABS32, 2)
- RELOC_NUMBER (R_ARM_REL32, 3)
-#ifdef OLD_ARM_ABI
- RELOC_NUMBER (R_ARM_ABS8, 4)
- RELOC_NUMBER (R_ARM_ABS16, 5)
- RELOC_NUMBER (R_ARM_ABS12, 6)
- RELOC_NUMBER (R_ARM_THM_ABS5, 7)
- RELOC_NUMBER (R_ARM_THM_PC22, 8)
- RELOC_NUMBER (R_ARM_SBREL32, 9)
- RELOC_NUMBER (R_ARM_AMP_VCALL9, 10)
- RELOC_NUMBER (R_ARM_THM_PC11, 11) /* Cygnus extension to abi: Thumb unconditional branch. */
- RELOC_NUMBER (R_ARM_THM_PC9, 12) /* Cygnus extension to abi: Thumb conditional branch. */
- RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 13)
- RELOC_NUMBER (R_ARM_GNU_VTENTRY, 14)
-#else /* not OLD_ARM_ABI */
- RELOC_NUMBER (R_ARM_PC13, 4)
- RELOC_NUMBER (R_ARM_ABS16, 5)
- RELOC_NUMBER (R_ARM_ABS12, 6)
- RELOC_NUMBER (R_ARM_THM_ABS5, 7)
- RELOC_NUMBER (R_ARM_ABS8, 8)
- RELOC_NUMBER (R_ARM_SBREL32, 9)
- RELOC_NUMBER (R_ARM_THM_PC22, 10)
- RELOC_NUMBER (R_ARM_THM_PC8, 11)
- RELOC_NUMBER (R_ARM_AMP_VCALL9, 12)
- RELOC_NUMBER (R_ARM_SWI24, 13)
- RELOC_NUMBER (R_ARM_THM_SWI8, 14)
- RELOC_NUMBER (R_ARM_XPC25, 15)
- RELOC_NUMBER (R_ARM_THM_XPC22, 16)
-#endif /* not OLD_ARM_ABI */
- RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime. */
- RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry. */
- RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry. */
- RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base. */
- RELOC_NUMBER (R_ARM_GOTOFF, 24) /* 32 bit offset to GOT. */
- RELOC_NUMBER (R_ARM_GOTPC, 25) /* 32 bit PC relative offset to GOT. */
- RELOC_NUMBER (R_ARM_GOT32, 26) /* 32 bit GOT entry. */
- RELOC_NUMBER (R_ARM_PLT32, 27) /* 32 bit PLT address. */
-#ifdef OLD_ARM_ABI
- FAKE_RELOC (FIRST_INVALID_RELOC, 28)
- FAKE_RELOC (LAST_INVALID_RELOC, 249)
-#else /* not OLD_ARM_ABI */
- FAKE_RELOC (FIRST_INVALID_RELOC1, 28)
- FAKE_RELOC (LAST_INVALID_RELOC1, 31)
- RELOC_NUMBER (R_ARM_ALU_PCREL7_0, 32)
- RELOC_NUMBER (R_ARM_ALU_PCREL15_8, 33)
- RELOC_NUMBER (R_ARM_ALU_PCREL23_15, 34)
- RELOC_NUMBER (R_ARM_LDR_SBREL11_0, 35)
- RELOC_NUMBER (R_ARM_ALU_SBREL19_12, 36)
- RELOC_NUMBER (R_ARM_ALU_SBREL27_20, 37)
- FAKE_RELOC (FIRST_INVALID_RELOC2, 38)
- FAKE_RELOC (LAST_INVALID_RELOC2, 99)
- RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100)
- RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101)
- RELOC_NUMBER (R_ARM_THM_PC11, 102) /* Cygnus extension to abi: Thumb unconditional branch. */
- RELOC_NUMBER (R_ARM_THM_PC9, 103) /* Cygnus extension to abi: Thumb conditional branch. */
- FAKE_RELOC (FIRST_INVALID_RELOC3, 104)
- FAKE_RELOC (LAST_INVALID_RELOC3, 248)
- RELOC_NUMBER (R_ARM_RXPC25, 249)
-#endif /* not OLD_ARM_ABI */
- RELOC_NUMBER (R_ARM_RSBREL32, 250)
- RELOC_NUMBER (R_ARM_THM_RPC22, 251)
- RELOC_NUMBER (R_ARM_RREL32, 252)
- RELOC_NUMBER (R_ARM_RABS32, 253)
- RELOC_NUMBER (R_ARM_RPC24, 254)
- RELOC_NUMBER (R_ARM_RBASE, 255)
-END_RELOC_NUMBERS
-
-#endif /* _ELF_ARM_H */
+/* AAELF official names and numbers. */
+ RELOC_NUMBER (R_ARM_NONE, 0)
+ RELOC_NUMBER (R_ARM_PC24, 1) /* deprecated */
+ RELOC_NUMBER (R_ARM_ABS32, 2)
+ RELOC_NUMBER (R_ARM_REL32, 3)
+ RELOC_NUMBER (R_ARM_LDR_PC_G0, 4)
+ RELOC_NUMBER (R_ARM_ABS16, 5)
+ RELOC_NUMBER (R_ARM_ABS12, 6)
+ RELOC_NUMBER (R_ARM_THM_ABS5, 7)
+ RELOC_NUMBER (R_ARM_ABS8, 8)
+ RELOC_NUMBER (R_ARM_SBREL32, 9)
+ RELOC_NUMBER (R_ARM_THM_CALL, 10)
+ RELOC_NUMBER (R_ARM_THM_PC8, 11)
+ RELOC_NUMBER (R_ARM_BREL_ADJ, 12)
+ RELOC_NUMBER (R_ARM_SWI24, 13) /* obsolete */
+ RELOC_NUMBER (R_ARM_THM_SWI8, 14) /* obsolete */
+ RELOC_NUMBER (R_ARM_XPC25, 15) /* obsolete */
+ RELOC_NUMBER (R_ARM_THM_XPC22, 16) /* obsolete */
+ RELOC_NUMBER (R_ARM_TLS_DTPMOD32, 17)
+ RELOC_NUMBER (R_ARM_TLS_DTPOFF32, 18)
+ RELOC_NUMBER (R_ARM_TLS_TPOFF32, 19)
+ RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime. */
+ RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry. */
+ RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry. */
+ RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base. */
+ RELOC_NUMBER (R_ARM_GOTOFF32, 24) /* 32 bit offset to GOT. */
+ RELOC_NUMBER (R_ARM_BASE_PREL, 25) /* 32 bit PC relative offset to GOT. */
+ RELOC_NUMBER (R_ARM_GOT_BREL, 26) /* 32 bit GOT entry. */
+ RELOC_NUMBER (R_ARM_PLT32, 27) /* deprecated - 32 bit PLT address. */
+ RELOC_NUMBER (R_ARM_CALL, 28)
+ RELOC_NUMBER (R_ARM_JUMP24, 29)
+ RELOC_NUMBER (R_ARM_THM_JUMP24, 30)
+ RELOC_NUMBER (R_ARM_BASE_ABS, 31)
+ RELOC_NUMBER (R_ARM_ALU_PCREL7_0, 32) /* obsolete */
+ RELOC_NUMBER (R_ARM_ALU_PCREL15_8, 33) /* obsolete */
+ RELOC_NUMBER (R_ARM_ALU_PCREL23_15, 34) /* obsolete */
+ RELOC_NUMBER (R_ARM_LDR_SBREL_11_0, 35) /* deprecated, should have _NC suffix */
+ RELOC_NUMBER (R_ARM_ALU_SBREL_19_12, 36) /* deprecated, should have _NC suffix */
+ RELOC_NUMBER (R_ARM_ALU_SBREL_27_20, 37) /* deprecated, should have _CK suffix */
+ RELOC_NUMBER (R_ARM_TARGET1, 38)
+ RELOC_NUMBER (R_ARM_SBREL31, 39) /* deprecated */
+ RELOC_NUMBER (R_ARM_V4BX, 40)
+ RELOC_NUMBER (R_ARM_TARGET2, 41)
+ RELOC_NUMBER (R_ARM_PREL31, 42)
+ RELOC_NUMBER (R_ARM_MOVW_ABS_NC, 43)
+ RELOC_NUMBER (R_ARM_MOVT_ABS, 44)
+ RELOC_NUMBER (R_ARM_MOVW_PREL_NC, 45)
+ RELOC_NUMBER (R_ARM_MOVT_PREL, 46)
+ RELOC_NUMBER (R_ARM_THM_MOVW_ABS_NC, 47)
+ RELOC_NUMBER (R_ARM_THM_MOVT_ABS, 48)
+ RELOC_NUMBER (R_ARM_THM_MOVW_PREL_NC, 49)
+ RELOC_NUMBER (R_ARM_THM_MOVT_PREL, 50)
+ RELOC_NUMBER (R_ARM_THM_JUMP19, 51)
+ RELOC_NUMBER (R_ARM_THM_JUMP6, 52)
+ RELOC_NUMBER (R_ARM_THM_ALU_PREL_11_0, 53)
+ RELOC_NUMBER (R_ARM_THM_PC12, 54)
+ RELOC_NUMBER (R_ARM_ABS32_NOI, 55)
+ RELOC_NUMBER (R_ARM_REL32_NOI, 56)
+ RELOC_NUMBER (R_ARM_ALU_PC_G0_NC, 57)
+ RELOC_NUMBER (R_ARM_ALU_PC_G0, 58)
+ RELOC_NUMBER (R_ARM_ALU_PC_G1_NC, 59)
+ RELOC_NUMBER (R_ARM_ALU_PC_G1, 60)
+ RELOC_NUMBER (R_ARM_ALU_PC_G2, 61)
+ RELOC_NUMBER (R_ARM_LDR_PC_G1, 62)
+ RELOC_NUMBER (R_ARM_LDR_PC_G2, 63)
+ RELOC_NUMBER (R_ARM_LDRS_PC_G0, 64)
+ RELOC_NUMBER (R_ARM_LDRS_PC_G1, 65)
+ RELOC_NUMBER (R_ARM_LDRS_PC_G2, 66)
+ RELOC_NUMBER (R_ARM_LDC_PC_G0, 67)
+ RELOC_NUMBER (R_ARM_LDC_PC_G1, 68)
+ RELOC_NUMBER (R_ARM_LDC_PC_G2, 69)
+ RELOC_NUMBER (R_ARM_ALU_SB_G0_NC, 70)
+ RELOC_NUMBER (R_ARM_ALU_SB_G0, 71)
+ RELOC_NUMBER (R_ARM_ALU_SB_G1_NC, 72)
+ RELOC_NUMBER (R_ARM_ALU_SB_G1, 73)
+ RELOC_NUMBER (R_ARM_ALU_SB_G2, 74)
+ RELOC_NUMBER (R_ARM_LDR_SB_G0, 75)
+ RELOC_NUMBER (R_ARM_LDR_SB_G1, 76)
+ RELOC_NUMBER (R_ARM_LDR_SB_G2, 77)
+ RELOC_NUMBER (R_ARM_LDRS_SB_G0, 78)
+ RELOC_NUMBER (R_ARM_LDRS_SB_G1, 79)
+ RELOC_NUMBER (R_ARM_LDRS_SB_G2, 80)
+ RELOC_NUMBER (R_ARM_LDC_SB_G0, 81)
+ RELOC_NUMBER (R_ARM_LDC_SB_G1, 82)
+ RELOC_NUMBER (R_ARM_LDC_SB_G2, 83)
+ RELOC_NUMBER (R_ARM_MOVW_BREL_NC, 84)
+ RELOC_NUMBER (R_ARM_MOVT_BREL, 85)
+ RELOC_NUMBER (R_ARM_MOVW_BREL, 86)
+ RELOC_NUMBER (R_ARM_THM_MOVW_BREL_NC, 87)
+ RELOC_NUMBER (R_ARM_THM_MOVT_BREL, 88)
+ RELOC_NUMBER (R_ARM_THM_MOVW_BREL, 89)
+ /* 90-93 unallocated */
+ RELOC_NUMBER (R_ARM_PLT32_ABS, 94)
+ RELOC_NUMBER (R_ARM_GOT_ABS, 95)
+ RELOC_NUMBER (R_ARM_GOT_PREL, 96)
+ RELOC_NUMBER (R_ARM_GOT_BREL12, 97)
+ RELOC_NUMBER (R_ARM_GOTOFF12, 98)
+ RELOC_NUMBER (R_ARM_GOTRELAX, 99)
+ RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100) /* deprecated - old C++ abi */
+ RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101) /* deprecated - old C++ abi */
+ RELOC_NUMBER (R_ARM_THM_JUMP11, 102)
+ RELOC_NUMBER (R_ARM_THM_JUMP8, 103)
+ RELOC_NUMBER (R_ARM_TLS_GD32, 104)
+ RELOC_NUMBER (R_ARM_TLS_LDM32, 105)
+ RELOC_NUMBER (R_ARM_TLS_LDO32, 106)
+ RELOC_NUMBER (R_ARM_TLS_IE32, 107)
+ RELOC_NUMBER (R_ARM_TLS_LE32, 108)
+ RELOC_NUMBER (R_ARM_TLS_LDO12, 109)
+ RELOC_NUMBER (R_ARM_TLS_LE12, 110)
+ RELOC_NUMBER (R_ARM_TLS_IE12GP, 111)
+ /* 112 - 127 private range */
+ RELOC_NUMBER (R_ARM_ME_TOO, 128) /* obsolete */
+
+ /* Extensions? R=read-only? */
+ RELOC_NUMBER (R_ARM_RXPC25, 249)
+ RELOC_NUMBER (R_ARM_RSBREL32, 250)
+ RELOC_NUMBER (R_ARM_THM_RPC22, 251)
+ RELOC_NUMBER (R_ARM_RREL32, 252)
+ RELOC_NUMBER (R_ARM_RABS32, 253)
+ RELOC_NUMBER (R_ARM_RPC24, 254)
+ RELOC_NUMBER (R_ARM_RBASE, 255)
+
+ /* Unofficial names for some of the relocs. */
+ FAKE_RELOC (R_ARM_GOTOFF, R_ARM_GOTOFF32) /* 32 bit offset to GOT. */
+ FAKE_RELOC (R_ARM_THM_PC22, R_ARM_THM_CALL)
+ FAKE_RELOC (R_ARM_THM_PC11, R_ARM_THM_JUMP11)
+ FAKE_RELOC (R_ARM_THM_PC9, R_ARM_THM_JUMP8)
+
+ /* Relocs with both a different name, and (apparently) different meaning in
+ GNU usage. */
+ FAKE_RELOC (R_ARM_GOTPC, R_ARM_BASE_PREL) /* 32 bit PC relative offset to GOT. */
+ FAKE_RELOC (R_ARM_GOT32, R_ARM_GOT_BREL) /* 32 bit GOT entry. */
+ FAKE_RELOC (R_ARM_ROSEGREL32, R_ARM_SBREL31) /* ??? */
+ FAKE_RELOC (R_ARM_AMP_VCALL9, R_ARM_BREL_ADJ) /* Thumb-something. Not used. */
+
+END_RELOC_NUMBERS (R_ARM_max = 256)
+
+#ifdef BFD_ARCH_SIZE
+/* EABI object attributes. */
+
+enum
+{
+ /* 0-3 are generic. */
+ Tag_CPU_raw_name = 4,
+ Tag_CPU_name,
+ Tag_CPU_arch,
+ Tag_CPU_arch_profile,
+ Tag_ARM_ISA_use,
+ Tag_THUMB_ISA_use,
+ Tag_VFP_arch,
+ Tag_WMMX_arch,
+ Tag_NEON_arch,
+ Tag_PCS_config,
+ Tag_ABI_PCS_R9_use,
+ Tag_ABI_PCS_RW_data,
+ Tag_ABI_PCS_RO_data,
+ Tag_ABI_PCS_GOT_use,
+ Tag_ABI_PCS_wchar_t,
+ Tag_ABI_FP_rounding,
+ Tag_ABI_FP_denormal,
+ Tag_ABI_FP_exceptions,
+ Tag_ABI_FP_user_exceptions,
+ Tag_ABI_FP_number_model,
+ Tag_ABI_align8_needed,
+ Tag_ABI_align8_preserved,
+ Tag_ABI_enum_size,
+ Tag_ABI_HardFP_use,
+ Tag_ABI_VFP_args,
+ Tag_ABI_WMMX_args,
+ Tag_ABI_optimization_goals,
+ Tag_ABI_FP_optimization_goals,
+ /* 32 is generic. */
+};
+
+#endif
+
+/* The name of the note section used to identify arm variants. */
+#define ARM_NOTE_SECTION ".note.gnu.arm.ident"
+
+/* Special section names. */
+#define ELF_STRING_ARM_unwind ".ARM.exidx"
+#define ELF_STRING_ARM_unwind_info ".ARM.extab"
+#define ELF_STRING_ARM_unwind_once ".gnu.linkonce.armexidx."
+#define ELF_STRING_ARM_unwind_info_once ".gnu.linkonce.armextab."
+
+#endif /* _TOOLCHAIN_NXFLAT_ARM_ARCH_H */
diff --git a/misc/buildroot/toolchain/nxflat/arm/dyncall_skeleton.def b/misc/buildroot/toolchain/nxflat/arm/dyncall_skeleton.def
index ce5ea0ad3..3aaa86d8b 100644
--- a/misc/buildroot/toolchain/nxflat/arm/dyncall_skeleton.def
+++ b/misc/buildroot/toolchain/nxflat/arm/dyncall_skeleton.def
@@ -144,7 +144,9 @@ static const char dyncall_decl_prologue[] =
"\t.text\n"
"\t.align\t2\n";
-#define MKCALLARGS(fn, i) (fn), (fn), (fn), (fn), (i), (fn), (fn), (i), (i)
+#define MKCALLARGS(fn, i) (fn), (fn), (fn), (fn), (i), (i), (i), (fn), (fn)
+
+#ifdef __USE_GOT__
static const char dyncall_format[] =
"\n/* Dynamic call logic for imported symbol %s */\n\n"
@@ -154,7 +156,7 @@ static const char dyncall_format[] =
"\tstmdb\tsp!,{r4, lr}\n"
"\tldr\tr4,.Ldyn%04d\n"
"\tldr\tr4,[sl,r4]\n"
- "\tldr\tr4,[r4,#0]\n"
+ "\tldr\tr4,[r4,#4]\n"
"\tblx\tr4\n"
"\tldmia\tsp!,{r4, pc}\n"
".Ldyn%04d:\n"
@@ -168,12 +170,44 @@ static const char nonreturning_dyncall_format[] =
"%s:\n"
"\tldr\tr4,.Ldyn%04d\n"
"\tldr\tr4,[sl,r4]\n"
- "\tldr\tr4,[r4,#0]\n"
+ "\tldr\tr4,[r4,#4]\n"
"\tbx\tr4\n"
".Ldyn%04d:\n"
"\t.word\t__dyninfo%04d(GOT)\n"
"\t.size\t%s, .-%s\n";
+#else
+
+static const char dyncall_format[] =
+ "\n/* Dynamic call logic for imported symbol %s */\n\n"
+ "\t.global\t%s\n"
+ "\t.type\t%s, function\n\n"
+ "%s:\n"
+ "\tstmdb\tsp!,{r4, lr}\n"
+ "\tldr\tr4,.Ldyn%04d\n"
+ "\tadd\tr4,r4,sl\n"
+ "\tldr\tr4,[r4,#4]\n"
+ "\tblx\tr4\n"
+ "\tldmia\tsp!,{r4, pc}\n"
+ ".Ldyn%04d:\n"
+ "\t.word\t__dyninfo%04d\n"
+ "\t.size\t%s, .-%s\n";
+
+static const char nonreturning_dyncall_format[] =
+ "\n/* Dynamic call logic for imported, non-returning symbol %s */\n\n"
+ "\t.global\t%s\n"
+ "\t.type\t%s, function\n\n"
+ "%s:\n"
+ "\tldr\tr4,.Ldyn%04d\n"
+ "\tadd\tr4,r4,sl\n"
+ "\tldr\tr4,[r4,#4]\n"
+ "\tbx\tr4\n"
+ ".Ldyn%04d:\n"
+ "\t.word\t__dyninfo%04d\n"
+ "\t.size\t%s, .-%s\n";
+
+#endif
+
/*******************************************************************
* File Epilogue
*******************************************************************/
diff --git a/misc/buildroot/toolchain/nxflat/ldnxflat.c b/misc/buildroot/toolchain/nxflat/ldnxflat.c
index 65c8133ce..0949d8492 100644
--- a/misc/buildroot/toolchain/nxflat/ldnxflat.c
+++ b/misc/buildroot/toolchain/nxflat/ldnxflat.c
@@ -127,14 +127,16 @@
* Private Types
***********************************************************************/
+/* Needs to match definition in include/elf/internal.h. This is from binutils-2.19.1 */
+
struct elf_internal_sym
{
- bfd_vma st_value; /* Value of the symbol */
- bfd_vma st_size; /* Associated symbol size */
- u_int32_t st_name; /* Symbol name, index in string tbl */
- u_int8_t st_info; /* Type and binding attributes */
- u_int8_t st_other; /* No defined meaning, 0 */
- u_int16_t st_shndx; /* Associated section index */
+ bfd_vma st_value; /* Value of the symbol */
+ bfd_vma st_size; /* Associated symbol size */
+ unsigned long st_name; /* Symbol name, index in string tbl */
+ unsigned char st_info; /* Type and binding attributes */
+ unsigned char st_other; /* Visibilty, and target specific */
+ unsigned int st_shndx; /* Associated section index */
};
typedef struct
@@ -738,12 +740,13 @@ static void
resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
u_int32_t * n_relocs, struct nxflat_reloc_s **relocs)
{
- int i;
- int j;
- int relsize, relcount;
- arelent **relpp;
struct nxflat_reloc_s *nxflat_relocs;
+ arelent **relpp;
u_int32_t nxflat_reloc_count;
+ int relsize;
+ int relcount;
+ int i;
+ int j;
nxflat_relocs = *relocs;
nxflat_reloc_count = *n_relocs;
@@ -777,6 +780,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
fprintf(stderr, "ERROR: bfd_canonicalize_reloc failed!\n");
exit(1);
}
+
if (verbose)
{
printf("Section %s can'd %08x relocs\n",
@@ -785,9 +789,22 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
for (j = 0; j < relcount; j++)
{
- reloc_howto_type *how_to = relpp[j]->howto;
- asymbol *rel_sym = *relpp[j]->sym_ptr_ptr;
- asection *rel_section = rel_sym->section;
+ /* Get information about this symbol */
+
+ reloc_howto_type *how_to = relpp[j]->howto;
+ asymbol *rel_sym = *relpp[j]->sym_ptr_ptr;
+ asection *rel_section = rel_sym->section;
+ symvalue sym_value;
+
+ /* If the symbol is a thumb function, then set bit 1 of the value */
+
+ sym_value = rel_sym->value;
+#ifdef NXFLAT_ARM
+ if ((((elf_symbol_type *)rel_sym)->internal_elf_sym.st_info & 0x0f) == STT_ARM_TFUNC)
+ {
+ sym_value |= 1;
+ }
+#endif
if (verbose > 1)
{
@@ -812,7 +829,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
printf("performing PC24 link at addr %08x to "
"sym [%20s] @ %08x\n",
(u_int32_t) relpp[j]->address, rel_sym->name,
- (u_int32_t) rel_sym->value);
+ (u_int32_t) sym_value);
}
/* Can't fix what we ain't got */
@@ -875,7 +892,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
/* offset */
temp +=
- ((rel_sym->value + rel_sym->section->vma)
+ ((sym_value + rel_sym->section->vma)
- relpp[j]->address) >> how_to->rightshift;
/* demote */
@@ -916,7 +933,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
printf("performing ABS32 link at addr %08x to "
"sym [%20s] @ %08x\n",
(u_int32_t) relpp[j]->address, rel_sym->name,
- (u_int32_t) rel_sym->value);
+ (u_int32_t) sym_value);
}
/* ABS32 links from .text are easy - since the fetches will */
@@ -959,7 +976,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
/* offset */
- temp += (rel_sym->value + rel_sym->section->vma) >>
+ temp += (sym_value + rel_sym->section->vma) >>
how_to->rightshift;
/* demote */
@@ -988,7 +1005,9 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
int reltype;
if (verbose)
- printf("RELOCATION in DATA!\n");
+ {
+ printf("RELOCATION in DATA!\n");
+ }
/* Locate the address referred to by section type. */
@@ -1017,7 +1036,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
"Attempted GOTOFF reloc at addr %08x to "
"sym [%20s] @ %08x\n",
(u_int32_t) relpp[j]->address, rel_sym->name,
- (u_int32_t) rel_sym->value);
+ (u_int32_t) sym_value);
goto got_not_supported;
case R_ARM_GOT32:
@@ -1027,7 +1046,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
"Attempted GOT32 reloc at addr %08x to "
"sym [%20s] @ %08x\n",
(u_int32_t) relpp[j]->address, rel_sym->name,
- (u_int32_t) rel_sym->value);
+ (u_int32_t) sym_value);
goto got_not_supported;
case R_ARM_GOTPC:
@@ -1036,7 +1055,7 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
"Attempted GOTPC reloc at addr %08x to "
"sym [%20s] @ %08x\n",
(u_int32_t) relpp[j]->address, rel_sym->name,
- (u_int32_t) rel_sym->value);
+ (u_int32_t) sym_value);
got_not_supported:
fprintf(stderr,
@@ -1070,38 +1089,59 @@ resolve_segment_relocs(bfd * input_bfd, segment_info * inf, asymbol ** syms,
static void dump_symbol(asymbol * psym)
{
+ struct elf_internal_sym *isym =
+ (struct elf_internal_sym *)&((elf_symbol_type *)psym)->internal_elf_sym;
+
if (bfd_is_com_section(psym->section))
{
/* Common Global - unplaced */
printf("Sym[%24s] @ sz %04x ",
psym->name, (u_int32_t) psym->value);
- printf("align %04x ",
- (u_int32_t) ((elf_symbol_type *) psym)->internal_elf_sym.st_value);
+ printf("align %04x ", (u_int32_t)isym->st_value);
}
else
{
printf("Sym[%24s] @ %04x align ",
psym->name, (u_int32_t) psym->value);
- printf("sz %04x ",
- (u_int32_t) ((elf_symbol_type *) psym)->internal_elf_sym.st_size);
+ printf("sz %04x ", (u_int32_t)isym->st_size);
+ }
+
+ /* Symbol type */
+
+ printf("tp %02x ", isym->st_info);
+
+ /* Tag thumb specific attributes */
+
+#ifdef NXFLAT_ARM
+ if ((isym->st_info & 0x0f) == STT_ARM_TFUNC || (isym->st_info & 0x0f) == STT_ARM_16BIT)
+ {
+ putchar('T');
}
- printf("%c", psym->flags & BSF_OBJECT ? 'O' : ' ');
- printf("%c", psym->flags & BSF_DYNAMIC ? 'D' : ' ');
- printf("%c", psym->flags & BSF_FILE ? 'F' : ' ');
- printf("%c", psym->flags & BSF_INDIRECT ? 'I' : ' ');
- printf("%c", psym->flags & BSF_WARNING ? 'W' : ' ');
- printf("%c", psym->flags & BSF_CONSTRUCTOR ? 'C' : ' ');
- printf("%c", psym->flags & BSF_NOT_AT_END ? 'N' : ' ');
- printf("%c", psym->flags & BSF_OLD_COMMON ? 'c' : ' ');
- printf("%c", psym->flags & BSF_SECTION_SYM ? 'S' : ' ');
- printf("%c", psym->flags & BSF_WEAK ? 'w' : ' ');
- printf("%c", psym->flags & BSF_KEEP_G ? 'G' : ' ');
- printf("%c", psym->flags & BSF_KEEP ? 'K' : ' ');
- printf("%c", psym->flags & BSF_FUNCTION ? 'f' : ' ');
- printf("%c", psym->flags & BSF_DEBUGGING ? 'd' : ' ');
- printf("%c", psym->flags & BSF_GLOBAL ? 'g' : ' ');
- printf("%c", psym->flags & BSF_LOCAL ? 'l' : ' ');
+ else
+ {
+ putchar(' ');
+ }
+#endif
+
+ /* Common attributes */
+
+ printf("|%c", psym->flags & BSF_OBJECT ? 'O' : '.');
+ printf("%c", psym->flags & BSF_DYNAMIC ? 'D' : '.');
+ printf("%c", psym->flags & BSF_FILE ? 'F' : '.');
+ printf("%c", psym->flags & BSF_INDIRECT ? 'I' : '.');
+ printf("%c", psym->flags & BSF_WARNING ? 'W' : '.');
+ printf("%c", psym->flags & BSF_CONSTRUCTOR ? 'C' : '.');
+ printf("%c", psym->flags & BSF_NOT_AT_END ? 'N' : '.');
+ printf("%c", psym->flags & BSF_OLD_COMMON ? 'c' : '.');
+ printf("%c", psym->flags & BSF_SECTION_SYM ? 'S' : '.');
+ printf("%c", psym->flags & BSF_WEAK ? 'w' : '.');
+ printf("%c", psym->flags & BSF_KEEP_G ? 'G' : '.');
+ printf("%c", psym->flags & BSF_KEEP ? 'K' : '.');
+ printf("%c", psym->flags & BSF_FUNCTION ? 'f' : '.');
+ printf("%c", psym->flags & BSF_DEBUGGING ? 'd' : '.');
+ printf("%c", psym->flags & BSF_GLOBAL ? 'g' : '.');
+ printf("%c|", psym->flags & BSF_LOCAL ? 'l' : '.');
printf("\n");
}
@@ -1356,17 +1396,8 @@ static struct nxflat_reloc_s *output_relocs(bfd * input_bfd, asymbol ** symbols,
u_int32_t * n_relocs)
{
struct nxflat_reloc_s *nxflat_relocs;
- asection *sym_section;
- arelent **relpp, **p, *q;
- const char *sym_name, *section_name;
u_int32_t nxflat_reloc_count;
- int relsize, relcount;
- int reltype;
int rc;
- bfd_vma v, addend;
- segment_info *relseg, *sym_segment;
- u_int32_t seg_offset;
-
int i;
*n_relocs = 0;
@@ -1374,10 +1405,6 @@ static struct nxflat_reloc_s *output_relocs(bfd * input_bfd, asymbol ** symbols,
nxflat_reloc_count = 0;
rc = 0;
-#if 1
-
- /* new code */
-
if (verbose)
{
printf(" Before mapp high mark %08x cooked %08x raw %08x \n",
@@ -1422,188 +1449,6 @@ static struct nxflat_reloc_s *output_relocs(bfd * input_bfd, asymbol ** symbols,
/* need to emit relocs for data only */
return nxflat_relocs;
-
-#endif
-
- relsize = bfd_get_dynamic_reloc_upper_bound(input_bfd);
- if (relsize <= 0)
- {
- if (verbose)
- printf("no relocation entries\n");
- return 0;
- }
-
- relpp = (arelent **) malloc(relsize);
- relcount = bfd_canonicalize_dynamic_reloc(input_bfd, relpp, symbols);
- if (relcount <= 0)
- {
- if (verbose)
- printf("no relocation entries\n");
- *n_relocs = 0;
- return NULL;
- }
-
- for (p = relpp; (relcount && (*p != NULL)); p++, relcount--)
- {
- q = *p;
- if (q->sym_ptr_ptr && *q->sym_ptr_ptr)
- {
- sym_name = (*(q->sym_ptr_ptr))->name;
- sym_section = (*(q->sym_ptr_ptr))->section;
- section_name = (*(q->sym_ptr_ptr))->section->name;
-
- if (verbose)
- {
- printf("Reloc address %08x type %s\n",
- (u_int32_t) q->address, q->howto->name);
- }
-
- switch (q->howto->type)
- {
- case R_ARM_RELATIVE:
- /* This reloc describes an offset from the "program base". We
- * need to figure out which segment it actually refers to, fiddle
- * the addend and output an appropriate FLAT reloc to be resolved
- * at run time. */
- /* XXX In an ideal world, the linker would output different
- * relocs for the different sections, so we wouldn't need to grub
- * around in the memory map quite so much. */
-
- v = q->address;
- reltype = -1;
- relseg = sym_segment = NULL;
- if (v >= text_info.low_mark && v <= text_info.high_mark)
- {
- /* The existing FLAT binary format only allows relocs to be
- * in the .data segment. Relocating in .text would be bad
- * practice anyway so this is no great loss. */
-
- printf("WARNING: Illegal RELATIVE reloc in text "
- "segment ignored.\n");
- continue;
- }
- else if (v >= data_info.low_mark && v <= data_info.high_mark)
- relseg = &data_info;
-
- if (!relseg)
- {
- /* This reloc isn't in the text or data segment. Probably it
- * refers to debug information and we can just ignore it. */
-
- if (verbose)
- {
- fprintf(stderr,
- "WARNING: ignoring reloc at %08x\n",
- (u_int32_t) v);
- }
- continue;
- }
-
- /* Locate the reloc in the appropriate segment and extract the
- * existing addend. */
-
- seg_offset = v - relseg->low_mark;
- addend = *((bfd_vma *) (relseg->contents + seg_offset));
-
- if (verbose)
- {
- printf("RELATIVE reloc at (%s+%08x) addend %08x\n",
- relseg->name, seg_offset, (u_int32_t) addend);
- }
-
- /* Locate the address referred to by section type. */
-
- reltype = get_reloc_type(sym_section, &sym_segment);
-
- if (!sym_segment)
- {
- /* The addend isn't within any of the segments we know about.
- * This might mean it was in a section we threw away. In any
- * case, there is nothing we can do about it now. */
-
- printf("ERROR: reloc at (%s+%08x) has out of "
- " range addend %08x or unrecognized "
- " section \"%s\"\n",
- relseg->name, seg_offset,
- (u_int32_t) addend, sym_section->name);
- rc = -1;
- continue;
- }
-
- /* Verify that the addend offset lies within the address range we
- * have identified for the segment. */
-
- if (addend < sym_segment->low_mark ||
- addend > sym_segment->high_mark)
- {
- fprintf(stderr,
- "ERROR: Symbol addend %x does lie within "
- "segment address range (%x-%x)\n",
- (u_int32_t) addend, (u_int32_t) sym_segment->low_mark,
- (u_int32_t) sym_segment->high_mark);
- continue;
- }
-
- /* Factor out the starting VMA of the segment, adjust the addend
- * in core and output a new reloc. */
-
- addend -= sym_segment->low_mark;
-
- if (verbose)
- {
- printf("(%s+%08x)\n",
- sym_segment->name, (u_int32_t) addend);
- }
-
- *((bfd_vma *) (relseg->contents + seg_offset)) = addend;
-
- nxflat_relocs = realloc(nxflat_relocs,
- (nxflat_reloc_count + 1)
- * sizeof(struct nxflat_reloc_s));
-
- nxflat_relocs[nxflat_reloc_count].r_info = NXFLAT_RELOC(reltype, seg_offset);
- nxflat_reloc_count++;
- break;
-
- case R_ARM_PC24:
- case R_ARM_GLOB_DAT:
- /* Because we linked with -Bsymbolic, the linker will already
- * have resolved all function calls apart from those to undefined
- * symbols. So long as this is a weak reference, we do nothing
- * and the reloc will be incomplete - it is up to the application
- * to avoid executing such branches. Global data relocs are also
- * OK to leave unresolved since they will yield zero by default.
- * If we encounter an unresolved strong reference we punt; the
- * linker should have trapped this case already so this is a
- * "can't happen" situation. */
-
- if (!((*q->sym_ptr_ptr)->flags & BSF_WEAK))
- {
- printf("ERROR: undefined symbolic reference to %s\n",
- (*q->sym_ptr_ptr)->name);
- rc = -1;
- }
- break;
-
- default:
- printf("ERROR: unknown reloc type %s\n", q->howto->name);
- rc = -1;
- break;
- }
- }
- else
- {
- printf("ERROR: undefined relocation entry\n");
- rc = -1;
- continue;
- }
- }
-
- if (rc < 0)
- return (NULL);
-
- *n_relocs = nxflat_reloc_count;
- return nxflat_relocs;
}
/***********************************************************************
@@ -2018,8 +1863,7 @@ int main(int argc, char **argv, char **envp)
load_sections(bf, &text_info);
load_sections(bf, &data_info);
- reloc = (u_int32_t *)
- output_relocs(bf, symbol_table, number_of_symbols, &reloc_len);
+ reloc = (u_int32_t*)output_relocs(bf, symbol_table, number_of_symbols, &reloc_len);
/* Fill in the xFLT file header */
diff --git a/misc/buildroot/toolchain/nxflat/reloc-macros.h b/misc/buildroot/toolchain/nxflat/reloc-macros.h
index 5cef95154..c3f88ba7a 100644
--- a/misc/buildroot/toolchain/nxflat/reloc-macros.h
+++ b/misc/buildroot/toolchain/nxflat/reloc-macros.h
@@ -1,8 +1,14 @@
/***********************************************************************
- * toolchain/nxflat/reloc-macros.h
- *
+ * xflat/tools/arm/arch.h
* Generic relocation support for BFD.
- * Copyright (C) 1998 Free Software Foundation, Inc.
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Simply lifted with minimal change from the BFD, binutils 2.19.1:
+ *
+ * Copyright 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+ * Free Software Foundation, Inc.
*
* This file is part of BFD, the Binary File Descriptor library.
*
@@ -18,106 +24,117 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- ***********************************************************************
- *
- * These macros are used by the various *.h target specific header
- * files to either generate an enum containing all the known relocations
- * for that target, or if RELOC_MACROS_GEN_FUNC is defined, a recognition
- * function is generated instead. (This is used by binutils/readelf.c)
+ * Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Given a header file like this:
- *
- * START_RELOC_NUMBERS (foo)
- * RELOC_NUMBER (R_foo_NONE, 0)
- * RELOC_NUMBER (R_foo_32, 1)
- * FAKE_RELOC (R_foo_illegal, 2)
- * EMPTY_RELOC (R_foo_max)
- * END_RELOC_NUMBERS
- *
- * Then the following will be produced by default (ie if
- * RELOC_MACROS_GEN_FUNC is *not* defined).
- *
- * enum foo
- * {
- * foo = -1,
- * R_foo_NONE = 0,
- * R_foo_32 = 1,
- * R_foo_illegal = 2,
- * R_foo_max
- * };
- *
- * If RELOC_MACROS_GEN_FUNC *is* defined, then instead the
- * following function will be generated:
- *
- * static const char * foo PARAMS ((unsigned long rtype));
- * static const char *
- * foo (rtype)
- * unsigned long rtype;
- * {
- * switch (rtype)
- * {
- * case 0: return "R_foo_NONE";
- * case 1: return "R_foo_32";
- * default: return NULL;
- * }
- * }
***********************************************************************/
-#ifndef _RELOC_MACROS_H
-# define _RELOC_MACROS_H
+/* These macros are used by the various *.h target specific header
+ files to either generate an enum containing all the known relocations
+ for that target, or if RELOC_MACROS_GEN_FUNC is defined, a recognition
+ function is generated instead. (This is used by binutils/readelf.c)
+
+ Given a header file like this:
-# ifdef RELOC_MACROS_GEN_FUNC
+ START_RELOC_NUMBERS (foo)
+ RELOC_NUMBER (R_foo_NONE, 0)
+ RELOC_NUMBER (R_foo_32, 1)
+ EMPTY_RELOC (R_foo_good)
+ FAKE_RELOC (R_foo_illegal, 9)
+ END_RELOC_NUMBERS (R_foo_count)
+
+ Then the following will be produced by default (ie if
+ RELOC_MACROS_GEN_FUNC is *not* defined).
+
+ enum foo
+ {
+ R_foo_NONE = 0,
+ R_foo_32 = 1,
+ R_foo_good,
+ R_foo_illegal = 9,
+ R_foo_count
+ };
+
+ Note: The value of the symbol defined in the END_RELOC_NUMBERS
+ macro (R_foo_count in the case of the example above) will be
+ set to the value of the whichever *_RELOC macro preceeds it plus
+ one. Therefore if you intend to use the symbol as a sentinel for
+ the highest valid macro value you should make sure that the
+ preceeding *_RELOC macro is the highest valid number. ie a
+ declaration like this:
+
+ START_RELOC_NUMBERS (foo)
+ RELOC_NUMBER (R_foo_NONE, 0)
+ RELOC_NUMBER (R_foo_32, 1)
+ FAKE_RELOC (R_foo_illegal, 9)
+ FAKE_RELOC (R_foo_synonym, 0)
+ END_RELOC_NUMBERS (R_foo_count)
+
+ will result in R_foo_count having a value of 1 (R_foo_synonym + 1)
+ rather than 10 or 2 as might be expected.
+
+ Alternatively you can assign a value to END_RELOC_NUMBERS symbol
+ explicitly, like this:
+
+ START_RELOC_NUMBERS (foo)
+ RELOC_NUMBER (R_foo_NONE, 0)
+ RELOC_NUMBER (R_foo_32, 1)
+ FAKE_RELOC (R_foo_illegal, 9)
+ FAKE_RELOC (R_foo_synonym, 0)
+ END_RELOC_NUMBERS (R_foo_count = 2)
+
+ If RELOC_MACROS_GEN_FUNC *is* defined, then instead the
+ following function will be generated:
+
+ static const char *foo (unsigned long rtype);
+ static const char *
+ foo (unsigned long rtype)
+ {
+ switch (rtype)
+ {
+ case 0: return "R_foo_NONE";
+ case 1: return "R_foo_32";
+ default: return NULL;
+ }
+ }
+ */
+
+#ifndef __TOOLCHAIN_NXFLAT_RELOC_MACROS_H
+#define __TOOLCHAIN_NXFLAT_RELOC_MACROS_H
+
+#ifdef RELOC_MACROS_GEN_FUNC
/* This function takes the relocation number and returns the
- * string version name of the name of that relocation. If
- * the relocation is not recognised, NULL is returned.
- */
+ string version name of the name of that relocation. If
+ the relocation is not recognised, NULL is returned. */
-# define START_RELOC_NUMBERS(name) \
-static const char * name PARAMS ((unsigned long rtype)); \
+#define START_RELOC_NUMBERS(name) \
+static const char *name (unsigned long rtype); \
static const char * \
-name (rtype) \
- unsigned long rtype; \
+name (unsigned long rtype) \
{ \
switch (rtype) \
- {
+ {
-# ifdef __STDC__
-# define RELOC_NUMBER(name, number) case number : return #name ;
-# else
-# define RELOC_NUMBER(name, number) case number : return "name" ;
-# endif
+#define RELOC_NUMBER(name, number) \
+ case number: return #name;
-# define FAKE_RELOC(name, number)
-# define EMPTY_RELOC(name)
+#define FAKE_RELOC(name, number)
+#define EMPTY_RELOC(name)
-# define END_RELOC_NUMBERS \
+#define END_RELOC_NUMBERS(name) \
default: return NULL; \
- } \
+ } \
}
-# else /* Default to generating enum. */
-
-/* Some compilers cannot cope with an enum that ends with a trailing
- * comma, so START_RELOC_NUMBERS creates a fake reloc entry, (initialised
- * to -1 so that the first real entry will still default to 0). Further
- * entries then prepend a comma to their definitions, creating a list
- * of enumerator entries that will satisfy these compilers.
- */
-# ifdef __STDC__
-# define START_RELOC_NUMBERS(name) enum name { _##name = -1
-# else
-# define START_RELOC_NUMBERS(name) enum name { name = -1
-# endif
+#else /* Default to generating enum. */
-# define RELOC_NUMBER(name, number) , name = number
-# define FAKE_RELOC(name, number) , name = number
-# define EMPTY_RELOC(name) , name
-# define END_RELOC_NUMBERS };
+#define START_RELOC_NUMBERS(name) enum name {
+#define RELOC_NUMBER(name, number) name = number,
+#define FAKE_RELOC(name, number) name = number,
+#define EMPTY_RELOC(name) name,
+#define END_RELOC_NUMBERS(name) name };
-# endif
+#endif
-#endif /* RELOC_MACROS_H */
+#endif /* __TOOLCHAIN_NXFLAT_RELOC_MACROS_H */
diff --git a/misc/buildroot/toolchain/nxflat/thumb2/arch.h b/misc/buildroot/toolchain/nxflat/thumb2/arch.h
index 9725e4cd1..bacc63892 100644
--- a/misc/buildroot/toolchain/nxflat/thumb2/arch.h
+++ b/misc/buildroot/toolchain/nxflat/thumb2/arch.h
@@ -5,153 +5,299 @@
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
- * Derived from XFLAT:
+ * Simply lifted with minimal change from the BFD, binutils 2.19.1:
*
- * Copyright (c) 2006, Cadenux, LLC. All rights reserved.
- * Copyright (c) 2006, Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
- *
- * Which simply lifted it from the BFD:
+ * Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ * Free Software Foundation, Inc.
*
- * Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
* This file is part of BFD, the Binary File Descriptor library.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*
***********************************************************************/
-#ifndef _ELF_ARM_H
-#define _ELF_ARM_H
+#ifndef _TOOLCHAIN_NXFLAT_THUMB2_ARCH_H
+#define _TOOLCHAIN_NXFLAT_THUMB2_ARCH_H
#include "reloc-macros.h"
+/* Inform ldnxflat that this is 16-bit Thumb2 code */
+
+#define NXFLAT_ARM 1
+#define NXFLAT_THUMB2 1
+
/* Processor specific flags for the ELF header e_flags field. */
-#define EF_ARM_RELEXEC 0x01
-#define EF_ARM_HASENTRY 0x02
-#define EF_INTERWORK 0x04
-#define EF_APCS_26 0x08
-#define EF_APCS_FLOAT 0x10
-#define EF_PIC 0x20
-#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
-#define EF_NEW_ABI 0x80
-#define EF_OLD_ABI 0x100
-#define EF_SOFT_FLOAT 0x200
-#define EF_VFP_FLOAT 0x400
+#define EF_ARM_RELEXEC 0x01
+#define EF_ARM_HASENTRY 0x02
+#define EF_ARM_INTERWORK 0x04
+#define EF_ARM_APCS_26 0x08
+#define EF_ARM_APCS_FLOAT 0x10
+#define EF_ARM_PIC 0x20
+#define EF_ARM_ALIGN8 0x40 /* 8-bit structure alignment is in use. */
+#define EF_ARM_NEW_ABI 0x80
+#define EF_ARM_OLD_ABI 0x100
+#define EF_ARM_SOFT_FLOAT 0x200
+#define EF_ARM_VFP_FLOAT 0x400
+#define EF_ARM_MAVERICK_FLOAT 0x800
+
+/* Frame unwind information */
+#define PT_ARM_EXIDX (PT_LOPROC + 1)
/* Other constants defined in the ARM ELF spec. version B-01. */
-#define EF_SYMSARESORTED 0x04 /* NB conflicts with EF_INTERWORK */
-#define EF_DYNSYMSUSESEGIDX 0x08 /* NB conflicts with EF_APCS26 */
-#define EF_MAPSYMSFIRST 0x10 /* NB conflicts with EF_APCS_FLOAT */
-#define EF_EABIMASK 0xFF000000
+#define EF_ARM_SYMSARESORTED 0x04 /* NB conflicts with EF_INTERWORK */
+#define EF_ARM_DYNSYMSUSESEGIDX 0x08 /* NB conflicts with EF_APCS26 */
+#define EF_ARM_MAPSYMSFIRST 0x10 /* NB conflicts with EF_APCS_FLOAT */
+#define EF_ARM_EABIMASK 0xFF000000
-#define EF_EABI_VERSION(flags) ((flags) & EF_EABIMASK)
-#define EF_EABI_UNKNOWN 0x00000000
-#define EF_EABI_VER1 0x01000000
-#define EF_EABI_VER2 0x02000000
+/* Constants defined in AAELF. */
+#define EF_ARM_BE8 0x00800000
+#define EF_ARM_LE8 0x00400000
+
+#define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
+#define EF_ARM_EABI_UNKNOWN 0x00000000
+#define EF_ARM_EABI_VER1 0x01000000
+#define EF_ARM_EABI_VER2 0x02000000
+#define EF_ARM_EABI_VER3 0x03000000
+#define EF_ARM_EABI_VER4 0x04000000
+#define EF_ARM_EABI_VER5 0x05000000
/* Local aliases for some flags to match names used by COFF port. */
-#define F_INTERWORK EF_INTERWORK
-#define F_APCS26 EF_APCS_26
-#define F_APCS_FLOAT EF_APCS_FLOAT
-#define F_PIC EF_PIC
-#define F_SOFT_FLOAT EF_SOFT_FLOAT
-#define F_VFP_FLOAT EF_VFP_FLOAT
+#define F_INTERWORK EF_ARM_INTERWORK
+#define F_APCS26 EF_ARM_APCS_26
+#define F_APCS_FLOAT EF_ARM_APCS_FLOAT
+#define F_PIC EF_ARM_PIC
+#define F_SOFT_FLOAT EF_ARM_SOFT_FLOAT
+#define F_VFP_FLOAT EF_ARM_VFP_FLOAT
+
+/* Additional symbol types for Thumb. */
+#define STT_ARM_TFUNC 13 /* A Thumb function. */
+#define STT_ARM_16BIT 15 /* A Thumb label. */
-/* Additional symbol types for Thumb */
-#define STT_ARM_TFUNC STT_LOPROC /* A Thumb function. */
-#define STT_ARM_16BIT STT_HIPROC /* A Thumb label. */
+/* Additional section types. */
+#define SHT_ARM_EXIDX 0x70000001 /* Section holds ARM unwind info. */
+#define SHT_ARM_PREEMPTMAP 0x70000002 /* Section pre-emption details. */
+#define SHT_ARM_ATTRIBUTES 0x70000003 /* Section holds attributes. */
-/* ARM-specific values for sh_flags */
-#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */
-#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */
+/* ARM-specific values for sh_flags. */
+#define SHF_ENTRYSECT 0x10000000 /* Section contains an entry point. */
+#define SHF_COMDEF 0x80000000 /* Section may be multiply defined in the input to a link step. */
/* ARM-specific program header flags. */
-#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */
-#define PF_ARM_PI 0x20000000 /* Segment is position-independent. */
-#define PF_ARM_ABS 0x40000000 /* Segment must be loaded at its base address. */
+#define PF_ARM_SB 0x10000000 /* Segment contains the location addressed by the static base. */
+#define PF_ARM_PI 0x20000000 /* Segment is position-independent. */
+#define PF_ARM_ABS 0x40000000 /* Segment must be loaded at its base address. */
+
+/* Values for the Tag_CPU_arch EABI attribute. */
+#define TAG_CPU_ARCH_PRE_V4 0
+#define TAG_CPU_ARCH_V4 1
+#define TAG_CPU_ARCH_V4T 2
+#define TAG_CPU_ARCH_V5T 3
+#define TAG_CPU_ARCH_V5TE 4
+#define TAG_CPU_ARCH_V5TEJ 5
+#define TAG_CPU_ARCH_V6 6
+#define TAG_CPU_ARCH_V6KZ 7
+#define TAG_CPU_ARCH_V6T2 8
+#define TAG_CPU_ARCH_V6K 9
+#define TAG_CPU_ARCH_V7 10
/* Relocation types. */
START_RELOC_NUMBERS (elf_arm_reloc_type)
- RELOC_NUMBER (R_ARM_NONE, 0)
- RELOC_NUMBER (R_ARM_PC24, 1)
- RELOC_NUMBER (R_ARM_ABS32, 2)
- RELOC_NUMBER (R_ARM_REL32, 3)
-#ifdef OLD_ARM_ABI
- RELOC_NUMBER (R_ARM_ABS8, 4)
- RELOC_NUMBER (R_ARM_ABS16, 5)
- RELOC_NUMBER (R_ARM_ABS12, 6)
- RELOC_NUMBER (R_ARM_THM_ABS5, 7)
- RELOC_NUMBER (R_ARM_THM_PC22, 8)
- RELOC_NUMBER (R_ARM_SBREL32, 9)
- RELOC_NUMBER (R_ARM_AMP_VCALL9, 10)
- RELOC_NUMBER (R_ARM_THM_PC11, 11) /* Cygnus extension to abi: Thumb unconditional branch. */
- RELOC_NUMBER (R_ARM_THM_PC9, 12) /* Cygnus extension to abi: Thumb conditional branch. */
- RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 13)
- RELOC_NUMBER (R_ARM_GNU_VTENTRY, 14)
-#else /* not OLD_ARM_ABI */
- RELOC_NUMBER (R_ARM_PC13, 4)
- RELOC_NUMBER (R_ARM_ABS16, 5)
- RELOC_NUMBER (R_ARM_ABS12, 6)
- RELOC_NUMBER (R_ARM_THM_ABS5, 7)
- RELOC_NUMBER (R_ARM_ABS8, 8)
- RELOC_NUMBER (R_ARM_SBREL32, 9)
- RELOC_NUMBER (R_ARM_THM_PC22, 10)
- RELOC_NUMBER (R_ARM_THM_PC8, 11)
- RELOC_NUMBER (R_ARM_AMP_VCALL9, 12)
- RELOC_NUMBER (R_ARM_SWI24, 13)
- RELOC_NUMBER (R_ARM_THM_SWI8, 14)
- RELOC_NUMBER (R_ARM_XPC25, 15)
- RELOC_NUMBER (R_ARM_THM_XPC22, 16)
-#endif /* not OLD_ARM_ABI */
- RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime. */
- RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry. */
- RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry. */
- RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base. */
- RELOC_NUMBER (R_ARM_GOTOFF, 24) /* 32 bit offset to GOT. */
- RELOC_NUMBER (R_ARM_GOTPC, 25) /* 32 bit PC relative offset to GOT. */
- RELOC_NUMBER (R_ARM_GOT32, 26) /* 32 bit GOT entry. */
- RELOC_NUMBER (R_ARM_PLT32, 27) /* 32 bit PLT address. */
-#ifdef OLD_ARM_ABI
- FAKE_RELOC (FIRST_INVALID_RELOC, 28)
- FAKE_RELOC (LAST_INVALID_RELOC, 249)
-#else /* not OLD_ARM_ABI */
- FAKE_RELOC (FIRST_INVALID_RELOC1, 28)
- FAKE_RELOC (LAST_INVALID_RELOC1, 31)
- RELOC_NUMBER (R_ARM_ALU_PCREL7_0, 32)
- RELOC_NUMBER (R_ARM_ALU_PCREL15_8, 33)
- RELOC_NUMBER (R_ARM_ALU_PCREL23_15, 34)
- RELOC_NUMBER (R_ARM_LDR_SBREL11_0, 35)
- RELOC_NUMBER (R_ARM_ALU_SBREL19_12, 36)
- RELOC_NUMBER (R_ARM_ALU_SBREL27_20, 37)
- FAKE_RELOC (FIRST_INVALID_RELOC2, 38)
- FAKE_RELOC (LAST_INVALID_RELOC2, 99)
- RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100)
- RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101)
- RELOC_NUMBER (R_ARM_THM_PC11, 102) /* Cygnus extension to abi: Thumb unconditional branch. */
- RELOC_NUMBER (R_ARM_THM_PC9, 103) /* Cygnus extension to abi: Thumb conditional branch. */
- FAKE_RELOC (FIRST_INVALID_RELOC3, 104)
- FAKE_RELOC (LAST_INVALID_RELOC3, 248)
- RELOC_NUMBER (R_ARM_RXPC25, 249)
-#endif /* not OLD_ARM_ABI */
- RELOC_NUMBER (R_ARM_RSBREL32, 250)
- RELOC_NUMBER (R_ARM_THM_RPC22, 251)
- RELOC_NUMBER (R_ARM_RREL32, 252)
- RELOC_NUMBER (R_ARM_RABS32, 253)
- RELOC_NUMBER (R_ARM_RPC24, 254)
- RELOC_NUMBER (R_ARM_RBASE, 255)
-END_RELOC_NUMBERS
-
-#endif /* _ELF_ARM_H */
+/* AAELF official names and numbers. */
+ RELOC_NUMBER (R_ARM_NONE, 0)
+ RELOC_NUMBER (R_ARM_PC24, 1) /* deprecated */
+ RELOC_NUMBER (R_ARM_ABS32, 2)
+ RELOC_NUMBER (R_ARM_REL32, 3)
+ RELOC_NUMBER (R_ARM_LDR_PC_G0, 4)
+ RELOC_NUMBER (R_ARM_ABS16, 5)
+ RELOC_NUMBER (R_ARM_ABS12, 6)
+ RELOC_NUMBER (R_ARM_THM_ABS5, 7)
+ RELOC_NUMBER (R_ARM_ABS8, 8)
+ RELOC_NUMBER (R_ARM_SBREL32, 9)
+ RELOC_NUMBER (R_ARM_THM_CALL, 10)
+ RELOC_NUMBER (R_ARM_THM_PC8, 11)
+ RELOC_NUMBER (R_ARM_BREL_ADJ, 12)
+ RELOC_NUMBER (R_ARM_SWI24, 13) /* obsolete */
+ RELOC_NUMBER (R_ARM_THM_SWI8, 14) /* obsolete */
+ RELOC_NUMBER (R_ARM_XPC25, 15) /* obsolete */
+ RELOC_NUMBER (R_ARM_THM_XPC22, 16) /* obsolete */
+ RELOC_NUMBER (R_ARM_TLS_DTPMOD32, 17)
+ RELOC_NUMBER (R_ARM_TLS_DTPOFF32, 18)
+ RELOC_NUMBER (R_ARM_TLS_TPOFF32, 19)
+ RELOC_NUMBER (R_ARM_COPY, 20) /* Copy symbol at runtime. */
+ RELOC_NUMBER (R_ARM_GLOB_DAT, 21) /* Create GOT entry. */
+ RELOC_NUMBER (R_ARM_JUMP_SLOT, 22) /* Create PLT entry. */
+ RELOC_NUMBER (R_ARM_RELATIVE, 23) /* Adjust by program base. */
+ RELOC_NUMBER (R_ARM_GOTOFF32, 24) /* 32 bit offset to GOT. */
+ RELOC_NUMBER (R_ARM_BASE_PREL, 25) /* 32 bit PC relative offset to GOT. */
+ RELOC_NUMBER (R_ARM_GOT_BREL, 26) /* 32 bit GOT entry. */
+ RELOC_NUMBER (R_ARM_PLT32, 27) /* deprecated - 32 bit PLT address. */
+ RELOC_NUMBER (R_ARM_CALL, 28)
+ RELOC_NUMBER (R_ARM_JUMP24, 29)
+ RELOC_NUMBER (R_ARM_THM_JUMP24, 30)
+ RELOC_NUMBER (R_ARM_BASE_ABS, 31)
+ RELOC_NUMBER (R_ARM_ALU_PCREL7_0, 32) /* obsolete */
+ RELOC_NUMBER (R_ARM_ALU_PCREL15_8, 33) /* obsolete */
+ RELOC_NUMBER (R_ARM_ALU_PCREL23_15, 34) /* obsolete */
+ RELOC_NUMBER (R_ARM_LDR_SBREL_11_0, 35) /* deprecated, should have _NC suffix */
+ RELOC_NUMBER (R_ARM_ALU_SBREL_19_12, 36) /* deprecated, should have _NC suffix */
+ RELOC_NUMBER (R_ARM_ALU_SBREL_27_20, 37) /* deprecated, should have _CK suffix */
+ RELOC_NUMBER (R_ARM_TARGET1, 38)
+ RELOC_NUMBER (R_ARM_SBREL31, 39) /* deprecated */
+ RELOC_NUMBER (R_ARM_V4BX, 40)
+ RELOC_NUMBER (R_ARM_TARGET2, 41)
+ RELOC_NUMBER (R_ARM_PREL31, 42)
+ RELOC_NUMBER (R_ARM_MOVW_ABS_NC, 43)
+ RELOC_NUMBER (R_ARM_MOVT_ABS, 44)
+ RELOC_NUMBER (R_ARM_MOVW_PREL_NC, 45)
+ RELOC_NUMBER (R_ARM_MOVT_PREL, 46)
+ RELOC_NUMBER (R_ARM_THM_MOVW_ABS_NC, 47)
+ RELOC_NUMBER (R_ARM_THM_MOVT_ABS, 48)
+ RELOC_NUMBER (R_ARM_THM_MOVW_PREL_NC, 49)
+ RELOC_NUMBER (R_ARM_THM_MOVT_PREL, 50)
+ RELOC_NUMBER (R_ARM_THM_JUMP19, 51)
+ RELOC_NUMBER (R_ARM_THM_JUMP6, 52)
+ RELOC_NUMBER (R_ARM_THM_ALU_PREL_11_0, 53)
+ RELOC_NUMBER (R_ARM_THM_PC12, 54)
+ RELOC_NUMBER (R_ARM_ABS32_NOI, 55)
+ RELOC_NUMBER (R_ARM_REL32_NOI, 56)
+ RELOC_NUMBER (R_ARM_ALU_PC_G0_NC, 57)
+ RELOC_NUMBER (R_ARM_ALU_PC_G0, 58)
+ RELOC_NUMBER (R_ARM_ALU_PC_G1_NC, 59)
+ RELOC_NUMBER (R_ARM_ALU_PC_G1, 60)
+ RELOC_NUMBER (R_ARM_ALU_PC_G2, 61)
+ RELOC_NUMBER (R_ARM_LDR_PC_G1, 62)
+ RELOC_NUMBER (R_ARM_LDR_PC_G2, 63)
+ RELOC_NUMBER (R_ARM_LDRS_PC_G0, 64)
+ RELOC_NUMBER (R_ARM_LDRS_PC_G1, 65)
+ RELOC_NUMBER (R_ARM_LDRS_PC_G2, 66)
+ RELOC_NUMBER (R_ARM_LDC_PC_G0, 67)
+ RELOC_NUMBER (R_ARM_LDC_PC_G1, 68)
+ RELOC_NUMBER (R_ARM_LDC_PC_G2, 69)
+ RELOC_NUMBER (R_ARM_ALU_SB_G0_NC, 70)
+ RELOC_NUMBER (R_ARM_ALU_SB_G0, 71)
+ RELOC_NUMBER (R_ARM_ALU_SB_G1_NC, 72)
+ RELOC_NUMBER (R_ARM_ALU_SB_G1, 73)
+ RELOC_NUMBER (R_ARM_ALU_SB_G2, 74)
+ RELOC_NUMBER (R_ARM_LDR_SB_G0, 75)
+ RELOC_NUMBER (R_ARM_LDR_SB_G1, 76)
+ RELOC_NUMBER (R_ARM_LDR_SB_G2, 77)
+ RELOC_NUMBER (R_ARM_LDRS_SB_G0, 78)
+ RELOC_NUMBER (R_ARM_LDRS_SB_G1, 79)
+ RELOC_NUMBER (R_ARM_LDRS_SB_G2, 80)
+ RELOC_NUMBER (R_ARM_LDC_SB_G0, 81)
+ RELOC_NUMBER (R_ARM_LDC_SB_G1, 82)
+ RELOC_NUMBER (R_ARM_LDC_SB_G2, 83)
+ RELOC_NUMBER (R_ARM_MOVW_BREL_NC, 84)
+ RELOC_NUMBER (R_ARM_MOVT_BREL, 85)
+ RELOC_NUMBER (R_ARM_MOVW_BREL, 86)
+ RELOC_NUMBER (R_ARM_THM_MOVW_BREL_NC, 87)
+ RELOC_NUMBER (R_ARM_THM_MOVT_BREL, 88)
+ RELOC_NUMBER (R_ARM_THM_MOVW_BREL, 89)
+ /* 90-93 unallocated */
+ RELOC_NUMBER (R_ARM_PLT32_ABS, 94)
+ RELOC_NUMBER (R_ARM_GOT_ABS, 95)
+ RELOC_NUMBER (R_ARM_GOT_PREL, 96)
+ RELOC_NUMBER (R_ARM_GOT_BREL12, 97)
+ RELOC_NUMBER (R_ARM_GOTOFF12, 98)
+ RELOC_NUMBER (R_ARM_GOTRELAX, 99)
+ RELOC_NUMBER (R_ARM_GNU_VTENTRY, 100) /* deprecated - old C++ abi */
+ RELOC_NUMBER (R_ARM_GNU_VTINHERIT, 101) /* deprecated - old C++ abi */
+ RELOC_NUMBER (R_ARM_THM_JUMP11, 102)
+ RELOC_NUMBER (R_ARM_THM_JUMP8, 103)
+ RELOC_NUMBER (R_ARM_TLS_GD32, 104)
+ RELOC_NUMBER (R_ARM_TLS_LDM32, 105)
+ RELOC_NUMBER (R_ARM_TLS_LDO32, 106)
+ RELOC_NUMBER (R_ARM_TLS_IE32, 107)
+ RELOC_NUMBER (R_ARM_TLS_LE32, 108)
+ RELOC_NUMBER (R_ARM_TLS_LDO12, 109)
+ RELOC_NUMBER (R_ARM_TLS_LE12, 110)
+ RELOC_NUMBER (R_ARM_TLS_IE12GP, 111)
+ /* 112 - 127 private range */
+ RELOC_NUMBER (R_ARM_ME_TOO, 128) /* obsolete */
+
+ /* Extensions? R=read-only? */
+ RELOC_NUMBER (R_ARM_RXPC25, 249)
+ RELOC_NUMBER (R_ARM_RSBREL32, 250)
+ RELOC_NUMBER (R_ARM_THM_RPC22, 251)
+ RELOC_NUMBER (R_ARM_RREL32, 252)
+ RELOC_NUMBER (R_ARM_RABS32, 253)
+ RELOC_NUMBER (R_ARM_RPC24, 254)
+ RELOC_NUMBER (R_ARM_RBASE, 255)
+
+ /* Unofficial names for some of the relocs. */
+ FAKE_RELOC (R_ARM_GOTOFF, R_ARM_GOTOFF32) /* 32 bit offset to GOT. */
+ FAKE_RELOC (R_ARM_THM_PC22, R_ARM_THM_CALL)
+ FAKE_RELOC (R_ARM_THM_PC11, R_ARM_THM_JUMP11)
+ FAKE_RELOC (R_ARM_THM_PC9, R_ARM_THM_JUMP8)
+
+ /* Relocs with both a different name, and (apparently) different meaning in
+ GNU usage. */
+ FAKE_RELOC (R_ARM_GOTPC, R_ARM_BASE_PREL) /* 32 bit PC relative offset to GOT. */
+ FAKE_RELOC (R_ARM_GOT32, R_ARM_GOT_BREL) /* 32 bit GOT entry. */
+ FAKE_RELOC (R_ARM_ROSEGREL32, R_ARM_SBREL31) /* ??? */
+ FAKE_RELOC (R_ARM_AMP_VCALL9, R_ARM_BREL_ADJ) /* Thumb-something. Not used. */
+
+END_RELOC_NUMBERS (R_ARM_max = 256)
+
+#ifdef BFD_ARCH_SIZE
+/* EABI object attributes. */
+
+enum
+{
+ /* 0-3 are generic. */
+ Tag_CPU_raw_name = 4,
+ Tag_CPU_name,
+ Tag_CPU_arch,
+ Tag_CPU_arch_profile,
+ Tag_ARM_ISA_use,
+ Tag_THUMB_ISA_use,
+ Tag_VFP_arch,
+ Tag_WMMX_arch,
+ Tag_NEON_arch,
+ Tag_PCS_config,
+ Tag_ABI_PCS_R9_use,
+ Tag_ABI_PCS_RW_data,
+ Tag_ABI_PCS_RO_data,
+ Tag_ABI_PCS_GOT_use,
+ Tag_ABI_PCS_wchar_t,
+ Tag_ABI_FP_rounding,
+ Tag_ABI_FP_denormal,
+ Tag_ABI_FP_exceptions,
+ Tag_ABI_FP_user_exceptions,
+ Tag_ABI_FP_number_model,
+ Tag_ABI_align8_needed,
+ Tag_ABI_align8_preserved,
+ Tag_ABI_enum_size,
+ Tag_ABI_HardFP_use,
+ Tag_ABI_VFP_args,
+ Tag_ABI_WMMX_args,
+ Tag_ABI_optimization_goals,
+ Tag_ABI_FP_optimization_goals,
+ /* 32 is generic. */
+};
+
+#endif
+
+/* The name of the note section used to identify arm variants. */
+#define ARM_NOTE_SECTION ".note.gnu.arm.ident"
+
+/* Special section names. */
+#define ELF_STRING_ARM_unwind ".ARM.exidx"
+#define ELF_STRING_ARM_unwind_info ".ARM.extab"
+#define ELF_STRING_ARM_unwind_once ".gnu.linkonce.armexidx."
+#define ELF_STRING_ARM_unwind_info_once ".gnu.linkonce.armextab."
+
+#endif /* _TOOLCHAIN_NXFLAT_THUMB2_ARCH_H */
diff --git a/misc/buildroot/toolchain/nxflat/thumb2/dyncall_skeleton.def b/misc/buildroot/toolchain/nxflat/thumb2/dyncall_skeleton.def
index bc7c7f076..935e2f59d 100644
--- a/misc/buildroot/toolchain/nxflat/thumb2/dyncall_skeleton.def
+++ b/misc/buildroot/toolchain/nxflat/thumb2/dyncall_skeleton.def
@@ -148,6 +148,8 @@ static const char dyncall_decl_prologue[] =
#define MKCALLARGS(fn, i) (fn), (fn), (fn), (fn), (i), (i), (i), (fn), (fn)
+#ifdef __USE_GOT__
+
static const char dyncall_format[] =
"\n/* Dynamic call logic for imported symbol %s */\n\n"
"\t.global\t%s\n"
@@ -157,7 +159,7 @@ static const char dyncall_format[] =
"\tstmdb\tsp!,{r4, lr}\n"
"\tldr\tr4,.Ldyn%04d\n"
"\tldr\tr4,[sl,r4]\n"
- "\tldr\tr4,[r4,#0]\n"
+ "\tldr\tr4,[r4,#4]\n"
"\tblx\tr4\n"
"\tldmia\tsp!,{r4, pc}\n"
".Ldyn%04d:\n"
@@ -172,12 +174,46 @@ static const char nonreturning_dyncall_format[] =
"%s:\n"
"\tldr\tr4,.Ldyn%04d\n"
"\tldr\tr4,[sl,r4]\n"
- "\tldr\tr4,[r4,#0]\n"
+ "\tldr\tr4,[r4,#4]\n"
"\tbx\tr4\n"
".Ldyn%04d:\n"
"\t.word\t__dyninfo%04d(GOT)\n"
"\t.size\t%s, .-%s\n";
+#else
+
+static const char dyncall_format[] =
+ "\n/* Dynamic call logic for imported symbol %s */\n\n"
+ "\t.global\t%s\n"
+ "\t.type\t%s, function\n"
+ "\t.thumb_func\n\n"
+ "%s:\n"
+ "\tstmdb\tsp!,{r4, lr}\n"
+ "\tldr\tr4,.Ldyn%04d\n"
+ "\tadd\tr4,r4,sl\n"
+ "\tldr\tr4,[r4,#4]\n"
+ "\tblx\tr4\n"
+ "\tldmia\tsp!,{r4, pc}\n"
+ ".Ldyn%04d:\n"
+ "\t.word\t__dyninfo%04d\n"
+ "\t.size\t%s, .-%s\n";
+
+static const char nonreturning_dyncall_format[] =
+ "\n/* Dynamic call logic for imported, non-returning symbol %s */\n\n"
+ "\t.global\t%s\n"
+ "\t.type\t%s, function\n"
+ "\t.thumb_func\n\n"
+ "%s:\n"
+ "\tldr\tr4,.Ldyn%04d\n"
+ "\tadd\tr4,r4,sl\n"
+ "\tldr\tr4,[r4,#4]\n"
+ "\tbx\tr4\n"
+ ".Ldyn%04d:\n"
+ "\t.word\t__dyninfo%04d\n"
+ "\t.size\t%s, .-%s\n";
+
+#endif
+
/*******************************************************************
* File Epilogue
*******************************************************************/