This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libtsan invalid use of ld-linux internals
- From: Dmitry Vyukov <dvyukov at google dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 24 Dec 2012 17:46:26 +0400
- Subject: Re: libtsan invalid use of ld-linux internals
- References: <20121217075850.GG2315@tucnak.redhat.com>
On Mon, Dec 17, 2012 at 11:58 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> I've noticed libtsan can't be installed via rpm, due to invalid use of
> dynamic linker's internals:
>
> #ifdef __i386__
> # define INTERNAL_FUNCTION __attribute__((regparm(3), stdcall))
> #else
> # define INTERNAL_FUNCTION
> #endif
> extern "C" void _dl_get_tls_static_info(size_t*, size_t*)
> __attribute__((weak)) INTERNAL_FUNCTION;
>
> static int InitTlsSize() {
> typedef void (*get_tls_func)(size_t*, size_t*) INTERNAL_FUNCTION;
> get_tls_func get_tls = &_dl_get_tls_static_info;
> if (get_tls == 0) {
> void *get_tls_static_info_ptr = dlsym(RTLD_NEXT, "_dl_get_tls_static_info");
> CHECK_EQ(sizeof(get_tls), sizeof(get_tls_static_info_ptr));
> internal_memcpy(&get_tls, &get_tls_static_info_ptr,
> sizeof(get_tls_static_info_ptr));
> }
> CHECK_NE(get_tls, 0);
> size_t tls_size = 0;
> size_t tls_align = 0;
> get_tls(&tls_size, &tls_align);
> return tls_size;
> }
>
> The
> get_tls_func get_tls = &_dl_get_tls_static_info;
> is what precludes libtsan installation, then libtsan.so refers to
> _dl_get_tls_static_info@@GLIBC_PRIVATE
> symbol and at least our rpm dependency stuff reject that, because nothing
> outside of glibc should ever refer to symbols marked as GLIBC_PRIVATE.
> Those are exported solely because they are used by other libraries that are
> part of glibc (in this case libc.so.6).
> If you need to get at the info it returns, please talk to
> libc-alpha@sourceware.org for help. The first line certainly must go, the
> second alternative (dlsym) will not prevent installation, but may break
> anytime, glibc doesn't guarantee anything about the ABI of the symbols, it
> can be removed any time, can change parameters/return values without
> warning.
>
> Jakub
Hi,
I've removed static reference to _dl_get_tls_static_info() for now:
http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?r1=171033&r2=171032&pathrev=171033
and sent the email to libc-alpha@
http://sourceware.org/ml/libc-alpha/2012-12/msg00404.html
Thanks!