The uCLibc library supports multiple architectures. A couple of MIPS toolchains contains both uCLibc and glibc implementation so these options allow to select used C library. Initially -muclibc / -mglibc (as well as -mbionic) have been implemented in gcc.
Diff Detail
Event Timeline
Is there a good reason for not switching them via a single option with value, e.g. -mlibc=musl, -mlibc=glibc etc?
-muclibc / -mglibc come from gcc. I think we need to keep their names as-is for compatibility.
I tried the patch locally, but two tests fails:
Clang :: Driver/mips-cs.cpp Clang :: Driver/mips-fsf.cpp
/home/espindola/llvm/clang/test/Driver/mips-cs.cpp:39:23: error: expected string not found in input
// CHECK-BE-UC-HF-32: "[[TC]]/../../../../mips-linux-gnu/include/c++/4.6.3/mips-linux-gnu/uclibc"
^
<stdin>:4:622: note: scanning from here
"/home/espindola/llvm/build/./bin/clang" "-cc1" "-triple" "mips--linux-gnu" "-S" "-disable-free" "-main-file-name" "mips-cs.cpp" "-mrelocation-model" "static" "-mdisable-fp-elim" "-fmath-errno" "-no-integrated-as" "-mconstructor-aliases" "-target-cpu" "mips32r2" "-target-feature" "-n64" "-target-feature" "+o32" "-target-abi" "o32" "-mfloat-abi" "hard" "-dwarf-column-info" "-resource-dir" "/home/espindola/llvm/build/./bin/../lib/clang/3.6.0" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3/mips-linux-gnu" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3/backward" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/usr/local/include" "-internal-isystem" "/home/espindola/llvm/build/./bin/../lib/clang/3.6.0/include" "-internal-externc-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/include" "-internal-externc-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/usr/include" "-fdeprecated-macro" "-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/home/espindola/llvm/build/tools/clang/test/Driver" "-ferror-limit" "19" "-fmessage-length" "0" "-mstackrealign" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-o" "/tmp/mips-cs-00c4ac.s" "-x" "c++" "/home/espindola/llvm/clang/test/Driver/mips-cs.cpp"
^
<stdin>:4:622: note: with variable "TC" equal to "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3"
"/home/espindola/llvm/build/./bin/clang" "-cc1" "-triple" "mips--linux-gnu" "-S" "-disable-free" "-main-file-name" "mips-cs.cpp" "-mrelocation-model" "static" "-mdisable-fp-elim" "-fmath-errno" "-no-integrated-as" "-mconstructor-aliases" "-target-cpu" "mips32r2" "-target-feature" "-n64" "-target-feature" "+o32" "-target-abi" "o32" "-mfloat-abi" "hard" "-dwarf-column-info" "-resource-dir" "/home/espindola/llvm/build/./bin/../lib/clang/3.6.0" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3/mips-linux-gnu" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3/backward" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/usr/local/include" "-internal-isystem" "/home/espindola/llvm/build/./bin/../lib/clang/3.6.0/include" "-internal-externc-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/include" "-internal-externc-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/usr/include" "-fdeprecated-macro" "-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/home/espindola/llvm/build/tools/clang/test/Driver" "-ferror-limit" "19" "-fmessage-length" "0" "-mstackrealign" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-o" "/tmp/mips-cs-00c4ac.s" "-x" "c++" "/home/espindola/llvm/clang/test/Driver/mips-cs.cpp"
^
<stdin>:4:697: note: possible intended match here
"/home/espindola/llvm/build/./bin/clang" "-cc1" "-triple" "mips--linux-gnu" "-S" "-disable-free" "-main-file-name" "mips-cs.cpp" "-mrelocation-model" "static" "-mdisable-fp-elim" "-fmath-errno" "-no-integrated-as" "-mconstructor-aliases" "-target-cpu" "mips32r2" "-target-feature" "-n64" "-target-feature" "+o32" "-target-abi" "o32" "-mfloat-abi" "hard" "-dwarf-column-info" "-resource-dir" "/home/espindola/llvm/build/./bin/../lib/clang/3.6.0" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3/mips-linux-gnu" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/include/c++/4.6.3/backward" "-internal-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/usr/local/include" "-internal-isystem" "/home/espindola/llvm/build/./bin/../lib/clang/3.6.0/include" "-internal-externc-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/include" "-internal-externc-isystem" "/home/espindola/llvm/clang/test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/../../../../mips-linux-gnu/libc/usr/include" "-fdeprecated-macro" "-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/home/espindola/llvm/build/tools/clang/test/Driver" "-ferror-limit" "19" "-fmessage-length" "0" "-mstackrealign" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-o" "/tmp/mips-cs-00c4ac.s" "-x" "c++" "/home/espindola/llvm/clang/test/Driver/mips-cs.cpp"
Hmm, could you check that changes (new files) in the test/Driver/Inputs/mips_cs_tree and test/Driver/Inputs/mips_fsf_tree directories applied correctly? I ran arc patch D4790 command, rebuilt the Clang, ran the Clang's test suite and did not get any errors.
The patch you can download from the Phabricator site using the "Download Raw Diff" link is reduced. Probably it is the Phabricator's bug. This file does not contain any new .o files. This page has paths like test/Driver/Inputs/mips_cs_tree/lib/gcc/mips-linux-gnu/4.6.3/uclibc/soft-float/crtbegin.o. The D4790.diff does not have such files.
I create another patch and attach it to this message.
LGTM with a nit.
lib/Driver/ToolChains.cpp | ||
---|---|---|
1739 | Since you are calling str() anyway, it might be cleaner to construct it with String S = InstallDir + "/../../../../sysroot/"; if (...) S += else S += |
Since you are calling str() anyway, it might be cleaner to construct it with