[PATCH 5/6] [DJGPP] Update DJGPP configuration related files
authorandris <andris@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jan 2016 04:57:10 +0000 (04:57 +0000)
committerandris <andris@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jan 2016 04:57:10 +0000 (04:57 +0000)
       * config/i386/djgpp.h (PREFERRED_DEBUGGING_TYPE): Define to DWARF2
       (TARGET_ASM_OUTPUT_IDENT): Define to default_asm_output_ident_directive
       (MD_EXEC_PREFIX): Remove.
       (MD_STARTFILE_PREFIX) Removee.
       (FILE_NAME_ABSOLUTE_P): Remove.
       (CPP_SPEC): Do not read macros from sys/version.h.
       (LINK_COMMAND_SPEC): Remove.
       (LOCAL_INCLUDE_DIR): Remove.
       (TARGET_ASM_NAMED_SECTION): Define to i386_djgpp_asm_named_section
       (TARGET_OS_CPP_BUILTINS): Add DJGPP (non ISO only), __DJGPP, __DJGPP__, unix.
       (POST_LINK_SPEC): Define to invoke stubify after linker
       (LIBSTDCXX): Remove define
       (DBX_REGISTER_NUMBER): Define to svr4_dbx_register_map.
       (DEFAULT_PCC_STRUCT_RETURN): Define to 1.
       (SUBTARGET_OVERRIDE_OPTIONS): Remove warning about -mbnu2210.
       (SUBTARGET_OVERRIDE_OPTIONS): Ignore -fPIC and generate message.
       (SUBTARGET_OVERRIDE_OPTIONS): Default to DWARF2 debugging info.
       (IX86_MAYBE_NO_LIBGCC_TFMODE): Remove.
       (i386_djgpp_asm_named_section): Add propotype of new procedure

       * config/i386/xm-djgpp.h (NATIVE_SYSTEM_HEADER_DIR): Define.
       (MD_EXEC_PREFIX): Define (moved from config/i386/djgpp.h).
       (STANDARD_STARTFILE_PREFIX_1): Define (moved from MD_STARTFILE_PREFIX in config/i386/djgpp.h).
       (STANDARD_STARTFILE_PREFIX_2): Define identical to STANDARD_STARTFILE_PREFIX_1.
       (LOCAL_INCLUDE_DIR): Define (moved from config/i386/djgpp.h).
       (GCC_DRIVER_HOST_INITIALIZATION): Fix reporting fatal installation errors.
       (MAX_OFILE_ALIGNMENT): Define to 128.
       (HAVE_FTW_H): Undefine as DJGPP do not have nftw, but have ftw.h.

       * config/i386/djgpp.c: New file. Add implementation of i386_djgpp_asm_named_section.

       * config/i386/djgpp.opt: Remove obsolete option -mbnu210.

       * config/i386/t-djgpp: New file. Add djgpp.o to EXTRA_OBJS.
       Add rule for building djgpp.o.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232258 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config.gcc
gcc/config/i386/djgpp.c [new file with mode: 0644]
gcc/config/i386/djgpp.h
gcc/config/i386/djgpp.opt
gcc/config/i386/t-djgpp [new file with mode: 0644]
gcc/config/i386/xm-djgpp.h

index 4a8a005..f8784f0 100644 (file)
@@ -1,3 +1,41 @@
+2016-01-12  Andris Pavenis <andris.pavenis@iki.fi>
+
+       * config/i386/djgpp.h (PREFERRED_DEBUGGING_TYPE): Define to DWARF2
+       (TARGET_ASM_OUTPUT_IDENT): Define to default_asm_output_ident_directive
+       (MD_EXEC_PREFIX): Remove.
+       (MD_STARTFILE_PREFIX) Removee.
+       (FILE_NAME_ABSOLUTE_P): Remove.
+       (CPP_SPEC): Do not read macros from sys/version.h.
+       (LINK_COMMAND_SPEC): Remove.
+       (LOCAL_INCLUDE_DIR): Remove.
+       (TARGET_ASM_NAMED_SECTION): Define to i386_djgpp_asm_named_section
+       (TARGET_OS_CPP_BUILTINS): Add DJGPP (non ISO only), __DJGPP, __DJGPP__, unix.
+       (POST_LINK_SPEC): Define to invoke stubify after linker
+       (LIBSTDCXX): Remove define
+       (DBX_REGISTER_NUMBER): Define to svr4_dbx_register_map.
+       (DEFAULT_PCC_STRUCT_RETURN): Define to 1.
+       (SUBTARGET_OVERRIDE_OPTIONS): Remove warning about -mbnu2210.
+       (SUBTARGET_OVERRIDE_OPTIONS): Ignore -fPIC and generate message.
+       (SUBTARGET_OVERRIDE_OPTIONS): Default to DWARF2 debugging info.
+       (IX86_MAYBE_NO_LIBGCC_TFMODE): Remove.
+       (i386_djgpp_asm_named_section): Add propotype of new procedure
+
+       * config/i386/xm-djgpp.h (NATIVE_SYSTEM_HEADER_DIR): Define.
+       (MD_EXEC_PREFIX): Define (moved from config/i386/djgpp.h).
+       (STANDARD_STARTFILE_PREFIX_1): Define (moved from MD_STARTFILE_PREFIX in config/i386/djgpp.h).
+       (STANDARD_STARTFILE_PREFIX_2): Define identical to STANDARD_STARTFILE_PREFIX_1.
+       (LOCAL_INCLUDE_DIR): Define (moved from config/i386/djgpp.h).
+       (GCC_DRIVER_HOST_INITIALIZATION): Fix reporting fatal installation errors.
+       (MAX_OFILE_ALIGNMENT): Define to 128.
+       (HAVE_FTW_H): Undefine as DJGPP do not have nftw, but have ftw.h.
+
+       * config/i386/djgpp.c: New file. Add implementation of i386_djgpp_asm_named_section.
+
+       * config/i386/djgpp.opt: Remove obsolete option -mbnu210.
+
+       * config/i386/t-djgpp: New file. Add djgpp.o to EXTRA_OBJS.
+       Add rule for building djgpp.o.
+
 2016-01-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.c (v2df_reduction_p): New function.
