This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]