Re: switching ARC to 64-bit time_t (Re: [RFC v6 07/23] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64)

Lukasz Majewski
2020-02-26T13:19:06Z

[-- Attachment #1.1: Type: text/plain, Size: 4020 bytes --]

Hi Joseph,

> On Tue, 25 Feb 2020, Lukasz Majewski wrote:
>
> > Lets consider for example __mq_timedsend_time64.
> >
> > With lib<name>_hidden_def/proto kept (NOT removed as in [1]):
> > GDB:
> > __GI___mq_timedsend_time64 [*]
> >
> > (No build errors, linking with test setup works as expected).
>
> What is the actual testcase, and the exact command line used to
> compile it?

The test case is a separate program [1] compiled with [2] (the
test_y2038 make target)

The glibc under test is installed on rootfs run by QEMU for ARM.

The lack of redirection, when I keep lib<name>_hidden_proto/
lib<name>_hidden_def for __mq_timedsend_time64, is seen when I debug
with GDB the 'test_y2038' program.

The glibc compiles correctly.

>
> _TIME_BITS=64 redirection is only relevant for programs built with
> glibc, using the installed headers - not for building glibc itself.
>
> lib<name>_hidden_proto is only relevant for building glibc, with its
> internal headers - not for programs built with glibc.

It seems like not removing lib<name>_hidden_proto/ lib<name>_hidden_def
for __mq_timedsend_time64 in glibc sources prevents the redirection on
installed glibc / headers when 'test_y2038' program is run.

>
> If you're talking about a glibc testcase, such tests should be in
> tests not tests-internal, so _ISOMAC is defined when they are built,
> so the glibc internal headers just wrap the public ones without
> defining anything else. In particular, the asm redirections from
> public headers should be in effect when tests are compiled, but not
> the lib<name>_hidden_proto redirections (but even for internal tests,
> lib<name>_hidden_proto shouldn't do anything because the build
> process knows they are tests not part of libc).

Unfortunately, mine Y2038 tests are a set of compiled programs (it is a
'legacy' code) and have nothing in common with glibc test suite.

The workflow is as follows (standard Yocto/OE):

1. Built the glibc and prepare "package" for other recipes.

2. For tests get the glibc "package" as a prerequisite. Use its
exported headers and libraries to build tests. Prepare test "package"

3. Install both above packages to rootfs

4. Run the rootfs with QEMU.

>
> You should look at the preprocessed source from building the test
> with -save-temps and find out why the asm redirection from the public
> header isn't being effective (or if it is effective in the .o file
> for the test, look at what happens afterwards in glibc). Since
> lib<name>_hidden_proto should not be called in the parts of headers
> included when building a test, its presence or absence should have no
> effect on the preprocessed source of the test.

Ok. I will dig the object files and generated temp files.

>
> > hidden_def (__mq_timedsend)
> > weak_alias (__mq_timedsend, mq_timedsend) [**]
> > hidden_weak (mq_timedsend)
>
> If you have lib<name>_hidden_weak note you also need a corresponding
> lib<name>_hidden_proto, for the name of the weak alias. But you
> probably don't need to have lib<name>_hidden* for the weak alias at
> all, just make sure internal calls use the internal name.

As fair as I can tell the weak_alias () is necessary for correct
operation of mq_timedsend when external programs call it.

Glibc internally defines __mq_timedsend (also for archs with
__WORDSIZE==64), but it exports mq_timedsend (and user space programs
call it). One needs an alias (at least a weak one) between mq_timedsend
and __mq_timedsend{_time}. Am I correct?

>

Links:

[1] -
https://github.com/lmajewski/y2038-tests/blob/master/test_mq_timedsend.c#L25

[2] - https://github.com/lmajewski/y2038-tests/blob/master/Makefile

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]