Coverage Report

Created: 2025-06-24 06:45

/src/binutils-gdb/gas/config/tc-i386.h
Line
Count
Source (jump to first uncovered line)
1
/* tc-i386.h -- Header file for tc-i386.c
2
   Copyright (C) 1989-2025 Free Software Foundation, Inc.
3
4
   This file is part of GAS, the GNU Assembler.
5
6
   GAS 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, or (at your option)
9
   any later version.
10
11
   GAS 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 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.  */
20
21
#ifndef TC_I386
22
#define TC_I386 1
23
24
#include "opcodes/i386-opc.h"
25
26
struct fix;
27
28
#define TARGET_BYTES_BIG_ENDIAN 0
29
30
#define TARGET_ARCH   (i386_arch ())
31
#define TARGET_MACH   (i386_mach ())
32
extern enum bfd_architecture i386_arch (void);
33
extern unsigned long i386_mach (void);
34
35
#ifdef TE_FreeBSD
36
#define AOUT_TARGET_FORMAT  "a.out-i386-freebsd"
37
#endif
38
#ifdef TE_NetBSD
39
#define AOUT_TARGET_FORMAT  "a.out-i386-netbsd"
40
#endif
41
#ifdef TE_386BSD
42
#define AOUT_TARGET_FORMAT  "a.out-i386-bsd"
43
#endif
44
#ifdef TE_LINUX
45
#define AOUT_TARGET_FORMAT  "a.out-i386-linux"
46
#endif
47
#ifdef TE_Mach
48
#define AOUT_TARGET_FORMAT  "a.out-mach3"
49
#endif
50
#ifdef TE_DYNIX
51
#define AOUT_TARGET_FORMAT  "a.out-i386-dynix"
52
#endif
53
#ifndef AOUT_TARGET_FORMAT
54
#define AOUT_TARGET_FORMAT  "a.out-i386"
55
#endif
56
57
#ifdef TE_FreeBSD
58
#define ELF_TARGET_FORMAT "elf32-i386-freebsd"
59
#define ELF_TARGET_FORMAT64 "elf64-x86-64-freebsd"
60
#elif defined (TE_VXWORKS)
61
#define ELF_TARGET_FORMAT "elf32-i386-vxworks"
62
#elif defined TE_CLOUDABI
63
#define ELF_TARGET_FORMAT64 "elf64-x86-64-cloudabi"
64
#endif
65
66
#ifdef TE_SOLARIS
67
#define ELF_TARGET_FORMAT "elf32-i386-sol2"
68
#define ELF_TARGET_FORMAT64 "elf64-x86-64-sol2"
69
#endif
70
71
#ifndef ELF_TARGET_FORMAT
72
0
#define ELF_TARGET_FORMAT "elf32-i386"
73
#endif
74
75
#ifndef ELF_TARGET_FORMAT64
76
28
#define ELF_TARGET_FORMAT64 "elf64-x86-64"
77
#endif
78
79
#ifndef ELF_TARGET_FORMAT32
80
0
#define ELF_TARGET_FORMAT32 "elf32-x86-64"
81
#endif
82
83
#ifndef ELF_TARGET_IAMCU_FORMAT
84
0
#define ELF_TARGET_IAMCU_FORMAT "elf32-iamcu"
85
#endif
86
87
#if (defined (OBJ_ELF) || defined (TE_PE) || defined (OBJ_MACH_O))
88
extern const char *i386_target_format (void);
89
28
#define TARGET_FORMAT i386_target_format ()
90
#else
91
#ifdef TE_GO32
92
#define TARGET_FORMAT   "coff-go32"
93
#endif
94
#ifdef OBJ_AOUT
95
#define TARGET_FORMAT   AOUT_TARGET_FORMAT
96
#endif
97
#endif
98
99
0
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
100
101
/* '$' may be used as immediate prefix.  */
102
#undef LOCAL_LABELS_DOLLAR
103
970k
#define LOCAL_LABELS_DOLLAR 0
104
#undef LOCAL_LABELS_FB
105
568k
#define LOCAL_LABELS_FB 1
106
107
extern const char extra_symbol_chars[];
108
28
#define tc_symbol_chars extra_symbol_chars
109
110
extern const char *i386_comment_chars;
111
41.5k
#define tc_comment_chars i386_comment_chars
112
113
/* The name of the global offset table generated by the compiler. Allow
114
   this to be overridden if need be.  */
