diff mbox

[5/6,DJGPP] gcc/config/i386: update DJGPP configuration related files

Message ID 56631D5D.4030806@wippies.com
State New
Headers show

Commit Message

Andris Pavenis Dec. 5, 2015, 5:22 p.m. UTC
Patch include updates to DJGPP related files in gcc/config/i386.

There are too many changes to gcc/config/i386/djgpp.h and
gcc/config/i386/xm-djgpp.h to list them completely in changelog
entry.

Andris

2015-11-25 Andris Pavenis <andris.pavenis@iki.fi>

Subject: [PATCH 6/6] [DJGPP] gcc/config/i386: update DJGPP configuration
  related files

* gcc/config/i386/djgpp.h: update
* gcc/config/i386/xm-djgpp.h: update
* gcc/config/i386/djgpp.c: new file
* gcc/config/i386/djgpp.opt: remove obsolete option -mbnu210
* gcc/config/i386/t-djgpp: new file
* gcc/config.gcc: use i386/t-djgpp for DJGPP target

Comments

Jeff Law Dec. 10, 2015, 10:43 p.m. UTC | #1
On 12/05/2015 10:22 AM, Andris Pavenis wrote:
> Patch include updates to DJGPP related files in gcc/config/i386.
>
> There are too many changes to gcc/config/i386/djgpp.h and
> gcc/config/i386/xm-djgpp.h to list them completely in changelog
> entry.
>
> Andris
>
> 2015-11-25 Andris Pavenis <andris.pavenis@iki.fi>
>
> Subject: [PATCH 6/6] [DJGPP] gcc/config/i386: update DJGPP configuration
>   related files
>
> * gcc/config/i386/djgpp.h: update
> * gcc/config/i386/xm-djgpp.h: update
> * gcc/config/i386/djgpp.c: new file
> * gcc/config/i386/djgpp.opt: remove obsolete option -mbnu210
> * gcc/config/i386/t-djgpp: new file
> * gcc/config.gcc: use i386/t-djgpp for DJGPP target
>
> 0005-DJGPP-gcc-config-i386-update-DJGPP-configuration-rel.patch
>
>
>  From 367432d08b4a00f180c3d0710a0f34cda1b6eeee Mon Sep 17 00:00:00 2001
> From: Andris Pavenis<andris.pavenis@iki.fi>
> Date: Sat, 5 Dec 2015 08:49:12 +0200
> Subject: [PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration related files
>
> * gcc/config/i386/djgpp.h: update
> * gcc/config/i386/xm-djgpp.h: update
You should describe what you updated.  SImply saying "update" is 
insufficient here.
> diff --git a/gcc/config/i386/djgpp.c b/gcc/config/i386/djgpp.c
> new file mode 100644
> index 0000000..29dad33
> --- /dev/null
> +++ b/gcc/config/i386/djgpp.c
> @@ -0,0 +1,50 @@
> +/* Subroutines for DJGPP.
> +   Contributed by Andris Pavenis<andris.pavenis@iki.fi>
> +   Copyright (C) 2013 Free Software Foundation, Inc.
Copyright date needs updating.

> +
> +void
> +i386_djgpp_asm_named_section(const char *name, unsigned int flags,
> +			     tree decl)
> +{
> +  char flagchars[8], *f = flagchars;
> +
> +(void)decl; /* silence warning. */
The way to do this now is to not give a name to the parameter.    So 
remove "decl" from the function signature (leaving its type though). 
Then you can remove this line.

> --- a/gcc/config/i386/djgpp.h
> +++ b/gcc/config/i386/djgpp.h
> @@ -17,12 +17,27 @@ 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/>.  */
>
> +#define DBX_DEBUGGING_INFO 1
> +#define SDB_DEBUGGING_INFO 1
?  Really,  do you *really* need this.  I'd really like to see DBX and 
SDB debugging info die, not propagate into more targets.

>
> -#define IX86_MAYBE_NO_LIBGCC_TFMODE
> +#undef DBX_REGISTER_NUMBER
> +#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
And if the DBX_DEBUGGING_INFO goes away, can't this go away too?

Jeff
diff mbox

Patch

From 367432d08b4a00f180c3d0710a0f34cda1b6eeee Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pavenis@iki.fi>
Date: Sat, 5 Dec 2015 08:49:12 +0200
Subject: [PATCH 5/6] [DJGPP] gcc/config/i386: update DJGPP configuration related files

* gcc/config/i386/djgpp.h: update
* gcc/config/i386/xm-djgpp.h: update
* gcc/config/i386/djgpp.c: new file
* gcc/config/i386/djgpp.opt: remove obsolete option
* gcc/config/i386/t-djgpp: new file
* gcc/config.gcc: use i386/t-djgpp for DJGPP target
---
 gcc/config.gcc             |   3 ++
 gcc/config/i386/djgpp.c    |  50 +++++++++++++++++++
 gcc/config/i386/djgpp.h    | 122 ++++++++++++++++++++++-----------------------
 gcc/config/i386/djgpp.opt  |   6 ---
 gcc/config/i386/t-djgpp    |   8 +++
 gcc/config/i386/xm-djgpp.h |  40 +++++++++++++--
 6 files changed, 158 insertions(+), 71 deletions(-)
 create mode 100644 gcc/config/i386/djgpp.c
 create mode 100644 gcc/config/i386/t-djgpp

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 59aee2c..656cbd8 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4387,6 +4387,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
index 0000000..29dad33
--- /dev/null
+++ b/gcc/config/i386/djgpp.c
@@ -0,0 +1,50 @@ 
+/* Subroutines for DJGPP.
+   Contributed by Andris Pavenis <andris.pavenis@iki.fi>
+   Copyright (C) 2013 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 decl)
+{
+  char flagchars[8], *f = flagchars;
+
+(void)decl; /* silence warning. */
+
+  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);
+}
diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h
index f8b9031..dd441b3 100644
--- a/gcc/config/i386/djgpp.h
+++ b/gcc/config/i386/djgpp.h
@@ -17,12 +17,27 @@  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/>.  */
 
