This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Bug in elf/dl-sysdep.c
- From: Laurent Charpentier <laurent_pubs at yahoo dot com>
- To: libc-help at sourceware dot org
- Date: Fri, 7 Oct 2011 06:48:58 -0700 (PDT)
- Subject: Bug in elf/dl-sysdep.c
Hi Everyone,
In glibc-2.14/elf/dl-sysdep.c (also in glibc-2.7 2.9 ...) I found the following code (line 366):
#if (defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO) && defined SHARED
const char *dsocaps = NULL;
size_t dsocapslen = 0;
...
#endif
[line 423]
#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
if (dsocaps != NULL) <- error here when SHARED is not defined
...
for (const char *p = dsocaps; p < dsocaps + dsocapslen; p += len + 1)
...
#endif
As you can see 'dsocaps' and 'dsocapslen' are not declared when 'SHARED' is not defined. However they are used in the #if/#endif sector after line 423 leading to 'undeclared identifier's.
It sounds like a bug to me, doesn't it?
GCC (thru crosstool-ng) reports the following:
[EXTRA] Building C library
[ERROR] ../elf/dl-sysdep.c:415: error: 'dsocaps' undeclared (first use in this function)
[ERROR] ../elf/dl-sysdep.c:415: error: (Each undeclared identifier is reported only once
[ERROR] ../elf/dl-sysdep.c:415: error: for each function it appears in.)
[ERROR] ../elf/dl-sysdep.c:420: error: 'dsocapslen' undeclared (first use in this function)
Laurent