[PATCH] D75849: [compiler-rt] Allow golang race detector to run on musl-c

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 01:36:40 PDT 2020


dvyukov added a comment.

How did you test this?

It would be good to add a test because it will be broken the very next release again. People changing C++ mode don't have any good means to foresee/test for any Go problems.

After running buildgo.sh I see:

go$ nm test | grep libc; ldd test
000000000002e9b0 T __libc_csu_fini
000000000002e950 T __libc_csu_init

  U __libc_free@@GLIBC_2.2.5
  U __libc_malloc@@GLIBC_2.2.5
  U __libc_realloc@@GLIBC_2.2.5
  U __libc_stack_end@@GLIBC_2.2.5
  U __libc_start_main@@GLIBC_2.2.5

linux-vdso.so.1 (0x00007ffd695dd000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff66aa37000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff66a877000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff66b44a000)

We could grep nm and/or link something without libc in buildgo.sh.



================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1075
 uptr GetPageSize() {
-#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
+#if SANITIZER_LINUX && defined(EXEC_PAGESIZE)
   return EXEC_PAGESIZE;
----------------
Looking at the comment below, this seems to be a hard-earned bit of logic:
// EXEC_PAGESIZE may not be trustworthy.

Why do we need this change?



================
Comment at: compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp:65
 
-#if SANITIZER_FREEBSD
+#if SANITIZER_FREEBSD && !SANITIZER_GO
 extern "C" void *__libc_stack_end;
----------------
Why is this needed? How does this affect alpine linux?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75849/new/

https://reviews.llvm.org/D75849





More information about the llvm-commits mailing list