| 1 |
14 |
khays |
/* Define a target vector and some small routines for a variant of a.out.
|
| 2 |
|
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
| 3 |
148 |
khays |
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011
|
| 4 |
14 |
khays |
Free Software Foundation, Inc.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
| 7 |
|
|
|
| 8 |
|
|
This program is free software; you can redistribute it and/or modify
|
| 9 |
|
|
it under the terms of the GNU General Public License as published by
|
| 10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
| 11 |
|
|
(at your option) any later version.
|
| 12 |
|
|
|
| 13 |
|
|
This program is distributed in the hope that it will be useful,
|
| 14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
|
|
GNU General Public License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
You should have received a copy of the GNU General Public License
|
| 19 |
|
|
along with this program; if not, write to the Free Software
|
| 20 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
| 21 |
|
|
MA 02110-1301, USA. */
|
| 22 |
|
|
|
| 23 |
|
|
#include "aout/aout64.h"
|
| 24 |
|
|
#include "aout/stab_gnu.h"
|
| 25 |
|
|
#include "aout/ar.h"
|
| 26 |
|
|
/*#include "libaout.h"*/
|
| 27 |
|
|
|
| 28 |
|
|
#ifndef SEGMENT_SIZE
|
| 29 |
|
|
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
| 30 |
|
|
#endif
|
| 31 |
|
|
|
| 32 |
|
|
extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
|
| 33 |
|
|
extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
|
| 34 |
|
|
|
| 35 |
|
|
/* Set parameters about this a.out file that are machine-dependent.
|
| 36 |
|
|
This routine is called from some_aout_object_p just before it returns. */
|
| 37 |
|
|
#ifndef MY_callback
|
| 38 |
|
|
|
| 39 |
|
|
static const bfd_target *
|
| 40 |
|
|
MY (callback) (bfd *abfd)
|
| 41 |
|
|
{
|
| 42 |
|
|
struct internal_exec *execp = exec_hdr (abfd);
|
| 43 |
|
|
unsigned int arch_align_power;
|
| 44 |
|
|
unsigned long arch_align;
|
| 45 |
|
|
|
| 46 |
|
|
/* Calculate the file positions of the parts of a newly read aout header. */
|
| 47 |
|
|
obj_textsec (abfd)->size = N_TXTSIZE (*execp);
|
| 48 |
|
|
|
| 49 |
|
|
/* The virtual memory addresses of the sections. */
|
| 50 |
|
|
obj_textsec (abfd)->vma = N_TXTADDR (*execp);
|
| 51 |
|
|
obj_datasec (abfd)->vma = N_DATADDR (*execp);
|
| 52 |
|
|
obj_bsssec (abfd)->vma = N_BSSADDR (*execp);
|
| 53 |
|
|
|
| 54 |
|
|
/* For some targets, if the entry point is not in the same page
|
| 55 |
|
|
as the start of the text, then adjust the VMA so that it is.
|
| 56 |
|
|
FIXME: Do this with a macro like SET_ARCH_MACH instead? */
|
| 57 |
|
|
if (aout_backend_info (abfd)->entry_is_text_address
|
| 58 |
|
|
&& execp->a_entry > obj_textsec (abfd)->vma)
|
| 59 |
|
|
{
|
| 60 |
|
|
bfd_vma adjust;
|
| 61 |
|
|
|
| 62 |
|
|
adjust = execp->a_entry - obj_textsec (abfd)->vma;
|
| 63 |
|
|
/* Adjust only by whole pages. */
|
| 64 |
|
|
adjust &= ~(TARGET_PAGE_SIZE - 1);
|
| 65 |
|
|
obj_textsec (abfd)->vma += adjust;
|
| 66 |
|
|
obj_datasec (abfd)->vma += adjust;
|
| 67 |
|
|
obj_bsssec (abfd)->vma += adjust;
|
| 68 |
|
|
}
|
| 69 |
|
|
|
| 70 |
|
|
/* Set the load addresses to be the same as the virtual addresses. */
|
| 71 |
|
|
obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
|
| 72 |
|
|
obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
|
| 73 |
|
|
obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
|
| 74 |
|
|
|
| 75 |
|
|
/* The file offsets of the sections. */
|
| 76 |
|
|
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
|
| 77 |
|
|
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
|
| 78 |
|
|
|
| 79 |
|
|
/* The file offsets of the relocation info. */
|
| 80 |
|
|
obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);
|
| 81 |
|
|
obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);
|
| 82 |
|
|
|
| 83 |
|
|
/* The file offsets of the string table and symbol table. */
|
| 84 |
|
|
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
|
| 85 |
|
|
obj_str_filepos (abfd) = N_STROFF (*execp);
|
| 86 |
|
|
|
| 87 |
|
|
/* Determine the architecture and machine type of the object file. */
|
| 88 |
|
|
#ifdef SET_ARCH_MACH
|
| 89 |
|
|
SET_ARCH_MACH (abfd, *execp);
|
| 90 |
|
|
#else
|
| 91 |
|
|
bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
|
| 92 |
|
|
#endif
|
| 93 |
|
|
|
| 94 |
|
|
/* The number of relocation records. This must be called after
|
| 95 |
|
|
SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set
|
| 96 |
|
|
obj_reloc_entry_size correctly, if the reloc size is not
|
| 97 |
|
|
RELOC_STD_SIZE. */
|
| 98 |
|
|
obj_textsec (abfd)->reloc_count =
|
| 99 |
|
|
execp->a_trsize / obj_reloc_entry_size (abfd);
|
| 100 |
|
|
obj_datasec (abfd)->reloc_count =
|
| 101 |
|
|
execp->a_drsize / obj_reloc_entry_size (abfd);
|
| 102 |
|
|
|
| 103 |
|
|
/* Now that we know the architecture, set the alignments of the
|
| 104 |
|
|
sections. This is normally done by NAME (aout,new_section_hook),
|
| 105 |
|
|
but when the initial sections were created the architecture had
|
| 106 |
|
|
not yet been set. However, for backward compatibility, we don't
|
| 107 |
|
|
set the alignment power any higher than as required by the size
|
| 108 |
|
|
of the section. */
|
| 109 |
|
|
arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
|
| 110 |
|
|
arch_align = 1 << arch_align_power;
|
| 111 |
|
|
if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
|
| 112 |
|
|
== obj_textsec (abfd)->size)
|
| 113 |
|
|
&& (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
|
| 114 |
|
|
== obj_datasec (abfd)->size)
|
| 115 |
|
|
&& (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
|
| 116 |
|
|
== obj_bsssec (abfd)->size))
|
| 117 |
|
|
{
|
| 118 |
|
|
obj_textsec (abfd)->alignment_power = arch_align_power;
|
| 119 |
|
|
obj_datasec (abfd)->alignment_power = arch_align_power;
|
| 120 |
|
|
obj_bsssec (abfd)->alignment_power = arch_align_power;
|
| 121 |
|
|
}
|
| 122 |
|
|
|
| 123 |
|
|
/* Don't set sizes now -- can't be sure until we know arch & mach.
|
| 124 |
|
|
Sizes get set in set_sizes callback, later. */
|
| 125 |
|
|
|
| 126 |
|
|
return abfd->xvec;
|
| 127 |
|
|
}
|
| 128 |
|
|
#endif
|
| 129 |
|
|
|
| 130 |
|
|
#ifndef MY_object_p
|
| 131 |
|
|
/* Finish up the reading of an a.out file header. */
|
| 132 |
|
|
|
| 133 |
|
|
static const bfd_target *
|
| 134 |
|
|
MY (object_p) (bfd *abfd)
|
| 135 |
|
|
{
|
| 136 |
|
|
struct external_exec exec_bytes; /* Raw exec header from file. */
|
| 137 |
|
|
struct internal_exec exec; /* Cleaned-up exec header. */
|
| 138 |
|
|
const bfd_target *target;
|
| 139 |
|
|
bfd_size_type amt = EXEC_BYTES_SIZE;
|
| 140 |
|
|
|
| 141 |
|
|
if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
|
| 142 |
|
|
{
|
| 143 |
|
|
if (bfd_get_error () != bfd_error_system_call)
|
| 144 |
|
|
bfd_set_error (bfd_error_wrong_format);
|
| 145 |
|
|
return 0;
|
| 146 |
|
|
}
|
| 147 |
|
|
|
| 148 |
|
|
#ifdef SWAP_MAGIC
|
| 149 |
|
|
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
| 150 |
|
|
#else
|
| 151 |
|
|
exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
|
| 152 |
|
|
#endif
|
| 153 |
|
|
|
| 154 |
|
|
if (N_BADMAG (exec))
|
| 155 |
|
|
return 0;
|
| 156 |
|
|
|
| 157 |
|
|
#ifdef MACHTYPE_OK
|
| 158 |
|
|
if (!(MACHTYPE_OK (N_MACHTYPE (exec))))
|
| 159 |
|
|
return 0;
|
| 160 |
|
|
#endif
|
| 161 |
|
|
|
| 162 |
|
|
NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
|
| 163 |
|
|
|
| 164 |
|
|
#ifdef SWAP_MAGIC
|
| 165 |
|
|
/* Swap_exec_header_in read in a_info with the wrong byte order. */
|
| 166 |
|
|
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
|
| 167 |
|
|
#endif
|
| 168 |
|
|
|
| 169 |
|
|
target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
|
| 170 |
|
|
|
| 171 |
|
|
#ifdef ENTRY_CAN_BE_ZERO
|
| 172 |
|
|
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
|
| 173 |
|
|
means that it isn't obvious if EXEC_P should be set.
|
| 174 |
|
|
All of the following must be true for an executable:
|
| 175 |
|
|
There must be no relocations, the bfd can be neither an
|
| 176 |
|
|
archive nor an archive element, and the file must be executable. */
|
| 177 |
|
|
|
| 178 |
|
|
if (exec.a_trsize + exec.a_drsize == 0
|
| 179 |
|
|
&& bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
|
| 180 |
|
|
{
|
| 181 |
|
|
struct stat buf;
|
| 182 |
|
|
#ifndef S_IXUSR
|
| 183 |
|
|
#define S_IXUSR 0100 /* Execute by owner. */
|
| 184 |
|
|
#endif
|
| 185 |
|
|
if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
|
| 186 |
|
|
abfd->flags |= EXEC_P;
|
| 187 |
|
|
}
|
| 188 |
|
|
#endif /* ENTRY_CAN_BE_ZERO */
|
| 189 |
|
|
|
| 190 |
|
|
return target;
|
| 191 |
|
|
}
|
| 192 |
|
|
#define MY_object_p MY (object_p)
|
| 193 |
|
|
#endif
|
| 194 |
|
|
|
| 195 |
|
|
#ifndef MY_mkobject
|
| 196 |
|
|
|
| 197 |
|
|
static bfd_boolean
|
| 198 |
|
|
MY (mkobject) (bfd *abfd)
|
| 199 |
|
|
{
|
| 200 |
|
|
return NAME (aout, mkobject (abfd));
|
| 201 |
|
|
}
|
| 202 |
|
|
|
| 203 |
|
|
#define MY_mkobject MY (mkobject)
|
| 204 |
|
|
#endif
|
| 205 |
|
|
|
| 206 |
|
|
#ifndef MY_bfd_copy_private_section_data
|
| 207 |
|
|
|
| 208 |
|
|
/* Copy private section data. This actually does nothing with the
|
| 209 |
|
|
sections. It copies the subformat field. We copy it here, because
|
| 210 |
|
|
we need to know whether this is a QMAGIC file before we set the
|
| 211 |
|
|
section contents, and copy_private_bfd_data is not called until
|
| 212 |
|
|
after the section contents have been set. */
|
| 213 |
|
|
|
| 214 |
|
|
static bfd_boolean
|
| 215 |
|
|
MY_bfd_copy_private_section_data (bfd *ibfd,
|
| 216 |
|
|
asection *isec ATTRIBUTE_UNUSED,
|
| 217 |
|
|
bfd *obfd,
|
| 218 |
|
|
asection *osec ATTRIBUTE_UNUSED)
|
| 219 |
|
|
{
|
| 220 |
|
|
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
|
| 221 |
|
|
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
|
| 222 |
|
|
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
|
| 223 |
|
|
return TRUE;
|
| 224 |
|
|
}
|
| 225 |
|
|
|
| 226 |
|
|
#endif
|
| 227 |
|
|
|
| 228 |
|
|
/* Write an object file.
|
| 229 |
|
|
Section contents have already been written. We write the
|
| 230 |
|
|
file header, symbols, and relocation. */
|
| 231 |
|
|
|
| 232 |
|
|
#ifndef MY_write_object_contents
|
| 233 |
|
|
|
| 234 |
|
|
static bfd_boolean
|
| 235 |
|
|
MY (write_object_contents) (bfd *abfd)
|
| 236 |
|
|
{
|
| 237 |
|
|
struct external_exec exec_bytes;
|
| 238 |
|
|
struct internal_exec *execp = exec_hdr (abfd);
|
| 239 |
|
|
|
| 240 |
|
|
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
| 241 |
|
|
|
| 242 |
|
|
WRITE_HEADERS (abfd, execp);
|
| 243 |
|
|
|
| 244 |
|
|
return TRUE;
|
| 245 |
|
|
}
|
| 246 |
|
|
#define MY_write_object_contents MY (write_object_contents)
|
| 247 |
|
|
#endif
|
| 248 |
|
|
|
| 249 |
|
|
#ifndef MY_set_sizes
|
| 250 |
|
|
|
| 251 |
|
|
static bfd_boolean
|
| 252 |
|
|
MY (set_sizes) (bfd *abfd)
|
| 253 |
|
|
{
|
| 254 |
|
|
adata(abfd).page_size = TARGET_PAGE_SIZE;
|
| 255 |
|
|
adata(abfd).segment_size = SEGMENT_SIZE;
|
| 256 |
|
|
|
| 257 |
|
|
#ifdef ZMAGIC_DISK_BLOCK_SIZE
|
| 258 |
|
|
adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
|
| 259 |
|
|
#else
|
| 260 |
|
|
adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
|
| 261 |
|
|
#endif
|
| 262 |
|
|
|
| 263 |
|
|
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
|
| 264 |
|
|
return TRUE;
|
| 265 |
|
|
}
|
| 266 |
|
|
#define MY_set_sizes MY (set_sizes)
|
| 267 |
|
|
#endif
|
| 268 |
|
|
|
| 269 |
|
|
#ifndef MY_exec_hdr_flags
|
| 270 |
|
|
#define MY_exec_hdr_flags 0
|
| 271 |
|
|
#endif
|
| 272 |
|
|
|
| 273 |
|
|
#ifndef MY_backend_data
|
| 274 |
|
|
|
| 275 |
|
|
#ifndef MY_zmagic_contiguous
|
| 276 |
|
|
#define MY_zmagic_contiguous 0
|
| 277 |
|
|
#endif
|
| 278 |
|
|
#ifndef MY_text_includes_header
|
| 279 |
|
|
#define MY_text_includes_header 0
|
| 280 |
|
|
#endif
|
| 281 |
|
|
#ifndef MY_entry_is_text_address
|
| 282 |
|
|
#define MY_entry_is_text_address 0
|
| 283 |
|
|
#endif
|
| 284 |
|
|
#ifndef MY_exec_header_not_counted
|
| 285 |
|
|
#define MY_exec_header_not_counted 0
|
| 286 |
|
|
#endif
|
| 287 |
|
|
#ifndef MY_add_dynamic_symbols
|
| 288 |
|
|
#define MY_add_dynamic_symbols 0
|
| 289 |
|
|
#endif
|
| 290 |
|
|
#ifndef MY_add_one_symbol
|
| 291 |
|
|
#define MY_add_one_symbol 0
|
| 292 |
|
|
#endif
|
| 293 |
|
|
#ifndef MY_link_dynamic_object
|
| 294 |
|
|
#define MY_link_dynamic_object 0
|
| 295 |
|
|
#endif
|
| 296 |
|
|
#ifndef MY_write_dynamic_symbol
|
| 297 |
|
|
#define MY_write_dynamic_symbol 0
|
| 298 |
|
|
#endif
|
| 299 |
|
|
#ifndef MY_check_dynamic_reloc
|
| 300 |
|
|
#define MY_check_dynamic_reloc 0
|
| 301 |
|
|
#endif
|
| 302 |
|
|
#ifndef MY_finish_dynamic_link
|
| 303 |
|
|
#define MY_finish_dynamic_link 0
|
| 304 |
|
|
#endif
|
| 305 |
|
|
|
| 306 |
|
|
static const struct aout_backend_data MY (backend_data) =
|
| 307 |
|
|
{
|
| 308 |
|
|
MY_zmagic_contiguous,
|
| 309 |
|
|
MY_text_includes_header,
|
| 310 |
|
|
MY_entry_is_text_address,
|
| 311 |
|
|
MY_exec_hdr_flags,
|
| 312 |
|
|
0, /* Text vma? */
|
| 313 |
|
|
MY_set_sizes,
|
| 314 |
|
|
MY_exec_header_not_counted,
|
| 315 |
|
|
MY_add_dynamic_symbols,
|
| 316 |
|
|
MY_add_one_symbol,
|
| 317 |
|
|
MY_link_dynamic_object,
|
| 318 |
|
|
MY_write_dynamic_symbol,
|
| 319 |
|
|
MY_check_dynamic_reloc,
|
| 320 |
|
|
MY_finish_dynamic_link
|
| 321 |
|
|
};
|
| 322 |
|
|
#define MY_backend_data &MY (backend_data)
|
| 323 |
|
|
#endif
|
| 324 |
|
|
|
| 325 |
|
|
#ifndef MY_final_link_callback
|
| 326 |
|
|
|
| 327 |
|
|
/* Callback for the final_link routine to set the section offsets. */
|
| 328 |
|
|
|
| 329 |
|
|
static void
|
| 330 |
|
|
MY_final_link_callback (bfd *abfd,
|
| 331 |
|
|
file_ptr *ptreloff,
|
| 332 |
|
|
file_ptr *pdreloff,
|
| 333 |
|
|
file_ptr *psymoff)
|
| 334 |
|
|
{
|
| 335 |
|
|
struct internal_exec *execp = exec_hdr (abfd);
|
| 336 |
|
|
|
| 337 |
|
|
*ptreloff = N_TRELOFF (*execp);
|
| 338 |
|
|
*pdreloff = N_DRELOFF (*execp);
|
| 339 |
|
|
*psymoff = N_SYMOFF (*execp);
|
| 340 |
|
|
}
|
| 341 |
|
|
|
| 342 |
|
|
#endif
|
| 343 |
|
|
|
| 344 |
|
|
#ifndef MY_bfd_final_link
|
| 345 |
|
|
|
| 346 |
|
|
/* Final link routine. We need to use a call back to get the correct
|
| 347 |
|
|
offsets in the output file. */
|
| 348 |
|
|
|
| 349 |
|
|
static bfd_boolean
|
| 350 |
|
|
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
| 351 |
|
|
{
|
| 352 |
|
|
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
|
| 353 |
|
|
}
|
| 354 |
|
|
|
| 355 |
|
|
#endif
|
| 356 |
|
|
|
| 357 |
|
|
/* We assume BFD generic archive files. */
|
| 358 |
|
|
#ifndef MY_openr_next_archived_file
|
| 359 |
|
|
#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
|
| 360 |
|
|
#endif
|
| 361 |
|
|
#ifndef MY_get_elt_at_index
|
| 362 |
|
|
#define MY_get_elt_at_index _bfd_generic_get_elt_at_index
|
| 363 |
|
|
#endif
|
| 364 |
|
|
#ifndef MY_generic_stat_arch_elt
|
| 365 |
|
|
#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt
|
| 366 |
|
|
#endif
|
| 367 |
|
|
#ifndef MY_slurp_armap
|
| 368 |
|
|
#define MY_slurp_armap bfd_slurp_bsd_armap
|
| 369 |
|
|
#endif
|
| 370 |
|
|
#ifndef MY_slurp_extended_name_table
|
| 371 |
|
|
#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table
|
| 372 |
|
|
#endif
|
| 373 |
|
|
#ifndef MY_construct_extended_name_table
|
| 374 |
|
|
#define MY_construct_extended_name_table \
|
| 375 |
|
|
_bfd_archive_bsd_construct_extended_name_table
|
| 376 |
|
|
#endif
|
| 377 |
|
|
#ifndef MY_write_armap
|
| 378 |
|
|
#define MY_write_armap bsd_write_armap
|
| 379 |
|
|
#endif
|
| 380 |
|
|
#ifndef MY_read_ar_hdr
|
| 381 |
|
|
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
|
| 382 |
|
|
#endif
|
| 383 |
|
|
#ifndef MY_write_ar_hdr
|
| 384 |
|
|
#define MY_write_ar_hdr _bfd_generic_write_ar_hdr
|
| 385 |
|
|
#endif
|
| 386 |
|
|
#ifndef MY_truncate_arname
|
| 387 |
|
|
#define MY_truncate_arname bfd_bsd_truncate_arname
|
| 388 |
|
|
#endif
|
| 389 |
|
|
#ifndef MY_update_armap_timestamp
|
| 390 |
|
|
#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
|
| 391 |
|
|
#endif
|
| 392 |
|
|
|
| 393 |
|
|
/* No core file defined here -- configure in trad-core.c separately. */
|
| 394 |
|
|
#ifndef MY_core_file_failing_command
|
| 395 |
|
|
#define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
|
| 396 |
|
|
#endif
|
| 397 |
|
|
#ifndef MY_core_file_failing_signal
|
| 398 |
|
|
#define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
| 399 |
|
|
#endif
|
| 400 |
|
|
#ifndef MY_core_file_matches_executable_p
|
| 401 |
|
|
#define MY_core_file_matches_executable_p \
|
| 402 |
|
|
_bfd_nocore_core_file_matches_executable_p
|
| 403 |
|
|
#endif
|
| 404 |
|
|
#ifndef MY_core_file_pid
|
| 405 |
|
|
#define MY_core_file_pid _bfd_nocore_core_file_pid
|
| 406 |
|
|
#endif
|
| 407 |
|
|
#ifndef MY_core_file_p
|
| 408 |
|
|
#define MY_core_file_p _bfd_dummy_target
|
| 409 |
|
|
#endif
|
| 410 |
|
|
|
| 411 |
|
|
#ifndef MY_bfd_debug_info_start
|
| 412 |
|
|
#define MY_bfd_debug_info_start bfd_void
|
| 413 |
|
|
#endif
|
| 414 |
|
|
#ifndef MY_bfd_debug_info_end
|
| 415 |
|
|
#define MY_bfd_debug_info_end bfd_void
|
| 416 |
|
|
#endif
|
| 417 |
|
|
#ifndef MY_bfd_debug_info_accumulate
|
| 418 |
|
|
#define MY_bfd_debug_info_accumulate \
|
| 419 |
|
|
(void (*) (bfd *, struct bfd_section *)) bfd_void
|
| 420 |
|
|
#endif
|
| 421 |
|
|
|
| 422 |
|
|
#ifndef MY_core_file_failing_command
|
| 423 |
|
|
#define MY_core_file_failing_command NAME (aout, core_file_failing_command)
|
| 424 |
|
|
#endif
|
| 425 |
|
|
#ifndef MY_core_file_failing_signal
|
| 426 |
|
|
#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
|
| 427 |
|
|
#endif
|
| 428 |
|
|
#ifndef MY_core_file_matches_executable_p
|
| 429 |
|
|
#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
|
| 430 |
|
|
#endif
|
| 431 |
|
|
#ifndef MY_set_section_contents
|
| 432 |
|
|
#define MY_set_section_contents NAME (aout, set_section_contents)
|
| 433 |
|
|
#endif
|
| 434 |
|
|
#ifndef MY_get_section_contents
|
| 435 |
|
|
#define MY_get_section_contents NAME (aout, get_section_contents)
|
| 436 |
|
|
#endif
|
| 437 |
|
|
#ifndef MY_get_section_contents_in_window
|
| 438 |
|
|
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
|
| 439 |
|
|
#endif
|
| 440 |
|
|
#ifndef MY_new_section_hook
|
| 441 |
|
|
#define MY_new_section_hook NAME (aout, new_section_hook)
|
| 442 |
|
|
#endif
|
| 443 |
|
|
#ifndef MY_get_symtab_upper_bound
|
| 444 |
|
|
#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
|
| 445 |
|
|
#endif
|
| 446 |
|
|
#ifndef MY_canonicalize_symtab
|
| 447 |
|
|
#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
|
| 448 |
|
|
#endif
|
| 449 |
|
|
#ifndef MY_get_reloc_upper_bound
|
| 450 |
|
|
#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound)
|
| 451 |
|
|
#endif
|
| 452 |
|
|
#ifndef MY_canonicalize_reloc
|
| 453 |
|
|
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
|
| 454 |
|
|
#endif
|
| 455 |
|
|
#ifndef MY_make_empty_symbol
|
| 456 |
|
|
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
|
| 457 |
|
|
#endif
|
| 458 |
|
|
#ifndef MY_print_symbol
|
| 459 |
|
|
#define MY_print_symbol NAME (aout, print_symbol)
|
| 460 |
|
|
#endif
|
| 461 |
|
|
#ifndef MY_get_symbol_info
|
| 462 |
|
|
#define MY_get_symbol_info NAME (aout, get_symbol_info)
|
| 463 |
|
|
#endif
|
| 464 |
|
|
#ifndef MY_get_lineno
|
| 465 |
|
|
#define MY_get_lineno NAME (aout, get_lineno)
|
| 466 |
|
|
#endif
|
| 467 |
|
|
#ifndef MY_set_arch_mach
|
| 468 |
|
|
#define MY_set_arch_mach NAME (aout, set_arch_mach)
|
| 469 |
|
|
#endif
|
| 470 |
|
|
#ifndef MY_find_nearest_line
|
| 471 |
|
|
#define MY_find_nearest_line NAME (aout, find_nearest_line)
|
| 472 |
|
|
#endif
|
| 473 |
|
|
#ifndef MY_find_inliner_info
|
| 474 |
|
|
#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
|
| 475 |
|
|
#endif
|
| 476 |
|
|
#ifndef MY_sizeof_headers
|
| 477 |
|
|
#define MY_sizeof_headers NAME (aout, sizeof_headers)
|
| 478 |
|
|
#endif
|
| 479 |
|
|
#ifndef MY_bfd_get_relocated_section_contents
|
| 480 |
|
|
#define MY_bfd_get_relocated_section_contents \
|
| 481 |
|
|
bfd_generic_get_relocated_section_contents
|
| 482 |
|
|
#endif
|
| 483 |
|
|
#ifndef MY_bfd_relax_section
|
| 484 |
|
|
#define MY_bfd_relax_section bfd_generic_relax_section
|
| 485 |
|
|
#endif
|
| 486 |
|
|
#ifndef MY_bfd_gc_sections
|
| 487 |
|
|
#define MY_bfd_gc_sections bfd_generic_gc_sections
|
| 488 |
|
|
#endif
|
| 489 |
161 |
khays |
#ifndef MY_bfd_lookup_section_flags
|
| 490 |
|
|
#define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
|
| 491 |
|
|
#endif
|
| 492 |
14 |
khays |
#ifndef MY_bfd_merge_sections
|
| 493 |
|
|
#define MY_bfd_merge_sections bfd_generic_merge_sections
|
| 494 |
|
|
#endif
|
| 495 |
|
|
#ifndef MY_bfd_is_group_section
|
| 496 |
|
|
#define MY_bfd_is_group_section bfd_generic_is_group_section
|
| 497 |
|
|
#endif
|
| 498 |
|
|
#ifndef MY_bfd_discard_group
|
| 499 |
|
|
#define MY_bfd_discard_group bfd_generic_discard_group
|
| 500 |
|
|
#endif
|
| 501 |
|
|
#ifndef MY_section_already_linked
|
| 502 |
|
|
#define MY_section_already_linked \
|
| 503 |
|
|
_bfd_generic_section_already_linked
|
| 504 |
|
|
#endif
|
| 505 |
|
|
#ifndef MY_bfd_define_common_symbol
|
| 506 |
|
|
#define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
|
| 507 |
|
|
#endif
|
| 508 |
|
|
#ifndef MY_bfd_reloc_type_lookup
|
| 509 |
|
|
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
|
| 510 |
|
|
#endif
|
| 511 |
|
|
#ifndef MY_bfd_reloc_name_lookup
|
| 512 |
|
|
#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup)
|
| 513 |
|
|
#endif
|
| 514 |
|
|
#ifndef MY_bfd_make_debug_symbol
|
| 515 |
|
|
#define MY_bfd_make_debug_symbol 0
|
| 516 |
|
|
#endif
|
| 517 |
|
|
#ifndef MY_read_minisymbols
|
| 518 |
|
|
#define MY_read_minisymbols NAME (aout, read_minisymbols)
|
| 519 |
|
|
#endif
|
| 520 |
|
|
#ifndef MY_minisymbol_to_symbol
|
| 521 |
|
|
#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
|
| 522 |
|
|
#endif
|
| 523 |
|
|
#ifndef MY_bfd_link_hash_table_create
|
| 524 |
|
|
#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
|
| 525 |
|
|
#endif
|
| 526 |
|
|
#ifndef MY_bfd_link_hash_table_free
|
| 527 |
|
|
#define MY_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
|
| 528 |
|
|
#endif
|
| 529 |
|
|
#ifndef MY_bfd_link_add_symbols
|
| 530 |
|
|
#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
|
| 531 |
|
|
#endif
|
| 532 |
|
|
#ifndef MY_bfd_link_just_syms
|
| 533 |
|
|
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
|
| 534 |
|
|
#endif
|
| 535 |
|
|
#ifndef MY_bfd_copy_link_hash_symbol_type
|
| 536 |
|
|
#define MY_bfd_copy_link_hash_symbol_type \
|
| 537 |
|
|
_bfd_generic_copy_link_hash_symbol_type
|
| 538 |
|
|
#endif
|
| 539 |
|
|
#ifndef MY_bfd_link_split_section
|
| 540 |
|
|
#define MY_bfd_link_split_section _bfd_generic_link_split_section
|
| 541 |
|
|
#endif
|
| 542 |
|
|
|
| 543 |
|
|
#ifndef MY_bfd_copy_private_bfd_data
|
| 544 |
|
|
#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
|
| 545 |
|
|
#endif
|
| 546 |
|
|
|
| 547 |
|
|
#ifndef MY_bfd_merge_private_bfd_data
|
| 548 |
|
|
#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
|
| 549 |
|
|
#endif
|
| 550 |
|
|
|
| 551 |
|
|
#ifndef MY_bfd_copy_private_symbol_data
|
| 552 |
|
|
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
|
| 553 |
|
|
#endif
|
| 554 |
|
|
|
| 555 |
|
|
#ifndef MY_bfd_copy_private_header_data
|
| 556 |
|
|
#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
|
| 557 |
|
|
#endif
|
| 558 |
|
|
|
| 559 |
|
|
#ifndef MY_bfd_print_private_bfd_data
|
| 560 |
|
|
#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
|
| 561 |
|
|
#endif
|
| 562 |
|
|
|
| 563 |
|
|
#ifndef MY_bfd_set_private_flags
|
| 564 |
|
|
#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
|
| 565 |
|
|
#endif
|
| 566 |
|
|
|
| 567 |
|
|
#ifndef MY_bfd_is_local_label_name
|
| 568 |
|
|
#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
|
| 569 |
|
|
#endif
|
| 570 |
|
|
|
| 571 |
|
|
#ifndef MY_bfd_is_target_special_symbol
|
| 572 |
|
|
#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
| 573 |
|
|
#endif
|
| 574 |
|
|
|
| 575 |
|
|
#ifndef MY_bfd_free_cached_info
|
| 576 |
|
|
#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
|
| 577 |
|
|
#endif
|
| 578 |
|
|
|
| 579 |
|
|
#ifndef MY_close_and_cleanup
|
| 580 |
|
|
#define MY_close_and_cleanup MY_bfd_free_cached_info
|
| 581 |
|
|
#endif
|
| 582 |
|
|
|
| 583 |
|
|
#ifndef MY_get_dynamic_symtab_upper_bound
|
| 584 |
|
|
#define MY_get_dynamic_symtab_upper_bound \
|
| 585 |
|
|
_bfd_nodynamic_get_dynamic_symtab_upper_bound
|
| 586 |
|
|
#endif
|
| 587 |
|
|
#ifndef MY_canonicalize_dynamic_symtab
|
| 588 |
|
|
#define MY_canonicalize_dynamic_symtab \
|
| 589 |
|
|
_bfd_nodynamic_canonicalize_dynamic_symtab
|
| 590 |
|
|
#endif
|
| 591 |
|
|
#ifndef MY_get_synthetic_symtab
|
| 592 |
|
|
#define MY_get_synthetic_symtab \
|
| 593 |
|
|
_bfd_nodynamic_get_synthetic_symtab
|
| 594 |
|
|
#endif
|
| 595 |
|
|
#ifndef MY_get_dynamic_reloc_upper_bound
|
| 596 |
|
|
#define MY_get_dynamic_reloc_upper_bound \
|
| 597 |
|
|
_bfd_nodynamic_get_dynamic_reloc_upper_bound
|
| 598 |
|
|
#endif
|
| 599 |
|
|
#ifndef MY_canonicalize_dynamic_reloc
|
| 600 |
|
|
#define MY_canonicalize_dynamic_reloc \
|
| 601 |
|
|
_bfd_nodynamic_canonicalize_dynamic_reloc
|
| 602 |
|
|
#endif
|
| 603 |
|
|
|
| 604 |
|
|
/* Aout symbols normally have leading underscores. */
|
| 605 |
|
|
#ifndef MY_symbol_leading_char
|
| 606 |
|
|
#define MY_symbol_leading_char '_'
|
| 607 |
|
|
#endif
|
| 608 |
|
|
|
| 609 |
|
|
/* Aout archives normally use spaces for padding. */
|
| 610 |
|
|
#ifndef AR_PAD_CHAR
|
| 611 |
|
|
#define AR_PAD_CHAR ' '
|
| 612 |
|
|
#endif
|
| 613 |
|
|
|
| 614 |
|
|
#ifndef MY_BFD_TARGET
|
| 615 |
|
|
const bfd_target MY (vec) =
|
| 616 |
|
|
{
|
| 617 |
|
|
TARGETNAME, /* Name. */
|
| 618 |
|
|
bfd_target_aout_flavour,
|
| 619 |
|
|
#ifdef TARGET_IS_BIG_ENDIAN_P
|
| 620 |
|
|
BFD_ENDIAN_BIG, /* Target byte order (big). */
|
| 621 |
|
|
BFD_ENDIAN_BIG, /* Target headers byte order (big). */
|
| 622 |
|
|
#else
|
| 623 |
|
|
BFD_ENDIAN_LITTLE, /* Target byte order (little). */
|
| 624 |
|
|
BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
|
| 625 |
|
|
#endif
|
| 626 |
|
|
(HAS_RELOC | EXEC_P | /* Object flags. */
|
| 627 |
|
|
HAS_LINENO | HAS_DEBUG |
|
| 628 |
|
|
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
| 629 |
|
|
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
|
| 630 |
|
|
MY_symbol_leading_char,
|
| 631 |
|
|
AR_PAD_CHAR, /* AR_pad_char. */
|
| 632 |
|
|
15, /* AR_max_namelen. */
|
| 633 |
148 |
khays |
0, /* match priority. */
|
| 634 |
14 |
khays |
#ifdef TARGET_IS_BIG_ENDIAN_P
|
| 635 |
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
| 636 |
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
| 637 |
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
|
| 638 |
|
|
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
| 639 |
|
|
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
| 640 |
|
|
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
|
| 641 |
|
|
#else
|
| 642 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
| 643 |
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
| 644 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
|
| 645 |
|
|
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
| 646 |
|
|
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
| 647 |
|
|
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
|
| 648 |
|
|
#endif
|
| 649 |
|
|
{_bfd_dummy_target, MY_object_p, /* bfd_check_format. */
|
| 650 |
|
|
bfd_generic_archive_p, MY_core_file_p},
|
| 651 |
|
|
{bfd_false, MY_mkobject, /* bfd_set_format. */
|
| 652 |
|
|
_bfd_generic_mkarchive, bfd_false},
|
| 653 |
|
|
{bfd_false, MY_write_object_contents, /* bfd_write_contents. */
|
| 654 |
|
|
_bfd_write_archive_contents, bfd_false},
|
| 655 |
|
|
|
| 656 |
|
|
BFD_JUMP_TABLE_GENERIC (MY),
|
| 657 |
|
|
BFD_JUMP_TABLE_COPY (MY),
|
| 658 |
|
|
BFD_JUMP_TABLE_CORE (MY),
|
| 659 |
|
|
BFD_JUMP_TABLE_ARCHIVE (MY),
|
| 660 |
|
|
BFD_JUMP_TABLE_SYMBOLS (MY),
|
| 661 |
|
|
BFD_JUMP_TABLE_RELOCS (MY),
|
| 662 |
|
|
BFD_JUMP_TABLE_WRITE (MY),
|
| 663 |
|
|
BFD_JUMP_TABLE_LINK (MY),
|
| 664 |
|
|
BFD_JUMP_TABLE_DYNAMIC (MY),
|
| 665 |
|
|
|
| 666 |
|
|
/* Alternative_target. */
|
| 667 |
|
|
NULL,
|
| 668 |
|
|
|
| 669 |
|
|
MY_backend_data
|
| 670 |
|
|
};
|
| 671 |
|
|
#endif /* MY_BFD_TARGET */
|