115
#ifndef GLOBAL_OFFSET_TABLE_NAME
116
6.39k
#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
117
#endif
118
119
2.31k
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES)
120
extern bfd_reloc_code_real_type x86_cons (expressionS *, int);
121
122
#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC) \
123
1.66k
  x86_cons_fix_new(FRAG, OFF, LEN, EXP, RELOC)
124
extern void x86_cons_fix_new
125
(fragS *, unsigned int, unsigned int, expressionS *, bfd_reloc_code_real_type);
126
127
413
#define X_PRECISION     5
128
413
#define X_PRECISION_PAD 0
129
130
0
#define TC_ADDRESS_BYTES x86_address_bytes
131
extern int x86_address_bytes (void);
132
133
#define DIFF_EXPR_OK    /* foo-. gets turned into PC relative relocs */
134
135
2.55M
#define NO_RELOC BFD_RELOC_NONE
136
137
int i386_validate_fix (struct fix *);
138
0
#define TC_VALIDATE_FIX(FIX,SEGTYPE,SKIP) do { \
139
0
    if (!i386_validate_fix(FIX)) goto SKIP;      \
140
0
  } while (0)
141
142
#ifdef OBJ_ELF
143
0
#define tc_fix_adjustable(X)  tc_i386_fix_adjustable(X)
144
extern int tc_i386_fix_adjustable (struct fix *);
145
#else
146
#define tc_fix_adjustable(X)  ((void)(X), 1)
147
#define md_undefined_symbol(N) ((void)(N), NULL)
148
#endif
149
150
/* Values passed to md_apply_fix don't include the symbol value.  */
151
0
#define MD_APPLY_SYM_VALUE(FIX) 0
152
153
/* ELF wants external syms kept, as does PE COFF.  */
154
#if defined (TE_PE) && defined (STRICT_PE_FORMAT)
155
#define EXTERN_FORCE_RELOC        \
156
  (IS_ELF || OUTPUT_FLAVOR == bfd_target_coff_flavour)
157
#else
158
0
#define EXTERN_FORCE_RELOC  IS_ELF
159
#endif
160
161
/* This expression evaluates to true if the relocation is for a local
162
   object for which we still want to do the relocation at runtime.
163
   False if we are willing to perform this relocation while building
164
   the .o file.  GOTOFF and GOT32 do not need to be checked here because
165
   they are not pcrel.  .*/
166
167
#define TC_FORCE_RELOCATION_LOCAL(FIX)        \
168
0
  (GENERIC_FORCE_RELOCATION_LOCAL (FIX)        \
169
0
   || (FIX)->fx_r_type == BFD_RELOC_386_PLT32      \
170
0
   || (FIX)->fx_r_type == BFD_RELOC_386_GOTPC      \
171
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL    \
172
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX    \
173
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX  \
174
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_CODE_4_GOTPCRELX  \
175
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_CODE_5_GOTPCRELX  \
176
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_CODE_6_GOTPCRELX)
177
178
#define TC_FORCE_RELOCATION_ABS(FIX)        \
179
0
  (TC_FORCE_RELOCATION (FIX)          \
180
0
   || (FIX)->fx_r_type == BFD_RELOC_386_GOT32      \
181
0
   || (FIX)->fx_r_type == BFD_RELOC_386_GOT32X      \
182
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCREL    \
183
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX    \
184
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX  \
185
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_CODE_4_GOTPCRELX  \
186
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_CODE_5_GOTPCRELX  \
187
0
   || (FIX)->fx_r_type == BFD_RELOC_X86_64_CODE_6_GOTPCRELX)
