* elf32-spu.c (build_stub): Fix malloc under-allocation.
[binutils.git] / gas / config / obj-macho.h
blob92cb8ef87891e743cfd305dd15acef909a31e70b
1 /* Mach-O object file format for gas, the assembler.
2 Copyright 2009, 2011, 2012 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 3,
9 or (at your option) any later version.
11 GAS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19 02110-1301, USA. */
21 #ifndef _OBJ_MACH_O_H
22 #define _OBJ_MACH_O_H
24 /* Tag to validate Mach-O object file format processing */
25 #define OBJ_MACH_O 1
27 #include "bfd/mach-o.h"
29 #include "targ-cpu.h"
31 #define OUTPUT_FLAVOR bfd_target_mach_o_flavour
33 /* We want to control how the sections are pre-defined on startup. */
34 #define obj_begin() mach_o_begin ()
35 extern void mach_o_begin (void);
37 /* All our align expressions are power of two. */
38 #define USE_ALIGN_PTWO 1
40 /* Common symbols can carry alignment information. */
41 #ifndef S_SET_ALIGN
42 #define S_SET_ALIGN(S,V) do {\
43 bfd_mach_o_asymbol *___s = (bfd_mach_o_asymbol *) symbol_get_bfdsym (S);\
44 ___s->n_desc = (___s->n_desc & 0xf0ff) | (((V) & 0x0f) << 8);\
45 } while (0)
46 #endif
48 extern const pseudo_typeS mach_o_pseudo_table[];
50 #ifndef obj_pop_insert
51 #define obj_pop_insert() pop_insert (mach_o_pseudo_table)
52 #endif
54 #define obj_sec_sym_ok_for_reloc(SEC) 1
56 #define obj_read_begin_hook() {;}
57 #define obj_symbol_new_hook(s) {;}
59 #define EMIT_SECTION_SYMBOLS 0
61 struct obj_mach_o_symbol_data
63 /* If the symbol represents a subsection, this is the size of the subsection.
64 This is used to check whether a local symbol belongs to a subsection. */
65 valueT subsection_size;
67 #define OBJ_SYMFIELD_TYPE struct obj_mach_o_symbol_data
69 #define obj_frob_colon obj_mach_o_frob_colon
70 extern void obj_mach_o_frob_colon (const char *);
72 /* Called when a label is defined. Mach-O uses this to create subsections. */
73 #define obj_frob_label obj_mach_o_frob_label
74 extern void obj_mach_o_frob_label (symbolS *);
76 #define obj_frob_symbol(s, punt) punt = obj_mach_o_frob_symbol(s)
77 extern int obj_mach_o_frob_symbol (struct symbol *);
79 #define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) obj_mach_o_process_stab(W,S,T,O,D)
80 extern void obj_mach_o_process_stab (int, const char *,int, int, int);
82 struct obj_mach_o_frag_data
84 /* Symbol that corresponds to the subsection. */
85 symbolS *subsection;
88 #define OBJ_FRAG_TYPE struct obj_mach_o_frag_data
90 #define md_pre_output_hook obj_mach_o_pre_output_hook()
91 extern void obj_mach_o_pre_output_hook(void);
93 #define md_pre_relax_hook obj_mach_o_pre_relax_hook()
94 extern void obj_mach_o_pre_relax_hook (void);
96 #define md_post_relax_hook obj_mach_o_post_relax_hook()
97 extern void obj_mach_o_post_relax_hook (void);
99 #define obj_frob_file_after_relocs obj_mach_o_frob_file_after_relocs
100 extern void obj_mach_o_frob_file_after_relocs (void);
102 #define SET_SECTION_RELOCS(sec, relocs, n) \
103 obj_mach_o_reorder_section_relocs (sec, relocs, n)
104 extern void obj_mach_o_reorder_section_relocs (asection *, arelent **,
105 unsigned int);
107 /* Emit relocs for local subtracts, to cater for subsections-via-symbols. */
108 #define md_allow_local_subtract(LEFT, RIGHT, SECTION) \
109 obj_mach_o_allow_local_subtract (LEFT, RIGHT, SECTION)
110 extern int obj_mach_o_allow_local_subtract (expressionS *, expressionS *,
111 segT);
113 struct fix;
114 extern int obj_mach_o_in_different_subsection (symbolS *a, symbolS *b);
115 extern int obj_mach_o_force_reloc (struct fix *fix);
116 extern int obj_mach_o_force_reloc_sub_same (struct fix *fix, segT seg);
117 extern int obj_mach_o_force_reloc_sub_local (struct fix *fix, segT seg);
119 #endif /* _OBJ_MACH_O_H */