index 0f2dc32..c602358 100644 (file)
@@ -4392,6 +4392,9 @@ case ${target} in
        i[34567]86-*-gnu*)
                tmake_file="$tmake_file i386/t-gnu"
                ;;
+       i[34567]86-*-msdosdjgpp*)
+               tmake_file="${tmake_file} i386/t-djgpp"
+               ;;
        i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
                ;;
        i[34567]86-*-cygwin* | x86_64-*-cygwin*)
diff --git a/gcc/config/i386/djgpp.c b/gcc/config/i386/djgpp.c
new file mode 100644 (file)
index 0000000..7414338
--- /dev/null
@@ -0,0 +1,47 @@
+/* Subroutines for DJGPP.
+   Copyright (C) 2013-2016 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+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 3, or (at your option) any later
+version.
+
+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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "output.h"
+#include "lto-section-names.h"
+
+void
+i386_djgpp_asm_named_section(const char *name, unsigned int flags,
+                            tree)
+{
+  char flagchars[8], *f = flagchars;
+
+  if (flags & SECTION_WRITE)
+    *f++ = 'w';
+  if (flags & SECTION_CODE)
+    *f++ = 'x';
+
+  /* LTO sections need 1-byte alignment to avoid confusing the
+     zlib decompression algorithm with trailing zero pad bytes.  */
+  if (strncmp (name, LTO_SECTION_NAME_PREFIX,
+                       strlen (LTO_SECTION_NAME_PREFIX)) == 0)
+    *f++ = '0';
+
+  *f++ = '\0';
+
+  fprintf (asm_out_file, "\t.section\t%s,\"%s\"\n", name, flagchars);
+}
index 17823d1..c758f5f 100644 (file)
@@ -20,6 +20,9 @@ along with GCC; see the file COPYING3.  If not see
 /* Support generation of DWARF2 debugging info.  */
 #define DWARF2_DEBUGGING_INFO 1
 
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
 
@@ -30,6 +33,10 @@ along with GCC; see the file COPYING3.  If not see
 #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\t"
@@ -39,56 +46,25 @@ along with GCC; see the file COPYING3.  If not see
 #undef TEXT_SECTION_ASM_OP
 #define TEXT_SECTION_ASM_OP "\t.section .text"
 
-/* Define standard DJGPP installation paths.  */
-/* We override default /usr or /usr/local part with /dev/env/DJDIR which */
-/* points to actual DJGPP installation directory.  */
-
-/* Search for as.exe and ld.exe in DJGPP's binary directory.  */ 
-#undef MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
-
-/* Standard DJGPP library and startup files */
-#undef MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/dev/env/DJDIR/lib/"
-
-/* 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] == ':')))
-
 #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)
 
-/* Include <sys/version.h> so __DJGPP__ and __DJGPP_MINOR__ are defined.  */
 #undef CPP_SPEC
-#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \
-  -imacros %s../include/sys/version.h"
-
-/* 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 " LINK_COMPRESS_DEBUG_SPEC \
-"%X %{o*} %{e*} %{N} %{n} \
-\t%{r} %{s} %{t} %{u*} %{z} %{Z}\
-\t%{!nostdlib:%{!nostartfiles:%S}}\
-\t%{static:} %{L*} %D %o\
-\t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\
-\t%{!nostdlib:%{!nostartfiles:%E}}\
-\t-Tdjgpp.djl %{T*}}}}}}}\n\
-%{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out} }}}}}"
+#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
@@ -98,12 +74,8 @@ along with GCC; see the file COPYING3.  If not see
 #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
-
 /* Switch into a generic section.  */
