1*56bb7041Schristos /* Multiple object format emulation.
2*56bb7041Schristos    Copyright (C) 1995-2020 Free Software Foundation, Inc.
3*56bb7041Schristos 
4*56bb7041Schristos    This file is part of GAS, the GNU Assembler.
5*56bb7041Schristos 
6*56bb7041Schristos    GAS is free software; you can redistribute it and/or modify
7*56bb7041Schristos    it under the terms of the GNU General Public License as published by
8*56bb7041Schristos    the Free Software Foundation; either version 3, or (at your option)
9*56bb7041Schristos    any later version.
10*56bb7041Schristos 
11*56bb7041Schristos    GAS is distributed in the hope that it will be useful,
12*56bb7041Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*56bb7041Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*56bb7041Schristos    GNU General Public License for more details.
15*56bb7041Schristos 
16*56bb7041Schristos    You should have received a copy of the GNU General Public License
17*56bb7041Schristos    along with GAS; see the file COPYING.  If not, write to the Free
18*56bb7041Schristos    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19*56bb7041Schristos    02110-1301, USA.  */
20*56bb7041Schristos 
21*56bb7041Schristos #ifndef _OBJ_MULTI_H
22*56bb7041Schristos #define _OBJ_MULTI_H
23*56bb7041Schristos 
24*56bb7041Schristos #ifdef OBJ_HEADER
25*56bb7041Schristos #include OBJ_HEADER
26*56bb7041Schristos #else
27*56bb7041Schristos 
28*56bb7041Schristos #include "emul.h"
29*56bb7041Schristos #include "targ-cpu.h"
30*56bb7041Schristos 
31*56bb7041Schristos #define OUTPUT_FLAVOR					\
32*56bb7041Schristos 	(this_format->flavor)
33*56bb7041Schristos 
34*56bb7041Schristos #define obj_begin()					\
35*56bb7041Schristos 	(this_format->begin				\
36*56bb7041Schristos 	 ? (*this_format->begin) ()			\
37*56bb7041Schristos 	 : (void) 0)
38*56bb7041Schristos 
39*56bb7041Schristos #define obj_app_file(NAME, APPFILE)			\
40*56bb7041Schristos 	(this_format->app_file				\
41*56bb7041Schristos 	 ? (*this_format->app_file) (NAME, APPFILE)	\
42*56bb7041Schristos 	 : (void) 0)
43*56bb7041Schristos 
44*56bb7041Schristos #define obj_frob_symbol(S,P)				\
45*56bb7041Schristos 	(*this_format->frob_symbol) (S, &(P))
46*56bb7041Schristos 
47*56bb7041Schristos #define obj_frob_file()					\
48*56bb7041Schristos 	(this_format->frob_file				\
49*56bb7041Schristos 	 ? (*this_format->frob_file) ()			\
50*56bb7041Schristos 	 : (void) 0)
51*56bb7041Schristos 
52*56bb7041Schristos #define obj_frob_file_before_adjust()			\
53*56bb7041Schristos 	(this_format->frob_file_before_adjust		\
54*56bb7041Schristos 	 ? (*this_format->frob_file_before_adjust) ()	\
55*56bb7041Schristos 	 : (void) 0)
56*56bb7041Schristos 
57*56bb7041Schristos #define obj_frob_file_before_fix()			\
58*56bb7041Schristos 	(this_format->frob_file_before_fix		\
59*56bb7041Schristos 	 ? (*this_format->frob_file_before_fix) ()	\
60*56bb7041Schristos 	 : (void) 0)
61*56bb7041Schristos 
62*56bb7041Schristos #define obj_frob_file_after_relocs()			\
63*56bb7041Schristos 	(this_format->frob_file_after_relocs		\
64*56bb7041Schristos 	 ? (*this_format->frob_file_after_relocs) ()	\
65*56bb7041Schristos 	 : (void) 0)
66*56bb7041Schristos 
67*56bb7041Schristos #define obj_ecoff_set_ext				\
68*56bb7041Schristos 	(*this_format->ecoff_set_ext)
69*56bb7041Schristos 
70*56bb7041Schristos #define obj_pop_insert					\
71*56bb7041Schristos 	(*this_format->pop_insert)
72*56bb7041Schristos 
73*56bb7041Schristos #define obj_read_begin_hook()				\
74*56bb7041Schristos 	(this_format->read_begin_hook			\
75*56bb7041Schristos 	 ? (*this_format->read_begin_hook) ()		\
76*56bb7041Schristos 	 : (void) 0)
77*56bb7041Schristos 
78*56bb7041Schristos #define obj_symbol_new_hook(S)				\
79*56bb7041Schristos 	(this_format->symbol_new_hook			\
80*56bb7041Schristos 	 ? (*this_format->symbol_new_hook) (S)		\
81*56bb7041Schristos 	 : (void) 0)
82*56bb7041Schristos 
83*56bb7041Schristos #define obj_symbol_clone_hook(N, O)			\
84*56bb7041Schristos 	(this_format->symbol_clone_hook			\
85*56bb7041Schristos 	 ? (*this_format->symbol_clone_hook) (N, O)	\
86*56bb7041Schristos 	 : (void) 0)
87*56bb7041Schristos 
88*56bb7041Schristos #define obj_sec_sym_ok_for_reloc(A)			\
89*56bb7041Schristos 	(this_format->sec_sym_ok_for_reloc		\
90*56bb7041Schristos 	 ? (*this_format->sec_sym_ok_for_reloc) (A)	\
91*56bb7041Schristos 	 : 0)
92*56bb7041Schristos 
93*56bb7041Schristos #define obj_adjust_symtab()				\
94*56bb7041Schristos 	(this_format->adjust_symtab			\
95*56bb7041Schristos 	 ? (*this_format->adjust_symtab) ()		\
96*56bb7041Schristos 	 : (void) 0)
97*56bb7041Schristos 
98*56bb7041Schristos #define S_GET_SIZE					\
99*56bb7041Schristos 	(*this_format->s_get_size)
100*56bb7041Schristos 
101*56bb7041Schristos #define S_SET_SIZE(S, N)				\
102*56bb7041Schristos 	(this_format->s_set_size			\
103*56bb7041Schristos 	 ? (*this_format->s_set_size) (S, N)		\
104*56bb7041Schristos 	 : (void) 0)
105*56bb7041Schristos 
106*56bb7041Schristos #define S_GET_ALIGN					\
107*56bb7041Schristos 	(*this_format->s_get_align)
108*56bb7041Schristos 
109*56bb7041Schristos #define S_SET_ALIGN(S, N)				\
110*56bb7041Schristos 	(this_format->s_set_align			\
111*56bb7041Schristos 	 ? (*this_format->s_set_align) (S, N)		\
112*56bb7041Schristos 	 : (void) 0)
113*56bb7041Schristos 
114*56bb7041Schristos #define S_GET_OTHER					\
115*56bb7041Schristos 	(*this_format->s_get_other)
116*56bb7041Schristos 
117*56bb7041Schristos #define S_SET_OTHER(S, O)				\
118*56bb7041Schristos 	(this_format->s_set_other			\
119*56bb7041Schristos 	 ? (*this_format->s_set_other) (S, O)		\
120*56bb7041Schristos 	 : (void) 0)
121*56bb7041Schristos 
122*56bb7041Schristos #define S_GET_DESC					\
123*56bb7041Schristos 	(*this_format->s_get_desc)
124*56bb7041Schristos 
125*56bb7041Schristos #define S_SET_DESC(S, D)				\
126*56bb7041Schristos 	(this_format->s_set_desc			\
127*56bb7041Schristos 	 ? (*this_format->s_set_desc) (S, D)		\
128*56bb7041Schristos 	 : (void) 0)
129*56bb7041Schristos 
130*56bb7041Schristos #define S_GET_TYPE					\
131*56bb7041Schristos 	(*this_format->s_get_desc)
132*56bb7041Schristos 
133*56bb7041Schristos #define S_SET_TYPE(S, T)				\
134*56bb7041Schristos 	(this_format->s_set_type			\
135*56bb7041Schristos 	 ? (*this_format->s_set_type) (S, T)		\
136*56bb7041Schristos 	 : (void) 0)
137*56bb7041Schristos 
138*56bb7041Schristos #define OBJ_COPY_SYMBOL_ATTRIBUTES(d,s)			\
139*56bb7041Schristos 	(this_format->copy_symbol_attributes		\
140*56bb7041Schristos 	 ? (*this_format->copy_symbol_attributes) (d, s) \
141*56bb7041Schristos 	 : (void) 0)
142*56bb7041Schristos 
143*56bb7041Schristos #define OBJ_PROCESS_STAB(SEG,W,S,T,O,D)			\
144*56bb7041Schristos 	(this_format->process_stab			\
145*56bb7041Schristos 	 ? (*this_format->process_stab) (SEG,W,S,T,O,D)	\
146*56bb7041Schristos 	 : (void) 0)
147*56bb7041Schristos 
148*56bb7041Schristos #define SEPARATE_STAB_SECTIONS \
149*56bb7041Schristos 	((*this_format->separate_stab_sections) ())
150*56bb7041Schristos 
151*56bb7041Schristos #define INIT_STAB_SECTION(S)				\
152*56bb7041Schristos 	(this_format->init_stab_section			\
153*56bb7041Schristos 	 ? (*this_format->init_stab_section) (S)	\
154*56bb7041Schristos 	 : (void) 0)
155*56bb7041Schristos 
156*56bb7041Schristos #define EMIT_SECTION_SYMBOLS (this_format->emit_section_symbols)
157*56bb7041Schristos 
158*56bb7041Schristos #ifndef INITIALIZING_EMULS
159*56bb7041Schristos /* We want to use the default FAKE_LABEL_NAME in as.c.  */
160*56bb7041Schristos #define FAKE_LABEL_NAME (this_emulation->fake_label_name)
161*56bb7041Schristos #endif
162*56bb7041Schristos 
163*56bb7041Schristos #ifdef OBJ_MAYBE_ELF
164*56bb7041Schristos /* We need OBJ_SYMFIELD_TYPE so that symbol_get_obj is defined in symbol.c
165*56bb7041Schristos    We also need various STAB defines for stab.c  */
166*56bb7041Schristos #include "obj-elf.h"
167*56bb7041Schristos #endif
168*56bb7041Schristos 
169*56bb7041Schristos #ifdef OBJ_MAYBE_AOUT
170*56bb7041Schristos /* We want aout_process_stab in stabs.c for the aout table.  Defining this
171*56bb7041Schristos    macro will have no other effect.  */
172*56bb7041Schristos #define AOUT_STABS
173*56bb7041Schristos #endif
174*56bb7041Schristos 
175*56bb7041Schristos #endif /* !OBJ_HEADER */
176*56bb7041Schristos #endif /* _OBJ_MULTI_H */
177