This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [4.1+ PATCH, libiberty]: Fix bootstrap failure for newlib targets


Uros Bizjak <ubizjak@gmail.com> writes:

> gcc-4.1 bootstrap fails for newlib targets with following error:
> 
> /export/home/uros/or32-gcc-4.1/./gcc/xgcc
> -B/export/home/uros/or32-gcc-4.1/./gcc/ -B/usr/local/or32-elf/bin/
> -B/usr/local/or32-elf/lib/ -isystem /usr/local/or32-elf/include
> -isystem /usr/local/or32-elf/sys-include -c -DHAVE_CONFIG_H -O2 -g -O2
>  -I. -I../../../gcc-svn/branches/gcc-4_1-branch/libiberty/../include 
> -W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes
> ../../../gcc-svn/branches/gcc-4_1-branch/libiberty/gettimeofday.c -o
> gettimeofday.o
> ../../../gcc-svn/branches/gcc-4_1-branch/libiberty/gettimeofday.c:23:
> error: conflicting types for ÃgettimeofdayÃ
> /usr/local/or32-elf/include/sys/time.h:73: error: previous declaration
> of Ãgettimeofdayà was here

> The problem is in wrong gettimeofday function declaration in
> libiberty/gettimeofday.c:
> int gettimeofday (struct timeval *tp, void *tz)
> 
> To fix the failure, this function should be declared as:
> int gettimeofday (struct timeval *tp, struct timezone *tz)
> 
> Attached pach fixes bootstrap for me. It also fixes a warning about
> implicit declaration of abort() by including stdlib.h.

Thanks, but the system should not be compiling gettimeofday.c at all
if it is provided by libraries.  The right way to fix this is to
change configure.ac so that gettimeofday.c is not built on systems
which do not require it to be built.  In particular, there is no
reason to assume that 'struct timezone' is defined, so your proposed
patch will not always work.

Since it unfortunately appears that some newlib targets provide
gettimeofday and some do not, I think what we may need to do here is
write a configure test for whether struct timezone is declared in the
sys/time.h header file.  If it is, we should use it in gettimeofday.c;
if it is not, we should use void*.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]