-#define TARGET_ASM_NAMED_SECTION  default_coff_asm_named_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
@@ -159,23 +131,37 @@ along with GCC; see the file COPYING3.  If not see
 #undef PTRDIFF_TYPE
 #define PTRDIFF_TYPE "int"
 
-/* Used to be defined in xm-djgpp.h, but moved here for cross-compilers.  */
-#define LIBSTDCXX "stdcxx"
-
-/* Warn that -mbnu210 is now obsolete.  */
-#undef  SUBTARGET_OVERRIDE_OPTIONS
-#define SUBTARGET_OVERRIDE_OPTIONS \
-do \
-  { \
-    if (TARGET_BNU210) \
-      {        \
-        warning (0, "-mbnu210 is ignored (option is obsolete)"); \
-      }        \
-  } \
-while (0)
+#undef DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n) svr4_dbx_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 (!global_options_set.x_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)
 
-#define IX86_MAYBE_NO_LIBGCC_TFMODE
+/* Function protypes for gcc/i386/djgpp.c */
+
+void
+i386_djgpp_asm_named_section(const char *name, unsigned int flags,
+                            tree decl);
index 4ef54db..b4ae04f 100644 (file)
 ; along with GCC; see the file COPYING3.  If not see
 ; <http://www.gnu.org/licenses/>.
 
-;; -mbnu210 is now ignored and obsolete.  It was used to enable support for
-;; weak symbols, and .gnu.linkonce support.
-mbnu210
-Target Var(TARGET_BNU210)
-Ignored (obsolete).
-
 posix
 Driver
diff --git a/gcc/config/i386/t-djgpp b/gcc/config/i386/t-djgpp
new file mode 100644 (file)
index 0000000..dd3b32a
--- /dev/null
@@ -0,0 +1,8 @@
+
+EXTRA_OBJS += djgpp.o
+
+djgpp.o:    $(srcdir)/config/i386/djgpp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+  $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h output.h $(TREE_H) flags.h \
+  $(TM_P_H) $(HASH_TABLE_H) $(GGC_H) $(LTO_STREAMER_H)
+       $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+       $(srcdir)/config/i386/djgpp.c
index 6be11b4..94e6ff6 100644 (file)
@@ -22,6 +22,31 @@ along with GCC; see the file COPYING3.  If not see
 
 #define HOST_EXECUTABLE_SUFFIX ".exe"
 
+/* Define standard DJGPP installation paths.  */
+/* We override default /usr or /usr/local part with /dev/env/DJDIR which */
+/* points to actual DJGPP installation directory.  */
+
+/* Native system include directory */
+#undef NATIVE_SYSTEM_HEADER_DIR
+#define NATIVE_SYSTEM_HEADER_DIR "/dev/env/DJDIR/include/"
+
+/* Search for as.exe and ld.exe in DJGPP's binary directory.  */
+#undef MD_EXEC_PREFIX
+#define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
+
+/* Standard DJGPP library and startup files */
+#undef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "/dev/env/DJDIR/lib/"
+
+/* Define STANDARD_STARTFILE_PREFIX_2 equal to STANDARD_STARTFILE_PREFIX_1
+   to avoid gcc.c redefining it to /usr/lib */
+#undef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_1 "/dev/env/DJDIR/lib/"
+
+/* Make sure that gcc will not look for .h files in /usr/local/include
+   unless user explicitly requests it.  */
+#undef LOCAL_INCLUDE_DIR
+
 /* System dependent initialization for collect2
    to tell system() to act like Unix.  */
 #define COLLECT2_HOST_INITIALIZATION \
@@ -57,12 +82,12 @@ along with GCC; see the file COPYING3.  If not see
            to try and figure out what's wrong.  */ \
         char *djgpp = getenv ("DJGPP"); \
         if (djgpp == NULL) \
-          fatal ("environment variable DJGPP not defined"); \
+          fatal_error (UNKNOWN_LOCATION, "environment variable DJGPP not defined"); \
         else if (access (djgpp, R_OK) == 0) \
-          fatal ("environment variable DJGPP points to missing file '%s'", \
+          fatal_error (UNKNOWN_LOCATION, "environment variable DJGPP points to missing file '%s'", \
                  djgpp); \
         else \
-          fatal ("environment variable DJGPP points to corrupt file '%s'", \
+          fatal_error (UNKNOWN_LOCATION, "environment variable DJGPP points to corrupt file '%s'", \
                   djgpp); \
       } \
   } while (0)
@@ -80,4 +105,11 @@ along with GCC; see the file COPYING3.  If not see
       _fixpath ((PATH), fixed_path);           \
       strcat (fixed_path, "/");                        \
       (PATH) = xstrdup (fixed_path);           \
-    } 
+    }
+
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT 128
+
+/* DJGPP versions up to current (2.05) have ftw.h but only ftw() not nftw().
+   Disable use of ftw.h */
+#undef HAVE_FTW_H