1 /* Definitions of target machine for GNU compiler, for MCore using COFF/PE. 2 Copyright (C) 1994, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 3 Contributed by Michael Tiemann (tiemann@cygnus.com). 4 5 This file is part of GCC. 6 7 GCC is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2, or (at your option) 10 any later version. 11 12 GCC is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with GCC; see the file COPYING. If not, write to 19 the Free Software Foundation, 59 Temple Place - Suite 330, 20 Boston, MA 02111-1307, USA. */ 21 22 /* Run-time Target Specification. */ 23 #define TARGET_VERSION fputs (" (MCORE/pe)", stderr) 24 25 #define TARGET_OS_CPP_BUILTINS() \ 26 do \ 27 { \ 28 builtin_define ("__pe__"); \ 29 } \ 30 while (0) 31 32 /* The MCore ABI says that bitfields are unsigned by default. */ 33 /* The EPOC C++ environment does not support exceptions. */ 34 #undef CC1_SPEC 35 #define CC1_SPEC "-funsigned-bitfields %{!DIN_GCC:-fno-rtti} %{!DIN_GCC:-fno-exceptions}" 36 37 #undef SDB_DEBUGGING_INFO 38 #define DBX_DEBUGGING_INFO 1 39 40 /* Computed in toplev.c. */ 41 #undef PREFERRED_DEBUGGING_TYPE 42 43 /* Lay out additional 'sections' where we place things like code 44 and readonly data. This gets them out of default places. */ 45 46 #define SUBTARGET_SWITCH_SECTIONS \ 47 case in_drectve: drectve_section (); break; 48 49 #define DRECTVE_SECTION_ASM_OP "\t.section .drectve" 50 #define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata" 51 52 #define SUBTARGET_EXTRA_SECTIONS in_drectve 53 54 #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \ 55 DRECTVE_SECTION_FUNCTION 56 57 #define DRECTVE_SECTION_FUNCTION \ 58 void \ 59 drectve_section () \ 60 { \ 61 if (in_section != in_drectve) \ 62 { \ 63 fprintf (asm_out_file, "%s\n", DRECTVE_SECTION_ASM_OP); \ 64 in_section = in_drectve; \ 65 } \ 66 } 67 68 #define MCORE_EXPORT_NAME(STREAM, NAME) \ 69 do \ 70 { \ 71 drectve_section (); \ 72 fprintf (STREAM, "\t.ascii \" -export:%s\"\n", \ 73 (* targetm.strip_name_encoding) (NAME)); \ 74 } \ 75 while (0); 76 77 /* Output the label for an initialized variable. */ 78 #undef ASM_DECLARE_OBJECT_NAME 79 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ 80 do \ 81 { \ 82 if (mcore_dllexport_name_p (NAME)) \ 83 { \ 84 enum in_section save_section = in_section; \ 85 MCORE_EXPORT_NAME (STREAM, NAME); \ 86 switch_to_section (save_section, (DECL)); \ 87 } \ 88 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ 89 } \ 90 while (0) 91 92 /* Output a function label definition. */ 93 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ 94 do \ 95 { \ 96 if (mcore_dllexport_name_p (NAME)) \ 97 { \ 98 MCORE_EXPORT_NAME (STREAM, NAME); \ 99 function_section (DECL); \ 100 } \ 101 ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ 102 } \ 103 while (0); 104 105 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true 106 107 #undef ASM_OUTPUT_SOURCE_LINE 108 #define ASM_OUTPUT_SOURCE_LINE(FILE, LINE, COUNTER) \ 109 { \ 110 if (write_symbols == DBX_DEBUG) \ 111 { \ 112 char buffer[256]; \ 113 \ 114 ASM_GENERATE_INTERNAL_LABEL (buffer, "LM", COUNTER); \ 115 fprintf (FILE, ".stabn 68,0,%d,", LINE); \ 116 assemble_name (FILE, buffer); \ 117 putc ('-', FILE); \ 118 assemble_name (FILE, \ 119 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ 120 putc ('\n', FILE); \ 121 (*targetm.asm_out.internal_label) (FILE, "LM", COUNTER); \ 122 } \ 123 } 124 125 #define STARTFILE_SPEC "crt0.o%s" 126 #define ENDFILE_SPEC "%{!mno-lsim:-lsim}" 127 128 /* __CTOR_LIST__ and __DTOR_LIST__ must be defined by the linker script. */ 129 #define CTOR_LISTS_DEFINED_EXTERNALLY 130 131 #undef DO_GLOBAL_CTORS_BODY 132 #undef DO_GLOBAL_DTORS_BODY 133 #undef INIT_SECTION_ASM_OP 134 #undef DTORS_SECTION_ASM_OP 135 136 #define SUPPORTS_ONE_ONLY 1 137 138 /* Switch into a generic section. */ 139 #undef TARGET_ASM_NAMED_SECTION 140 #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section 141