[OE-core] eglibc: powerpc time related syscall malfunction

Mats Kärrman Mats.Karrman at tritech.se
Wed Mar 26 16:10:06 UTC 2014


Hi,

The system is an OE-Core Dora "distro-less" build for a 32-bit PowerPC MPC5125.
Tune file used is tune-ppce300c3.inc.
eglibc version 2.18, gcc 4.8.1, binutils 2.23.2 (Dora defaults).

The symptom that made me discover the problem was that some programs could not
get the correct system time while others could. The failing ones often got the same
"insane" time value every time a specific printout was triggered but different printouts
got different time values (i.e. probably uninitialized stack variables). E.g.:

"date" (busybox) works.
"logger" (same busybox binary) does not.
Neither does the pppd (syslog too).
File access dates are OK.
A proprietary program using ftime() is not working.
A little test program (see below) gets the correct time when using time() but not
when using ftime().

The same HW with SW built on OE-classic 2011.03 does not have this error.
Dora on i.MX6 also works OK.

I tried different kernels (3.2 and 3.12), and different tunings (hard-float, soft-float, etc.)
but the behavior is the same.

Tried using strace and found that on the old OE-classic and on i.MX6 I got trace
logs for the syscalls to time (OE-classic) or gettimeofday (i.MX6) but for the
new system there are no time related calls traced at all, not when it works
and not when it fails...

Then I tried with gdb. The paths taken by the program depends a lot on the
machine tuning options used when building the image and SDK but I believe I
have found a common pattern:
When it works, a time function invoking a syscall, e.g. __kernel_time, is called
but when it doesn't work, instead a "gnu_indirect_function" is called, returning
a pointer to either a vdso or a local function but after that the function isn't
called. As I understand it, this should happen through as/ld magic but for some
reason it doesn't.

Grep'ing for gnu_indirect_function I find it's used mostly for multiarch
configurations, should it really be used here? Could it be that configure/build
does not properly recognize the machine?

I'm a bit off turf here so if any one with more insight/knowledge in eglibc and
the use of indirect functions could give me a few pointers I would really
appreciate that!

BR // Mats

timetest.c:
----------------------------------------------------------------------------------------
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>

int main(int argc, char *argv[])
{
	time_t now;
	struct timeb tim;

	(void)argc;
	(void)argv;

	(void)time(&now);
	printf("time=%d\n", (int)now);

	(void)ftime( &tim );
	printf("ftime=%d\n", (int)tim.time);

	return 0;
}
----------------------------------------------------------------------------------------



More information about the Openembedded-core mailing list