Build problem with ToT GCC
Steve Ellcey
sellcey@imgtec.com
Fri Apr 17 18:08:00 GMT 2015
I just ran into a build problem building the latest top-of-tree glibc
with the latest top-of-tree GCC. The GCC change was a fix to PR 64277
(in the GCC bugzilla database). See:
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00919.html
Here is the problem from a glibc point of view (when SHARED is not set).
I don't know if we want to change the code or not or what the right change
would be if we did.
Steve Ellcey
sellcey@imgtec.com
In sysdeps/generic/ldsodefs.h we have:
/* Non-shared code has no support for multiple namespaces. */
#ifdef SHARED
# define DL_NNS 16
#else
# define DL_NNS 1
#endif
EXTERN struct link_namespaces
{
.
.
} _dl_ns[DL_NNS];
In dlfcn/dlfcn.h we have:
# define LM_ID_BASE 0 /* Initial namespace. */
And in elf/dl-open.c (_dl_open) we have:
else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
&& (GL(dl_ns)[nsid]._ns_nloaded == 0
|| GL(dl_ns)[nsid]._ns_loaded->l_auditing))
_dl_signal_error (EINVAL, file, NULL,
N_("invalid target namespace in dlmopen()"));
So GCC seems to see that for 'GL(dl_ns)[nsid]', nsid cannot be 0. But 0
is the only legal index for dl_ns so it gives this warning/error:
dl-open.c: In function '_dl_open':
dl-open.c:623:18: error: array subscript is outside array bounds [-Werror=array-bounds]
&& (GL(dl_ns)[nsid]._ns_nloaded == 0
^
dl-open.c:624:21: error: array subscript is outside array bounds [-Werror=array-bounds]
|| GL(dl_ns)[nsid]._ns_loaded->l_auditing))
More information about the Libc-alpha
mailing list