Commit c49d2df6 by Jakub Jelinek Committed by Jakub Jelinek

gcc.c (set_multilib_dir): Don't access *end.

	* gcc.c (set_multilib_dir): Don't access *end.
	Use memcpy instead of strncpy.  Don't write beyond malloced buffer.
	(print_multilib_info): Don't show paths starting with ".:".
	* genmultilib: Add new option, "yes" if multilibs are enabled.
	Update comments.  If multilibs not enabled, print .:${osdirout}
	for each directory.  If multilibs are enabled, always print
	${dirout}:${osdirout}, even if the two are the same.
	* Makefile.in (s-mlib): Pass @enable_multilib@ to genmultilib.
	Pass all MULTILIB_* variables to genmultilib even if
	--disable-multilib but MULTILIB_OSDIRNAMES is not empty.

From-SVN: r57846
parent d758c1db
2002-10-05 Jakub Jelinek <jakub@redhat.com>
* gcc.c (set_multilib_dir): Don't access *end.
Use memcpy instead of strncpy. Don't write beyond malloced buffer.
(print_multilib_info): Don't show paths starting with ".:".
* genmultilib: Add new option, "yes" if multilibs are enabled.
Update comments. If multilibs not enabled, print .:${osdirout}
for each directory. If multilibs are enabled, always print
${dirout}:${osdirout}, even if the two are the same.
* Makefile.in (s-mlib): Pass @enable_multilib@ to genmultilib.
Pass all MULTILIB_* variables to genmultilib even if
--disable-multilib but MULTILIB_OSDIRNAMES is not empty.
2002-10-04 Bruce Korb <bkorb@gnu.org> 2002-10-04 Bruce Korb <bkorb@gnu.org>
* fixinc/inclhack.def(hpux11_abs): use format fix * fixinc/inclhack.def(hpux11_abs): use format fix
......
...@@ -1061,7 +1061,8 @@ libgcc.a: $(LIBGCC_DEPS) ...@@ -1061,7 +1061,8 @@ libgcc.a: $(LIBGCC_DEPS)
# switches. # switches.
multilib.h: s-mlib; @true multilib.h: s-mlib; @true
s-mlib: $(srcdir)/genmultilib Makefile s-mlib: $(srcdir)/genmultilib Makefile
if test @enable_multilib@ = yes; then \ if test @enable_multilib@ = yes \
|| test -n "$(MULTILIB_OSDIRNAMES)"; then \
$(SHELL) $(srcdir)/genmultilib \ $(SHELL) $(srcdir)/genmultilib \
"$(MULTILIB_OPTIONS)" \ "$(MULTILIB_OPTIONS)" \
"$(MULTILIB_DIRNAMES)" \ "$(MULTILIB_DIRNAMES)" \
...@@ -1070,9 +1071,11 @@ s-mlib: $(srcdir)/genmultilib Makefile ...@@ -1070,9 +1071,11 @@ s-mlib: $(srcdir)/genmultilib Makefile
"$(MULTILIB_EXTRA_OPTS)" \ "$(MULTILIB_EXTRA_OPTS)" \
"$(MULTILIB_EXCLUSIONS)" \ "$(MULTILIB_EXCLUSIONS)" \
"$(MULTILIB_OSDIRNAMES)" \ "$(MULTILIB_OSDIRNAMES)" \
"@enable_multilib@" \
> tmp-mlib.h; \ > tmp-mlib.h; \
else \ else \
$(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' > tmp-mlib.h; \ $(SHELL) $(srcdir)/genmultilib '' '' '' '' '' '' '' no \
> tmp-mlib.h; \
fi fi
$(SHELL) $(srcdir)/move-if-change tmp-mlib.h multilib.h $(SHELL) $(srcdir)/move-if-change tmp-mlib.h multilib.h
$(STAMP) s-mlib $(STAMP) s-mlib
......
...@@ -6926,11 +6926,11 @@ set_multilib_dir () ...@@ -6926,11 +6926,11 @@ set_multilib_dir ()
while (q < end && *q != ':') while (q < end && *q != ':')
q++; q++;
if (*q == ':') if (q < end)
{ {
char *new_multilib_os_dir = xmalloc (end - q); char *new_multilib_os_dir = xmalloc (end - q);
strncpy (new_multilib_os_dir, q + 1, end - q - 1); memcpy (new_multilib_os_dir, q + 1, end - q - 1);
new_multilib_os_dir[end - q] = '\0'; new_multilib_os_dir[end - q - 1] = '\0';
multilib_os_dir = new_multilib_os_dir; multilib_os_dir = new_multilib_os_dir;
break; break;
} }
...@@ -6986,6 +6986,12 @@ print_multilib_info () ...@@ -6986,6 +6986,12 @@ print_multilib_info ()
++p; ++p;
} }
/* When --disable-multilib was used but target defines
MULTILIB_OSDIRNAMES, entries starting with .: are there just
to find multilib_os_dir, so skip them from output. */
if (this_path[0] == '.' && this_path[1] == ':')
skip = 1;
/* Check for matches with the multilib_exclusions. We don't bother /* Check for matches with the multilib_exclusions. We don't bother
with the '!' in either list. If any of the exclusion rules match with the '!' in either list. If any of the exclusion rules match
all of its options with the select rule, we skip it. */ all of its options with the select rule, we skip it. */
......
...@@ -68,6 +68,9 @@ ...@@ -68,6 +68,9 @@
# The difference is that second argument describes multilib directories # The difference is that second argument describes multilib directories
# in GCC conventions, while this one the OS multilib convention. # in GCC conventions, while this one the OS multilib convention.
# The last option should be "yes" if multilibs are enabled. If it is not
# "yes", all GCC multilib dir names will be ".".
# The output looks like # The output looks like
# #define MULTILIB_MATCHES "\ # #define MULTILIB_MATCHES "\
# SUBDIRECTORY OPTIONS;\ # SUBDIRECTORY OPTIONS;\
...@@ -85,7 +88,7 @@ ...@@ -85,7 +88,7 @@
# genmultilib 'm64/m32 mno-app-regs|mcmodel=medany' '64 32 alt' # genmultilib 'm64/m32 mno-app-regs|mcmodel=medany' '64 32 alt'
# 'mcmodel?medany=mcmodel?medmid' 'm32/mno-app-regs* m32/mcmodel=*' # 'mcmodel?medany=mcmodel?medmid' 'm32/mno-app-regs* m32/mcmodel=*'
# '' 'm32/!m64/mno-app-regs m32/!m64/mcmodel=medany' # '' 'm32/!m64/mno-app-regs m32/!m64/mcmodel=medany'
# '../lib64 ../lib32 alt' # '../lib64 ../lib32 alt' yes
# This produces: # This produces:
# ". !m64 !m32 !mno-app-regs !mcmodel=medany;", # ". !m64 !m32 !mno-app-regs !mcmodel=medany;",
# "64:../lib64 m64 !m32 !mno-app-regs !mcmodel=medany;", # "64:../lib64 m64 !m32 !mno-app-regs !mcmodel=medany;",
...@@ -113,6 +116,7 @@ exceptions=$4 ...@@ -113,6 +116,7 @@ exceptions=$4
extra=$5 extra=$5
exclusions=$6 exclusions=$6
osdirnames=$7 osdirnames=$7
enable_multilib=$8
echo "static const char *const multilib_raw[] = {" echo "static const char *const multilib_raw[] = {"
...@@ -292,9 +296,18 @@ for combo in ${combinations}; do ...@@ -292,9 +296,18 @@ for combo in ${combinations}; do
osdirout=`echo ${combo} | sed ${toosdirnames}` osdirout=`echo ${combo} | sed ${toosdirnames}`
# Remove the leading and trailing slashes. # Remove the leading and trailing slashes.
osdirout=`echo ${osdirout} | sed -e 's|^/||' -e 's|/$||g'` osdirout=`echo ${osdirout} | sed -e 's|^/||' -e 's|/$||g'`
if [ "x${dirout}" != "x${osdirout}" ]; then if [ "x${enable_multilib}" != xyes ]; then
dirout=".:${osdirout}"
else
dirout="${dirout}:${osdirout}" dirout="${dirout}:${osdirout}"
fi fi
else
if [ "x${enable_multilib}" != xyes ]; then
# genmultilib with --disable-multilib should be
# called with '' '' '' '' '' '' '' no
# if MULTILIB_OSDIRNAMES is empty.
exit 1
fi
fi fi
# Look through the options. We must output each option that is # Look through the options. We must output each option that is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment