Page MenuHomePhabricator

[TSan][MIPS64] Fix go build for MIPS64
AbandonedPublic

Authored by slthakur on Feb 12 2015, 3:58 AM.

Details

Summary

Diff Detail

Repository
rL LLVM

Event Timeline

slthakur updated this revision to Diff 19816.Feb 12 2015, 3:58 AM
slthakur retitled this revision from to [TSan][MIPS64] Fix go build for MIPS64.
slthakur updated this object.
slthakur edited the test plan for this revision. (Show Details)
slthakur added reviewers: dvyukov, kcc, samsonov.
slthakur set the repository for this revision to rL LLVM.
slthakur added subscribers: mohit.bhakkad, Anand.Takale, dsanders, Unknown Object (MLST).
samsonov added inline comments.Feb 12 2015, 10:11 AM
lib/tsan/CMakeLists.txt
105

You need to have GotsanRuntimeCheck for every ${arch} from ${TSAN_SUPPORTED_ARCH}.

lib/tsan/go/buildgo.sh
92

This part is far too similar to linux_amd64. I believe you should generalize the former.

121

ditto

slthakur updated this revision to Diff 20008.Feb 16 2015, 2:30 AM

Addressed review comments by @samsonov

slthakur added inline comments.Feb 16 2015, 2:38 AM
lib/tsan/go/buildgo.sh
54

I have shifed ../rtl/tsan_platform_linux.h down in the list because :

The file asm/stat is included in sanitizer_linux.cc file only for mips.
And sys/stat is included in ../rtl/tsan_platform_linux.h, which includes bits/stat.
Therefore when the structure stat defined in asm/stat.h included from sanitizer_linux.cc is compiled, st_atime in struct stat is interpreted as the macro defined in bits/stat.h, where as it is only the variable name. Because of this reason we were getting the following error in Go runtime check :

In file included from ./gotsan.cc:9678:
/usr/include/mips64el-linux-gnuabi64/asm/stat.h:113:16: error: expected ';' at end of declaration list
        unsigned int            st_atime;
                                ^
/usr/include/mips64el-linux-gnuabi64/bits/stat.h:166:26: note: expanded from macro 'st_atime'
# define st_atime st_atim.tv_sec        /* Backward compatibility.  */

I have also tested this patch on x86_64.

dvyukov edited edge metadata.Feb 16 2015, 2:41 AM

This is not right. Go tsan does not run on mips64.
C++ tsan needs to be tested on linux/amd64, freebsd/amd64 and linux/mips64.
Go tsan needs to be tested on linux/amd64, darwin/amd64, windows/amd64 and freebsd/amd64.

Hi @dvyukov

I ran the check-tsan test suite on my mips64 board and GotsanRuntimeCheck is working fine.
How can I add support for tsan go runtime for mips64 and test it ?

dvyukov accepted this revision.Feb 16 2015, 3:34 AM
dvyukov edited edge metadata.

I ran the check-tsan test suite on my mips64 board and GotsanRuntimeCheck is working fine.
How can I add support for tsan go runtime for mips64 and test it ?

You first need to add mips64 support to Go compiler, assemebler, linker and runtime :)
The test is very simplified and does not involve any Go code, but does not test most of the system as well. We probably can leave the test if it works. I just hope that it won't break.

But please add a comment in lib/tsan/rtl/tsan_platform.h saying that Go/mips64 is not a working configuration and it is there merely to satisfy rtl/go/buildgo.sh.

This revision is now accepted and ready to land.Feb 16 2015, 3:34 AM

OK. Then I think it will be better to enable GotsanRuntimeCheck only for x86_64 arch. I will just submit a patch for enabling GotsanRuntimeCheck on x86_64 arch only.

slthakur abandoned this revision.Feb 18 2015, 1:15 AM

Added code to enable GotsanRuntimeCheck for x86_64 only in lib/tsan/CMakeLists.txt in http://reviews.llvm.org/D6291