aout-target.h 20.7 KB
Newer Older
Richard Henderson's avatar
Richard Henderson committed
1
/* Define a target vector and some small routines for a variant of a.out.
2
   Copyright (C) 1990-2018 Free Software Foundation, Inc.
Richard Henderson's avatar
Richard Henderson committed
3

Nick Clifton's avatar
Nick Clifton committed
4
   This file is part of BFD, the Binary File Descriptor library.
Richard Henderson's avatar
Richard Henderson committed
5

Nick Clifton's avatar
Nick Clifton committed
6 7
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 3 of the License, or
Nick Clifton's avatar
Nick Clifton committed
9
   (at your option) any later version.
Richard Henderson's avatar
Richard Henderson committed
10

Nick Clifton's avatar
Nick Clifton committed
11 12 13 14
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
Richard Henderson's avatar
Richard Henderson committed
15

Nick Clifton's avatar
Nick Clifton committed
16 17
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
18 19
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
   MA 02110-1301, USA.  */
Richard Henderson's avatar
Richard Henderson committed
20 21 22 23 24 25 26 27 28 29

#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
/*#include "libaout.h"*/

#ifndef SEGMENT_SIZE
#define SEGMENT_SIZE TARGET_PAGE_SIZE
#endif

Nick Clifton's avatar
Nick Clifton committed
30
extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
31
extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
Richard Henderson's avatar
Richard Henderson committed
32 33 34 35 36 37

/* Set parameters about this a.out file that are machine-dependent.
   This routine is called from some_aout_object_p just before it returns.  */
#ifndef MY_callback

static const bfd_target *
Nick Clifton's avatar
Nick Clifton committed
38
MY (callback) (bfd *abfd)
Richard Henderson's avatar
Richard Henderson committed
39 40 41 42 43
{
  struct internal_exec *execp = exec_hdr (abfd);
  unsigned int arch_align_power;
  unsigned long arch_align;

Nick Clifton's avatar
Nick Clifton committed
44
  /* Calculate the file positions of the parts of a newly read aout header.  */
45
  obj_textsec (abfd)->size = N_TXTSIZE (execp);
Richard Henderson's avatar
Richard Henderson committed
46

Nick Clifton's avatar
Nick Clifton committed
47
  /* The virtual memory addresses of the sections.  */
48 49 50
  obj_textsec (abfd)->vma = N_TXTADDR (execp);
  obj_datasec (abfd)->vma = N_DATADDR (execp);
  obj_bsssec  (abfd)->vma = N_BSSADDR (execp);
Richard Henderson's avatar
Richard Henderson committed
51 52 53 54 55 56 57 58 59 60

  /* For some targets, if the entry point is not in the same page
     as the start of the text, then adjust the VMA so that it is.
     FIXME: Do this with a macro like SET_ARCH_MACH instead?  */
  if (aout_backend_info (abfd)->entry_is_text_address
      && execp->a_entry > obj_textsec (abfd)->vma)
    {
      bfd_vma adjust;

      adjust = execp->a_entry - obj_textsec (abfd)->vma;
61
      /* Adjust only by whole pages.  */
Richard Henderson's avatar
Richard Henderson committed
62 63 64 65 66 67 68 69 70 71 72
      adjust &= ~(TARGET_PAGE_SIZE - 1);
      obj_textsec (abfd)->vma += adjust;
      obj_datasec (abfd)->vma += adjust;
      obj_bsssec (abfd)->vma += adjust;
    }

  /* Set the load addresses to be the same as the virtual addresses.  */
  obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
  obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
  obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;

Nick Clifton's avatar
Nick Clifton committed
73
  /* The file offsets of the sections.  */
74 75
  obj_textsec (abfd)->filepos = N_TXTOFF (execp);
  obj_datasec (abfd)->filepos = N_DATOFF (execp);
Richard Henderson's avatar
Richard Henderson committed
76

Nick Clifton's avatar
Nick Clifton committed
77
  /* The file offsets of the relocation info.  */
78 79
  obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
  obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
Richard Henderson's avatar
Richard Henderson committed
80 81

  /* The file offsets of the string table and symbol table.  */
82 83
  obj_sym_filepos (abfd) = N_SYMOFF (execp);
  obj_str_filepos (abfd) = N_STROFF (execp);
84

Richard Henderson's avatar
Richard Henderson committed
85 86
  /* Determine the architecture and machine type of the object file.  */
#ifdef SET_ARCH_MACH
87
  SET_ARCH_MACH (abfd, execp);
Richard Henderson's avatar
Richard Henderson committed
88
#else
89
  bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
Richard Henderson's avatar
Richard Henderson committed
90 91 92 93 94 95 96 97 98 99 100 101
#endif

  /* The number of relocation records.  This must be called after
     SET_ARCH_MACH.  It assumes that SET_ARCH_MACH will set
     obj_reloc_entry_size correctly, if the reloc size is not
     RELOC_STD_SIZE.  */
  obj_textsec (abfd)->reloc_count =
    execp->a_trsize / obj_reloc_entry_size (abfd);
  obj_datasec (abfd)->reloc_count =
    execp->a_drsize / obj_reloc_entry_size (abfd);

  /* Now that we know the architecture, set the alignments of the
Nick Clifton's avatar
Nick Clifton committed
102
     sections.  This is normally done by NAME (aout,new_section_hook),
Richard Henderson's avatar
Richard Henderson committed
103 104 105 106 107 108
     but when the initial sections were created the architecture had
     not yet been set.  However, for backward compatibility, we don't
     set the alignment power any higher than as required by the size
     of the section.  */
  arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
  arch_align = 1 << arch_align_power;
Alan Modra's avatar
bfd/  
Alan Modra committed
109 110 111 112 113 114
  if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
       == obj_textsec (abfd)->size)
      && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
	  == obj_datasec (abfd)->size)
      && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
	  == obj_bsssec (abfd)->size))
