1*3d8817e4Smiod /* BFD back-end for Mach3/532 a.out-ish binaries. 2*3d8817e4Smiod Copyright 1990, 1991, 1992, 1994, 1995, 2000, 2001, 2002 3*3d8817e4Smiod Free Software Foundation, Inc. 4*3d8817e4Smiod 5*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library. 6*3d8817e4Smiod 7*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 8*3d8817e4Smiod it under the terms of the GNU General Public License as published by 9*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 10*3d8817e4Smiod (at your option) any later version. 11*3d8817e4Smiod 12*3d8817e4Smiod This program is distributed in the hope that it will be useful, 13*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 14*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*3d8817e4Smiod GNU General Public License for more details. 16*3d8817e4Smiod 17*3d8817e4Smiod You should have received a copy of the GNU General Public License 18*3d8817e4Smiod along with this program; if not, write to the Free Software 19*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 20*3d8817e4Smiod 21*3d8817e4Smiod /* Written by Ian Dall 22*3d8817e4Smiod * 19-Apr-94 23*3d8817e4Smiod * 24*3d8817e4Smiod * Formerly part of aout-pc532-mach.c. Split out to allow more 25*3d8817e4Smiod * flexibility with multiple formats. 26*3d8817e4Smiod * 27*3d8817e4Smiod */ 28*3d8817e4Smiod /* This architecture has N_TXTOFF and N_TXTADDR defined as if 29*3d8817e4Smiod * N_HEADER_IN_TEXT, but the a_text entry (text size) does not include the 30*3d8817e4Smiod * space for the header. So we have N_HEADER_IN_TEXT defined to 31*3d8817e4Smiod * 1 and specially define our own N_TXTSIZE 32*3d8817e4Smiod */ 33*3d8817e4Smiod 34*3d8817e4Smiod #define N_HEADER_IN_TEXT(x) 1 35*3d8817e4Smiod #define N_TXTSIZE(x) ((x).a_text) 36*3d8817e4Smiod 37*3d8817e4Smiod #define TEXT_START_ADDR 0x10000 /* from old ld */ 38*3d8817e4Smiod #define TARGET_PAGE_SIZE 0x1000 /* from old ld, 032 & 532 are really 512/4k */ 39*3d8817e4Smiod 40*3d8817e4Smiod /* Use a_entry of 0 to distinguish object files from OMAGIC executables */ 41*3d8817e4Smiod #define N_TXTADDR(x) \ 42*3d8817e4Smiod (N_MAGIC(x) == OMAGIC ? \ 43*3d8817e4Smiod ((x).a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \ 44*3d8817e4Smiod (N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \ 45*3d8817e4Smiod TEXT_START_ADDR + EXEC_BYTES_SIZE)) 46*3d8817e4Smiod 47*3d8817e4Smiod #define SEGMENT_SIZE TARGET_PAGE_SIZE 48*3d8817e4Smiod 49*3d8817e4Smiod #define N_SHARED_LIB(x) 0 50*3d8817e4Smiod #define SEGMENT_SIZE TARGET_PAGE_SIZE 51*3d8817e4Smiod #define DEFAULT_ARCH bfd_arch_ns32k 52*3d8817e4Smiod 53*3d8817e4Smiod /* Do not "beautify" the CONCAT* macro args. Traditional C will not 54*3d8817e4Smiod remove whitespace added here, and thus will fail to concatenate 55*3d8817e4Smiod the tokens. */ 56*3d8817e4Smiod #define MY(OP) CONCAT2 (pc532machaout_,OP) 57*3d8817e4Smiod 58*3d8817e4Smiod /* Must be the same as aout-ns32k.c */ 59*3d8817e4Smiod #define NAME(x,y) CONCAT3 (ns32kaout,_32_,y) 60*3d8817e4Smiod 61*3d8817e4Smiod #define TARGETNAME "a.out-pc532-mach" 62*3d8817e4Smiod 63*3d8817e4Smiod #include "bfd.h" 64*3d8817e4Smiod #include "sysdep.h" 65*3d8817e4Smiod #include "libaout.h" 66*3d8817e4Smiod #include "libbfd.h" 67*3d8817e4Smiod #include "aout/aout64.h" 68*3d8817e4Smiod 69*3d8817e4Smiod #define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup 70*3d8817e4Smiod 71*3d8817e4Smiod /* libaout doesn't use NAME for these ... */ 72*3d8817e4Smiod 73*3d8817e4Smiod #define MY_get_section_contents aout_32_get_section_contents 74*3d8817e4Smiod 75*3d8817e4Smiod #define MY_text_includes_header 1 76*3d8817e4Smiod 77*3d8817e4Smiod #define MY_exec_header_not_counted 1 78*3d8817e4Smiod 79*3d8817e4Smiod reloc_howto_type *ns32kaout_bfd_reloc_type_lookup 80*3d8817e4Smiod PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); 81*3d8817e4Smiod 82*3d8817e4Smiod static bfd_boolean MY(write_object_contents) 83*3d8817e4Smiod PARAMS ((bfd *abfd)); 84*3d8817e4Smiod 85*3d8817e4Smiod static bfd_boolean 86*3d8817e4Smiod MY(write_object_contents) (abfd) 87*3d8817e4Smiod bfd *abfd; 88*3d8817e4Smiod { 89*3d8817e4Smiod struct external_exec exec_bytes; 90*3d8817e4Smiod struct internal_exec *execp = exec_hdr (abfd); 91*3d8817e4Smiod 92*3d8817e4Smiod obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; 93*3d8817e4Smiod 94*3d8817e4Smiod BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_ns32k); 95*3d8817e4Smiod switch (bfd_get_mach (abfd)) 96*3d8817e4Smiod { 97*3d8817e4Smiod case 32032: 98*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_NS32032); 99*3d8817e4Smiod break; 100*3d8817e4Smiod case 32532: 101*3d8817e4Smiod default: 102*3d8817e4Smiod N_SET_MACHTYPE (*execp, M_NS32532); 103*3d8817e4Smiod break; 104*3d8817e4Smiod } 105*3d8817e4Smiod N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags); 106*3d8817e4Smiod 107*3d8817e4Smiod WRITE_HEADERS(abfd, execp); 108*3d8817e4Smiod 109*3d8817e4Smiod return TRUE; 110*3d8817e4Smiod } 111*3d8817e4Smiod 112*3d8817e4Smiod #define MY_write_object_contents MY(write_object_contents) 113*3d8817e4Smiod 114*3d8817e4Smiod #include "aout-target.h" 115