188
189
extern void i386_start_line (void);
190
6.89M
#define md_start_line_hook i386_start_line
191
192
extern bool i386_check_label (void);
193
#define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) \
194
644k
  (NEXT_CHAR == ':' && i386_check_label ())
195
196
extern int i386_unrecognized_line (int);
197
262k
#define tc_unrecognized_line i386_unrecognized_line
198
199
extern int i386_parse_name (char *, expressionS *, enum expr_mode, char *);
200
86.9k
#define md_parse_name(s, e, m, c) i386_parse_name (s, e, m, c)
201
202
extern operatorT i386_operator (const char *name, unsigned int operands, char *);
203
337k
#define md_operator i386_operator
204
205
extern int i386_need_index_operator (void);
206
105
#define md_need_index_operator i386_need_index_operator
207
208
#ifdef BFD64
209
extern bool i386_record_operator
210
  (operatorT, const expressionS *, const expressionS *);
211
142k
#define md_optimize_expr(l, o, r) i386_record_operator (o, l, r)
212
#endif
213
214
68.9k
#define md_register_arithmetic 0
215
216
extern const struct relax_type md_relax_table[];
217
0
#define TC_GENERIC_RELAX_TABLE md_relax_table
218
219
extern int optimize_align_code;
220
221
575
#define md_do_align(n, fill, len, max, around)        \
222
575
if ((n)                  \
223
575
    && !need_pass_2              \
224
575
    && optimize_align_code            \
225
575
    && (!(fill)                \
226
377
  || ((char)*(fill) == (char)0x90 && (len) == 1))      \
227
575
    && subseg_text_p (now_seg))           \
228
575
  {                 \
229
192
    frag_align_code ((n), (max));         \
230
192
    goto around;              \
231
192
  }
232
233
extern void i386_cons_align (int);
234
6.90k
#define md_cons_align(nbytes) i386_cons_align (nbytes)
235
236
#ifndef OBJ_AOUT
237
0
#define md_section_align(seg, value) ((void)(seg), (value))
238
#endif
239
240
void i386_print_statistics (FILE *);
241
0
#define tc_print_statistics i386_print_statistics
242
243
void i386_md_end (void);
244
28
#define md_end i386_md_end
245
246
extern unsigned int i386_frag_max_var (fragS *);
247
0
#define md_frag_max_var i386_frag_max_var
248
249
extern long i386_generic_table_relax_frag (segT, fragS *, long);
250
#define md_generic_table_relax_frag(segment, fragP, stretch) \
251
0
  i386_generic_table_relax_frag (segment, fragP, stretch)
252
253
9.57k
#define md_number_to_chars number_to_chars_littleendian
254
255
enum processor_type
256
{
257
  PROCESSOR_UNKNOWN,
258
  PROCESSOR_GENERIC32,
259
  PROCESSOR_GENERIC64,
260
  PROCESSOR_I386,
261
  PROCESSOR_I486,
262
  PROCESSOR_PENTIUM,
263
  PROCESSOR_I686,
264
  PROCESSOR_PENTIUMPRO,
265
  PROCESSOR_PENTIUM4,
266
  PROCESSOR_NOCONA,
267
  PROCESSOR_CORE,
268
  PROCESSOR_CORE2,
269
  PROCESSOR_COREI7,
270
  PROCESSOR_IAMCU,
271
  PROCESSOR_K6,
272
  PROCESSOR_ATHLON,
273
  PROCESSOR_K8,
274
  PROCESSOR_AMDFAM10,
275
  PROCESSOR_BD,
276
  PROCESSOR_ZNVER,
277
  PROCESSOR_BT,
278
  /* Keep this last.  */
279
  PROCESSOR_NONE
280
};
281
282
extern i386_cpu_flags cpu_arch_flags;
283
extern enum processor_type cpu_arch_tune;
284
extern enum processor_type cpu_arch_isa;
285
extern i386_cpu_flags cpu_arch_isa_flags;
286
287
/* We support four different modes.  I386_FLAG_CODE variable is used to
288
   distinguish three of these.  */
