| 1 |
/* Definitions for Intel 386 systems using GNU userspace. |
| 2 |
Copyright (C) 1994-2025 Free Software Foundation, Inc. |
| 3 |
Contributed by Eric Youngdale. |
| 4 |
Modified for stabs-in-ELF by H.J. Lu. |
| 5 |
|
| 6 |
This file is part of GCC. |
| 7 |
|
| 8 |
GCC is free software; you can redistribute it and/or modify |
| 9 |
it under the terms of the GNU General Public License as published by |
| 10 |
the Free Software Foundation; either version 3, or (at your option) |
| 11 |
any later version. |
| 12 |
|
| 13 |
GCC is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with GCC; see the file COPYING3. If not see |
| 20 |
<http://www.gnu.org/licenses/>. */ |
| 21 |
|
| 22 |
/* Output at beginning of assembler file. */ |
| 23 |
/* The .file command should always begin the output. */ |
| 24 |
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true |
| 25 |
|
| 26 |
#undef ASM_COMMENT_START |
| 27 |
#define ASM_COMMENT_START "#" |
| 28 |
|
| 29 |
#undef DEBUGGER_REGNO |
| 30 |
#define DEBUGGER_REGNO(n) \ |
| 31 |
(TARGET_64BIT ? debugger64_register_map[n] : svr4_debugger_register_map[n]) |
| 32 |
|
| 33 |
/* Output assembler code to FILE to call the profiler. |
| 34 |
To the best of my knowledge, no GNU userspace libc has required the label |
| 35 |
argument to mcount. */ |
| 36 |
|
| 37 |
#define NO_PROFILE_COUNTERS 1 |
| 38 |
|
| 39 |
#undef MCOUNT_NAME |
| 40 |
#define MCOUNT_NAME "mcount" |
| 41 |
|
| 42 |
#undef SIZE_TYPE |
| 43 |
#define SIZE_TYPE "unsigned int" |
| 44 |
|
| 45 |
#undef PTRDIFF_TYPE |
| 46 |
#define PTRDIFF_TYPE "int" |
| 47 |
|
| 48 |
#undef WCHAR_TYPE |
| 49 |
#define WCHAR_TYPE "long int" |
| 50 |
|
| 51 |
#undef WCHAR_TYPE_SIZE |
| 52 |
#define WCHAR_TYPE_SIZE BITS_PER_WORD |
| 53 |
|
| 54 |
/* Provide a LINK_SPEC appropriate for GNU userspace. Here we provide support |
| 55 |
for the special GCC options -static and -shared, which allow us to |
| 56 |
link things in one of these three modes by applying the appropriate |
| 57 |
combinations of options at link-time. |
| 58 |
|
| 59 |
When the -shared link option is used a final link is not being |
| 60 |
done. */ |
| 61 |
|
| 62 |
#undef ASM_SPEC |
| 63 |
#define ASM_SPEC \ |
| 64 |
"--32 %{msse2avx:%{!mavx:-msse2avx}}" |
| 65 |
|
| 66 |
#undef SUBTARGET_EXTRA_SPECS |
| 67 |
#define SUBTARGET_EXTRA_SPECS \ |
| 68 |
{ "link_emulation", GNU_USER_LINK_EMULATION },\ |
| 69 |
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER } |
| 70 |
|
| 71 |
#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ |
| 72 |
%{!shared: \ |
| 73 |
%{!static: \ |
| 74 |
%{!static-pie: \ |
| 75 |
%{rdynamic:-export-dynamic} \ |
| 76 |
-dynamic-linker %(dynamic_linker)}} \ |
| 77 |
%{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" |
| 78 |
|
| 79 |
#undef LINK_SPEC |
| 80 |
#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC |
| 81 |
|
| 82 |
/* A C statement (sans semicolon) to output to the stdio stream |
| 83 |
FILE the assembler definition of uninitialized global DECL named |
| 84 |
NAME whose size is SIZE bytes and alignment is ALIGN bytes. |
| 85 |
Try to use asm_output_aligned_bss to implement this macro. */ |
| 86 |
|
| 87 |
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ |
| 88 |
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) |
| 89 |
|
| 90 |
/* A C statement to output to the stdio stream FILE an assembler |
| 91 |
command to advance the location counter to a multiple of 1<<LOG |
| 92 |
bytes if it is within MAX_SKIP bytes. */ |
| 93 |
|
| 94 |
#define SUBALIGN_LOG 3 |
| 95 |
|
| 96 |
/* Handle special EH pointer encodings. Absolute, pc-relative, and |
| 97 |
indirect are handled automatically. */ |
| 98 |
#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ |
| 99 |
do { \ |
| 100 |
if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \ |
| 101 |
{ \ |
| 102 |
fputs (ASM_LONG, FILE); \ |
| 103 |
assemble_name (FILE, XSTR (ADDR, 0)); \ |
| 104 |
fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \ |
| 105 |
goto DONE; \ |
| 106 |
} \ |
| 107 |
} while (0) |
| 108 |
|
| 109 |
#ifdef TARGET_LIBC_PROVIDES_SSP |
| 110 |
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */ |
| 111 |
#define TARGET_THREAD_SSP_OFFSET 0x14 |
| 112 |
|
| 113 |
/* i386 glibc provides __private_ss in %gs:0x30. */ |
| 114 |
#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 |
| 115 |
#endif |