Deleted Added
full compact
freebsd.h (95349) freebsd.h (95810)
1/* Definitions for Intel 386 running FreeBSD with either a.out or ELF format
2 Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
3 Contributed by Eric Youngdale.
4 Modified for stabs-in-ELF by H.J. Lu.
5 Adapted from GNU/Linux version by John Polstra.
6 Added support for generating "old a.out gas" on the fly by Peter Wemm.
7 Continued development by David O'Brien <obrien@freebsd.org>
8

--- 9 unchanged lines hidden (view full) ---

18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GNU CC; see the file COPYING. If not, write to
23the Free Software Foundation, 59 Temple Place - Suite 330,
24Boston, MA 02111-1307, USA. */
25
1/* Definitions for Intel 386 running FreeBSD with either a.out or ELF format
2 Copyright (C) 1996, 2000, 2002 Free Software Foundation, Inc.
3 Contributed by Eric Youngdale.
4 Modified for stabs-in-ELF by H.J. Lu.
5 Adapted from GNU/Linux version by John Polstra.
6 Added support for generating "old a.out gas" on the fly by Peter Wemm.
7 Continued development by David O'Brien <obrien@freebsd.org>
8

--- 9 unchanged lines hidden (view full) ---

18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with GNU CC; see the file COPYING. If not, write to
23the Free Software Foundation, 59 Temple Place - Suite 330,
24Boston, MA 02111-1307, USA. */
25
26/* $FreeBSD: head/contrib/gcc/config/i386/freebsd.h 95349 2002-04-24 04:49:34Z obrien $ */
26/* $FreeBSD: head/contrib/gcc/config/i386/freebsd.h 95810 2002-04-30 17:15:01Z obrien $ */
27
27
28#undef CPP_PREDEFINES
29#define CPP_PREDEFINES \
30 "-Di386 -Acpu(i386) -Amachine(i386)" \
31 FBSD_CPP_PREDEFINES
28#undef TARGET_VERSION
29#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
32
33#undef CC1_SPEC
30
31#undef CC1_SPEC
34#define CC1_SPEC "\
32#define CC1_SPEC "%(cc1_cpu) %{profile:-p} \
35 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
36 %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
37
38#undef ASM_SPEC
39#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
40
41#undef ASM_FINAL_SPEC
42#define ASM_FINAL_SPEC "%|"

--- 71 unchanged lines hidden (view full) ---

114#define SIZE_TYPE "unsigned int"
115
116#undef PTRDIFF_TYPE
117#define PTRDIFF_TYPE "int"
118
119#undef WCHAR_TYPE_SIZE
120#define WCHAR_TYPE_SIZE BITS_PER_WORD
121
33 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
34 %{maout: %{!mno-underscores: %{!munderscores: -munderscores }}}"
35
36#undef ASM_SPEC
37#define ASM_SPEC "%{v*: -v} %{maout: %{fpic:-k} %{fPIC:-k}}"
38
39#undef ASM_FINAL_SPEC
40#define ASM_FINAL_SPEC "%|"

--- 71 unchanged lines hidden (view full) ---

112#define SIZE_TYPE "unsigned int"
113
114#undef PTRDIFF_TYPE
115#define PTRDIFF_TYPE "int"
116
117#undef WCHAR_TYPE_SIZE
118#define WCHAR_TYPE_SIZE BITS_PER_WORD
119
122/* This is the pseudo-op used to generate a 32-bit word of data with a
123 specific value in some section. */
124
125#undef INT_ASM_OP
126#define INT_ASM_OP ".long"
127
128/* Biggest alignment supported by the object file format of this
129 machine. Use this macro to limit the alignment which can be
130 specified using the `__attribute__ ((aligned (N)))' construct. If
131 not defined, the default value is `BIGGEST_ALIGNMENT'. */
132
133#define MAX_OFILE_ALIGNMENT (32768*8)
134
135#undef TARGET_VERSION
136#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
137
138#define MASK_PROFILER_EPILOGUE 010000000000
139#define MASK_AOUT 004000000000 /* a.out not elf */
140#define MASK_UNDERSCORES 002000000000 /* use leading _ */
141
142#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)