289
290
extern enum i386_flag_code {
291
  CODE_32BIT,
292
  CODE_16BIT,
293
  CODE_64BIT
294
} i386_flag_code;
295
296
struct i386_segment_info {
297
  /* Type of previous "instruction", e.g. .byte or stand-alone prefix.  */
298
  struct last_insn {
299
    const char *file;
300
    const char *name;
301
    unsigned int line;
302
    enum last_insn_kind
303
      {
304
  last_insn_other = 0,
305
  last_insn_directive,
306
  last_insn_prefix
307
      } kind;
308
  } last_insn;
309
  subsegT subseg;
310
  struct i386_segment_info *next;
311
};
312
313
#define TC_SEGMENT_INFO_TYPE struct i386_segment_info
314
315
struct i386_tc_frag_data
316
{
317
  union
318
    {
319
      fragS *padding_fragP;
320
      fragS *branch_fragP;
321
    } u;
322
  addressT padding_address;
323
  enum processor_type isa;
324
  enum processor_type tune;
325
  enum i386_flag_code code;
326
  unsigned int max_bytes;
327
  unsigned char length;
328
  unsigned char last_length;
329
  unsigned char max_prefix_length;
330
  unsigned char prefix_length;
331
  unsigned char default_prefix;
332
  unsigned char cmp_size;
333
  unsigned int mf_type : 3;
334
  unsigned int classified : 1;
335
  unsigned int branch_type : 3;
336
  unsigned int cpunop : 1;
337
  unsigned int isanop : 1;
338
  unsigned int last_insn_normal : 1;
339
};
340
341
/* We need to emit the right NOP pattern in .align frags.  This is
342
   done after the text-to-bits assembly pass, so we need to mark it with
343
   the isa/tune settings at the time the .align was assembled.  */
344
#define TC_FRAG_TYPE struct i386_tc_frag_data
345
346
#define TC_FRAG_INIT(FRAGP, MAX_BYTES)        \
347
3.30k
 do                \
348
3.30k
   {               \
349
3.30k
     (FRAGP)->tc_frag_data.u.padding_fragP = NULL;    \
350
3.30k
     (FRAGP)->tc_frag_data.padding_address = 0;     \
351
3.30k
     (FRAGP)->tc_frag_data.isa = cpu_arch_isa;      \
352
3.30k
     (FRAGP)->tc_frag_data.tune = cpu_arch_tune;    \
353
3.30k
     (FRAGP)->tc_frag_data.cpunop = cpu_arch_flags.bitfield.cpunop; \
354
3.30k
     (FRAGP)->tc_frag_data.isanop = cpu_arch_isa_flags.bitfield.cpunop; \
355
3.30k
     (FRAGP)->tc_frag_data.code = i386_flag_code;   \
356
3.30k
     (FRAGP)->tc_frag_data.max_bytes = (MAX_BYTES);   \
357
3.30k
     (FRAGP)->tc_frag_data.length = 0;        \
358
3.30k
     (FRAGP)->tc_frag_data.last_length = 0;     \
359
3.30k
     (FRAGP)->tc_frag_data.max_prefix_length = 0;   \
360
3.30k
     (FRAGP)->tc_frag_data.prefix_length = 0;     \
361
3.30k
     (FRAGP)->tc_frag_data.default_prefix = 0;      \
362
3.30k
     (FRAGP)->tc_frag_data.cmp_size = 0;      \
363
3.30k
     (FRAGP)->tc_frag_data.classified = 0;      \
364
3.30k
     (FRAGP)->tc_frag_data.branch_type = 0;     \
365
3.30k
     (FRAGP)->tc_frag_data.mf_type = 0;       \
366
3.30k
     (FRAGP)->tc_frag_data.last_insn_normal     \
367
3.30k
  = (seg_info(now_seg)->tc_segment_info_data.last_insn.kind \
368
3.30k
     == last_insn_other);         \
369
3.30k
   }                \
