This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

revised DJGPP changes


Hi guys,
This patch makes several changes DJGPP port:

* Canonicalize prefixes beginning with '/dev/env/' (the default prefix for 
DJGPP with Bash 2.03 or later) so the relative path routine in gcc.c 
correctly compares directories so the various directories are set correctly.

*  Use Binutils 2.10 features by default. If gcc 3.0 takes long enough, perhaps the -
mno-bnu210 switch can be dropped entirely.

* Set the default include directory to '/dev/env/DJDIR/include' and delete code that 
forces in $DJDIR.

* Move code that shortens the target alias and rids 'gcc_version' of extra dots (native DOS can't handle multiple dots in a filename) to the 
top-level.


gcc/Changelog:

2000-07-17  Mark Elbrecht  <snowball3@bigfoot.com>

	* x-djgpp: Delete code that conditionally modifies target_alias.
	  Delete code that conditionally modifies 'version'.
	  Delete X_CPPFLAGS. Add comment for SYSTEM_HEADER_DIR.
	* config/i386/xm-djgpp.h (GCC_DRIVER_HOST_INITIALIZATION): New macro.
	* gcc.c (main): Use it.
	* config/i386/xm-djgpp.h (UPDATE_PATH_HOST_CANONICALIZE): New macro.
	* prefix.c (update_path): Use it.
	* config/i386/djgpp.h (STANDARD_INCLUDE_DIR): Define.
	  (MD_EXEC_PREFIX): Set to '/dev/env/DJDIR/bin/'.
	  (ASM_OUTPUT_SECTION_NAME): Add code attribute to sections containing
	  code.
	  (SUPPORTS_WEAK, SUPPORTS_ONE_ONLY): Default to true.
	  (SUBTARGET_SWITCHES): Adjust.

config/Changelog:

2000-07-17  Mark Elbrecht  <snowball3@bigfoot.com>

	* mh-djgpp: Conditionally set 'target_alias' to djgpp. Conditionally
	  modify 'gcc_version'.

Index: gcc/gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcc.c,v
retrieving revision 1.153
diff -c -p -r1.153 gcc.c
*** gcc.c	2000/07/13 07:14:11	1.153
--- gcc.c	2000/07/17 15:52:27
*************** main (argc, argv)
*** 5098,5103 ****
--- 5098,5108 ----
      --p;
    programname = p;
  
+ #ifdef GCC_DRIVER_HOST_INITIALIZATION
+   /* Perform host dependant initialization when needed.  */
+   GCC_DRIVER_HOST_INITIALIZATION;
+ #endif
+ 
  #ifdef HAVE_LC_MESSAGES
    setlocale (LC_MESSAGES, "");
  #endif
Index: gcc/gcc/prefix.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/prefix.c,v
retrieving revision 1.24
diff -c -p -r1.24 prefix.c
*** prefix.c	2000/02/13 19:59:29	1.24
--- prefix.c	2000/07/17 15:52:33
*************** update_path (path, key)
*** 298,303 ****
--- 298,308 ----
  	path = translate_name (path);
      }
  
+ #ifdef UPDATE_PATH_HOST_CANONICALIZE
+ /* Perform host dependant canonicalization when needed.  */
+ UPDATE_PATH_HOST_CANONICALIZE (path, key);
+ #endif
+ 
  #ifdef DIR_SEPARATOR_2
    /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
    if (DIR_SEPARATOR != DIR_SEPARATOR_2)
Index: gcc/config/mh-djgpp
===================================================================
RCS file: /cvs/gcc/egcs/config/mh-djgpp,v
retrieving revision 1.2
diff -c -p -r1.2 mh-djgpp
*** mh-djgpp	1999/09/04 15:08:48	1.2
--- mh-djgpp	2000/07/17 15:52:42
***************
*** 2,4 ****
--- 2,19 ----
  # this requires that we set CFLAGS.
  # This used to set -fno-omit-frame-pointer.
  CFLAGS=-O2
