]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/i386/djgpp.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / i386 / djgpp.h
index 4801c5d8819be3d36ce7e3bc118413d7d5087e6c..1b5dfb7e46e462a7b7c386fdd77c31de97951350 100644 (file)
@@ -1,83 +1,67 @@
 /* Configuration for an i386 running MS-DOS with DJGPP.
-   Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997-2024 Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
+/* Support generation of DWARF2 debugging info.  */
+#define DWARF2_DEBUGGING_INFO 1
 
-#include "dbxcoff.h"
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
 
-/* Don't assume anything about the header files. */
-#define NO_IMPLICIT_EXTERN_C
-
-#define HANDLE_SYSV_PRAGMA
-
-/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop).  */
-#define HANDLE_PRAGMA_PACK_PUSH_POP 1
-
-#define YES_UNDERSCORES
-
-#include "i386/gas.h"
-
-/* If defined, a C expression whose value is a string containing the
-   assembler operation to identify the following data as
-   uninitialized global data.  If not defined, and neither
-   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
-   uninitialized global data will be output in the data section if
-   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
-   used.  */
 #undef BSS_SECTION_ASM_OP
 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
 
+/* Define the name of the .data section.  */
+#undef DATA_SECTION_ASM_OP
+#define DATA_SECTION_ASM_OP "\t.section .data"
+
+/* Define the name of the .ident op.  */
+#undef TARGET_ASM_OUTPUT_IDENT
+#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
+
 /* Enable alias attribute support.  */
 #ifndef SET_ASM_OP
-#define SET_ASM_OP "\t.set"
+#define SET_ASM_OP "\t.set\t"
 #endif
 
-/* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
-#define MD_EXEC_PREFIX "$DJDIR/bin/"
-
-/* Correctly handle absolute filename detection in cp/xref.c */
-#define FILE_NAME_ABSOLUTE_P(NAME) \
-        (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \
-        (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':')))
-
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES "-Dunix -DGO32 -DDJGPP=2 -DMSDOS \
-  -Asystem(unix) -Asystem(msdos)"
-
-/* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl.
-   This cannot be done in LINK_SPECS as that LINK_SPECS is processed
-   before library search directories are known by the linker.
-   This avoids problems when specs file is not available. An alternate way,
-   suggested by Robert Hoehne, is to use SUBTARGET_EXTRA_SPECS instead.
-*/ 
-
-#undef LINK_COMMAND_SPEC
-#define LINK_COMMAND_SPEC \
-"%{!fsyntax-only: \
-%{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \
-\t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\
-\t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
-\t%{static:} %{L*} %D %o\
-\t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
-\t%{!A:%{!nostdlib:%{!nostartfiles:%E}}}\
-\t-Tdjgpp.djl %{T*}}}}}}}\n\
-%{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
+/* Define the name of the .text section.  */
+#undef TEXT_SECTION_ASM_OP
+#define TEXT_SECTION_ASM_OP "\t.section .text"
+
+#define TARGET_OS_CPP_BUILTINS()               \
+  do                                           \
+    {                                          \
+        if (!flag_iso)                          \
+          builtin_define_with_int_value ("DJGPP",2);  \
+       builtin_define_with_int_value ("__DJGPP",2);   \
+       builtin_define_with_int_value ("__DJGPP__",2); \
+       builtin_define_std ("MSDOS");           \
+       builtin_define_std ("GO32");            \
+       builtin_define_std ("unix");            \
+       builtin_assert ("system=msdos");        \
+    }                                          \
+  while (0)
+
+#undef CPP_SPEC
+#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE}"
+
+#undef POST_LINK_SPEC
+#define POST_LINK_SPEC "stubify %{v} %{o*:%*} %{!o*:a.out}"
 
 /* Always just link in 'libc.a'.  */
 #undef LIB_SPEC
@@ -87,70 +71,8 @@ Boston, MA 02111-1307, USA.  */
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s}"
 