--- 6 unchanged lines hidden (view full) ---

149 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \
150 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, \
151 { "aout", MASK_AOUT, "Generate an a.out (vs. ELF) binary"}, \
152 { "no-aout", -MASK_AOUT, "Do not generate an a.out binary"}, \
153 { "underscores", MASK_UNDERSCORES, "Add leading underscores to symbols"}, \
154 { "no-underscores", -MASK_UNDERSCORES, "Do not add leading underscores to symbols"},
155
156/* This goes away when the math emulator is fixed. */
120#undef TARGET_VERSION
121#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
122
123#define MASK_PROFILER_EPILOGUE 010000000000
124#define MASK_AOUT 004000000000 /* a.out not elf */
125#define MASK_UNDERSCORES 002000000000 /* use leading _ */
126
127#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE)

--- 6 unchanged lines hidden (view full) ---

134 { "profiler-epilogue", MASK_PROFILER_EPILOGUE, "Function profiler epilogue"}, \
135 { "no-profiler-epilogue", -MASK_PROFILER_EPILOGUE, "No function profiler epilogue"}, \
136 { "aout", MASK_AOUT, "Generate an a.out (vs. ELF) binary"}, \
137 { "no-aout", -MASK_AOUT, "Do not generate an a.out binary"}, \
138 { "underscores", MASK_UNDERSCORES, "Add leading underscores to symbols"}, \
139 { "no-underscores", -MASK_UNDERSCORES, "Do not add leading underscores to symbols"},
140
141/* This goes away when the math emulator is fixed. */
157#undef TARGET_DEFAULT
158#define TARGET_DEFAULT \
142#undef TARGET_SUBTARGET_DEFAULT
143#define TARGET_SUBTARGET_DEFAULT \
159 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
160
161/* Don't default to pcc-struct-return, we want to retain compatibility with
162 older gcc versions AND pcc-struct-return is nonreentrant.
163 (even though the SVR4 ABI for the i386 says that records and unions are
164 returned in memory). */
165
166#undef DEFAULT_PCC_STRUCT_RETURN

--- 15 unchanged lines hidden (view full) ---

182#undef GEN_CALL__MAIN
183#define GEN_CALL__MAIN \
184 do { \
185 if (!(TARGET_ELF)) \
186 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
187 VOIDmode, 0); \
188 } while (0)
189
144 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
145
146/* Don't default to pcc-struct-return, we want to retain compatibility with
147 older gcc versions AND pcc-struct-return is nonreentrant.
148 (even though the SVR4 ABI for the i386 says that records and unions are
149 returned in memory). */
150
151#undef DEFAULT_PCC_STRUCT_RETURN

--- 15 unchanged lines hidden (view full) ---

