- revert previous fix which altered sys/stat.h
- fix libgloss/cris/gensyscalls to undef st_atime, st_mtime,
and st_ctime macros which cannot be used with new_stat structure
It's been a while... I see the CRIS port broke with the
time_t-default-to-64-bit change, observable by a few test-cases in the
gcc fortran(!) tests failing, regressing when trying a recent newlib.
This is a two-part belt-and-suspenders change: adjust the CRIS port
gettimeofday syscall (the only one in newlib/CRIS passing a time_t or
struct timeval) to handle a userspace 64-bit time_t and secondly default
time_t to 32-bit long anyway. I considered making the local
"kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t
being 64 bits, but thought it not worth bothering with the few move insns.
The effect of a 64-bit time_t is however observable as longer simulation
time when running the gcc testsuite and as bigger binaries without any
actual upside from the larger time_t size, so I thought better make the
default for this port go back to being a "long" again.
Tested by running the gcc testsuite over the three combinations of two
parts of the patch and observing the expected changes. Committed.
libgloss:
Adjust for syscall and userspace having different time_t or timeval.
* cris/linunistd.h (kernel_time_t, kernel_suseconds_t, kernel_timeval):
New types.
(gettimeofday): Change the type of the first argument to be a
pointer to a struct kernel_timeval.
* cris/gensyscalls (_gettimeofday): Use an intermediate struct
kernel_timeval for the syscall and initialize the result from
that.
Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
After a binutils change "a while ago" (2015-12) to default to
--enable-initfini-array, i.e. to merge .ctors and .dtors into
.init_array and .fini_array, this is needed for cdtors to run at all.
Based on what goes on in arm/ and aarch64/. Tested for cris-elf by
running the gcc testsuite.
By the way, the configure test doesn't detect this change, so the
HAVE_INITFINI_ARRAY ifdeffery is somewhat redundant. Still, the
change is tested to be safe with older binutils too.
libgloss/
* cris/crt0.S, cris/lcrt0.c: Include newlib.h.
[HAVE_INITFINI_ARRAY] (_init): Define to __libc_init_array.
[HAVE_INITFINI_ARRAY] (_fini): Ditto __libc_fini_array.
"setf", not "nop", for common_v10_v32 compatibility.
Move out interrupt table to irqtable.S. Include here for non-ELF.
* cris/irqtable.S: Extracted from cris/crt0.S. Provide per-entry
weak default stub definitions.
* cris/crtn.c: Use "setf", not "nop", for common_v10_v32
compatibility.
* cris/setup.S [__arch_common_v10_v32]: Return.
* cris/Makefile.in (BSP_OBJS): Add irqtable.o.
(ALL_INSTALL_FILES_NEWLIB_COPY): New macro.
(all): Use ALL_INSTALL_FILES instead of its contents. Add
ALL_INSTALL_FILES_NEWLIB_COPY.
($(objroot)/newlib/%, $(objroot)/newlib/libnosys.a): New rules