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