mach-o-i386.c revision 1.1.1.6 1 1.1 christos /* Intel i386 Mach-O support for BFD.
2 1.1.1.6 christos Copyright (C) 2009-2020 Free Software Foundation, Inc.
3 1.1 christos
4 1.1 christos This file is part of BFD, the Binary File Descriptor library.
5 1.1 christos
6 1.1 christos This program is free software; you can redistribute it and/or modify
7 1.1 christos it under the terms of the GNU General Public License as published by
8 1.1 christos the Free Software Foundation; either version 3 of the License, or
9 1.1 christos (at your option) any later version.
10 1.1 christos
11 1.1 christos This program is distributed in the hope that it will be useful,
12 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
13 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 1.1 christos GNU General Public License for more details.
15 1.1 christos
16 1.1 christos You should have received a copy of the GNU General Public License
17 1.1 christos along with this program; if not, write to the Free Software
18 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 1.1 christos MA 02110-1301, USA. */
20 1.1 christos
21 1.1 christos #include "sysdep.h"
22 1.1 christos #include "bfd.h"
23 1.1 christos #include "libbfd.h"
24 1.1 christos #include "libiberty.h"
25 1.1.1.6 christos #include "mach-o.h"
26 1.1.1.2 christos #include "mach-o/reloc.h"
27 1.1 christos
28 1.1 christos #define bfd_mach_o_object_p bfd_mach_o_i386_object_p
29 1.1 christos #define bfd_mach_o_core_p bfd_mach_o_i386_core_p
30 1.1 christos #define bfd_mach_o_mkobject bfd_mach_o_i386_mkobject
31 1.1 christos
32 1.1 christos static const bfd_target *
33 1.1 christos bfd_mach_o_i386_object_p (bfd *abfd)
34 1.1 christos {
35 1.1.1.4 christos return bfd_mach_o_header_p (abfd, 0, 0, BFD_MACH_O_CPU_TYPE_I386);
36 1.1 christos }
37 1.1 christos
38 1.1 christos static const bfd_target *
39 1.1 christos bfd_mach_o_i386_core_p (bfd *abfd)
40 1.1 christos {
41 1.1.1.4 christos return bfd_mach_o_header_p (abfd, 0,
42 1.1.1.5 christos BFD_MACH_O_MH_CORE, BFD_MACH_O_CPU_TYPE_I386);
43 1.1 christos }
44 1.1 christos
45 1.1 christos static bfd_boolean
46 1.1 christos bfd_mach_o_i386_mkobject (bfd *abfd)
47 1.1 christos {
48 1.1 christos bfd_mach_o_data_struct *mdata;
49 1.1 christos
50 1.1 christos if (!bfd_mach_o_mkobject_init (abfd))
51 1.1 christos return FALSE;
52 1.1 christos
53 1.1 christos mdata = bfd_mach_o_get_data (abfd);
54 1.1 christos mdata->header.magic = BFD_MACH_O_MH_MAGIC;
55 1.1 christos mdata->header.cputype = BFD_MACH_O_CPU_TYPE_I386;
56 1.1 christos mdata->header.cpusubtype = BFD_MACH_O_CPU_SUBTYPE_X86_ALL;
57 1.1 christos mdata->header.byteorder = BFD_ENDIAN_LITTLE;
58 1.1 christos mdata->header.version = 1;
59 1.1 christos
60 1.1 christos return TRUE;
61 1.1 christos }
62 1.1 christos
63 1.1 christos static reloc_howto_type i386_howto_table[]=
64 1.1 christos {
65 1.1.1.2 christos /* 0 */
66 1.1 christos HOWTO(BFD_RELOC_32, 0, 2, 32, FALSE, 0,
67 1.1 christos complain_overflow_bitfield,
68 1.1 christos NULL, "32",
69 1.1 christos FALSE, 0xffffffff, 0xffffffff, FALSE),
70 1.1 christos HOWTO(BFD_RELOC_16, 0, 1, 16, FALSE, 0,
71 1.1 christos complain_overflow_bitfield,
72 1.1 christos NULL, "16",
73 1.1 christos FALSE, 0xffff, 0xffff, FALSE),
74 1.1 christos HOWTO(BFD_RELOC_8, 0, 0, 8, FALSE, 0,
75 1.1 christos complain_overflow_bitfield,
76 1.1 christos NULL, "8",
77 1.1 christos FALSE, 0xff, 0xff, FALSE),
78 1.1 christos HOWTO(BFD_RELOC_32_PCREL, 0, 2, 32, TRUE, 0,
79 1.1 christos complain_overflow_bitfield,
80 1.1 christos NULL, "DISP32",
81 1.1 christos FALSE, 0xffffffff, 0xffffffff, TRUE),
82 1.1.1.2 christos /* 4 */
83 1.1 christos HOWTO(BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0,
84 1.1 christos complain_overflow_bitfield,
85 1.1 christos NULL, "DISP16",
86 1.1 christos FALSE, 0xffff, 0xffff, TRUE),
87 1.1 christos HOWTO(BFD_RELOC_MACH_O_SECTDIFF, 0, 2, 32, FALSE, 0,
88 1.1 christos complain_overflow_bitfield,
89 1.1 christos NULL, "SECTDIFF_32",
90 1.1 christos FALSE, 0xffffffff, 0xffffffff, FALSE),
91 1.1.1.2 christos HOWTO(BFD_RELOC_MACH_O_LOCAL_SECTDIFF, 0, 2, 32, FALSE, 0,
92 1.1.1.2 christos complain_overflow_bitfield,
93 1.1.1.2 christos NULL, "LSECTDIFF_32",
94 1.1.1.2 christos FALSE, 0xffffffff, 0xffffffff, FALSE),
95 1.1 christos HOWTO(BFD_RELOC_MACH_O_PAIR, 0, 2, 32, FALSE, 0,
96 1.1 christos complain_overflow_bitfield,
97 1.1 christos NULL, "PAIR_32",
98 1.1 christos FALSE, 0xffffffff, 0xffffffff, FALSE),
99 1.1.1.2 christos /* 8 */
100 1.1.1.2 christos HOWTO(BFD_RELOC_MACH_O_SECTDIFF, 0, 1, 16, FALSE, 0,
101 1.1.1.2 christos complain_overflow_bitfield,
102 1.1.1.2 christos NULL, "SECTDIFF_16",
103 1.1.1.2 christos FALSE, 0xffff, 0xffff, FALSE),
104 1.1.1.2 christos HOWTO(BFD_RELOC_MACH_O_LOCAL_SECTDIFF, 0, 1, 16, FALSE, 0,
105 1.1.1.2 christos complain_overflow_bitfield,
106 1.1.1.2 christos NULL, "LSECTDIFF_16",
107 1.1.1.2 christos FALSE, 0xffff, 0xffff, FALSE),
108 1.1.1.2 christos HOWTO(BFD_RELOC_MACH_O_PAIR, 0, 1, 16, FALSE, 0,
109 1.1.1.2 christos complain_overflow_bitfield,
110 1.1.1.2 christos NULL, "PAIR_16",
111 1.1.1.2 christos FALSE, 0xffff, 0xffff, FALSE),
112 1.1 christos };
113 1.1 christos
114 1.1 christos static bfd_boolean
115 1.1.1.5 christos bfd_mach_o_i386_canonicalize_one_reloc (bfd * abfd,
116 1.1.1.5 christos struct mach_o_reloc_info_external * raw,
117 1.1.1.5 christos arelent * res,
118 1.1.1.5 christos asymbol ** syms,
119 1.1.1.5 christos arelent * res_base)
120 1.1 christos {
121 1.1.1.4 christos bfd_mach_o_reloc_info reloc;
122 1.1.1.4 christos
123 1.1.1.4 christos if (!bfd_mach_o_pre_canonicalize_one_reloc (abfd, raw, &reloc, res, syms))
124 1.1.1.4 christos return FALSE;
125 1.1.1.4 christos
126 1.1.1.4 christos if (reloc.r_scattered)
127 1.1 christos {
128 1.1.1.4 christos switch (reloc.r_type)
129 1.1.1.5 christos {
130 1.1.1.5 christos case BFD_MACH_O_GENERIC_RELOC_PAIR:
131 1.1.1.5 christos /* PR 21813: Check for a corrupt PAIR reloc at the start. */
132 1.1.1.5 christos if (res == res_base)
133 1.1.1.5 christos return FALSE;
134 1.1.1.5 christos if (reloc.r_length == 2)
135 1.1.1.5 christos {
136 1.1.1.2 christos res->howto = &i386_howto_table[7];
137 1.1.1.2 christos res->address = res[-1].address;
138 1.1.1.2 christos return TRUE;
139 1.1.1.5 christos }
140 1.1.1.5 christos else if (reloc.r_length == 1)
141 1.1.1.2 christos {
142 1.1.1.2 christos res->howto = &i386_howto_table[10];
143 1.1.1.2 christos res->address = res[-1].address;
144 1.1.1.2 christos return TRUE;
145 1.1.1.2 christos }
146 1.1.1.5 christos return FALSE;
147 1.1.1.5 christos case BFD_MACH_O_GENERIC_RELOC_SECTDIFF:
148 1.1.1.5 christos if (reloc.r_length == 2)
149 1.1.1.5 christos {
150 1.1.1.2 christos res->howto = &i386_howto_table[5];
151 1.1.1.2 christos return TRUE;
152 1.1.1.5 christos }
153 1.1.1.5 christos else if (reloc.r_length == 1)
154 1.1.1.5 christos {
155 1.1.1.2 christos res->howto = &i386_howto_table[8];
156 1.1.1.2 christos return TRUE;
157 1.1.1.5 christos }
158 1.1.1.5 christos return FALSE;
159 1.1.1.5 christos case BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF:
160 1.1.1.5 christos if (reloc.r_length == 2)
161 1.1.1.5 christos {
162 1.1.1.2 christos res->howto = &i386_howto_table[6];
163 1.1.1.2 christos return TRUE;
164 1.1.1.5 christos }
165 1.1.1.5 christos else if (reloc.r_length == 1)
166 1.1.1.5 christos {
167 1.1.1.2 christos res->howto = &i386_howto_table[9];
168 1.1.1.2 christos return TRUE;
169 1.1.1.5 christos }
170 1.1.1.5 christos return FALSE;
171 1.1.1.5 christos default:
172 1.1.1.5 christos break;
173 1.1.1.5 christos }
174 1.1 christos }
175 1.1 christos else
176 1.1 christos {
177 1.1.1.4 christos switch (reloc.r_type)
178 1.1.1.5 christos {
179 1.1.1.5 christos case BFD_MACH_O_GENERIC_RELOC_VANILLA:
180 1.1.1.5 christos switch ((reloc.r_length << 1) | reloc.r_pcrel)
181 1.1.1.5 christos {
182 1.1.1.5 christos case 0: /* len = 0, pcrel = 0 */
183 1.1.1.5 christos res->howto = &i386_howto_table[2];
184 1.1.1.5 christos return TRUE;
185 1.1.1.5 christos case 2: /* len = 1, pcrel = 0 */
186 1.1.1.5 christos res->howto = &i386_howto_table[1];
187 1.1.1.5 christos return TRUE;
188 1.1.1.5 christos case 3: /* len = 1, pcrel = 1 */
189 1.1.1.5 christos res->howto = &i386_howto_table[4];
190 1.1.1.5 christos return TRUE;
191 1.1.1.5 christos case 4: /* len = 2, pcrel = 0 */
192 1.1.1.5 christos res->howto = &i386_howto_table[0];
193 1.1.1.5 christos return TRUE;
194 1.1.1.5 christos case 5: /* len = 2, pcrel = 1 */
195 1.1.1.5 christos res->howto = &i386_howto_table[3];
196 1.1.1.5 christos return TRUE;
197 1.1.1.5 christos default:
198 1.1.1.5 christos return FALSE;
199 1.1.1.5 christos }
200 1.1.1.5 christos default:
201 1.1.1.5 christos break;
202 1.1.1.5 christos }
203 1.1 christos }
204 1.1.1.5 christos return FALSE;
205 1.1 christos }
206 1.1 christos
207 1.1 christos static bfd_boolean
208 1.1 christos bfd_mach_o_i386_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
209 1.1 christos {
210 1.1 christos rinfo->r_address = rel->address;
211 1.1 christos switch (rel->howto->type)
212 1.1 christos {
213 1.1 christos case BFD_RELOC_32:
214 1.1 christos case BFD_RELOC_32_PCREL:
215 1.1 christos case BFD_RELOC_16:
216 1.1 christos case BFD_RELOC_16_PCREL:
217 1.1 christos case BFD_RELOC_8:
218 1.1 christos rinfo->r_scattered = 0;
219 1.1 christos rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_VANILLA;
220 1.1 christos rinfo->r_pcrel = rel->howto->pc_relative;
221 1.1 christos rinfo->r_length = rel->howto->size; /* Correct in practice. */
222 1.1 christos if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
223 1.1.1.5 christos {
224 1.1.1.5 christos rinfo->r_extern = 0;
225 1.1.1.5 christos rinfo->r_value =
226 1.1.1.3 christos (*rel->sym_ptr_ptr)->section->output_section->target_index;
227 1.1.1.5 christos }
228 1.1 christos else
229 1.1.1.5 christos {
230 1.1.1.5 christos rinfo->r_extern = 1;
231 1.1.1.5 christos rinfo->r_value = (*rel->sym_ptr_ptr)->udata.i;
232 1.1.1.5 christos }
233 1.1 christos break;
234 1.1 christos case BFD_RELOC_MACH_O_SECTDIFF:
235 1.1 christos rinfo->r_scattered = 1;
236 1.1 christos rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_SECTDIFF;
237 1.1 christos rinfo->r_pcrel = 0;
238 1.1.1.2 christos rinfo->r_length = rel->howto->size;
239 1.1 christos rinfo->r_extern = 0;
240 1.1.1.2 christos rinfo->r_value = rel->addend;
241 1.1.1.2 christos break;
242 1.1.1.2 christos case BFD_RELOC_MACH_O_LOCAL_SECTDIFF:
243 1.1.1.2 christos rinfo->r_scattered = 1;
244 1.1.1.2 christos rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF;
245 1.1.1.2 christos rinfo->r_pcrel = 0;
246 1.1.1.2 christos rinfo->r_length = rel->howto->size;
247 1.1.1.2 christos rinfo->r_extern = 0;
248 1.1.1.2 christos rinfo->r_value = rel->addend;
249 1.1 christos break;
250 1.1 christos case BFD_RELOC_MACH_O_PAIR:
251 1.1 christos rinfo->r_address = 0;
252 1.1 christos rinfo->r_scattered = 1;
253 1.1 christos rinfo->r_type = BFD_MACH_O_GENERIC_RELOC_PAIR;
254 1.1 christos rinfo->r_pcrel = 0;
255 1.1.1.2 christos rinfo->r_length = rel->howto->size;
256 1.1 christos rinfo->r_extern = 0;
257 1.1.1.2 christos rinfo->r_value = rel->addend;
258 1.1 christos break;
259 1.1 christos default:
260 1.1 christos return FALSE;
261 1.1 christos }
262 1.1 christos return TRUE;
263 1.1 christos }
264 1.1 christos
265 1.1 christos static reloc_howto_type *
266 1.1 christos bfd_mach_o_i386_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
267 1.1.1.5 christos bfd_reloc_code_real_type code)
268 1.1 christos {
269 1.1 christos unsigned int i;
270 1.1 christos
271 1.1 christos for (i = 0; i < sizeof (i386_howto_table) / sizeof (*i386_howto_table); i++)
272 1.1 christos if (code == i386_howto_table[i].type)
273 1.1 christos return &i386_howto_table[i];
274 1.1 christos return NULL;
275 1.1 christos }
276 1.1 christos
277 1.1 christos static reloc_howto_type *
278 1.1 christos bfd_mach_o_i386_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
279 1.1.1.5 christos const char *name ATTRIBUTE_UNUSED)
280 1.1 christos {
281 1.1 christos return NULL;
282 1.1 christos }
283 1.1 christos
284 1.1 christos static bfd_boolean
285 1.1 christos bfd_mach_o_i386_print_thread (bfd *abfd, bfd_mach_o_thread_flavour *thread,
286 1.1.1.5 christos void *vfile, char *buf)
287 1.1 christos {
288 1.1 christos FILE *file = (FILE *)vfile;
289 1.1 christos
290 1.1 christos switch (thread->flavour)
291 1.1 christos {
292 1.1 christos case BFD_MACH_O_x86_THREAD_STATE:
293 1.1 christos if (thread->size < (8 + 16 * 4))
294 1.1.1.5 christos return FALSE;
295 1.1 christos fprintf (file, " x86_THREAD_STATE:\n");
296 1.1 christos fprintf (file, " flavor: 0x%08lx count: 0x%08lx\n",
297 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 0),
298 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 4));
299 1.1 christos fprintf (file, " eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
300 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 8),
301 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 12),
302 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 16),
303 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 20));
304 1.1 christos fprintf (file, " edi: %08lx esi: %08lx ebp: %08lx esp: %08lx\n",
305 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 24),
306 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 28),
307 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 32),
308 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 36));
309 1.1 christos fprintf (file, " ss: %08lx flg: %08lx eip: %08lx cs: %08lx\n",
310 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 40),
311 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 44),
312 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 48),
313 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 52));
314 1.1 christos fprintf (file, " ds: %08lx es: %08lx fs: %08lx gs: %08lx\n",
315 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 56),
316 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 60),
317 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 64),
318 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 68));
319 1.1 christos return TRUE;
320 1.1 christos case BFD_MACH_O_x86_FLOAT_STATE:
321 1.1 christos if (thread->size < 8)
322 1.1.1.5 christos return FALSE;
323 1.1 christos fprintf (file, " x86_FLOAT_STATE:\n");
324 1.1 christos fprintf (file, " flavor: 0x%08lx count: 0x%08lx\n",
325 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 0),
326 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 4));
327 1.1 christos return TRUE;
328 1.1 christos case BFD_MACH_O_x86_EXCEPTION_STATE:
329 1.1 christos if (thread->size < 8 + 3 * 4)
330 1.1.1.5 christos return FALSE;
331 1.1 christos fprintf (file, " x86_EXCEPTION_STATE:\n");
332 1.1 christos fprintf (file, " flavor: 0x%08lx count: 0x%08lx\n",
333 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 0),
334 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 4));
335 1.1 christos fprintf (file, " trapno: %08lx err: %08lx faultaddr: %08lx\n",
336 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 8),
337 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 12),
338 1.1.1.5 christos (unsigned long)bfd_get_32 (abfd, buf + 16));
339 1.1 christos return TRUE;
340 1.1 christos default:
341 1.1 christos break;
342 1.1 christos }
343 1.1 christos return FALSE;
344 1.1 christos }
345 1.1 christos
346 1.1.1.2 christos static const mach_o_section_name_xlat text_section_names_xlat[] =
347 1.1.1.2 christos {
348 1.1.1.2 christos { ".symbol_stub", "__symbol_stub",
349 1.1.1.2 christos SEC_CODE | SEC_LOAD, BFD_MACH_O_S_SYMBOL_STUBS,
350 1.1.1.2 christos BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS,
351 1.1.1.2 christos 0},
352 1.1.1.2 christos { ".picsymbol_stub", "__picsymbol_stub",
353 1.1.1.2 christos SEC_CODE | SEC_LOAD, BFD_MACH_O_S_SYMBOL_STUBS,
354 1.1.1.2 christos BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS,
355 1.1.1.2 christos 0},
356 1.1.1.2 christos { NULL, NULL, 0, 0, 0, 0}
357 1.1.1.2 christos };
358 1.1.1.2 christos
359 1.1.1.2 christos static const mach_o_section_name_xlat data_section_names_xlat[] =
360 1.1.1.2 christos {
361 1.1.1.2 christos /* The first two are recognized by i386, but not emitted for x86 by
362 1.1.1.2 christos modern GCC. */
363 1.1.1.2 christos { ".non_lazy_symbol_pointer", "__nl_symbol_ptr",
364 1.1.1.2 christos SEC_DATA | SEC_LOAD, BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS,
365 1.1.1.2 christos BFD_MACH_O_S_ATTR_NONE, 2},
366 1.1.1.2 christos { ".lazy_symbol_pointer", "__la_symbol_ptr",
367 1.1.1.2 christos SEC_DATA | SEC_LOAD, BFD_MACH_O_S_LAZY_SYMBOL_POINTERS,
368 1.1.1.2 christos BFD_MACH_O_S_ATTR_NONE, 2},
369 1.1.1.2 christos { ".lazy_symbol_pointer2", "__la_sym_ptr2",
370 1.1.1.2 christos SEC_DATA | SEC_LOAD, BFD_MACH_O_S_LAZY_SYMBOL_POINTERS,
371 1.1.1.2 christos BFD_MACH_O_S_ATTR_NONE, 2},
372 1.1.1.2 christos { ".lazy_symbol_pointer3", "__la_sym_ptr3",
373 1.1.1.2 christos SEC_DATA | SEC_LOAD, BFD_MACH_O_S_LAZY_SYMBOL_POINTERS,
374 1.1.1.2 christos BFD_MACH_O_S_ATTR_NONE, 2},
375 1.1.1.2 christos { NULL, NULL, 0, 0, 0, 0}
376 1.1.1.2 christos };
377 1.1.1.2 christos
378 1.1.1.2 christos static const mach_o_section_name_xlat import_section_names_xlat[] =
379 1.1.1.2 christos {
380 1.1.1.2 christos { ".picsymbol_stub3", "__jump_table",
381 1.1.1.2 christos SEC_CODE | SEC_LOAD, BFD_MACH_O_S_SYMBOL_STUBS,
382 1.1.1.3 christos BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS
383 1.1.1.2 christos | BFD_MACH_O_S_SELF_MODIFYING_CODE,
384 1.1.1.2 christos 6},
385 1.1.1.2 christos { ".non_lazy_symbol_pointer_x86", "__pointers",
386 1.1.1.2 christos SEC_DATA | SEC_LOAD, BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS,
387 1.1.1.2 christos BFD_MACH_O_S_ATTR_NONE, 2},
388 1.1.1.2 christos { NULL, NULL, 0, 0, 0, 0}
389 1.1.1.2 christos };
390 1.1.1.2 christos
391 1.1.1.2 christos const mach_o_segment_name_xlat mach_o_i386_segsec_names_xlat[] =
392 1.1.1.2 christos {
393 1.1.1.2 christos { "__TEXT", text_section_names_xlat },
394 1.1.1.2 christos { "__DATA", data_section_names_xlat },
395 1.1.1.2 christos { "__IMPORT", import_section_names_xlat },
396 1.1.1.2 christos { NULL, NULL }
397 1.1.1.2 christos };
398 1.1.1.2 christos
399 1.1.1.5 christos #define bfd_mach_o_canonicalize_one_reloc bfd_mach_o_i386_canonicalize_one_reloc
400 1.1.1.5 christos #define bfd_mach_o_swap_reloc_out bfd_mach_o_i386_swap_reloc_out
401 1.1.1.5 christos #define bfd_mach_o_print_thread bfd_mach_o_i386_print_thread
402 1.1 christos
403 1.1.1.2 christos #define bfd_mach_o_tgt_seg_table mach_o_i386_segsec_names_xlat
404 1.1.1.2 christos #define bfd_mach_o_section_type_valid_for_tgt NULL
405 1.1.1.2 christos
406 1.1.1.3 christos #define bfd_mach_o_bfd_reloc_type_lookup bfd_mach_o_i386_bfd_reloc_type_lookup
407 1.1 christos #define bfd_mach_o_bfd_reloc_name_lookup bfd_mach_o_i386_bfd_reloc_name_lookup
408 1.1 christos
409 1.1.1.5 christos #define TARGET_NAME i386_mach_o_vec
410 1.1.1.5 christos #define TARGET_STRING "mach-o-i386"
411 1.1 christos #define TARGET_ARCHITECTURE bfd_arch_i386
412 1.1.1.3 christos #define TARGET_PAGESIZE 4096
413 1.1.1.5 christos #define TARGET_BIG_ENDIAN 0
414 1.1.1.5 christos #define TARGET_ARCHIVE 0
415 1.1.1.2 christos #define TARGET_PRIORITY 0
416 1.1 christos #include "mach-o-target.c"
417