This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
DJGPP related patch to gcc/config/i386/xm-djgpp.h
- To: gcc-patches at gcc dot gnu dot org
- Subject: DJGPP related patch to gcc/config/i386/xm-djgpp.h
- From: pavenis at lanet dot lv
- Date: Sat, 29 Sep 2001 16:52:18 +0300
Included patch fixes for gcc/config/i386/xm-djgpp.h (HEAD branch)
fixes 2 problems with DJGPP port of gcc:
1) updating md_exec_prefix in macro GCC_DRIVER_HOST_INITIALIZATION
causes md_exec_prefix be dumped to specs (gcc -dumpspecs) in
converted form (for example c:/djgpp/bin instead of initial
/dev/env/DJDIR/bin as it should be). Removing
corresponding line does not cause any harm, so I think it's safe
to remove it
2) freeing PATH in macro UPDATE_PATH_HOST_CANONICALIZE(PATH)
is not Ok as at least in some situations PATH points to string constants.
As the result I'm getting SIGSEGV there (not only for calls to
update_path from GCC_DRIVER_HOST_INITIALIZATION)
Andris
2001-09-29 Andris Pavenis <pavenis@lanet.lv>
* config/i386/xm-djgpp.h (GCC_DRIVER_HOST_INITIALIZATION): don't
update md_exec_prefix
(UPDATE_PATH_HOST_CANONICALIZE(PATH)): don't free PATH
as it can point to string constant
--- gcc/config/i386/xm-djgpp.h~2 Sat Sep 29 15:21:48 2001
+++ gcc/config/i386/xm-djgpp.h Sat Sep 29 15:54:42 2001
@@ -79,13 +79,13 @@
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/'; used in prefix.c.
_fixpath is a djgpp-specific function to canonicalize a path.
"/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
example. It removes any trailing '/', so add it back. */
+/* We cannot free PATH below as it can point to string constant */
#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
{ \
@@ -93,6 +93,5 @@
\
_fixpath ((PATH), fixed_path); \
strcat (fixed_path, "/"); \
- free (PATH); \
(PATH) = xstrdup (fixed_path); \
}