[llvm-commits] [cfe-commits] (autoconf) Build ASan runtime for ARM/Android

Eric Christopher echristo at gmail.com
Wed Oct 10 08:31:25 PDT 2012


> Let's look at it this way. As things are, I can build
> llvm+clang+compiler-rt combo that can target both x86_64 and i386.
>
> $ ls lib/clang/3.2/lib/linux/ | cat
> libclang_rt.asan-i386.a
> libclang_rt.asan-x86_64.a
> libclang_rt.i386.a
> libclang_rt.tsan-x86_64.a
> libclang_rt.x86_64.a
>
> Now, I want to add arm-android to the mix. I.e., I'd like to build
> clang that can target all three (at least these three) platforms, and
> compiler-rt libraries for all of them.
>
> To do that, I need to specify the path to android ndk somewhere. If I
> use --with-default-sysroot option, I'll get a clang binary that
> targets the ndk by default (this is bad already). Then I'll need to
> somehow cancel that in compiler-rt build system to build x86_64 and
> i386 libraries. That would be a mess, and we lose the ability to
> choose the default sysroot of the resulting compiler on the way.
>
> Compiler-rt (and clang) build system already has some simple
> autodetection of the supported targets to build either i386, or x86_64
> runtime, or both of them. I'm just adding the capability to detect and
> build the android runtime as well, but that requires a configure
> option, because there is no standard path where the android ndk can be
> located.
>
> Does it make any sense? Please let me know if there is something I've missed.
>

Great explanation, and no, I don't think you've missed anything. I think that
this is going to be a general problem; i.e. what if you wanted to build
both an arm and mips android compiler-rt at the same time? A command-line
sysroot will solve the "location of the sysroot" but won't handle the problem
of building n versions of compiler-rt all at once. I was leaning towards a
solution of "build them individually out of tree" and then just use
make variables to set the location of things needed by each individual
build rather than trying to build everything possible in tree in one build.

Otherwise I think it starts to become an unwieldy set of configure flags
to set any sdk/sysroot that any particular target triple needs in building
any of the runtime libraries (libcxx will necessarily have this problem too).

Thoughts?

-eric



More information about the llvm-commits mailing list