Home | History | Annotate | Line # | Download | only in i386
      1 /* Configuration for an i386 running MS-DOS with DJGPP.
      2    Copyright (C) 1997-2022 Free Software Foundation, Inc.
      3 
      4 This file is part of GCC.
      5 
      6 GCC 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 GCC 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 GCC; see the file COPYING3.  If not see
     18 <http://www.gnu.org/licenses/>.  */
     19 
     20 /* Support generation of DWARF2 debugging info.  */
     21 #define DWARF2_DEBUGGING_INFO 1
     22 
     23 #undef PREFERRED_DEBUGGING_TYPE
     24 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
     25 
     26 #undef BSS_SECTION_ASM_OP
     27 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
     28 
     29 /* Define the name of the .data section.  */
     30 #undef DATA_SECTION_ASM_OP
     31 #define DATA_SECTION_ASM_OP "\t.section .data"
     32 
     33 /* Define the name of the .ident op.  */
     34 #undef TARGET_ASM_OUTPUT_IDENT
     35 #define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
     36 
     37 /* Enable alias attribute support.  */
     38 #ifndef SET_ASM_OP
     39 #define SET_ASM_OP "\t.set\t"
     40 #endif
     41 
     42 /* Define the name of the .text section.  */
     43 #undef TEXT_SECTION_ASM_OP
     44 #define TEXT_SECTION_ASM_OP "\t.section .text"
     45 
     46 #define TARGET_OS_CPP_BUILTINS()		\
     47   do						\
     48     {						\
     49         if (!flag_iso)                          \
     50 	   builtin_define_with_int_value ("DJGPP",2);  \
     51 	builtin_define_with_int_value ("__DJGPP",2);   \
     52 	builtin_define_with_int_value ("__DJGPP__",2); \
     53 	builtin_define_std ("MSDOS");		\
     54 	builtin_define_std ("GO32");		\
     55 	builtin_define_std ("unix");		\
     56 	builtin_assert ("system=msdos");	\
     57     }						\
     58   while (0)
     59 
     60 #undef CPP_SPEC
     61 #define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE}"
     62 
     63 #undef POST_LINK_SPEC
     64 #define POST_LINK_SPEC "stubify %{v} %{o*:%*} %{!o*:a.out}"
     65 
     66 /* Always just link in 'libc.a'.  */
     67 #undef LIB_SPEC
     68 #define LIB_SPEC "-lc"
     69 
     70 /* Pick the right startup code depending on the -pg flag.  */
     71 #undef STARTFILE_SPEC
     72 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
     73 
     74 /* Switch into a generic section.  */
     75 #define TARGET_ASM_NAMED_SECTION  i386_djgpp_asm_named_section
     76 
     77 /* This is how to output an assembler line
     78    that says to advance the location counter
     79    to a multiple of 2**LOG bytes.  */
     80 
     81 #undef ASM_OUTPUT_ALIGN
     82 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
     83   if ((LOG) != 0) fprintf ((FILE), "\t.p2align %d\n", LOG)
     84 
     85 /* This is how to output a global symbol in the BSS section.  */
     86 #undef ASM_OUTPUT_ALIGNED_BSS
     87 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
     88   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
     89 
     90 /* Write the extra assembler code needed to declare a function properly.  */
     91 
     92 #ifndef ASM_DECLARE_FUNCTION_NAME
     93 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)		\
     94   do								\
     95     {								\
     96       ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL);		\
     97     }								\
     98   while (0)
     99 #endif
    100 
    101 /* This is how to tell assembler that a symbol is weak  */
    102 #undef ASM_WEAKEN_LABEL
    103 #define ASM_WEAKEN_LABEL(FILE,NAME) \
    104   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
    105        fputc ('\n', FILE); } while (0)
    106 
    107 /* djgpp automatically calls its own version of __main, so don't define one
    108    in libgcc, nor call one in main().  */
    109 #define HAS_INIT_SECTION
    110 
    111 #undef TARGET_LIBC_HAS_FUNCTION
    112 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
    113 
    114 /* Definitions for types and sizes. Wide characters are 16-bits long so
    115    Win32 compiler add-ons will be wide character compatible.  */
    116 #undef WCHAR_TYPE_SIZE
    117 #define WCHAR_TYPE_SIZE 16
    118 
    119 #undef WCHAR_TYPE
    120 #define WCHAR_TYPE "short unsigned int"
    121 
    122 #undef WINT_TYPE
    123 #define WINT_TYPE "int"
    124 
    125 #undef SIZE_TYPE
    126 #define SIZE_TYPE "long unsigned int"
    127 
    128 #undef PTRDIFF_TYPE
    129 #define PTRDIFF_TYPE "int"
    130 
    131 #undef DBX_REGISTER_NUMBER
    132 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
    133 
    134 /* Default to pcc-struct-return.  */
    135 #define DEFAULT_PCC_STRUCT_RETURN 1
    136 
    137 /* Ignore (with warning) -fPIC for DJGPP */
    138 #undef SUBTARGET_OVERRIDE_OPTIONS
    139 #define SUBTARGET_OVERRIDE_OPTIONS                                      \
    140     do {                                                                \
    141         if (flag_pic)                                                   \
    142         {                                                               \
    143             fnotice(stdout, "-f%s ignored (not supported for DJGPP)\n", \
    144                 (flag_pic > 1) ? "PIC" : "pic");                        \
    145             flag_pic = 0;                                               \
    146         }                                                               \
    147                                                                         \
    148         /* Don't emit DWARF3/4 unless specifically selected. */         \
    149         /* DWARF3/4 currently does not work for DJGPP.  */              \
    150         if (!OPTION_SET_P (dwarf_version))                        \
    151             dwarf_version = 2;                                          \
    152                                                                         \
    153         }                                                               \
    154     while (0)
    155 
    156 /* Support for C++ templates.  */
    157 #undef MAKE_DECL_ONE_ONLY
    158 #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
    159 
    160 #undef TARGET_COFF
    161 #define TARGET_COFF 1
    162 
    163 /* Kludge because of missing COFF support for early LTO debug.  */
    164 #undef  TARGET_ASM_LTO_START
    165 #define TARGET_ASM_LTO_START i386_djgpp_asm_lto_start
    166 #undef  TARGET_ASM_LTO_END
    167 #define TARGET_ASM_LTO_END i386_djgpp_asm_lto_end
    168 
    169 /* Function protypes for gcc/i386/djgpp.cc */
    170 
    171 void
    172 i386_djgpp_asm_named_section(const char *name, unsigned int flags,
    173 			     tree decl);
    174 void i386_djgpp_asm_lto_start (void);
    175 void i386_djgpp_asm_lto_end (void);
    176