pc532-mach.c 3.2 KB

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