370
3.30k
 while (0)
371
372
#define WORKING_DOT_WORD 1
373
374
/* How to generate NOPs for .nop direct directive.  */
375
extern void i386_generate_nops (fragS *, char *, offsetT, int);
376
#define md_generate_nops(frag, where, amount, control) \
377
0
  i386_generate_nops ((frag), (where), (amount), (control))
378
379
0
#define HANDLE_ALIGN(sec, fragP) \
380
0
if (fragP->fr_type == rs_align_code)           \
381
0
  {                 \
382
0
    offsetT __count = (fragP->fr_next->fr_address     \
383
0
           - fragP->fr_address        \
384
0
           - fragP->fr_fix);        \
385
0
    if (__count > 0)             \
386
0
      {                 \
387
0
  know (fragP->tc_frag_data.max_bytes >= (valueT) __count   \
388
0
        || (fragP->tc_frag_data.max_bytes       \
389
0
      >= MAX_MEM_FOR_RS_ALIGN_CODE (fragP->fr_offset, \
390
0
            fragP->fr_subtype))); \
391
0
  md_generate_nops (fragP, fragP->fr_literal + fragP->fr_fix, \
392
0
        __count, 0);          \
393
0
      }                  \
394
0
  }
395
/* Possible plain nop, branch, twice largest nop less 1.
396
   Yes, the branch might be one byte longer in CODE_16BIT but then the
397
   largest nop is smaller.  */
398
196
#define MAX_MEM_FOR_RS_SPACE_NOP (1 + 5 + 2 * 15 - 1)
399
400
static inline unsigned int
401
max_mem_for_rs_align_code (unsigned int p2align, unsigned int max)
402
192
{
403
192
  unsigned int bytes = 1;
404
192
  if (p2align != 0)
405
192
    {
406
192
      bytes = MAX_MEM_FOR_RS_SPACE_NOP;
407
192
      if (bytes > (1ull << p2align) - 1)
408
192
  bytes = (1ull << p2align) - 1;
409
192
      if (max != 0 && bytes > max)
410
0
  bytes = max;
411
192
    }
412
192
  return bytes;
413
192
}
Unexecuted instantiation: fuzz_as.c:max_mem_for_rs_align_code
Unexecuted instantiation: codeview.c:max_mem_for_rs_align_code
Unexecuted instantiation: cond.c:max_mem_for_rs_align_code
Unexecuted instantiation: depend.c:max_mem_for_rs_align_code
Unexecuted instantiation: dw2gencfi.c:max_mem_for_rs_align_code
Unexecuted instantiation: dwarf2dbg.c:max_mem_for_rs_align_code
Unexecuted instantiation: ehopt.c:max_mem_for_rs_align_code
Unexecuted instantiation: expr.c:max_mem_for_rs_align_code
frags.c:max_mem_for_rs_align_code
Line
Count
Source
402
192
{
403
192
  unsigned int bytes = 1;
404
192
  if (p2align != 0)
405
192
    {
406
192
      bytes = MAX_MEM_FOR_RS_SPACE_NOP;
407
192
      if (bytes > (1ull << p2align) - 1)
408
192
  bytes = (1ull << p2align) - 1;
409
192
      if (max != 0 && bytes > max)
410
0
  bytes = max;
411
192
    }
412
192
  return bytes;
413
192
}
Unexecuted instantiation: gen-sframe.c:max_mem_for_rs_align_code
Unexecuted instantiation: input-scrub.c:max_mem_for_rs_align_code
Unexecuted instantiation: listing.c:max_mem_for_rs_align_code
Unexecuted instantiation: macro.c:max_mem_for_rs_align_code
Unexecuted instantiation: messages.c:max_mem_for_rs_align_code
Unexecuted instantiation: output-file.c:max_mem_for_rs_align_code
Unexecuted instantiation: read.c:max_mem_for_rs_align_code
Unexecuted instantiation: remap.c:max_mem_for_rs_align_code
Unexecuted instantiation: sb.c:max_mem_for_rs_align_code
Unexecuted instantiation: scfidw2gen.c:max_mem_for_rs_align_code
Unexecuted instantiation: stabs.c:max_mem_for_rs_align_code
Unexecuted instantiation: subsegs.c:max_mem_for_rs_align_code
Unexecuted instantiation: symbols.c:max_mem_for_rs_align_code
Unexecuted instantiation: write.c:max_mem_for_rs_align_code
Unexecuted instantiation: app.c:max_mem_for_rs_align_code
Unexecuted instantiation: atof-generic.c:max_mem_for_rs_align_code
Unexecuted instantiation: ecoff.c:max_mem_for_rs_align_code
Unexecuted instantiation: flonum-copy.c:max_mem_for_rs_align_code
Unexecuted instantiation: ginsn.c:max_mem_for_rs_align_code
Unexecuted instantiation: hash.c:max_mem_for_rs_align_code
Unexecuted instantiation: input-file.c:max_mem_for_rs_align_code
Unexecuted instantiation: scfi.c:max_mem_for_rs_align_code
Unexecuted instantiation: sframe-opt.c:max_mem_for_rs_align_code
Unexecuted instantiation: tc-i386.c:max_mem_for_rs_align_code
Unexecuted instantiation: obj-elf.c:max_mem_for_rs_align_code
Unexecuted instantiation: atof-ieee.c:max_mem_for_rs_align_code
414
#define MAX_MEM_FOR_RS_ALIGN_CODE(p2align, max) \
415
192
  max_mem_for_rs_align_code (p2align, max)