-/* Make sure that gcc will not look for .h files in /usr/local/include 
-   unless user explicitly requests it.  */
-#undef LOCAL_INCLUDE_DIR
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_ctor, in_dtor
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS                                        \
-  CTOR_SECTION_FUNCTION                                                \
-  DTOR_SECTION_FUNCTION
-
-#define CTOR_SECTION_FUNCTION                                  \
-void                                                           \
-ctor_section ()                                                        \
-{                                                              \
-  if (in_section != in_ctor)                                   \
-    {                                                          \
-      fprintf (asm_out_file, "\t.section .ctor\n");            \
-      in_section = in_ctor;                                    \
-    }                                                          \
-}
-
-#define DTOR_SECTION_FUNCTION                                  \
-void                                                           \
-dtor_section ()                                                        \
-{                                                              \
-  if (in_section != in_dtor)                                   \
-    {                                                          \
-      fprintf (asm_out_file, "\t.section .dtor\n");            \
-      in_section = in_dtor;                                    \
-    }                                                          \
-}
-
-#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)      \
-  do {                                         \
-    ctor_section ();                           \
-    fprintf (FILE, "%s\t", ASM_LONG);          \
-    assemble_name (FILE, NAME);                        \
-    fprintf (FILE, "\n");                      \
-  } while (0)
-
-/* Allow (eg) __attribute__((section "locked")) to work */
-#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
-  do {                                         \
-    fprintf (FILE, "\t.section %s\n", NAME);   \
-  } while (0)
-
-#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)       \
-  do {                                         \
-    dtor_section ();                                   \
-    fprintf (FILE, "%s\t", ASM_LONG);          \
-    assemble_name (FILE, NAME);                \
-    fprintf (FILE, "\n");                      \
-  } while (0)
-
-/* Output at beginning of assembler file.  */
-/* The .file command should always begin the output.  */
-
-#undef ASM_FILE_START
-#define ASM_FILE_START(FILE)                                           \
-  do {                                                                 \
-       output_file_directive (FILE, main_input_filename);              \
-  } while (0)
+/* Switch into a generic section.  */
+#define TARGET_ASM_NAMED_SECTION  i386_djgpp_asm_named_section
 
 /* This is how to output an assembler line
    that says to advance the location counter
@@ -165,6 +87,89 @@ dtor_section ()                                                     \
 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
   asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
 
+/* Write the extra assembler code needed to declare a function properly.  */
+
+#ifndef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)            \
+  do                                                           \
+    {                                                          \
+      ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL);            \
+    }                                                          \
+  while (0)
+#endif
+
+/* This is how to tell assembler that a symbol is weak  */ 
+#undef ASM_WEAKEN_LABEL
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+  do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+       fputc ('\n', FILE); } while (0)
+
 /* djgpp automatically calls its own version of __main, so don't define one
    in libgcc, nor call one in main().  */
 #define HAS_INIT_SECTION
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+
+/* Definitions for types and sizes. Wide characters are 16-bits long so
+   Win32 compiler add-ons will be wide character compatible.  */
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 16
+
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "short unsigned int"
+
+#undef WINT_TYPE
+#define WINT_TYPE "int"
+
+#undef SIZE_TYPE
+#define SIZE_TYPE "long unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
+#undef DEBUGGER_REGNO
+#define DEBUGGER_REGNO(n) svr4_debugger_register_map[n]
+
+/* Default to pcc-struct-return.  */
+#define DEFAULT_PCC_STRUCT_RETURN 1
+
+/* Ignore (with warning) -fPIC for DJGPP */
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS                                      \
+    do {                                                                \
+        if (flag_pic)                                                   \
+        {                                                               \
+            fnotice(stdout, "-f%s ignored (not supported for DJGPP)\n", \
+                (flag_pic > 1) ? "PIC" : "pic");                        \
+            flag_pic = 0;                                               \
+        }                                                               \
+                                                                        \
+        /* Don't emit DWARF3/4 unless specifically selected. */         \
+        /* DWARF3/4 currently does not work for DJGPP.  */              \
+        if (!OPTION_SET_P (dwarf_version))                        \
+            dwarf_version = 2;                                          \
+                                                                        \
+        }                                                               \
+    while (0)
+
+/* Support for C++ templates.  */
+#undef MAKE_DECL_ONE_ONLY
+#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+
+#undef TARGET_COFF
+#define TARGET_COFF 1
+
+/* Kludge because of missing COFF support for early LTO debug.  */
+#undef  TARGET_ASM_LTO_START
+#define TARGET_ASM_LTO_START i386_djgpp_asm_lto_start
+#undef  TARGET_ASM_LTO_END
+#define TARGET_ASM_LTO_END i386_djgpp_asm_lto_end
+
+/* Function protypes for gcc/i386/djgpp.cc */
+
+void
+i386_djgpp_asm_named_section(const char *name, unsigned int flags,
+                            tree decl);
+void i386_djgpp_asm_lto_start (void);
+void i386_djgpp_asm_lto_end (void);