[Bug other/25035] [4.1/4.2 regression] libssp causes a failure with cross compilers
bjoern dot m dot haase at web dot de
gcc-bugzilla@gcc.gnu.org
Mon May 15 17:25:00 GMT 2006
------- Comment #7 from bjoern dot m dot haase at web dot de 2006-05-15 17:25 -------
Subject: Re: [4.1/4.2 regression] libssp causes a failure with cross compilers
mmitchel at gcc dot gnu dot org wrote on Montag, 15. Mai 2006 00:26 :
> ------- Comment #6 from mmitchel at gcc dot gnu dot org 2006-05-14 22:26
> ------- Where is the patch referenced in Comment #3?
Here it is. It seems that Bugzilla does not permit me to add more comments.
Bjoern.
PATCH: libssp, fix AVR bootstrap failure for gcc
From:
Björn Haase <bjoern.m.haase@web.de>
To:
gcc-patches@gcc.gnu.org
Date:
30.12.2005 04:01
The code in
/libssp/ssp.c
implicitly assumes that the define symbols O_RDONLY and O_WRONLY exist. For
the AVR target those are not defined in the header files included by ssp.c.
Also the code does not work as expected for embedded targets that do not have
"files" with the usual meaning.
All of this causes a bootstrap failure for the AVR target.
The patch adds #ifdefs as guards that first check for existing definitions of
O_RDONLY and O_WRONLY before actually using them.
After applying this change, bootstrap again succeeds.
Bjoern.
2005-12-30 ÃÂ Bjoern Haase ÃÂ <bjoern.m.haase@web.de>
ÃÂ ÃÂ ÃÂ ÃÂ * ssp.c: add "#ifdef" protections for symbols O_RDONLY and O_WRONLY
Index: ssp.c
===================================================================
--- ssp.cÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ (revision 109170)
+++ ssp.cÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ (working copy)
@@ -67,6 +67,8 @@
ÃÂ ÃÂ if (__stack_chk_guard != 0)
ÃÂ ÃÂ ÃÂ return;
ÃÂ
+#ifdef O_RDONLY
+
ÃÂ ÃÂ fd = open ("/dev/urandom", O_RDONLY);
ÃÂ ÃÂ if (fd != -1)
ÃÂ ÃÂ ÃÂ {
@@ -77,6 +79,8 @@
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ return;
ÃÂ ÃÂ ÃÂ }
ÃÂ
+#endif
+
ÃÂ ÃÂ /* If a random generator can't be used, the protector switches the guard
ÃÂ ÃÂ ÃÂ to the "terminator canary". ÃÂ */
ÃÂ ÃÂ p = (unsigned char *) &__stack_chk_guard;
@@ -97,6 +101,8 @@
ÃÂ
ÃÂ ÃÂ /* Print error message directly to the tty. ÃÂ This avoids Bad Things
ÃÂ ÃÂ ÃÂ happening if stderr is redirected. ÃÂ */
+
+#ifdef O_WRONLY
ÃÂ ÃÂ fd = open (_PATH_TTY, O_WRONLY);
ÃÂ ÃÂ if (fd != -1)
ÃÂ ÃÂ ÃÂ {
@@ -124,6 +130,7 @@
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ }
ÃÂ ÃÂ ÃÂ ÃÂ close (fd);
ÃÂ ÃÂ ÃÂ }
+#endif
ÃÂ
ÃÂ #ifdef HAVE_SYSLOG_H
ÃÂ ÃÂ /* Only send the error to syslog if there was no tty available. ÃÂ */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25035
More information about the Gcc-bugs
mailing list