Richard Henderson's avatar
Richard Henderson committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128
    {
      obj_textsec (abfd)->alignment_power = arch_align_power;
      obj_datasec (abfd)->alignment_power = arch_align_power;
      obj_bsssec (abfd)->alignment_power = arch_align_power;
    }

  /* Don't set sizes now -- can't be sure until we know arch & mach.
     Sizes get set in set_sizes callback, later.  */

  return abfd->xvec;
}
#endif

#ifndef MY_object_p
Nick Clifton's avatar
Nick Clifton committed
129
/* Finish up the reading of an a.out file header.  */
Richard Henderson's avatar
Richard Henderson committed
130 131

static const bfd_target *
Nick Clifton's avatar
Nick Clifton committed
132
MY (object_p) (bfd *abfd)
Richard Henderson's avatar
Richard Henderson committed
133
{
Nick Clifton's avatar
Nick Clifton committed
134 135
  struct external_exec exec_bytes;	/* Raw exec header from file.  */
  struct internal_exec exec;		/* Cleaned-up exec header.  */
Richard Henderson's avatar
Richard Henderson committed
136
  const bfd_target *target;
137
  bfd_size_type amt = EXEC_BYTES_SIZE;
Richard Henderson's avatar
Richard Henderson committed
138

Nick Clifton's avatar
Nick Clifton committed
139
  if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
140 141 142 143 144
    {
      if (bfd_get_error () != bfd_error_system_call)
	bfd_set_error (bfd_error_wrong_format);
      return 0;
    }
Richard Henderson's avatar
Richard Henderson committed
145 146 147 148

#ifdef SWAP_MAGIC
  exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
Nick Clifton's avatar
Nick Clifton committed
149
  exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
Nick Clifton's avatar
Nick Clifton committed
150 151
#endif

152
  if (N_BADMAG (&exec))
Nick Clifton's avatar
Nick Clifton committed
153
    return 0;
Richard Henderson's avatar
Richard Henderson committed
154 155

#ifdef MACHTYPE_OK
156
  if (!(MACHTYPE_OK (N_MACHTYPE (&exec))))
Nick Clifton's avatar
Nick Clifton committed
157
    return 0;
Richard Henderson's avatar
Richard Henderson committed
158 159
#endif

Nick Clifton's avatar
Nick Clifton committed
160
  NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
Richard Henderson's avatar
Richard Henderson committed
161 162

#ifdef SWAP_MAGIC
Nick Clifton's avatar
Nick Clifton committed
163
  /* Swap_exec_header_in read in a_info with the wrong byte order.  */
Richard Henderson's avatar
Richard Henderson committed
164
  exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
Nick Clifton's avatar
Nick Clifton committed
165
#endif
Richard Henderson's avatar
Richard Henderson committed
166

Nick Clifton's avatar
Nick Clifton committed
167
  target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
Richard Henderson's avatar
Richard Henderson committed
168 169 170

#ifdef ENTRY_CAN_BE_ZERO
  /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
Nick Clifton's avatar
Nick Clifton committed
171 172 173 174
     means that it isn't obvious if EXEC_P should be set.
     All of the following must be true for an executable:
     There must be no relocations, the bfd can be neither an
     archive nor an archive element, and the file must be executable.  */
Richard Henderson's avatar
Richard Henderson committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189

  if (exec.a_trsize + exec.a_drsize == 0
      && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
    {
      struct stat buf;
#ifndef S_IXUSR
#define S_IXUSR 0100	/* Execute by owner.  */
#endif
      if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
	abfd->flags |= EXEC_P;
    }
#endif /* ENTRY_CAN_BE_ZERO */

  return target;
}
Nick Clifton's avatar
Nick Clifton committed
190
#define MY_object_p MY (object_p)
Richard Henderson's avatar
Richard Henderson committed
191 192 193 194
#endif

#ifndef MY_mkobject

195
static bfd_boolean
Nick Clifton's avatar
Nick Clifton committed
196
MY (mkobject) (bfd *abfd)
Richard Henderson's avatar
Richard Henderson committed
197
{
198
  return NAME (aout, mkobject (abfd));
Richard Henderson's avatar
Richard Henderson committed
199
}
200

Nick Clifton's avatar
Nick Clifton committed
201
#define MY_mkobject MY (mkobject)
Richard Henderson's avatar
Richard Henderson committed
202 203 204 205 206 207 208 209 210 211
#endif

#ifndef MY_bfd_copy_private_section_data

/* Copy private section data.  This actually does nothing with the
   sections.  It copies the subformat field.  We copy it here, because
   we need to know whether this is a QMAGIC file before we set the
   section contents, and copy_private_bfd_data is not called until
   after the section contents have been set.  */

212
static bfd_boolean
Nick Clifton's avatar
Nick Clifton committed
213 214 215 216
MY_bfd_copy_private_section_data (bfd *ibfd,
				  asection *isec ATTRIBUTE_UNUSED,
				  bfd *obfd,
				  asection *osec ATTRIBUTE_UNUSED)
Richard Henderson's avatar
Richard Henderson committed
217 218 219 220
{
  if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
      && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
    obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
221
  return TRUE;
Richard Henderson's avatar
Richard Henderson committed
222 223 224 225 226 227 228 229 230
}

#endif

/* Write an object file.
   Section contents have already been written.  We write the
   file header, symbols, and relocation.  */

#ifndef MY_write_object_contents
231

232
static bfd_boolean
Nick Clifton's avatar
Nick Clifton committed
233
MY (write_object_contents) (bfd *abfd)
Richard Henderson's avatar
Richard Henderson committed
234 235 236 237 238 239
{
  struct external_exec exec_bytes;
  struct internal_exec *execp = exec_hdr (abfd);

  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;

Nick Clifton's avatar
Nick Clifton committed
240
  WRITE_HEADERS (abfd, execp);
Richard Henderson's avatar
Richard Henderson committed
241

242
  return TRUE;
Richard Henderson's avatar
Richard Henderson committed
243
}
Nick Clifton's avatar
Nick Clifton committed
244
#define MY_write_object_contents MY (write_object_contents)
Richard Henderson's avatar
Richard Henderson committed
245 246 247 248
#endif

#ifndef MY_set_sizes

249
static bfd_boolean
Nick Clifton's avatar
Nick Clifton committed
250
MY (set_sizes) (bfd *abfd)
Richard Henderson's avatar
Richard Henderson committed
251 252 253 254 255 256 257 258 259 260 261
{
  adata(abfd).page_size = TARGET_PAGE_SIZE;
  adata(abfd).segment_size = SEGMENT_SIZE;

#ifdef ZMAGIC_DISK_BLOCK_SIZE
  adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
#else
  adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
#endif

  adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
262
  return TRUE;
Richard Henderson's avatar
Richard Henderson committed
263
}
Nick Clifton's avatar
Nick Clifton committed
264
#define MY_set_sizes MY (set_sizes)
Richard Henderson's avatar
Richard Henderson committed
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
#endif

#ifndef MY_exec_hdr_flags
#define MY_exec_hdr_flags 0
#endif

#ifndef MY_backend_data

#ifndef MY_zmagic_contiguous
#define MY_zmagic_contiguous 0
#endif
#ifndef MY_text_includes_header
#define MY_text_includes_header 0
#endif
#ifndef MY_entry_is_text_address
#define MY_entry_is_text_address 0
#endif
#ifndef MY_exec_header_not_counted
#define MY_exec_header_not_counted 0
#endif
#ifndef MY_add_dynamic_symbols
#define MY_add_dynamic_symbols 0
#endif
#ifndef MY_add_one_symbol
#define MY_add_one_symbol 0
#endif
#ifndef MY_link_dynamic_object
#define MY_link_dynamic_object 0
#endif
#ifndef MY_write_dynamic_symbol
#define MY_write_dynamic_symbol 0
#endif
#ifndef MY_check_dynamic_reloc
#define MY_check_dynamic_reloc 0
#endif
#ifndef MY_finish_dynamic_link
#define MY_finish_dynamic_link 0
#endif

Nick Clifton's avatar
Nick Clifton committed
304 305
static const struct aout_backend_data MY (backend_data) =
{
Richard Henderson's avatar
Richard Henderson committed
306 307 308 309
  MY_zmagic_contiguous,
  MY_text_includes_header,
  MY_entry_is_text_address,
  MY_exec_hdr_flags,
Nick Clifton's avatar
Nick Clifton committed
310
  0,				/* Text vma?  */
Richard Henderson's avatar
Richard Henderson committed
311 312 313 314 315 316 317 318 319
  MY_set_sizes,
  MY_exec_header_not_counted,
  MY_add_dynamic_symbols,
  MY_add_one_symbol,
  MY_link_dynamic_object,
  MY_write_dynamic_symbol,
  MY_check_dynamic_reloc,
  MY_finish_dynamic_link
};
Nick Clifton's avatar
Nick Clifton committed
320
#define MY_backend_data &MY (backend_data)
Richard Henderson's avatar
Richard Henderson committed
321 322 323 324 325 326 327
#endif

#ifndef MY_final_link_callback

/* Callback for the final_link routine to set the section offsets.  */

static void
Nick Clifton's avatar
Nick Clifton committed
328 329 330 331
MY_final_link_callback (bfd *abfd,
			file_ptr *ptreloff,
			file_ptr *pdreloff,
			file_ptr *psymoff)
Richard Henderson's avatar
Richard Henderson committed
332 333 334
{
  struct internal_exec *execp = exec_hdr (abfd);

335 336 337
  *ptreloff = N_TRELOFF (execp);
  *pdreloff = N_DRELOFF (execp);
  *psymoff = N_SYMOFF (execp);
Richard Henderson's avatar
Richard Henderson committed
338 339 340 341 342 343 344 345 346
}

#endif

#ifndef MY_bfd_final_link

/* Final link routine.  We need to use a call back to get the correct
   offsets in the output file.  */

347
static bfd_boolean
Nick Clifton's avatar
Nick Clifton committed
348
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
Richard Henderson's avatar
Richard Henderson committed
349
{
Nick Clifton's avatar
Nick Clifton committed
350
  return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
Richard Henderson's avatar
Richard Henderson committed
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
}

#endif

/* We assume BFD generic archive files.  */
#ifndef	MY_openr_next_archived_file
#define	MY_openr_next_archived_file	bfd_generic_openr_next_archived_file
#endif
#ifndef MY_get_elt_at_index
#define MY_get_elt_at_index		_bfd_generic_get_elt_at_index
#endif
#ifndef	MY_generic_stat_arch_elt
#define	MY_generic_stat_arch_elt	bfd_generic_stat_arch_elt
#endif
#ifndef	MY_slurp_armap
#define	MY_slurp_armap			bfd_slurp_bsd_armap
#endif
#ifndef	MY_slurp_extended_name_table
#define	MY_slurp_extended_name_table	_bfd_slurp_extended_name_table
#endif
#ifndef MY_construct_extended_name_table
#define MY_construct_extended_name_table \
  _bfd_archive_bsd_construct_extended_name_table
#endif
#ifndef	MY_write_armap
376
#define	MY_write_armap		_bfd_bsd_write_armap
Richard Henderson's avatar
Richard Henderson committed
377 378 379 380
#endif
#ifndef MY_read_ar_hdr
#define MY_read_ar_hdr		_bfd_generic_read_ar_hdr
#endif
381 382 383
#ifndef MY_write_ar_hdr
#define MY_write_ar_hdr		_bfd_generic_write_ar_hdr
#endif
Richard Henderson's avatar
Richard Henderson committed
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
#ifndef	MY_truncate_arname
#define	MY_truncate_arname		bfd_bsd_truncate_arname
#endif
#ifndef MY_update_armap_timestamp
#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
#endif

/* No core file defined here -- configure in trad-core.c separately.  */
#ifndef	MY_core_file_failing_command
#define	MY_core_file_failing_command _bfd_nocore_core_file_failing_command
#endif
#ifndef	MY_core_file_failing_signal
#define	MY_core_file_failing_signal	_bfd_nocore_core_file_failing_signal
#endif
#ifndef	MY_core_file_matches_executable_p
#define	MY_core_file_matches_executable_p	\
				_bfd_nocore_core_file_matches_executable_p
#endif
402 403 404
#ifndef	MY_core_file_pid
#define	MY_core_file_pid _bfd_nocore_core_file_pid
#endif
Richard Henderson's avatar
Richard Henderson committed
405 406 407 408 409 410 411 412 413 414 415 416
#ifndef	MY_core_file_p
#define	MY_core_file_p		_bfd_dummy_target
#endif

#ifndef MY_bfd_debug_info_start
#define MY_bfd_debug_info_start		bfd_void
#endif
#ifndef MY_bfd_debug_info_end
#define MY_bfd_debug_info_end		bfd_void
#endif
#ifndef MY_bfd_debug_info_accumulate
#define MY_bfd_debug_info_accumulate	\
Nick Clifton's avatar
Nick Clifton committed
417
		(void (*) (bfd *, struct bfd_section *)) bfd_void
Richard Henderson's avatar
Richard Henderson committed
418 419 420
#endif

#ifndef MY_core_file_failing_command
Nick Clifton's avatar
Nick Clifton committed
421
#define MY_core_file_failing_command NAME (aout, core_file_failing_command)
Richard Henderson's avatar
Richard Henderson committed
422 423
#endif
#ifndef MY_core_file_failing_signal
Nick Clifton's avatar
Nick Clifton committed
424
#define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
Richard Henderson's avatar
Richard Henderson committed
425 426
#endif
#ifndef MY_core_file_matches_executable_p
Nick Clifton's avatar
Nick Clifton committed
427
#define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
Richard Henderson's avatar
Richard Henderson committed
428 429
#endif
#ifndef MY_set_section_contents
Nick Clifton's avatar
Nick Clifton committed
430
#define MY_set_section_contents NAME (aout, set_section_contents)
Richard Henderson's avatar
Richard Henderson committed
431 432
#endif
#ifndef MY_get_section_contents
Nick Clifton's avatar
Nick Clifton committed
433
#define MY_get_section_contents NAME (aout, get_section_contents)
Richard Henderson's avatar
Richard Henderson committed
434 435 436 437 438
#endif
#ifndef MY_get_section_contents_in_window
#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#endif
#ifndef MY_new_section_hook
Nick Clifton's avatar
Nick Clifton committed
439
#define MY_new_section_hook NAME (aout, new_section_hook)
Richard Henderson's avatar
Richard Henderson committed
440 441
#endif
#ifndef MY_get_symtab_upper_bound
Nick Clifton's avatar
Nick Clifton committed
442
#define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
Richard Henderson's avatar
Richard Henderson committed
443
#endif
Andrew Cagney's avatar
Andrew Cagney committed
444
#ifndef MY_canonicalize_symtab
Nick Clifton's avatar
Nick Clifton committed
445
#define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
Richard Henderson's avatar
Richard Henderson committed
446 447
#endif
#ifndef MY_get_reloc_upper_bound
Nick Clifton's avatar
Nick Clifton committed
448
#define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound)
Richard Henderson's avatar
Richard Henderson committed
449 450
#endif
#ifndef MY_canonicalize_reloc
Nick Clifton's avatar
Nick Clifton committed
451
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
Richard Henderson's avatar
Richard Henderson committed
452
#endif
453 454 455
#ifndef MY_set_reloc
#define MY_set_reloc _bfd_generic_set_reloc
#endif
Richard Henderson's avatar
Richard Henderson committed
456
#ifndef MY_make_empty_symbol
Nick Clifton's avatar
Nick Clifton committed
457
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
Richard Henderson's avatar
Richard Henderson committed
458 459
#endif
#ifndef MY_print_symbol
Nick Clifton's avatar
Nick Clifton committed
460
#define MY_print_symbol NAME (aout, print_symbol)
Richard Henderson's avatar
Richard Henderson committed
461 462
#endif
#ifndef MY_get_symbol_info
Nick Clifton's avatar
Nick Clifton committed
463
#define MY_get_symbol_info NAME (aout, get_symbol_info)
Richard Henderson's avatar
Richard Henderson committed
464
#endif
465 466 467 468
#ifndef MY_get_symbol_version_string
#define MY_get_symbol_version_string \
  _bfd_nosymbols_get_symbol_version_string
#endif
Richard Henderson's avatar
Richard Henderson committed
469
#ifndef MY_get_lineno
Nick Clifton's avatar
Nick Clifton committed
470
#define MY_get_lineno NAME (aout, get_lineno)
Richard Henderson's avatar
Richard Henderson committed
471 472
#endif
#ifndef MY_set_arch_mach
Nick Clifton's avatar
Nick Clifton committed
473
#define MY_set_arch_mach NAME (aout, set_arch_mach)
Richard Henderson's avatar
Richard Henderson committed
474 475
#endif
#ifndef MY_find_nearest_line
Nick Clifton's avatar
Nick Clifton committed
476
#define MY_find_nearest_line NAME (aout, find_nearest_line)
Richard Henderson's avatar
Richard Henderson committed
477
#endif
478 479 480
#ifndef MY_find_line
#define MY_find_line _bfd_nosymbols_find_line
#endif
Fred Fish's avatar
Fred Fish committed
481 482 483
#ifndef MY_find_inliner_info
#define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
#endif
Richard Henderson's avatar
Richard Henderson committed
484
#ifndef MY_sizeof_headers
Nick Clifton's avatar
Nick Clifton committed
485
#define MY_sizeof_headers NAME (aout, sizeof_headers)
Richard Henderson's avatar
Richard Henderson committed
486 487 488 489 490 491 492 493 494 495 496
#endif
#ifndef MY_bfd_get_relocated_section_contents
#define MY_bfd_get_relocated_section_contents \
			bfd_generic_get_relocated_section_contents
#endif
#ifndef MY_bfd_relax_section
#define MY_bfd_relax_section bfd_generic_relax_section
#endif
#ifndef MY_bfd_gc_sections
#define MY_bfd_gc_sections bfd_generic_gc_sections
#endif
Catherine Moore's avatar
Catherine Moore committed
497 498 499
#ifndef MY_bfd_lookup_section_flags
#define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#endif
500 501 502
#ifndef MY_bfd_merge_sections
#define MY_bfd_merge_sections bfd_generic_merge_sections
#endif
503 504 505
#ifndef MY_bfd_is_group_section
#define MY_bfd_is_group_section bfd_generic_is_group_section
#endif
506 507 508
#ifndef MY_bfd_discard_group
#define MY_bfd_discard_group bfd_generic_discard_group
#endif
H.J. Lu's avatar
bfd/  
H.J. Lu committed
509 510 511 512
#ifndef MY_section_already_linked
#define MY_section_already_linked \
  _bfd_generic_section_already_linked
#endif
Richard Sandiford's avatar
bfd/  
Richard Sandiford committed
513 514 515
#ifndef MY_bfd_define_common_symbol
#define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
#endif
516 517 518
#ifndef MY_bfd_define_start_stop
#define MY_bfd_define_start_stop bfd_generic_define_start_stop
#endif
Richard Henderson's avatar
Richard Henderson committed
519
#ifndef MY_bfd_reloc_type_lookup
Nick Clifton's avatar
Nick Clifton committed
520
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
Richard Henderson's avatar
Richard Henderson committed
521
#endif
522 523 524
#ifndef MY_bfd_reloc_name_lookup
#define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup)
#endif
Richard Henderson's avatar
Richard Henderson committed
525 526 527 528
#ifndef MY_bfd_make_debug_symbol
#define MY_bfd_make_debug_symbol 0
#endif
#ifndef MY_read_minisymbols
Nick Clifton's avatar
Nick Clifton committed
529
#define MY_read_minisymbols NAME (aout, read_minisymbols)
Richard Henderson's avatar
Richard Henderson committed
530 531
#endif
#ifndef MY_minisymbol_to_symbol
Nick Clifton's avatar
Nick Clifton committed
532
#define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
Richard Henderson's avatar
Richard Henderson committed
533 534
#endif
#ifndef MY_bfd_link_hash_table_create
Nick Clifton's avatar
Nick Clifton committed
535
#define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
Richard Henderson's avatar
Richard Henderson committed
536 537
#endif
#ifndef MY_bfd_link_add_symbols
Nick Clifton's avatar
Nick Clifton committed
538
#define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
Richard Henderson's avatar
Richard Henderson committed
539
#endif
Alan Modra's avatar
Alan Modra committed
540 541 542
#ifndef MY_bfd_link_just_syms
#define MY_bfd_link_just_syms _bfd_generic_link_just_syms
#endif
543 544 545 546
#ifndef MY_bfd_copy_link_hash_symbol_type
#define MY_bfd_copy_link_hash_symbol_type \
  _bfd_generic_copy_link_hash_symbol_type
#endif
Richard Henderson's avatar
Richard Henderson committed
547 548 549 550
#ifndef MY_bfd_link_split_section
#define MY_bfd_link_split_section  _bfd_generic_link_split_section
#endif

551 552 553 554
#ifndef MY_bfd_link_check_relocs
#define MY_bfd_link_check_relocs   _bfd_generic_link_check_relocs
#endif

Richard Henderson's avatar
Richard Henderson committed
555 556 557 558 559 560 561 562 563 564 565 566
#ifndef MY_bfd_copy_private_bfd_data
#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#endif

#ifndef MY_bfd_merge_private_bfd_data
#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
#endif

#ifndef MY_bfd_copy_private_symbol_data
#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
#endif

Bob Wilson's avatar
Bob Wilson committed
567 568 569 570
#ifndef MY_bfd_copy_private_header_data
#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#endif

Richard Henderson's avatar
Richard Henderson committed
571 572 573 574 575 576 577 578 579 580 581 582
#ifndef MY_bfd_print_private_bfd_data
#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
#endif

#ifndef MY_bfd_set_private_flags
#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#endif

#ifndef MY_bfd_is_local_label_name
#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
#endif

583 584 585 586
#ifndef MY_bfd_is_target_special_symbol
#define MY_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#endif

Richard Henderson's avatar
Richard Henderson committed
587
#ifndef MY_bfd_free_cached_info
Nick Clifton's avatar
Nick Clifton committed
588
#define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
Richard Henderson's avatar
Richard Henderson committed
589 590 591
#endif

#ifndef MY_close_and_cleanup
Hans-Peter Nilsson's avatar
Hans-Peter Nilsson committed
592 593 594 595 596 597 598 599 600 601 602 603

/* Handle closing of a BFD including the resource-releasing parts.  */

static bfd_boolean
MY_close_and_cleanup (bfd *abfd)
{
  if (!MY_bfd_free_cached_info (abfd))
    return FALSE;

  return _bfd_generic_close_and_cleanup (abfd);
}

Richard Henderson's avatar
Richard Henderson committed
604 605 606 607 608 609 610 611 612 613
#endif

#ifndef MY_get_dynamic_symtab_upper_bound
#define MY_get_dynamic_symtab_upper_bound \
  _bfd_nodynamic_get_dynamic_symtab_upper_bound
#endif
#ifndef MY_canonicalize_dynamic_symtab
#define MY_canonicalize_dynamic_symtab \
  _bfd_nodynamic_canonicalize_dynamic_symtab
#endif
Jakub Jelinek's avatar
bfd/  
Jakub Jelinek committed
614 615 616 617
#ifndef MY_get_synthetic_symtab
#define MY_get_synthetic_symtab \
  _bfd_nodynamic_get_synthetic_symtab
#endif
Richard Henderson's avatar
Richard Henderson committed
618 619 620 621 622 623 624 625 626
#ifndef MY_get_dynamic_reloc_upper_bound
#define MY_get_dynamic_reloc_upper_bound \
  _bfd_nodynamic_get_dynamic_reloc_upper_bound
#endif
#ifndef MY_canonicalize_dynamic_reloc
#define MY_canonicalize_dynamic_reloc \
  _bfd_nodynamic_canonicalize_dynamic_reloc
#endif

Nick Clifton's avatar
Nick Clifton committed
627
/* Aout symbols normally have leading underscores.  */
628
#ifndef MY_symbol_leading_char
Richard Henderson's avatar
Richard Henderson committed
629 630 631
#define MY_symbol_leading_char '_'
#endif

Nick Clifton's avatar
Nick Clifton committed
632
/* Aout archives normally use spaces for padding.  */
Richard Henderson's avatar
Richard Henderson committed
633 634 635 636 637
#ifndef AR_PAD_CHAR
#define AR_PAD_CHAR ' '
#endif

#ifndef MY_BFD_TARGET
Nick Clifton's avatar
Nick Clifton committed
638
const bfd_target MY (vec) =
Richard Henderson's avatar
Richard Henderson committed
639
{
Nick Clifton's avatar
Nick Clifton committed
640
  TARGETNAME,			/* Name.  */
Richard Henderson's avatar
Richard Henderson committed
641 642
  bfd_target_aout_flavour,
#ifdef TARGET_IS_BIG_ENDIAN_P
Nick Clifton's avatar
Nick Clifton committed
643 644
  BFD_ENDIAN_BIG,		/* Target byte order (big).  */
  BFD_ENDIAN_BIG,		/* Target headers byte order (big).  */
Richard Henderson's avatar
Richard Henderson committed
645
#else
Nick Clifton's avatar
Nick Clifton committed
646 647
  BFD_ENDIAN_LITTLE,		/* Target byte order (little).  */
  BFD_ENDIAN_LITTLE,		/* Target headers byte order (little).  */
Richard Henderson's avatar
Richard Henderson committed
648
#endif
Nick Clifton's avatar
Nick Clifton committed
649
  (HAS_RELOC | EXEC_P |		/* Object flags.  */
Richard Henderson's avatar
Richard Henderson committed
650 651 652 653
   HAS_LINENO | HAS_DEBUG |
   HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
  MY_symbol_leading_char,
Nick Clifton's avatar
Nick Clifton committed
654 655
  AR_PAD_CHAR,			/* AR_pad_char.  */
  15,				/* AR_max_namelen.  */
656
  0,				/* match priority.  */
Richard Henderson's avatar
Richard Henderson committed
657 658 659
#ifdef TARGET_IS_BIG_ENDIAN_P
  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
Nick Clifton's avatar
Nick Clifton committed
660
     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data.  */
Richard Henderson's avatar
Richard Henderson committed
661 662
  bfd_getb64, bfd_getb_signed_64, bfd_putb64,
     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
Nick Clifton's avatar
Nick Clifton committed
663
     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers.  */
Richard Henderson's avatar
Richard Henderson committed
664 665 666
#else
  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
Nick Clifton's avatar
Nick Clifton committed
667
     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data.  */
Richard Henderson's avatar
Richard Henderson committed
668 669
  bfd_getl64, bfd_getl_signed_64, bfd_putl64,
     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
Nick Clifton's avatar
Nick Clifton committed
670
     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers.  */
Richard Henderson's avatar
Richard Henderson committed
671
#endif
Alan Modra's avatar
Alan Modra committed
672
    {_bfd_dummy_target, MY_object_p,		/* bfd_check_format.  */
Richard Henderson's avatar
Richard Henderson committed
673
       bfd_generic_archive_p, MY_core_file_p},
Nick Clifton's avatar
Nick Clifton committed
674
    {bfd_false, MY_mkobject,			/* bfd_set_format.  */
Richard Henderson's avatar
Richard Henderson committed
675
       _bfd_generic_mkarchive, bfd_false},
Alan Modra's avatar
Alan Modra committed
676
    {bfd_false, MY_write_object_contents,	/* bfd_write_contents.  */
Richard Henderson's avatar
Richard Henderson committed
677 678 679 680 681 682 683 684 685 686 687 688
       _bfd_write_archive_contents, bfd_false},

     BFD_JUMP_TABLE_GENERIC (MY),
     BFD_JUMP_TABLE_COPY (MY),
     BFD_JUMP_TABLE_CORE (MY),
     BFD_JUMP_TABLE_ARCHIVE (MY),
     BFD_JUMP_TABLE_SYMBOLS (MY),
     BFD_JUMP_TABLE_RELOCS (MY),
     BFD_JUMP_TABLE_WRITE (MY),
     BFD_JUMP_TABLE_LINK (MY),
     BFD_JUMP_TABLE_DYNAMIC (MY),

Nick Clifton's avatar
Nick Clifton committed
689
  /* Alternative_target.  */
690
  NULL,
691

Nick Clifton's avatar
Nick Clifton committed
692
  MY_backend_data
Richard Henderson's avatar
Richard Henderson committed
693 694
};
#endif /* MY_BFD_TARGET */