+ 
+ # Shorten the target alias so when it is used to set 'libsubdir'
+ # the name will work in both short and long filename environments.
+ ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp)
+ target_alias=djgpp
+ endif
+ 
+ # The version string must be modified to contain just one dot
+ # because DOS filenames can only have one dot when long filenames
+ # are not available.
+ __version:=$(gcc_version)
+ __version:=$(subst ., ,$(__version))
+ ifeq ($(words $(__version)),3)
+ gcc_version=$(word 1,$(__version)).$(word 2,$(__version))$(word 3,$(__version))
+ endif
Index: gcc/gcc/config/i386/xm-djgpp.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/xm-djgpp.h,v
retrieving revision 1.7
diff -c -p -r1.7 xm-djgpp.h
*** xm-djgpp.h	2000/05/11 06:18:26	1.7
--- xm-djgpp.h	2000/07/17 15:52:57
*************** Boston, MA 02111-1307, USA.  */
*** 54,56 ****
--- 54,113 ----
        strcat (xref_file, xref_ext); \
    } while (0)
  
+ /* Change /dev/env/DJDIR/prefix/dir/ to canonical form so gcc_exec_prefix
+    is set properly in 'gcc.c'. It also helps to cut down the number of times
+    the value of the DJGPP environment variable 'DJDIR' is evaluated.  */
+ #undef GCC_DRIVER_HOST_INITIALIZATION
+ #define GCC_DRIVER_HOST_INITIALIZATION \
+   do { \
+     /* If the environment variable DJDIR is not defined, then DJGPP is not \
+        installed correctly and GCC will quickly become confused with the \
+        default prefix settings. Report the problem now so the user doesn't \
+        receive deceptive "file not found" error messages later.  */ \
+     char *djdir = getenv ("DJDIR"); \
+     if (djdir == NULL) \
+       { \
+         /* DJDIR is automatically defined by the DJGPP environment config \
+            file pointed to by the environment variable DJGPP. Examine DJGPP \
+            to try and figure out what's wrong.  */ \
+         char *djgpp = getenv ("DJGPP"); \
+         if (djgpp == NULL) \
+           fatal ("Environment variable DJGPP not defined."); \
+         else if (access (djgpp, R_OK) == 0) \
+           fatal ("Environment variable DJGPP points to missing file '%s'.", \
+                  djgpp); \
+         else \
+           fatal ("Environment variable DJGPP points to corrupt file '%s'.", \
+                   djgpp); \
+       } \
+     standard_exec_prefix = update_path (standard_exec_prefix, NULL); \
+     standard_bindir_prefix = update_path (standard_bindir_prefix, NULL); \
+     standard_startfile_prefix = update_path (standard_startfile_prefix, NULL); \
+     md_exec_prefix = update_path (md_exec_prefix, NULL); \
+   } while (0)
+ 
+ /* Canonicalize paths containing '/dev/env/', especially those in
+    prefix.c.  */
+ #define UPDATE_PATH_HOST_CANONICALIZE(PATH, KEY) \
+   do { \
+     if (strncmp (PATH, "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
+       { \
+         static char *djdir; \
+         static int djdir_len; \
+         static char fixed_path[FILENAME_MAX + 1]; \
+         char *new_path; \
+         /* The default prefixes all use '/dev/env/DJDIR', so optimize \
+            for this. All other uses of '/dev/env/' go through \
+            libc's canonicalization function.  */ \
+         _fixpath (PATH, fixed_path); \
+         /* _fixpath removes any trailing '/', so add it back.  */ \
+         strcat (fixed_path, "/"); \
+         new_path = xstrdup (fixed_path); \
+         PATH = new_path; \
+         return PATH; \
+       } \
+     /* If DIR_SEPARATOR_2 isn't in PATH, nothing more need be done.  */ \
+     if (strchr (PATH, DIR_SEPARATOR_2) == NULL) \
+       return PATH; \
+   } while (0)
+ 
Index: gcc/gcc/config/i386/djgpp.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/djgpp.h,v
retrieving revision 1.15
diff -c -p -r1.15 djgpp.h
*** djgpp.h	2000/06/27 02:26:20	1.15
--- djgpp.h	2000/07/17 15:53:05
*************** along with GNU CC; see the file COPYING.
*** 18,24 ****
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
- 
  #include "dbxcoff.h"
  
  /* Don't assume anything about the header files. */
--- 18,23 ----
*************** Boston, MA 02111-1307, USA.  */
*** 76,83 ****
  #undef TEXT_SECTION_ASM_OP
  #define TEXT_SECTION_ASM_OP "\t.section .text"
  
  /* 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) \
--- 75,86 ----
  #undef TEXT_SECTION_ASM_OP
  #define TEXT_SECTION_ASM_OP "\t.section .text"
  
+ /* Tell GCC where our standard include directory is.  */
+ #undef STANDARD_INCLUDE_DIR
+ #define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/"
+ 
  /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
! #define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
  
  /* Correctly handle absolute filename detection in cp/xref.c */
  #define FILE_NAME_ABSOLUTE_P(NAME) \
*************** dtor_section ()							\
*** 161,170 ****
      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)	\
--- 164,176 ----
      fprintf (FILE, "\n");			\
    } while (0)
  
