1b305b0f1Sespie /* ARM COFF support for BFD. 2*c074d1c9Sdrahn Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc. 32159047fSniklas 4b305b0f1Sespie This file is part of BFD, the Binary File Descriptor library. 5b305b0f1Sespie 6b305b0f1Sespie This program is free software; you can redistribute it and/or modify 7b305b0f1Sespie it under the terms of the GNU General Public License as published by 8b305b0f1Sespie the Free Software Foundation; either version 2 of the License, or 9b305b0f1Sespie (at your option) any later version. 10b305b0f1Sespie 11b305b0f1Sespie This program is distributed in the hope that it will be useful, 12b305b0f1Sespie but WITHOUT ANY WARRANTY; without even the implied warranty of 13b305b0f1Sespie MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14b305b0f1Sespie GNU General Public License for more details. 15b305b0f1Sespie 16b305b0f1Sespie You should have received a copy of the GNU General Public License 17b305b0f1Sespie along with this program; if not, write to the Free Software Foundation, 18b305b0f1Sespie Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 19b305b0f1Sespie 20b305b0f1Sespie #define COFFARM 1 212159047fSniklas 22*c074d1c9Sdrahn #define L_LNNO_SIZE 2 23*c074d1c9Sdrahn #define INCLUDE_COMDAT_FIELDS_IN_AUXENT 24*c074d1c9Sdrahn #include "coff/external.h" 252159047fSniklas 262159047fSniklas /* Bits for f_flags: 27*c074d1c9Sdrahn F_RELFLG relocation info stripped from file 28*c074d1c9Sdrahn F_EXEC file is executable (no unresolved external references) 29*c074d1c9Sdrahn F_LNNO line numbers stripped from file 30*c074d1c9Sdrahn F_LSYMS local symbols stripped from file 31*c074d1c9Sdrahn F_INTERWORK file supports switching between ARM and Thumb instruction sets 32*c074d1c9Sdrahn F_INTERWORK_SET the F_INTERWORK bit is valid 33*c074d1c9Sdrahn F_APCS_FLOAT code passes float arguments in float registers 34*c074d1c9Sdrahn F_PIC code is reentrant/position-independent 35*c074d1c9Sdrahn F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) 36*c074d1c9Sdrahn F_APCS_26 file uses 26 bit ARM Procedure Calling Standard 37*c074d1c9Sdrahn F_APCS_SET the F_APCS_26, F_APCS_FLOAT and F_PIC bits have been initialised 38*c074d1c9Sdrahn F_SOFT_FLOAT code does not use floating point instructions. */ 392159047fSniklas 402159047fSniklas #define F_RELFLG (0x0001) 412159047fSniklas #define F_EXEC (0x0002) 422159047fSniklas #define F_LNNO (0x0004) 432159047fSniklas #define F_LSYMS (0x0008) 44b305b0f1Sespie #define F_INTERWORK (0x0010) 45b305b0f1Sespie #define F_INTERWORK_SET (0x0020) 46b305b0f1Sespie #define F_APCS_FLOAT (0x0040) 47b305b0f1Sespie #undef F_AR16WR 48b305b0f1Sespie #define F_PIC (0x0080) 49b305b0f1Sespie #define F_AR32WR (0x0100) 50b305b0f1Sespie #define F_APCS_26 (0x0400) 51b305b0f1Sespie #define F_APCS_SET (0x0800) 52b305b0f1Sespie #define F_SOFT_FLOAT (0x2000) 53*c074d1c9Sdrahn #define F_VFP_FLOAT (0x4000) 542159047fSniklas 55b305b0f1Sespie /* Bits stored in flags field of the internal_f structure */ 562159047fSniklas 57b305b0f1Sespie #define F_INTERWORK (0x0010) 58b305b0f1Sespie #define F_APCS_FLOAT (0x0040) 59b305b0f1Sespie #define F_PIC (0x0080) 60b305b0f1Sespie #define F_APCS26 (0x1000) 61b305b0f1Sespie #define F_ARM_ARCHITECTURE_MASK (0x4000+0x0800+0x0400) 62b305b0f1Sespie #define F_ARM_2 (0x0400) 63b305b0f1Sespie #define F_ARM_2a (0x0800) 64b305b0f1Sespie #define F_ARM_3 (0x0c00) 65b305b0f1Sespie #define F_ARM_3M (0x4000) 66b305b0f1Sespie #define F_ARM_4 (0x4400) 67b305b0f1Sespie #define F_ARM_4T (0x4800) 68b305b0f1Sespie #define F_ARM_5 (0x4c00) 692159047fSniklas 70b305b0f1Sespie /* 71*c074d1c9Sdrahn ARMMAGIC ought to encoded the procesor type, 72*c074d1c9Sdrahn but it is too late to change it now, instead 73*c074d1c9Sdrahn the flags field of the internal_f structure 74*c074d1c9Sdrahn is used as shown above. 75*c074d1c9Sdrahn 76*c074d1c9Sdrahn XXX - NC 5/6/97. */ 77b305b0f1Sespie 78b305b0f1Sespie #define ARMMAGIC 0xa00 /* I just made this up */ 792159047fSniklas 802159047fSniklas #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC)) 812159047fSniklas 82b305b0f1Sespie #define ARMPEMAGIC 0x1c0 83b305b0f1Sespie #define THUMBPEMAGIC 0x1c2 84b305b0f1Sespie 85b305b0f1Sespie #undef ARMBADMAG 86b305b0f1Sespie #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC)) 87b305b0f1Sespie 882159047fSniklas #define OMAGIC 0404 /* object files, eg as output */ 892159047fSniklas #define ZMAGIC 0413 /* demand load format, eg normal ld output */ 902159047fSniklas #define STMAGIC 0401 /* target shlib */ 912159047fSniklas #define SHMAGIC 0443 /* host shlib */ 922159047fSniklas 932159047fSniklas /* define some NT default values */ 942159047fSniklas /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ 952159047fSniklas #define NT_SECTION_ALIGNMENT 0x1000 962159047fSniklas #define NT_FILE_ALIGNMENT 0x200 972159047fSniklas #define NT_DEF_RESERVE 0x100000 982159047fSniklas #define NT_DEF_COMMIT 0x1000 992159047fSniklas 100b305b0f1Sespie /* We use the .rdata section to hold read only data. */ 101b305b0f1Sespie #define _LIT ".rdata" 102b305b0f1Sespie 1032159047fSniklas /********************** RELOCATION DIRECTIVES **********************/ 104b305b0f1Sespie #ifdef ARM_WINCE 105b305b0f1Sespie struct external_reloc 106b305b0f1Sespie { 107b305b0f1Sespie char r_vaddr[4]; 108b305b0f1Sespie char r_symndx[4]; 109b305b0f1Sespie char r_type[2]; 110b305b0f1Sespie }; 1112159047fSniklas 112b305b0f1Sespie #define RELOC struct external_reloc 113b305b0f1Sespie #define RELSZ 10 1142159047fSniklas 115b305b0f1Sespie #else 116b305b0f1Sespie struct external_reloc 117b305b0f1Sespie { 1182159047fSniklas char r_vaddr[4]; 1192159047fSniklas char r_symndx[4]; 1202159047fSniklas char r_type[2]; 1212159047fSniklas char r_offset[4]; 1222159047fSniklas }; 1232159047fSniklas 1242159047fSniklas #define RELOC struct external_reloc 1250c6d0228Sniklas #define RELSZ 14 126b305b0f1Sespie #endif 127*c074d1c9Sdrahn 128*c074d1c9Sdrahn #define ARM_NOTE_SECTION ".note" 129