How do you build a canonical 64-bit time_t i686 build today?
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Jan 19 12:48:36 GMT 2022
On 14/01/2022 18:41, Carlos O'Donell wrote:
> Adhemerval,
>
> Recently I tried to build what I remembered being the canoncial
> 64-bit time_t and 64-bit file offset i686 build, but it failed
> like this on Fedora 35 with gcc 11:
>
> gcc -m32 -Wl,--build-id=none -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 init-first.c -c -std=gnu11 -fgnu89-inline -g -O2 -march=i686 -Wl,--build-id=none -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wstrict-prototypes -Wold-style-definition -fmath-errno -fPIC -fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0 -Wa,-mtune=i686 -fcf-protection -ftls-model=initial-exec -g -O2 -march=i686 -Wl,--build-id=none -I../include -I/home/carlos/build/glibc-review-i686/csu -I/home/carlos/build/glibc-review-i686 -I../sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/i386/i686/nptl -I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/x86/include -I../sysdeps/unix/sysv/linux/x86 -I../sysdeps/x86/nptl -I../sysdeps/i386/nptl -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu/multiarch -I../sysdeps/i386/i686/fpu -I../sysdeps/i386/i686/multiarch -I../sysdeps/i386/i686 -I../sysdeps/i386/fpu -I../sysdeps/x86/fpu -I../sysdeps/i386 -I../sysdeps/x86/include -I../sysdeps/x86 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/float128 -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/11/include -isystem /home/carlos/build/glibc-headers-review-i686/include -D_LIBC_REENTRANT -include /home/carlos/build/glibc-review-i686/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -DPIC -DSHARED -DTOP_NAMESPACE=glibc -o /home/carlos/build/glibc-review-i686/csu/init-first.os -MD -MP -MF /home/carlos/build/glibc-review-i686/csu/init-first.os.dt -MT /home/carlos/build/glibc-review-i686/csu/init-first.os
> In file included from ../sysdeps/nptl/pthread.h:23,
> from ../include/pthread.h:1,
> from ../sysdeps/unix/sysv/linux/x86/elision-conf.h:21,
> from ../sysdeps/nptl/lowlevellock.h:23,
> from ../nptl/descr.h:28,
> from ../sysdeps/i386/nptl/tls.h:114,
> from ../sysdeps/i386/i686/nptl/tls.h:32,
> from ../sysdeps/unix/sysv/linux/i386/sysdep.h:26,
> from init-first.c:23:
> ../include/time.h:21:1: error: ‘asm’ declaration ignored due to conflict with previous rename [-Werror=pragmas]
> 21 | libc_hidden_proto (mktime)
> | ^~~~~~~~~~~~~~~~~
> ../include/time.h:22:1: error: ‘asm’ declaration ignored due to conflict with previous rename [-Werror=pragmas]
> 22 | libc_hidden_proto (timelocal)
> | ^~~~~~~~~~~~~~~~~
> ../include/time.h:23:1: error: ‘asm’ declaration ignored due to conflict with previous rename [-Werror=pragmas]
> 23 | libc_hidden_proto (localtime)
> | ^~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[2]: *** [../o-iterator.mk:9: /home/carlos/build/glibc-review-i686/csu/init-first.os] Error 1
> make[2]: Leaving directory '/home/carlos/src/glibc-review/csu'
> make[1]: *** [Makefile:483: csu/subdir_lib] Error 2
> make[1]: Leaving directory '/home/carlos/src/glibc-review'
> make: *** [Makefile:9: all] Error 2
>
> I added -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 to my CC and CXX because
> they are ABI-affecting options that I don't want to be purged from other
> options I pass down to the build.
>
> What is the canonical way to do this build for testing?
>
> Should we have a build-many-glibc's option for this configuration?
>
I already answered you on the weekly call, but I think it is worth to register
it on the maillist as well. The 64-bit time support is similar to LFS, which
is a opt-in feature enabled when *user* programs are built with _TIME_BITS.
So similar with LFS, it does not make sense to build glibc with _TIME_BITS=64.
It already provides both ABI and redefine the types and functions if the
define it set. One note is _TIME_BITS=64 requires -D_FILE_OFFSET_BITS=64.
The internal usage should be done through the 64 bit time internal name,
such as __stat64_time64. The internal headers do the redirection for the
ABI with default 64 bit time_t (such as x86_64), so __stat64_time64 will
be __stat/__stat64 in such case.
More information about the Libc-alpha
mailing list