OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [bfd/] [netbsd.h] - Blame information for rev 298

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* BFD back-end definitions used by all NetBSD targets.
2
   Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 2000, 2002,
3
   2005, 2007 Free Software Foundation, Inc.
4
 
5
   This file is part of BFD, the Binary File Descriptor library.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program; if not, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20
   MA 02110-1301, USA.  */
21
 
22
 
23
/* Check for our machine type (part of magic number).  */
24
#ifndef MACHTYPE_OK
25
#define MACHTYPE_OK(m) ((m) == DEFAULT_MID || (m) == M_UNKNOWN)
26
#endif
27
 
28
/* This is the normal load address for executables.  */
29
#define TEXT_START_ADDR         TARGET_PAGE_SIZE
30
 
31
/* NetBSD ZMAGIC has its header in the text segment.  */
32
#define N_HEADER_IN_TEXT(x)     1
33
 
34
/* Determine if this is a shared library using the flags.  */
35
#define N_SHARED_LIB(x)         (N_DYNAMIC (x))
36
 
37
/* We have 6 bits of flags and 10 bits of machine ID.  */
38
#define N_MACHTYPE(exec) \
39
        ((enum machine_type) (((exec).a_info >> 16) & 0x03ff))
40
#define N_FLAGS(exec) \
41
        (((exec).a_info >> 26) & 0x3f)
42
 
43
#define N_SET_INFO(exec, magic, type, flags) \
44
        ((exec).a_info = ((magic) & 0xffff) \
45
         | (((int) (type) & 0x3ff) << 16) \
46
         | (((flags) & 0x3f) << 24))
47
#define N_SET_MACHTYPE(exec, machtype) \
48
        ((exec).a_info = \
49
         ((exec).a_info & 0xfb00ffff) | ((((int) (machtype)) & 0x3ff) << 16))
50
#define N_SET_FLAGS(exec, flags) \
51
        ((exec).a_info = \
52
         ((exec).a_info & 0x03ffffff) | ((flags & 0x03f) << 26))
53
 
54
#include "sysdep.h"
55
#include "bfd.h"
56
#include "libbfd.h"
57
#include "libaout.h"
58
 
59
/* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
60
   format.  */
61
#define SWAP_MAGIC(ext) bfd_getb32 (ext)
62
 
63
/* On NetBSD, the entry point may be taken to be the start of the text
64
   section.  */
65
#define MY_entry_is_text_address 1
66
 
67
#define MY_write_object_contents MY (write_object_contents)
68
static bfd_boolean MY (write_object_contents) (bfd *);
69
 
70
#define MY_text_includes_header 1
71
 
72
#include "aout-target.h"
73
 
74
/* Write an object file.
75
   Section contents have already been written.  We write the
76
   file header, symbols, and relocation.  */
77
 
78
static bfd_boolean
79
MY (write_object_contents) (bfd *abfd)
80
{
81
  struct external_exec exec_bytes;
82
  struct internal_exec *execp = exec_hdr (abfd);
83
 
84
  /* We must make certain that the magic number has been set.  This
85
     will normally have been done by set_section_contents, but only if
86
     there actually are some section contents.  */
87
  if (! abfd->output_has_begun)
88
    {
89
      bfd_size_type text_size;
90
      file_ptr text_end;
91
 
92
      NAME (aout, adjust_sizes_and_vmas) (abfd, & text_size, & text_end);
93
    }
94
 
95
  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
96
 
97
  /* Magic number, maestro, please!  */
98
  switch (bfd_get_arch(abfd))
99
    {
100
    case DEFAULT_ARCH:
101
      N_SET_MACHTYPE(*execp, DEFAULT_MID);
102
      break;
103
    default:
104
      N_SET_MACHTYPE(*execp, M_UNKNOWN);
105
      break;
106
    }
107
 
108
  /* The NetBSD magic number is always big-endian */
109
#ifndef TARGET_IS_BIG_ENDIAN_P
110
  /* XXX aren't there any macro to change byteorder of a word independent of
111
     the host's or target's endianesses?  */
112
  execp->a_info
113
    = (execp->a_info & 0xff) << 24 | (execp->a_info & 0xff00) << 8
114
      | (execp->a_info & 0xff0000) >> 8 | (execp->a_info & 0xff000000) >> 24;
115
#endif
116
 
117
  WRITE_HEADERS (abfd, execp);
118
 
119
  return TRUE;
120
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.