! /* Tell GCC how to output a section name. Add "x" for code sections.  */
  #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\
!   do {									\
!     if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)			\
!       fprintf ((FILE), "\t.section %s,\"x\"\n", (NAME));		\
!     else								\
!       fprintf ((FILE), "\t.section %s\n", (NAME));			\
    } while (0)
  
  #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)	\
*************** dtor_section ()							\
*** 222,237 ****
  
  #undef SUBTARGET_SWITCHES
  #define SUBTARGET_SWITCHES 		\
!   { "bnu210", MASK_BNU210, N_("Enable weak symbol and enhanced C++ template support. Binutils 2.9.5.1 or higher required.") }, \
!   { "no-bnu210", -MASK_BNU210, N_("Disable weak symbol and enhanced C++ template support.") },
  
! /* Weak symbols and .gnu.linkonce are only in the binutils snapshots
!    and binutils-2.10.  So do it only when -mbnu210 is specified.  */
  #undef SUPPORTS_WEAK
! #define SUPPORTS_WEAK (target_flags & MASK_BNU210)
  
  #undef SUPPORTS_ONE_ONLY
! #define SUPPORTS_ONE_ONLY (target_flags & MASK_BNU210)
  
  /* Support for C++ templates.  */
  #undef MAKE_DECL_ONE_ONLY
--- 228,243 ----
  
  #undef SUBTARGET_SWITCHES
  #define SUBTARGET_SWITCHES 		\
!   { "bnu210", -MASK_BNU210, "Enable weak symbol and enhanced C++ template support. Binutils 2.10 or higher required." }, \
!   { "no-bnu210", MASK_BNU210, "Disable weak symbol and enhanced C++ template support." },
  
! /* Weak symbols and .gnu.linkonce are only in Binutils-2.10 and later. 
!    Default to using Binutils 2.10 features.  */
  #undef SUPPORTS_WEAK
! #define SUPPORTS_WEAK ((target_flags & MASK_BNU210) == 0)
  
  #undef SUPPORTS_ONE_ONLY
! #define SUPPORTS_ONE_ONLY ((target_flags & MASK_BNU210) == 0)
  
  /* Support for C++ templates.  */
  #undef MAKE_DECL_ONE_ONLY
Index: gcc/gcc/config/i386/x-djgpp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/x-djgpp,v
retrieving revision 1.2
diff -c -p -r1.2 x-djgpp
*** x-djgpp	1999/09/04 15:08:57	1.2
--- x-djgpp	2000/07/17 15:53:13
***************
*** 1,22 ****
! # translate the version string, so it can be used on DJGPP, where only
! # one dot in filename is allowed
! 
! # to avoid recursion when redefining $(version)
! _version:=$(version)
! __version=$(subst ., ,$(_version))
! version=$(word 1,$(__version))$(word 2,$(__version)).$(word 3,$(__version))
! 
  SYSTEM_HEADER_DIR=$(DJDIR)/include
- X_CPPFLAGS=-DSTANDARD_INCLUDE_DIR=\"\$$DJDIR/include\" \
- 	   -DSTANDARD_INCLUDE_COMPONENT=\"\"
- 
- # when building a native compiler for DJGPP, make the target_alias
- # a shorter name, since otherwise it will produce some problems, when
- # using the same gcc once with long filenames and once with short (8+3)
- # filenames
- ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp)
- target_alias=djgpp
- endif
  
  # on DJGPP the 'ln -s' does not work correctly
  LN = cp -p
--- 1,5 ----
! # Location of DJGPP's header directory.
  SYSTEM_HEADER_DIR=$(DJDIR)/include
  
  # on DJGPP the 'ln -s' does not work correctly
  LN = cp -p


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]