Hi Joseph, > On Tue, 25 Feb 2020, Lukasz Majewski wrote: > > > Lets consider for example __mq_timedsend_time64. > > > > With lib_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_hidden_proto/ lib_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_hidden_proto is only relevant for building glibc, with its > internal headers - not for programs built with glibc. It seems like not removing lib_hidden_proto/ lib_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_hidden_proto redirections (but even for internal tests, > lib_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_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_hidden_weak note you also need a corresponding > lib_hidden_proto, for the name of the weak alias. But you > probably don't need to have lib_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