|
Lines 21-115
Link Here
|
| 21 |
along with GCC; see the file COPYING3. If not see |
21 |
along with GCC; see the file COPYING3. If not see |
| 22 |
<http://www.gnu.org/licenses/>. */ |
22 |
<http://www.gnu.org/licenses/>. */ |
| 23 |
|
23 |
|
|
|
24 |
#undef CC1_SPEC |
| 25 |
#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" |
| 24 |
|
26 |
|
| 25 |
#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); |
27 |
/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support |
|
|
28 |
for the special GCC options -static and -shared, which allow us to |
| 29 |
link things in one of these three modes by applying the appropriate |
| 30 |
combinations of options at link-time. We like to support here for |
| 31 |
as many of the other GNU linker options as possible. But I don't |
| 32 |
have the time to search for those flags. I am sure how to add |
| 33 |
support for -soname shared_object_name. H.J. |
| 26 |
|
34 |
|
| 27 |
/* Override the default comment-starter of "/". */ |
35 |
When the -shared link option is used a final link is not being |
| 28 |
#undef ASM_COMMENT_START |
36 |
done. */ |
| 29 |
#define ASM_COMMENT_START "#" |
|
|
| 30 |
|
37 |
|
| 31 |
#undef ASM_APP_ON |
38 |
#undef LINK_SPEC |
| 32 |
#define ASM_APP_ON "#APP\n" |
39 |
#define LINK_SPEC "\ |
|
|
40 |
%{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \ |
| 41 |
%{v:-V} \ |
| 42 |
%{assert*} %{R*} %{rpath*} %{defsym*} \ |
| 43 |
%{shared:-Bshareable %{h*} %{soname*}} \ |
| 44 |
%{!shared: \ |
| 45 |
%{!static: \ |
| 46 |
%{rdynamic: -export-dynamic} \ |
| 47 |
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ |
| 48 |
%{static:-Bstatic}} \ |
| 49 |
%{symbolic:-Bsymbolic}" |
| 33 |
|
50 |
|
| 34 |
#undef ASM_APP_OFF |
51 |
/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h |
| 35 |
#define ASM_APP_OFF "#NO_APP\n" |
52 |
but trashed by config/<cpu>/<file.h>. */ |
| 36 |
|
53 |
|
| 37 |
#undef DBX_REGISTER_NUMBER |
54 |
#undef STARTFILE_SPEC |
| 38 |
#define DBX_REGISTER_NUMBER(n) \ |
55 |
#define STARTFILE_SPEC FBSD_STARTFILE_SPEC |
| 39 |
(TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) |
|
|
| 40 |
|
56 |
|
| 41 |
#undef NO_PROFILE_COUNTERS |
57 |
/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */ |
| 42 |
#define NO_PROFILE_COUNTERS 1 |
|
|
| 43 |
|
58 |
|
| 44 |
/* Tell final.c that we don't need a label passed to mcount. */ |
59 |
#undef ENDFILE_SPEC |
|
|
60 |
#define ENDFILE_SPEC FBSD_ENDFILE_SPEC |
| 45 |
|
61 |
|
| 46 |
#undef MCOUNT_NAME |
|
|
| 47 |
#define MCOUNT_NAME ".mcount" |
| 48 |
|
62 |
|
| 49 |
/* Make gcc agree with <machine/ansi.h>. */ |
63 |
/************************[ Target stuff ]***********************************/ |
|
|
64 |
|
| 65 |
/* Define the actual types of some ANSI-mandated types. |
| 66 |
Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c, |
| 67 |
c-common.c, and config/<arch>/<arch>.h. */ |
| 50 |
|
68 |
|
| 51 |
#undef SIZE_TYPE |
69 |
#undef SIZE_TYPE |
| 52 |
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") |
70 |
#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") |
| 53 |
|
71 |
|
| 54 |
#undef PTRDIFF_TYPE |
72 |
#undef PTRDIFF_TYPE |
| 55 |
#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") |
73 |
#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") |
| 56 |
|
74 |
|
| 57 |
#undef WCHAR_TYPE_SIZE |
75 |
#undef WCHAR_TYPE_SIZE |
| 58 |
#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) |
76 |
#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) |
| 59 |
|
77 |
|
| 60 |
#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ |
78 |
#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ |
| 61 |
#define SUBTARGET_EXTRA_SPECS \ |
79 |
#define SUBTARGET_EXTRA_SPECS \ |
| 62 |
{ "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } |
80 |
{ "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } |
| 63 |
|
|
|
| 64 |
/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add |
| 65 |
the magical crtbegin.o file (see crtstuff.c) which provides part |
| 66 |
of the support for getting C++ file-scope static object constructed |
| 67 |
before entering `main'. */ |
| 68 |
|
| 69 |
#undef STARTFILE_SPEC |
| 70 |
#define STARTFILE_SPEC \ |
| 71 |
"%{!shared: \ |
| 72 |
%{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \ |
| 73 |
%{!p:%{profile:gcrt1.o%s} \ |
| 74 |
%{!profile:crt1.o%s}}}} \ |
| 75 |
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" |
| 76 |
|
| 77 |
/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on |
| 78 |
the magical crtend.o file (see crtstuff.c) which provides part of |
| 79 |
the support for getting C++ file-scope static object constructed |
| 80 |
before entering `main', followed by a normal "finalizer" file, |
| 81 |
`crtn.o'. */ |
| 82 |
|
| 83 |
#undef ENDFILE_SPEC |
| 84 |
#define ENDFILE_SPEC \ |
| 85 |
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" |
| 86 |
|
81 |
|
| 87 |
/* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support |
82 |
#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); |
| 88 |
for the special GCC options -static and -shared, which allow us to |
|
|
| 89 |
link things in one of these three modes by applying the appropriate |
| 90 |
combinations of options at link-time. We like to support here for |
| 91 |
as many of the other GNU linker options as possible. But I don't |
| 92 |
have the time to search for those flags. I am sure how to add |
| 93 |
support for -soname shared_object_name. H.J. |
| 94 |
|
83 |
|
| 95 |
I took out %{v:%{!V:-V}}. It is too much :-(. They can use |
84 |
#define TARGET_ELF 1 |
| 96 |
-Wl,-V. |
|
|
| 97 |
|
85 |
|
| 98 |
When the -shared link option is used a final link is not being |
86 |
/* This goes away when the math emulator is fixed. */ |
| 99 |
done. */ |
87 |
#undef TARGET_SUBTARGET_DEFAULT |
|
|
88 |
#define TARGET_SUBTARGET_DEFAULT \ |
| 89 |
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) |
| 100 |
|
90 |
|
| 101 |
#undef LINK_SPEC |
91 |
/* Don't default to pcc-struct-return, we want to retain compatibility with |
| 102 |
#define LINK_SPEC "\ |
92 |
older gcc versions AND pcc-struct-return is nonreentrant. |
| 103 |
%{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ |
93 |
(even though the SVR4 ABI for the i386 says that records and unions are |
| 104 |
%{v:-V} \ |
94 |
returned in memory). */ |
| 105 |
%{assert*} %{R*} %{rpath*} %{defsym*} \ |
95 |
|
| 106 |
%{shared:-Bshareable %{h*} %{soname*}} \ |
96 |
#undef DEFAULT_PCC_STRUCT_RETURN |
| 107 |
%{!shared: \ |
97 |
#define DEFAULT_PCC_STRUCT_RETURN 0 |
| 108 |
%{!static: \ |
98 |
|
| 109 |
%{rdynamic:-export-dynamic} \ |
99 |
/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the |
| 110 |
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ |
100 |
compiler get the contents of <float.h> and std::numeric_limits correct. */ |
| 111 |
%{static:-Bstatic}} \ |
101 |
#undef TARGET_96_ROUND_53_LONG_DOUBLE |
| 112 |
%{symbolic:-Bsymbolic}" |
102 |
#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) |
|
|
103 |
|
| 104 |
/* Tell final.c that we don't need a label passed to mcount. */ |
| 105 |
#define NO_PROFILE_COUNTERS 1 |
| 106 |
|
| 107 |
/* Output assembler code to FILE to begin profiling of the current function. |
| 108 |
LABELNO is an optional label. */ |
| 109 |
|
| 110 |
#undef MCOUNT_NAME |
| 111 |
#define MCOUNT_NAME ".mcount" |
| 112 |
|
| 113 |
/* Output assembler code to FILE to end profiling of the current function. */ |
| 114 |
|
| 115 |
#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */ |
| 116 |
|
| 117 |
|
| 118 |
/************************[ Assembler stuff ]********************************/ |
| 119 |
|
| 120 |
/* Override the default comment-starter of "/" from unix.h. */ |
| 121 |
#undef ASM_COMMENT_START |
| 122 |
#define ASM_COMMENT_START "#" |
| 123 |
|
| 124 |
/* Override the default comment-starter of "/APP" from unix.h. */ |
| 125 |
#undef ASM_APP_ON |
| 126 |
#define ASM_APP_ON "#APP\n" |
| 127 |
#undef ASM_APP_OFF |
| 128 |
#define ASM_APP_OFF "#NO_APP\n" |
| 129 |
|
| 130 |
/* XXX:DEO do we still need this override to defaults.h ?? */ |
| 131 |
/* This is how to output a reference to a user-level label named NAME. */ |
| 132 |
#undef ASM_OUTPUT_LABELREF |
| 133 |
#define ASM_OUTPUT_LABELREF(FILE, NAME) \ |
| 134 |
do { \ |
| 135 |
const char *xname = (NAME); \ |
| 136 |
/* Hack to avoid writing lots of rtl in \ |
| 137 |
FUNCTION_PROFILER_EPILOGUE (). */ \ |
| 138 |
if (*xname == '.' && strcmp(xname + 1, "mexitcount") == 0) \ |
| 139 |
{ \ |
| 140 |
if (flag_pic) \ |
| 141 |
fprintf ((FILE), "*%s@GOT(%%ebx)", xname); \ |
| 142 |
else \ |
| 143 |
fprintf ((FILE), "%s", xname); \ |
| 144 |
} \ |
| 145 |
else \ |
| 146 |
{ \ |
| 147 |
if (xname[0] == '%') \ |
| 148 |
xname += 2; \ |
| 149 |
if (xname[0] == '*') \ |
| 150 |
xname += 1; \ |
| 151 |
else \ |
| 152 |
fputs (user_label_prefix, FILE); \ |
| 153 |
fputs (xname, FILE); \ |
| 154 |
} \ |
| 155 |
} while (0) |
| 156 |
|
| 157 |
/* This is how to hack on the symbol code of certain relcalcitrant |
| 158 |
symbols to modify their output in output_pic_addr_const (). */ |
| 159 |
|
| 160 |
#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */ |
| 113 |
|
161 |
|
| 114 |
/* A C statement to output to the stdio stream FILE an assembler |
162 |
/* A C statement to output to the stdio stream FILE an assembler |
| 115 |
command to advance the location counter to a multiple of 1<<LOG |
163 |
command to advance the location counter to a multiple of 1<<LOG |
|
Lines 117-140
Link Here
|
| 117 |
|
165 |
|
| 118 |
This is used to align code labels according to Intel recommendations. */ |
166 |
This is used to align code labels according to Intel recommendations. */ |
| 119 |
|
167 |
|
|
|
168 |
/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE, |
| 169 |
but it is easier to fix in an MD way. */ |
| 170 |
|
| 120 |
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
171 |
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
| 121 |
#undef ASM_OUTPUT_MAX_SKIP_ALIGN |
172 |
#undef ASM_OUTPUT_MAX_SKIP_ALIGN |
| 122 |
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ |
173 |
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ |
| 123 |
if ((LOG) != 0) { \ |
174 |
do { \ |
| 124 |
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ |
175 |
if ((LOG) != 0) { \ |
| 125 |
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ |
176 |
if ((MAX_SKIP) == 0) \ |
| 126 |
} |
177 |
fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ |
|
|
178 |
else \ |
| 179 |
fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ |
| 180 |
} \ |
| 181 |
} while (0) |
| 127 |
#endif |
182 |
#endif |
| 128 |
|
183 |
|
| 129 |
/* Don't default to pcc-struct-return, we want to retain compatibility with |
184 |
/* If defined, a C expression whose value is a string containing the |
| 130 |
older gcc versions AND pcc-struct-return is nonreentrant. |
185 |
assembler operation to identify the following data as |
| 131 |
(even though the SVR4 ABI for the i386 says that records and unions are |
186 |
uninitialized global data. If not defined, and neither |
| 132 |
returned in memory). */ |
187 |
`ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, |
|
|
188 |
uninitialized global data will be output in the data section if |
| 189 |
`-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be |
| 190 |
used. */ |
| 191 |
#undef BSS_SECTION_ASM_OP |
| 192 |
#define BSS_SECTION_ASM_OP "\t.section\t.bss" |
| 193 |
|
| 194 |
/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a |
| 195 |
separate, explicit argument. If you define this macro, it is used |
| 196 |
in place of `ASM_OUTPUT_BSS', and gives you more flexibility in |
| 197 |
handling the required alignment of the variable. The alignment is |
| 198 |
specified as the number of bits. |
| 199 |
|
| 200 |
Try to use function `asm_output_aligned_bss' defined in file |
| 201 |
`varasm.c' when defining this macro. */ |
| 202 |
#undef ASM_OUTPUT_ALIGNED_BSS |
| 203 |
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ |
| 204 |
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) |
| 133 |
|
205 |
|
| 134 |
#undef DEFAULT_PCC_STRUCT_RETURN |
206 |
/************************[ Debugger stuff ]*********************************/ |
| 135 |
#define DEFAULT_PCC_STRUCT_RETURN 0 |
|
|
| 136 |
|
207 |
|
| 137 |
/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the |
208 |
#undef DBX_REGISTER_NUMBER |
| 138 |
compiler get the contents of <float.h> and std::numeric_limits correct. */ |
209 |
#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \ |
| 139 |
#undef TARGET_96_ROUND_53_LONG_DOUBLE |
210 |
: (write_symbols == DWARF2_DEBUG) \ |
| 140 |
#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) |
211 |
? svr4_dbx_register_map[(n)] \ |
|
|
212 |
: dbx_register_map[(n)]) |
| 213 |
|
| 214 |
/* The same functions are used to creating the DWARF2 debug info and C++ |
| 215 |
unwind info (except.c). Regardless of the debug format requested, the |
| 216 |
register numbers used in exception unwinding sections still have to be |
| 217 |
DWARF compatible. IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER |
| 218 |
macro to mean too much. */ |
| 219 |
#define DWARF_FRAME_REGNUM(n) (TARGET_64BIT ? dbx64_register_map[n] \ |
| 220 |
: svr4_dbx_register_map[(n)]) |
| 221 |
|
| 222 |
/* stabs-in-elf has offsets relative to function beginning */ |
| 223 |
#undef DBX_OUTPUT_LBRAC |
| 224 |
#define DBX_OUTPUT_LBRAC(FILE, NAME) \ |
| 225 |
do { \ |
| 226 |
fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ |
| 227 |
assemble_name (asm_out_file, NAME); \ |
| 228 |
fputc ('-', asm_out_file); \ |
| 229 |
assemble_name (asm_out_file, \ |
| 230 |
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ |
| 231 |
fprintf (asm_out_file, "\n"); \ |
| 232 |
} while (0) |
| 233 |
|
| 234 |
#undef DBX_OUTPUT_RBRAC |
| 235 |
#define DBX_OUTPUT_RBRAC(FILE, NAME) \ |
| 236 |
do { \ |
| 237 |
fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ |
| 238 |
assemble_name (asm_out_file, NAME); \ |
| 239 |
fputc ('-', asm_out_file); \ |
| 240 |
assemble_name (asm_out_file, \ |
| 241 |
XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ |
| 242 |
fprintf (asm_out_file, "\n"); \ |
| 243 |
} while (0) |