------- 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 <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] 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  <[EMAIL PROTECTED]>     * 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