[LLVMdev] [RFC PATCH] X32 ABI support for Clang/compiler-rt (compiler-rt patch)

Steven Newbury
Thu, 22 Aug 2013 07:39:31 -0000

On Thu, 2013-08-22 at 11:27 +0400, Alexey Samsonov
wrote:
> Hi Steven,
>
> This looks interesting and raises a number of questions :)
>
> 1) Does applying this patch actually bring working sanitizers to x32
> platform?
> That is, after you build the clang, does "clang -fsanitize=whatever
foo.c"
> compile/link/run with expected results?
> I doubt that, as there is some platform-specific code in all the
> sanitizers, and many of them heavily depend
> on the address space layout. Porting TSan and MSan to 32-bit address space
> is especially hard, and we don't plan
> to do this anytime soon. I think it makes sense to build only the libraries
> that are expected to work on a given arch.
>
I should have made clear this is very much a WIP. I expect to have make
an effort to port compiler-rt, but first I need to be able to generate
elf32_x86_64 objects with Clang.  I confess, my method of porting code
to x32 so far has consisted of trying to build existing code and
modifying what breaks, or disabling features where inapplicable.  I
haven't studied the code well enough to understand and predict where I'm
going to have make modification in advance.  It's worked so far with
most things I've attempted but LLVM/Clang/compiler-rt is an order of
magnitude more complex than anything else I've poked at.  The biggest
success I've had so far with this method is porting of Mozilla
Spidermonkey/js17.

> 2) If we're stepping on the path of porting some sanitizers to x32, it
> would be great to
> setup a buildbot, make our tests pass cleanly, and make this bot public to
> catch regressions.
> Do you have plans for that? Running sanitizer test suites also leads us
> to...
>
I'm new to llvm/clang, I'm going to have to take guidance from others.

> 3) Do you plan to add support for building sanitizers on x32 to CMake build
> system? It would
> make sense (and, in fact, I would start from there), as our testsuite can
> be run only in CMake builds.
>
I can do so, (locally switch to cmake) I have a little experience with
cmake so I should be able to figure it out.  From my distro point of
view, the plan on Gentoo is to switch to CMake for the LLVM/Clang
ebuild, but it hasn't happened yet.  Perhaps this could be expedited, I
can contact the package maintainer.