167#undef GEN_CALL__MAIN
168#define GEN_CALL__MAIN \
169 do { \
170 if (!(TARGET_ELF)) \
171 emit_library_call (gen_rtx (SYMBOL_REF, Pmode, NAME__MAIN), 0, \
172 VOIDmode, 0); \
173 } while (0)
174
190/* Indicate that jump tables go in the text section. This is
191 necessary when compiling PIC code. */
192#undef JUMP_TABLES_IN_TEXT_SECTION
193#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
194
195/* override the exception table positioning */
196#undef EXCEPTION_SECTION
197#define EXCEPTION_SECTION() \
198 do { \
199 if (TARGET_ELF) \
200 { \
201 named_section (NULL_TREE, ".gcc_except_table", 0); \
202 } \
203 else \
204 { \
205 if (flag_pic) \
206 data_section (); \
207 else \
208 readonly_data_section (); \
209 } \
210 } while (0);
211
212/* Tell final.c that we don't need a label passed to mcount. */
175/* Tell final.c that we don't need a label passed to mcount. */
213#undef NO_PROFILE_COUNTERS
214#define NO_PROFILE_COUNTERS
176#define NO_PROFILE_COUNTERS 1
215
216/* Output assembler code to FILE to begin profiling of the current function.
217 LABELNO is an optional label. */
218
219#undef FUNCTION_PROFILER
220#define FUNCTION_PROFILER(FILE, LABELNO) \
221 do { \
222 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
223 if (flag_pic) \
224 fprintf ((FILE), "\tcall *%s@GOT(%%ebx)\n", _name); \
225 else \
226 fprintf ((FILE), "\tcall %s\n", _name); \
227 } while (0)
228
229/* Output assembler code to FILE to end profiling of the current function. */
230
177
178/* Output assembler code to FILE to begin profiling of the current function.
179 LABELNO is an optional label. */
180
181#undef FUNCTION_PROFILER
182#define FUNCTION_PROFILER(FILE, LABELNO) \
183 do { \
184 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
185 if (flag_pic) \
186 fprintf ((FILE), "\tcall *%s@GOT(%%ebx)\n", _name); \
187 else \
188 fprintf ((FILE), "\tcall %s\n", _name); \
189 } while (0)
190
191/* Output assembler code to FILE to end profiling of the current function. */
192
231#undef FUNCTION_PROFILER_EPILOGUE
232#define FUNCTION_PROFILER_EPILOGUE(FILE, DO_RTL) \
233 do { \
234 if (TARGET_PROFILER_EPILOGUE) \
235 { \
236 if (DO_RTL) \
237 { \
238 /* ".mexitcount" is specially handled in \
239 ASM_HACK_SYMBOLREF () so that we don't need to handle \
240 flag_pic or TARGET_AOUT here. */ \
241 rtx xop; \
242 xop = gen_rtx_MEM (FUNCTION_MODE, \
243 gen_rtx_SYMBOL_REF (Pmode, ".mexitcount")); \
244 emit_call_insn (gen_rtx (CALL, VOIDmode, xop, const0_rtx)); \
245 } \
246 else \
247 { \
248 /* XXX this !DO_RTL case is broken but not actually used. */ \
249 char *_name = TARGET_AOUT ? "mcount" : ".mcount"; \
250 if (flag_pic) \
251 fprintf (FILE, "\tcall *%s@GOT(%%ebx)\n", _name); \
252 else \
253 fprintf (FILE, "\tcall %s\n", _name); \
254 } \
255 } \
256 } while (0)
193#undef FUNCTION_PROFILER_EPILOGUE /* BDE will need to fix this. */
257
258
259/************************[ Assembler stuff ]********************************/
260
261/* Override the default comment-starter of "/" from unix.h. */
262#undef ASM_COMMENT_START
263#define ASM_COMMENT_START "#"
264
265#undef ASM_APP_ON
266#define ASM_APP_ON "#APP\n"
267
268#undef ASM_APP_OFF
269#define ASM_APP_OFF "#NO_APP\n"
270
194
195
196/************************[ Assembler stuff ]********************************/
197
198/* Override the default comment-starter of "/" from unix.h. */
199#undef ASM_COMMENT_START
200#define ASM_COMMENT_START "#"
201
202#undef ASM_APP_ON
203#define ASM_APP_ON "#APP\n"
204
205#undef ASM_APP_OFF
206#define ASM_APP_OFF "#NO_APP\n"
207
271/* Enable alias attribute support. */
272#undef SET_ASM_OP
273#define SET_ASM_OP ".set"
274
275/* This is how to begin an assembly language file.
276 The .file command should always begin the output.
277 ELF also needs a .version. */
278
279#undef ASM_FILE_START
280#define ASM_FILE_START(FILE) \
281 do { \
282 output_file_directive ((FILE), main_input_filename); \
283 if (TARGET_ELF) \
284 fprintf ((FILE), "\t.version\t\"01.01\"\n"); \
285 } while (0)
286
287/* This is how to store into the string BUF
288 the symbol_ref name of an internal numbered label where
289 PREFIX is the class of label and NUM is the number within the class.
290 This is suitable for output with `assemble_name'. */
291#undef ASM_GENERATE_INTERNAL_LABEL
208/* This is how to store into the string BUF
209 the symbol_ref name of an internal numbered label where
210 PREFIX is the class of label and NUM is the number within the class.
211 This is suitable for output with `assemble_name'. */
212#undef ASM_GENERATE_INTERNAL_LABEL
292#define ASM_GENERATE_INTERNAL_LABEL(BUF, PREFIX, NUMBER) \
293 sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \
294 (PREFIX), (NUMBER))
213#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
214 sprintf ((LABEL), "*%s%s%u", (TARGET_UNDERSCORES) ? "" : ".", \
215 (PREFIX), (unsigned) (NUM))
295
296/* This is how to output an internal numbered label where
297 PREFIX is the class of label and NUM is the number within the class.
298 For most svr4/ELF systems, the convention is that any symbol which begins
299 with a period is not put into the linker symbol table by the assembler. */
300#undef ASM_OUTPUT_INTERNAL_LABEL
216
217/* This is how to output an internal numbered label where
218 PREFIX is the class of label and NUM is the number within the class.
219 For most svr4/ELF systems, the convention is that any symbol which begins
220 with a period is not put into the linker symbol table by the assembler. */
221#undef ASM_OUTPUT_INTERNAL_LABEL
301#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
302 fprintf ((FILE), "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \
303 (PREFIX), (NUM))
222#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
223 fprintf ((FILE), "%s%s%u:\n", (TARGET_UNDERSCORES) ? "" : ".", \
224 (PREFIX), (unsigned) (NUM))
304
305/* This is how to output a reference to a user-level label named NAME. */
306#undef ASM_OUTPUT_LABELREF
307#define ASM_OUTPUT_LABELREF(FILE, NAME) \
308 do { \
309 char *_name = (NAME); \
310 /* Hack to avoid writing lots of rtl in \
311 FUNCTION_PROFILER_EPILOGUE (). */ \

--- 8 unchanged lines hidden (view full) ---

320 } \
321 else \
322 fprintf (FILE, "%s%s", TARGET_UNDERSCORES ? "_" : "", _name); \
323} while (0)
324
325/* This is how to hack on the symbol code of certain relcalcitrant
326 symbols to modify their output in output_pic_addr_const (). */
327
225
226/* This is how to output a reference to a user-level label named NAME. */
227#undef ASM_OUTPUT_LABELREF
228#define ASM_OUTPUT_LABELREF(FILE, NAME) \
229 do { \
230 char *_name = (NAME); \
231 /* Hack to avoid writing lots of rtl in \
232 FUNCTION_PROFILER_EPILOGUE (). */ \

--- 8 unchanged lines hidden (view full) ---

241 } \
242 else \
243 fprintf (FILE, "%s%s", TARGET_UNDERSCORES ? "_" : "", _name); \
244} while (0)
245
246/* This is how to hack on the symbol code of certain relcalcitrant
247 symbols to modify their output in output_pic_addr_const (). */
248
328#undef ASM_HACK_SYMBOLREF_CODE
329#define ASM_HACK_SYMBOLREF_CODE(NAME, CODE) \
330 do { \
331 /* Part of hack to avoid writing lots of rtl in \
332 FUNCTION_PROFILER_EPILOGUE (). */ \
333 char *_name = (NAME); \
334 if (*_name == '.' && strcmp(_name + 1, "mexitcount") == 0) \
335 (CODE) = 'X'; \
336 } while (0)
249#undef ASM_HACK_SYMBOLREF_CODE /* BDE will need to fix this. */
337
338/* This is how to output an element of a case-vector that is relative.
339 This is only used for PIC code. See comments by the `casesi' insn in
340 i386.md for an explanation of the expression this outputs. */
341#undef ASM_OUTPUT_ADDR_DIFF_ELT
342#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
343 fprintf ((FILE), "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, (VALUE))
344

--- 85 unchanged lines hidden (view full) ---

430 } \
431 else \
432 { \
433 fprintf ((FILE), "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, \
434 lineno); \
435 } \
436 } while (0)
437
250
251/* This is how to output an element of a case-vector that is relative.
252 This is only used for PIC code. See comments by the `casesi' insn in
253 i386.md for an explanation of the expression this outputs. */
254#undef ASM_OUTPUT_ADDR_DIFF_ELT
255#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
256 fprintf ((FILE), "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, (VALUE))
257

--- 85 unchanged lines hidden (view full) ---

343 } \
344 else \
345 { \
346 fprintf ((FILE), "\t%s %d,0,%d\n", ASM_STABD_OP, N_SLINE, \
347 lineno); \
348 } \
349 } while (0)
350
438/* These macros generate the special .type and .size directives which
439 are used to set the corresponding fields of the linker symbol table
440 entries in an ELF object file under SVR4. These macros also output
441 the starting labels for the relevant functions/objects. */
351/* A C statement to output to the stdio stream FILE an assembler
352 command to advance the location counter to a multiple of 1<<LOG
353 bytes if it is within MAX_SKIP bytes.
442
354
443/* Write the extra assembler code needed to declare a function properly.
444 Some svr4 assemblers need to also have something extra said about the
445 function's return value. We allow for that here. */
355 This is used to align code labels according to Intel recommendations. */
446
356
447#undef ASM_DECLARE_FUNCTION_NAME
448#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
449 do { \
450 fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
451 assemble_name (FILE, NAME); \
452 putc (',', FILE); \
453 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
454 putc ('\n', FILE); \
455 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
456 ASM_OUTPUT_LABEL(FILE, NAME); \
457 } while (0)
458
459/* This is how to declare the size of a function. */
460
461#undef ASM_DECLARE_FUNCTION_SIZE
462#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
463 do { \
464 if (!flag_inhibit_size_directive) \
465 { \
466 char label[256]; \
467 static int labelno; \
468 labelno++; \
469 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
470 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
471 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
472 assemble_name (FILE, (FNAME)); \
473 fprintf (FILE, ","); \
474 assemble_name (FILE, label); \
475 fprintf (FILE, "-"); \
476 assemble_name (FILE, (FNAME)); \
477 putc ('\n', FILE); \
478 } \
479 } while (0)
480
481
482/* The routine used to output NUL terminated strings. We use a special
483 version of this for most svr4 targets because doing so makes the
484 generated assembly code more compact (and thus faster to assemble)
485 as well as more readable, especially for targets like the i386
486 (where the only alternative is to output character sequences as
487 comma separated lists of numbers). */
488
489#undef ASM_OUTPUT_LIMITED_STRING
490#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \
491 do { \
492 register unsigned char *_limited_str = (unsigned char *) (STR); \
493 register unsigned ch; \
494 fprintf ((FILE), "\t%s\t\"", STRING_ASM_OP); \
495 for (; (ch = *_limited_str); _limited_str++) \
496 { \
497 register int escape; \
498 switch (escape = ESCAPES[ch]) \
499 { \
500 case 0: \
501 putc (ch, (FILE)); \
502 break; \
503 case 1: \
504 fprintf ((FILE), "\\%03o", ch); \
505 break; \
506 default: \
507 putc ('\\', (FILE)); \
508 putc (escape, (FILE)); \
509 break; \
510 } \
511 } \
512 fprintf ((FILE), "\"\n"); \
513 } while (0)
514
515/* Switch into a generic section.
516
517 We make the section read-only and executable for a function decl,
518 read-only for a const data decl, and writable for a non-const data decl.
519
520 If the section has already been defined, we must not
521 emit the attributes here. The SVR4 assembler does not
522 recognize section redefinitions.
523 If DECL is NULL, no attributes are emitted. */
524
525#undef ASM_OUTPUT_SECTION_NAME
526#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
527 do { \
528 static struct section_info \
529 { \
530 struct section_info *next; \
531 char *name; \
532 enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
533 } *sections; \
534 struct section_info *s; \
535 char *mode; \
536 enum sect_enum type; \
537 \
538 for (s = sections; s; s = s->next) \
539 if (!strcmp (NAME, s->name)) \
540 break; \
541 \
542 if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
543 type = SECT_EXEC, mode = "ax"; \
544 else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
545 type = SECT_RO, mode = "a"; \
546 else \
547 type = SECT_RW, mode = "aw"; \
548 \
549 if (s == 0) \
550 { \
551 s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
552 s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
553 strcpy (s->name, NAME); \
554 s->type = type; \
555 s->next = sections; \
556 sections = s; \
557 fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, mode); \
558 } \
559 else \
560 { \
561 if (DECL && s->type != type) \
562 error_with_decl (DECL, "%s causes a section type conflict"); \
563 \
564 fprintf (FILE, ".section\t%s\n", NAME); \
565 } \
566 } while (0)
567
568#undef MAKE_DECL_ONE_ONLY
569#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
570#undef UNIQUE_SECTION_P
571#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
572#undef UNIQUE_SECTION
573#define UNIQUE_SECTION(DECL,RELOC) \
574 do { \
575 int len; \
576 char *name, *string, *prefix; \
577 \
578 name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
579 \
580 if (! DECL_ONE_ONLY (DECL)) \
581 { \
582 prefix = "."; \
583 if (TREE_CODE (DECL) == FUNCTION_DECL) \
584 prefix = ".text."; \
585 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
586 prefix = ".rodata."; \
587 else \
588 prefix = ".data."; \
589 } \
590 else if (TREE_CODE (DECL) == FUNCTION_DECL) \
591 prefix = ".gnu.linkonce.t."; \
592 else if (DECL_READONLY_SECTION (DECL, RELOC)) \
593 prefix = ".gnu.linkonce.r."; \
594 else \
595 prefix = ".gnu.linkonce.d."; \
596 \
597 len = strlen (name) + strlen (prefix); \
598 string = alloca (len + 1); \
599 sprintf (string, "%s%s", prefix, name); \
600 \
601 DECL_SECTION_NAME (DECL) = build_string (len, string); \
602 } while (0)
603
604/* A C statement or statements to switch to the appropriate
605 section for output of DECL. DECL is either a `VAR_DECL' node
606 or a constant of some sort. RELOC indicates whether forming
607 the initial value of DECL requires link-time relocations. */
608
609#undef SELECT_SECTION
610#define SELECT_SECTION(DECL,RELOC) \
611 { \
612 if (flag_pic && RELOC) \
613 data_section (); \
614 else if (TREE_CODE (DECL) == STRING_CST) \
615 { \
616 if (! flag_writable_strings) \
617 const_section (); \
618 else \
619 data_section (); \
620 } \
621 else if (TREE_CODE (DECL) == VAR_DECL) \
622 { \
623 if (! DECL_READONLY_SECTION (DECL, RELOC)) \
624 data_section (); \
625 else \
626 const_section (); \
627 } \
628 else \
629 const_section (); \
357#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
358#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
359 if ((LOG) != 0) { \
360 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
361 else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
630 }
362 }
363#endif
631
364
632/* A C statement (sans semicolon) to output an element in the table of
633 global constructors. */
634#undef ASM_OUTPUT_CONSTRUCTOR
635#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
636 do { \
637 if (TARGET_ELF) \
638 { \
639 ctors_section (); \
640 fprintf ((FILE), "%s ", INT_ASM_OP); \
641 assemble_name ((FILE), (NAME)); \
642 fprintf ((FILE), "\n"); \
643 } \
644 else \
645 { \
646 fprintf (asm_out_file, "%s \"%s__CTOR_LIST__\",22,0,0,", \
647 ASM_STABS_OP, (TARGET_UNDERSCORES) ? "_" : ""); \
648 assemble_name (asm_out_file, name); \
649 fputc ('\n', asm_out_file); \
650 } \
651 } while (0)
652
365
653/* A C statement (sans semicolon) to output an element in the table of
654 global destructors. */
655#undef ASM_OUTPUT_DESTRUCTOR
656#define ASM_OUTPUT_DESTRUCTOR(FILE, NAME) \
657 do { \
658 if (TARGET_ELF) \
659 { \
660 dtors_section (); \
661 fprintf ((FILE), "%s ", INT_ASM_OP); \
662 assemble_name ((FILE), (NAME)); \
663 fprintf ((FILE), "\n"); \
664 } \
665 else \
666 { \
667 fprintf (asm_out_file, "%s \"%s__DTOR_LIST__\",22,0,0,", \
668 ASM_STABS_OP, (TARGET_UNDERSCORES) ? "_" : ""); \
669 assemble_name (asm_out_file, name); \
670 fputc ('\n', asm_out_file); \
671 } \
672 } while (0)
673
674/* Define macro used to output shift-double opcodes when the shift
675 count is in %cl. Some assemblers require %cl as an argument;
676 some don't.
677
678 *OLD* GAS requires the %cl argument, so override i386/unix.h. */
679
680#undef AS3_SHIFT_DOUBLE
681#define AS3_SHIFT_DOUBLE(a,b,c,d) AS3 (a,b,c,d)
682
683
684/************************[ Debugger stuff ]*********************************/
685
686/* The a.out tools do not support "Lscope" .stabs symbols. */
687#undef NO_DBX_FUNCTION_END
688#define NO_DBX_FUNCTION_END TARGET_AOUT
689
690/* In ELF, the function stabs come first, before the relative offsets. */
691#undef DBX_FUNCTION_FIRST
692#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
693
366/************************[ Debugger stuff ]*********************************/
367
368/* The a.out tools do not support "Lscope" .stabs symbols. */
369#undef NO_DBX_FUNCTION_END
370#define NO_DBX_FUNCTION_END TARGET_AOUT
371
372/* In ELF, the function stabs come first, before the relative offsets. */
373#undef DBX_FUNCTION_FIRST
374#define DBX_CHECK_FUNCTION_FIRST TARGET_ELF
375
694/* Copy this from the svr4 specifications... */
695/* Define the register numbers to be used in Dwarf debugging information.
696 The SVR4 reference port C compiler uses the following register numbers
697 in its Dwarf output code:
698 0 for %eax (gnu regno = 0)
699 1 for %ecx (gnu regno = 2)
700 2 for %edx (gnu regno = 1)
701 3 for %ebx (gnu regno = 3)
702 4 for %esp (gnu regno = 7)
703 5 for %ebp (gnu regno = 6)
704 6 for %esi (gnu regno = 4)
705 7 for %edi (gnu regno = 5)
706 The following three DWARF register numbers are never generated by
707 the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
708 believes these numbers have these meanings.
709 8 for %eip (no gnu equivalent)
710 9 for %eflags (no gnu equivalent)
711 10 for %trapno (no gnu equivalent)
712 It is not at all clear how we should number the FP stack registers
713 for the x86 architecture. If the version of SDB on x86/svr4 were
714 a bit less brain dead with respect to floating-point then we would
715 have a precedent to follow with respect to DWARF register numbers
716 for x86 FP registers, but the SDB on x86/svr4 is so completely
717 broken with respect to FP registers that it is hardly worth thinking
718 of it as something to strive for compatibility with.
719 The version of x86/svr4 SDB I have at the moment does (partially)
720 seem to believe that DWARF register number 11 is associated with
721 the x86 register %st(0), but that's about all. Higher DWARF
722 register numbers don't seem to be associated with anything in
723 particular, and even for DWARF regno 11, SDB only seems to under-
724 stand that it should say that a variable lives in %st(0) (when
725 asked via an `=' command) if we said it was in DWARF regno 11,
726 but SDB still prints garbage when asked for the value of the
727 variable in question (via a `/' command).
728 (Also note that the labels SDB prints for various FP stack regs
729 when doing an `x' command are all wrong.)
730 Note that these problems generally don't affect the native SVR4
731 C compiler because it doesn't allow the use of -O with -g and
732 because when it is *not* optimizing, it allocates a memory
733 location for each floating-point variable, and the memory
734 location is what gets described in the DWARF AT_location
735 attribute for the variable in question.
736 Regardless of the severe mental illness of the x86/svr4 SDB, we
737 do something sensible here and we use the following DWARF
738 register numbers. Note that these are all stack-top-relative
739 numbers.
740 11 for %st(0) (gnu regno = 8)
741 12 for %st(1) (gnu regno = 9)
742 13 for %st(2) (gnu regno = 10)
743 14 for %st(3) (gnu regno = 11)
744 15 for %st(4) (gnu regno = 12)
745 16 for %st(5) (gnu regno = 13)
746 17 for %st(6) (gnu regno = 14)
747 18 for %st(7) (gnu regno = 15)
748*/
749#undef DWARF_DBX_REGISTER_NUMBER
750#define DWARF_DBX_REGISTER_NUMBER(n) \
751((n) == 0 ? 0 \
752 : (n) == 1 ? 2 \
753 : (n) == 2 ? 1 \
754 : (n) == 3 ? 3 \
755 : (n) == 4 ? 6 \
756 : (n) == 5 ? 7 \
757 : (n) == 6 ? 5 \
758 : (n) == 7 ? 4 \
759 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
760 : (-1))
761
762/* Now what stabs expects in the register. */
763#undef STABS_DBX_REGISTER_NUMBER
764#define STABS_DBX_REGISTER_NUMBER(n) \
765((n) == 0 ? 0 : \
766 (n) == 1 ? 2 : \
767 (n) == 2 ? 1 : \
768 (n) == 3 ? 3 : \
769 (n) == 4 ? 6 : \
770 (n) == 5 ? 7 : \
771 (n) == 6 ? 4 : \
772 (n) == 7 ? 5 : \
773 (n) + 4)
774
775#undef DBX_REGISTER_NUMBER
376#undef DBX_REGISTER_NUMBER
776#define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF2_DEBUG \
377#define DBX_REGISTER_NUMBER(n) (TARGET_64BIT ? dbx64_register_map[n] \
378 : (write_symbols == DWARF2_DEBUG \
777 || write_symbols == DWARF_DEBUG) \
379 || write_symbols == DWARF_DEBUG) \
778 ? DWARF_DBX_REGISTER_NUMBER(n) \
779 : STABS_DBX_REGISTER_NUMBER(n))
380 ? svr4_dbx_register_map[(n)] \
381 : dbx_register_map[(n)])
780
781/* tag end of file in elf mode */
782#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
783#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
784 do { \
785 if (TARGET_ELF) { \
382
383/* tag end of file in elf mode */
384#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
385#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
386 do { \
387 if (TARGET_ELF) { \
786 fprintf ((FILE), "\t.text\n\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", \
388 fprintf ((FILE), "\t.text\n\t.stabs \"\",%d,0,0,%LLetext\n%LLetext:\n", \
787 N_SO); \
788 } \
789 } while (0)
790
791/* stabs-in-elf has offsets relative to function beginning */
792#undef DBX_OUTPUT_LBRAC
793#define DBX_OUTPUT_LBRAC(FILE, NAME) \
794 do { \

--- 24 unchanged lines hidden ---
389 N_SO); \
390 } \
391 } while (0)
392
393/* stabs-in-elf has offsets relative to function beginning */
394#undef DBX_OUTPUT_LBRAC
395#define DBX_OUTPUT_LBRAC(FILE, NAME) \
396 do { \

--- 24 unchanged lines hidden ---