+#define DBX_DEBUGGING_INFO 1
+#define SDB_DEBUGGING_INFO 1
+
 /* Support generation of DWARF2 debugging info.  */
 #define DWARF2_DEBUGGING_INFO 1
 
+/* Use DWARF2 debugging info by default: comment out following  */
+/* 2 lines to default to COFF debugging info  */
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
 /* Don't assume anything about the header files.  */
 #define NO_IMPLICIT_EXTERN_C
 
+/* 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"
 
@@ -30,6 +45,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 +58,26 @@  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 +87,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
@@ -129,7 +114,7 @@  along with GCC; see the file COPYING3.  If not see
   while (0)
 #endif
 
-/* This is how to tell assembler that a symbol is weak  */ 
+/* 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); \
@@ -159,23 +144,38 @@  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)
-
 /* 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
+#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)
+
+/* Function protypes for gcc/i386/djgpp.c */
+
+void
+i386_djgpp_asm_named_section(const char *name, unsigned int flags,
+			     tree decl);
+
diff --git a/gcc/config/i386/djgpp.opt b/gcc/config/i386/djgpp.opt
index d52c77d..dea04e2d 100644
--- a/gcc/config/i386/djgpp.opt
+++ b/gcc/config/i386/djgpp.opt
@@ -18,11 +18,5 @@ 
 ; 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
index 0000000..dd3b32a
--- /dev/null
+++ b/gcc/config/i386/t-djgpp
@@ -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
diff --git a/gcc/config/i386/xm-djgpp.h b/gcc/config/i386/xm-djgpp.h
index 626be2f..cba7e1b 100644
--- a/gcc/config/i386/xm-djgpp.h
+++ b/gcc/config/i386/xm-djgpp.h
@@ -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
-- 
2.4.3