416
417
/* We want .cfi_* pseudo-ops for generating unwind info.  */
418
#define TARGET_USE_CFIPOP 1
419
420
extern unsigned int x86_dwarf2_return_column;
421
9
#define DWARF2_DEFAULT_RETURN_COLUMN x86_dwarf2_return_column
422
423
extern int x86_cie_data_alignment;
424
10
#define DWARF2_CIE_DATA_ALIGNMENT x86_cie_data_alignment
425
426
extern int x86_dwarf2_addr_size (void);
427
13
#define DWARF2_ADDR_SIZE(bfd) x86_dwarf2_addr_size ()
428
429
4
#define tc_parse_to_dw2regnum tc_x86_parse_to_dw2regnum
430
extern void tc_x86_parse_to_dw2regnum (expressionS *);
431
432
5
#define tc_cfi_frame_initial_instructions tc_x86_frame_initial_instructions
433
extern void tc_x86_frame_initial_instructions (void);
434
435
/* DWARF register number of the frame-pointer register in 64-bit mode.  */
436
0
#define REG_FP 6
437
/* DWARF register number of the stack-pointer register in 64-bit mode.  */
438
5
#define REG_SP 7
439
/* DWARF register number of the (pseudo) return address register in 64-bit
440
   mode.  This is the same as reg RIP in i386-reg.tbl.  */
441
28
#define REG_RA 16
442
443
0
#define md_elf_section_type(str,len) i386_elf_section_type (str, len)
444
extern int i386_elf_section_type (const char *, size_t);
445
446
2.53k
#define md_elf_section_change_hook i386_elf_section_change_hook
447
extern void i386_elf_section_change_hook (void);
448
449
#ifdef TE_SOLARIS
450
#define md_fix_up_eh_frame(sec) i386_solaris_fix_up_eh_frame (sec)
451
extern void i386_solaris_fix_up_eh_frame (segT);
452
#endif
453
454
/* Support for SHF_X86_64_LARGE */
455
extern bfd_vma x86_64_section_letter (int, const char **);
456
0
#define md_elf_section_letter(LETTER, PTR_MSG)  x86_64_section_letter (LETTER, PTR_MSG)
457
458
#ifdef OBJ_ELF
459
extern void x86_cleanup (void);
460
28
#define md_cleanup() x86_cleanup ()
461
462
#define TARGET_USE_GINSN 1
463
/* Allow GAS to synthesize DWARF CFI for hand-written asm.
464
   PS: TARGET_USE_CFIPOP is a pre-condition.  */
