i386dynix.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* BFD back-end for i386 a.out binaries under dynix.
  2. Copyright (C) 1994-2015 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. /* This BFD is currently only tested with gdb, writing object files
  17. may not work. */
  18. #define TEXT_START_ADDR 4096
  19. #define TARGET_PAGE_SIZE 4096
  20. #define SEGMENT_SIZE TARGET_PAGE_SIZE
  21. #include "aout/dynix3.h"
  22. #define DEFAULT_ARCH bfd_arch_i386
  23. #define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_UNKNOWN)
  24. /* Do not "beautify" the CONCAT* macro args. Traditional C will not
  25. remove whitespace added here, and thus will fail to concatenate
  26. the tokens. */
  27. #define MY(OP) CONCAT2 (i386_aout_dynix_,OP)
  28. #define TARGETNAME "a.out-i386-dynix"
  29. #define NAME(x,y) CONCAT3 (i386dynix,_32_,y)
  30. #define ARCH_SIZE 32
  31. #define NAME_swap_exec_header_in NAME(i386dynix_32_,swap_exec_header_in)
  32. #define MY_get_section_contents aout_32_get_section_contents
  33. /* aoutx.h requires definitions for NMAGIC, BMAGIC and QMAGIC. */
  34. #define NMAGIC 0
  35. #define BMAGIC OMAGIC
  36. #define QMAGIC XMAGIC
  37. #include "aoutx.h"
  38. /* (Ab)use some fields in the internal exec header to be able to read
  39. executables that contain shared data. */
  40. #define a_shdata a_tload
  41. #define a_shdrsize a_dload
  42. void
  43. i386dynix_32_swap_exec_header_in (bfd *abfd,
  44. struct external_exec *raw_bytes,
  45. struct internal_exec *execp)
  46. {
  47. struct external_exec *bytes = (struct external_exec *)raw_bytes;
  48. /* The internal_exec structure has some fields that are unused in this
  49. configuration (IE for i960), so ensure that all such uninitialized
  50. fields are zero'd out. There are places where two of these structs
  51. are memcmp'd, and thus the contents do matter. */
  52. memset (execp, 0, sizeof (struct internal_exec));
  53. /* Now fill in fields in the execp, from the bytes in the raw data. */
  54. execp->a_info = H_GET_32 (abfd, bytes->e_info);
  55. execp->a_text = GET_WORD (abfd, bytes->e_text);
  56. execp->a_data = GET_WORD (abfd, bytes->e_data);
  57. execp->a_bss = GET_WORD (abfd, bytes->e_bss);
  58. execp->a_syms = GET_WORD (abfd, bytes->e_syms);
  59. execp->a_entry = GET_WORD (abfd, bytes->e_entry);
  60. execp->a_trsize = GET_WORD (abfd, bytes->e_trsize);
  61. execp->a_drsize = GET_WORD (abfd, bytes->e_drsize);
  62. execp->a_shdata = GET_WORD (abfd, bytes->e_shdata);
  63. execp->a_shdrsize = GET_WORD (abfd, bytes->e_shdrsize);
  64. }
  65. #include "aout-target.h"