Back to index

cell-binutils  2.17cvs20070401
pc532-mach.c
Go to the documentation of this file.
00001 /* BFD back-end for Mach3/532 a.out-ish binaries.
00002    Copyright 1990, 1991, 1992, 1994, 1995, 2000, 2001, 2002
00003    Free Software Foundation, Inc.
00004 
00005 This file is part of BFD, the Binary File Descriptor library.
00006 
00007 This program is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 This program is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with this program; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 /* Written by Ian Dall
00022  *            19-Apr-94
00023  *
00024  * Formerly part of aout-pc532-mach.c. Split out to allow more
00025  * flexibility with multiple formats.
00026  *
00027  */
00028 /* This architecture has N_TXTOFF and N_TXTADDR defined as if
00029  * N_HEADER_IN_TEXT, but the a_text entry (text size) does not include the
00030  * space for the header. So we have N_HEADER_IN_TEXT defined to
00031  * 1 and specially define our own N_TXTSIZE
00032  */
00033 
00034 #define N_HEADER_IN_TEXT(x) 1
00035 #define N_TXTSIZE(x) ((x).a_text)
00036 
00037 #define TEXT_START_ADDR 0x10000       /* from old ld */
00038 #define TARGET_PAGE_SIZE 0x1000       /* from old ld,  032 & 532 are really 512/4k */
00039 
00040 /* Use a_entry of 0 to distinguish object files from OMAGIC executables */
00041 #define N_TXTADDR(x) \
00042   (N_MAGIC(x) == OMAGIC ? \
00043    ((x).a_entry < TEXT_START_ADDR? 0: TEXT_START_ADDR): \
00044    (N_MAGIC(x) == NMAGIC? TEXT_START_ADDR: \
00045     TEXT_START_ADDR + EXEC_BYTES_SIZE))
00046 
00047 #define       SEGMENT_SIZE  TARGET_PAGE_SIZE
00048 
00049 #define N_SHARED_LIB(x) 0
00050 #define SEGMENT_SIZE TARGET_PAGE_SIZE
00051 #define DEFAULT_ARCH bfd_arch_ns32k
00052 
00053 /* Do not "beautify" the CONCAT* macro args.  Traditional C will not
00054    remove whitespace added here, and thus will fail to concatenate
00055    the tokens.  */
00056 #define MY(OP) CONCAT2 (pc532machaout_,OP)
00057 
00058 /* Must be the same as aout-ns32k.c */
00059 #define NAME(x,y) CONCAT3 (ns32kaout,_32_,y)
00060 
00061 #define TARGETNAME "a.out-pc532-mach"
00062 
00063 #include "bfd.h"
00064 #include "sysdep.h"
00065 #include "libaout.h"
00066 #include "libbfd.h"
00067 #include "aout/aout64.h"
00068 
00069 #define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup
00070 
00071 /* libaout doesn't use NAME for these ...  */
00072 
00073 #define MY_get_section_contents aout_32_get_section_contents
00074 
00075 #define MY_text_includes_header 1
00076 
00077 #define MY_exec_header_not_counted 1
00078 
00079 reloc_howto_type *ns32kaout_bfd_reloc_type_lookup
00080   PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
00081 
00082 static bfd_boolean MY(write_object_contents)
00083   PARAMS ((bfd *abfd));
00084 
00085 static bfd_boolean
00086 MY(write_object_contents) (abfd)
00087      bfd *abfd;
00088 {
00089   struct external_exec exec_bytes;
00090   struct internal_exec *execp = exec_hdr (abfd);
00091 
00092   obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
00093 
00094   BFD_ASSERT (bfd_get_arch (abfd) == bfd_arch_ns32k);
00095   switch (bfd_get_mach (abfd))
00096     {
00097     case 32032:
00098       N_SET_MACHTYPE (*execp, M_NS32032);
00099       break;
00100     case 32532:
00101     default:
00102       N_SET_MACHTYPE (*execp, M_NS32532);
00103       break;
00104     }
00105   N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
00106 
00107   WRITE_HEADERS(abfd, execp);
00108 
00109   return TRUE;
00110 }
00111 
00112 #define MY_write_object_contents MY(write_object_contents)
00113 
00114 #include "aout-target.h"