From 93284395b02210f59118783ba162e4544061751c Mon Sep 17 00:00:00 2001 From: Mark Elbrecht Date: Fri, 4 Aug 2000 16:19:19 +0000 Subject: [PATCH] x-djgpp: Delete code that conditionally modifies target_alias. * i386/x-djgpp: Delete code that conditionally modifies target_alias. Delete code that conditionally modifies 'version'. Delete X_CPPFLAGS. Add comment for SYSTEM_HEADER_DIR. * 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. * 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. (WCHAR_UNSIGNED, WCHAR_TYPE_SIZE, WCHAR_TYPE): Undefine before defining. (WINT_TYPE, SIZE_TYPE, PTRDIFF_TYPE): Define. From-SVN: r35484 --- gcc/ChangeLog | 19 +++++++++++++ gcc/config/i386/djgpp.h | 46 +++++++++++++++++++++--------- gcc/config/i386/x-djgpp | 19 +------------ gcc/config/i386/xm-djgpp.h | 57 ++++++++++++++++++++++++++++++++++++++ gcc/gcc.c | 5 ++++ gcc/prefix.c | 5 ++++ 6 files changed, 120 insertions(+), 31 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44d151a5262..2437da28ef1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2000-07-17 Mark Elbrecht + + * i386/x-djgpp: Delete code that conditionally modifies target_alias. + Delete code that conditionally modifies 'version'. + Delete X_CPPFLAGS. Add comment for SYSTEM_HEADER_DIR. + * 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. + * 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. + (WCHAR_UNSIGNED, WCHAR_TYPE_SIZE, WCHAR_TYPE): Undefine before + defining. + (WINT_TYPE, SIZE_TYPE, PTRDIFF_TYPE): Define. + 2000-08-04 Joseph S. Myers * c-common.h (flag_isoc94): Declare. diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h index 21c66cc39fb..e18db775637 100644 --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -18,7 +18,6 @@ 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. */ - #include "dbxcoff.h" /* Don't assume anything about the header files. */ @@ -76,8 +75,12 @@ Boston, MA 02111-1307, USA. */ #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 "$DJDIR/bin/" +#define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/" /* Correctly handle absolute filename detection in cp/xref.c */ #define FILE_NAME_ABSOLUTE_P(NAME) \ @@ -161,10 +164,13 @@ dtor_section () \ fprintf (FILE, "\n"); \ } while (0) -/* Allow (eg) __attribute__((section "locked")) to work */ +/* Tell GCC how to output a section name. Add "x" for code sections. */ #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC)\ - do { \ - fprintf (FILE, "\t.section %s\n", NAME); \ + 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) \ @@ -207,12 +213,26 @@ dtor_section () \ in libgcc, nor call one in main(). */ #define HAS_INIT_SECTION -/* Definitions to set wchar_t type to 'unsigned short int' to help out - add-on Windows compilers for DJGPP. */ +/* Definitions for types and sizes. Wide characters are 16-bits long so + Win32 compiler add-ons will be wide character compatible. */ +#undef WCHAR_UNSIGNED #define WCHAR_UNSIGNED 1 + +#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" + /* Used to be defined in xm-djgpp.h, but moved here for cross-compilers. */ #define LIBSTDCXX "-lstdcxx" @@ -222,16 +242,16 @@ dtor_section () \ #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.") }, + { "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 the binutils snapshots - and binutils-2.10. So do it only when -mbnu210 is specified. */ +/* 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) +#define SUPPORTS_WEAK ((target_flags & MASK_BNU210) == 0) #undef SUPPORTS_ONE_ONLY -#define SUPPORTS_ONE_ONLY (target_flags & MASK_BNU210) +#define SUPPORTS_ONE_ONLY ((target_flags & MASK_BNU210) == 0) /* Support for C++ templates. */ #undef MAKE_DECL_ONE_ONLY diff --git a/gcc/config/i386/x-djgpp b/gcc/config/i386/x-djgpp index 89f31ff5008..a49a51cda0f 100644 --- a/gcc/config/i386/x-djgpp +++ b/gcc/config/i386/x-djgpp @@ -1,22 +1,5 @@ -# 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)) - +# Location of DJGPP's header directory. 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 diff --git a/gcc/config/i386/xm-djgpp.h b/gcc/config/i386/xm-djgpp.h index e0c2bb5145d..f9932589214 100644 --- a/gcc/config/i386/xm-djgpp.h +++ b/gcc/config/i386/xm-djgpp.h @@ -54,3 +54,60 @@ Boston, MA 02111-1307, USA. */ 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) + diff --git a/gcc/gcc.c b/gcc/gcc.c index 57c75da14df..50c49ea7e85 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -5110,6 +5110,11 @@ main (argc, argv) --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 diff --git a/gcc/prefix.c b/gcc/prefix.c index a7336e0395d..1c98271b187 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -298,6 +298,11 @@ update_path (path, key) 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) -- 2.30.2