465
#define TARGET_USE_SCFI 1
466
/* Identify the maximum DWARF register number of all the registers being
467
   tracked for SCFI.  This is the last DWARF register number of the set
468
   of SP, BP, and all callee-saved registers.  For AMD64, this means
469
   R15 (15).  Use SCFI_CALLEE_SAVED_REG_P to identify which registers
470
   are callee-saved from this set.  */
471
0
#define SCFI_MAX_REG_ID 15
472
/* Some ABIs, like AMD64, use stack for call instruction.  For such an ABI,
473
   identify the initial (CFA) offset from RSP at the entry of function.  */
474
0
#define SCFI_INIT_CFA_OFFSET 8
475
476
0
#define SCFI_CALLEE_SAVED_REG_P(dw2reg)  x86_scfi_callee_saved_p (dw2reg)
477
extern bool x86_scfi_callee_saved_p (uint32_t dw2reg_num);
478
479
/* Whether SFrame stack trace info is supported.  */
480
extern bool x86_support_sframe_p (void);
481
1
#define support_sframe_p x86_support_sframe_p
482
483
/* The stack pointer DWARF register number for SFrame CFA tracking.  */
484
extern const unsigned int x86_sframe_cfa_sp_reg;
485
10
#define SFRAME_CFA_SP_REG x86_sframe_cfa_sp_reg
486
487
/* The frame pointer DWARF register number for SFrame CFA and FP tracking.  */
488
extern const unsigned int x86_sframe_cfa_fp_reg;
489
9
#define SFRAME_CFA_FP_REG x86_sframe_cfa_fp_reg
490
491
/* The return address DWARF register number for SFrame purposes.  Although for
492
   AMD64, RA tracking is disabled, specific constructs, like for indicating
493
   the _start function, may use it.  */
494
extern const unsigned int x86_sframe_cfa_ra_reg;
495
4
#define SFRAME_CFA_RA_REG x86_sframe_cfa_ra_reg
496
497
/* Whether SFrame return address tracking is needed.  */
498
extern bool x86_sframe_ra_tracking_p (void);
499
9
#define sframe_ra_tracking_p x86_sframe_ra_tracking_p
500
501
/* The fixed offset from CFA for SFrame to recover the return address.
502
   (useful only when SFrame RA tracking is not needed).  */
503
extern offsetT x86_sframe_cfa_ra_offset (void);
504
1
#define sframe_cfa_ra_offset x86_sframe_cfa_ra_offset
505
506
/* The abi/arch identifier for SFrame.  */
507
extern unsigned char x86_sframe_get_abi_arch (void);
508
4
#define sframe_get_abi_arch x86_sframe_get_abi_arch
509
510
#endif
511
512
#ifdef TE_PE
513
514
#define O_secrel O_md1
515
516
#define TC_DWARF2_EMIT_OFFSET  tc_pe_dwarf2_emit_offset
517
void tc_pe_dwarf2_emit_offset (symbolS *, unsigned int);
518
519
#endif /* TE_PE */
520
521
/* X_add_symbol:X_op_symbol (Intel mode only) */
522
2
#define O_full_ptr O_md2
523
524
#ifdef OBJ_MACH_O
525
526
#define TC_FORCE_RELOCATION(FIX) (obj_mach_o_force_reloc (FIX))
527
528
#define TC_FORCE_RELOCATION_SUB_SAME(FIX,SEG) \
529
    (obj_mach_o_force_reloc_sub_same (FIX, SEG))
530
531
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX,SEG) \
532
  (obj_mach_o_force_reloc_sub_local (FIX, SEG))
533
534
#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
535
536
#endif /* OBJ_MACH_O */
537
538
#endif /* TC_I386 */