[cfe-dev] Forcing default target, linker, includes

Chris Hanson via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 6 12:10:58 PST 2019


I’ve built clang, compiler_rt, and lld on Linux from LLVM master as of last night targeting MIPS like so:

cmake \
        -G Ninja \
        $CMHPROJECTS/llvm-project/llvm \
        -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld" \
        -DCMAKE_INSTALL_PREFIX="/opt/llvm-mips" \
        -DLLVM_TARGETS_TO_BUILD="Mips"

ninja -j8 -k8

(A couple things fail to link but clang, lld, etc. do get built.)

Unfortunately the built clang does two things I don’t want: It looks in my Linux system’s / for headers even when I specify -isysroot and it uses my Linux system’s ld instead of the built lld even when I specify -fuse-ld=lld.

Are there CMake flags that I can use to force the built clang to only ever use headers from the provided sysroot? (And of course, I’d love the same for forcing lld to only look in sysroot for libraries.) How about CMake flags to force the built clang to only use its paired lld?

I also have to specify a number of options to get the (IRIX MIPS IV n64 ABI) code generation I desire; I’m compiling hello.c in my LLVM build directory with:

./bin/clang -g --std=c99 -D_LANGUAGE_C=1 -D__sgi=1 -D_SGIAPI=1 -D_SGI_SOURCE=1 -D_MIPSABI_SOURCE=1 --target=mips-sgi-irix -march=mips4 -m64 -isysroot $IRIXSDK -isystem $IRIXSDK/usr/include -c hello.c

Obviously the target tuple mips-sgi-irix isn’t supported, it does at least result in MIPS codegen and the rest winds up getting me MIPS IV n64. If I eventually add support for the sgi-irix part of the target tuple I know I can easily make it imply the preprocessor macros, but is that also necessary to force the use of the MIPS n64 ABI? Or is there some other way to select which MIPS ABI that I get? And is there a CMake option I can use to make all of that the default for the built clang?

  — Chris

Sent from my iPad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191106/d00e0ed7/attachment.html>


More information about the cfe-dev mailing list