[RFC 0/9] Remove legacy platform bits and cleanups
Stefan Liebler
stli@linux.ibm.com
Tue Jun 11 12:13:17 GMT 2024
On 10.06.24 15:36, Stefan Liebler wrote:
> On 08.06.24 13:09, Florian Weimer wrote:
>> * Stefan Liebler:
>>
>>> This patch series is the result of:
>>> "Question regarding platform-bits in ld.so.cache"
>>> https://sourceware.org/pipermail/libc-alpha/2024-May/156793.html
>>
>> This series fails to build on MIPS with:
>>
>> mips64-glibc-linux-gnu-gcc -mabi=32 ldconfig.c -c -std=gnu11 -fgnu89-inline -g -O2 -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wstrict-prototypes -Wold-style-definition -fmath-errno -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 -fPIE -Wa,-execstack -D'SYSCONFDIR="/etc"' -D'LIBDIR="/usr/lib"' -D'SLIBDIR="/lib"' -I../include -I/home/bmg/build/glibcs/mips-linux-gnu/glibc/elf -I/home/bmg/build/glibcs/mips-linux-gnu/glibc -I../sysdeps/unix/sysv/linux/mips/mips32/fpu -I../sysdeps/unix/sysv/linux/mips/mips32 -I../sysdeps/unix/sysv/linux/mips -I../sysdeps/mips/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/mips/mips32 -I../sysdeps/unix/mips -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/mips/mips32/fpu -I../sysdeps/mips/mips32 -I../sysdeps/mips/ieee754 -I../sysdeps/mips/include -I../sysdeps/mips -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/wordsize-32 -I../sysdeps/mips/fpu -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /home/bmg/build/glibcs/mips-linux-gnu/glibc/libc-modules.h -DMODULE_NAME=ldconfig -include ../include/libc-symbols.h -DPIC -DTOP_NAMESPACE=glibc -o /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o -MD -MP -MF /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o.dt -MT /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o
>> In file included from ../sysdeps/generic/ldsodefs.h:643,
>> from ../sysdeps/mips/ldsodefs.h:82,
>> from ../sysdeps/gnu/ldsodefs.h:46,
>> from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
>> from ../sysdeps/unix/sysv/linux/mips/ldsodefs.h:22,
>> from ../sysdeps/mips/dl-procinfo.h:22,
>> from /home/bmg/build/glibcs/mips-linux-gnu/glibc/dl-tunable-list.h:6,
>> from ../elf/dl-tunables.h:48,
>> from ./dl-hwcaps.h:25,
>> from ldconfig.c:44:
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:62:22: error: ‘_dl_vdso_clock_getres’ defined but not used [-Werror=unused-variable]
>> 62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t,
>> | ^~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:53:22: error: ‘_dl_vdso_gettimeofday’ defined but not used [-Werror=unused-variable]
>> 53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO;
>> | ^~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:49:22: error: ‘_dl_vdso_clock_gettime64’ defined but not used [-Werror=unused-variable]
>> 49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t,
>> | ^~~~~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/dl-vdso-setup.c:45:22: error: ‘_dl_vdso_clock_gettime’ defined but not used [-Werror=unused-variable]
>> 45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t,
>> | ^~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make[3]: *** [../o-iterator.mk:9: /home/bmg/build/glibcs/mips-linux-gnu/glibc/elf/ldconfig.o] Error 1
>> make[3]: Leaving directory '/home/bmg/src/glibc/elf'
>> make[3]: *** Waiting for unfinished jobs....
>> make[2]: *** [Makefile:484: elf/others] Error 2
>> make[1]: *** [Makefile:9: all] Error 2
>>
>> Florian
>>
> Hi Florian,
>
> thanks for the info. I've take a look. Seems to be related to the
> removed sysdeps/mips/dl-procinfo.c with those undefs at the end:
> #undef PROCINFO_DECL
> #undef PROCINFO_CLASS
>
> Bye,
> Stefan
Okay, we have this chain:
- elf/ldconfig.c:
#define PROCINFO_CLASS static
#include <dl-hwcaps.h>
-> elf/dl-hwcaps.h
-> elf/dl-tunables.h
-> <build>/dl-tunable-list.h
-> sysdeps/mips/dl-procinfo.h:
-> sysdeps/unix/sysv/linux/mips/ldsodefs.h
-> sysdeps/unix/sysv/linux/ldsodefs.h:
-> sysdeps/gnu/ldsodefs.h
-> sysdeps/mips/ldsodefs.h
-> sysdeps/generic/ldsodefs.h:
...
#include <dl-procinfo.c>
...
# define PROCINFO_DECL
# ifndef PROCINFO_CLASS
# define PROCINFO_CLASS EXTERN
# endif
# include <dl-vdso-setup.c>
...
Before my patch, sysdeps/mips/dl-procinfo.c contains those undefs at the
end:
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
With my patch, the empty sysdeps/generic/dl-procinfo.c is used.
Thus we end up in:
static int (*_dl_vdso_...) (...) RELRO;
vs before:
extern int (*_dl_vdso_...) (...) RELRO;
The latter builds fine, while the former produces the "defined but not
used" warnings.
Thus I will adjust my patch to keep sysdeps/mips/dl-procinfo.c with only
something like this:
/* Note:
When compiling elf/ldconfig.c, PROCINFO_CLASS is defined to static.
This dl-procinfo.c is included in sysdeps/generic/ldsodefs.h.
Afterwards, if not yet defined, PROCINFO_CLASS is defined to EXTERN
just before dl-vdso-setup.c is included. A "static" _dl_vdso_xyz
function prototype would lead to gcc warnings/errors: defined but
not used. */
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
My patch also removes sysdeps/alpha/dl-procinfo.c and
sysdeps/csky/dl-procinfo.c with those #undef's at the end. But alpha and
csky do not define the vdso HAVE_XYZ_VSYSCALL macros and thus do not end
up with those errors.
(At the end of dl-vdso-setup.c, PROCINFO_DECL and PROCINFO_CLASS are
also undefined)
I run build-many-glibcs.py from scratch which lasts some time.
Afterwards I'll send a V2 series.
Thanks,
Stefan
More information about the Libc-alpha
mailing list