This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: time(2) missing for target i386-elf (corrected)


Hmm, the libc/time/time.c code checks for the existence of HAVE_GETTIMEOFDAY flag and if not present, it doesn't compile the entire time function. The time function is ANSI and ifdefing it out is wrong. It also doesn't make sense to check for the syscall before calling it as it is one of the basic syscalls (stubbed in libnosys to return -1). I will fix this. In your case, you will see time() return -1 when libnosys provides the syscall.

-- Jeff J.

John D. Ramsdell wrote:
[The previous version of the note was sent in error and before
editing.]

I used the latest newlib along with binutils and gcc to build a
cross-compiler with a target of i386-elf.  This compiler was used to
compile Lua <http://www.lua.org>, with the aim of placing it inside an
operating system that consists only of a Lua intrepreter inside a
small kernel.  When I linked Lua with libm, libc, and libnosys, there
was still one undefined symbol, time.  The Lua authors claim time(2)
is part of ANSI C, however my GNU/Linux manual page says it conforms
to SVr4, SVID, POSIX, X/OPEN, BSD 4.3.  In any event, is there a
reason time(2) is not part of the newlib C library?  If the reason is
simply no one has submitted a patch that adds this functionality, I'll
gladly supply the code.

John


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