[cfe-dev] Clang Linux driver - header directories for wrong architecture are selected for -m32
Aleksei Sidorin
a.sidorin at samsung.com
Wed Apr 30 03:46:11 PDT 2014
Hello,
I have a problem with current Clang master: it selects x64 headers for
32-bit architecture and it leads to compiler errors.
I have Ubuntu 14.04 with GCC-4.8.2 and 4.6.4 installed + multilib. Clang
3.5 (master) doesn't add "/32" suffixes if "-m32" option is specified.
Sample code:
#include <iostream>
#include <limits>
int main() {
std::cout << "Hello world!\n";
}
-### command:
-### -c -m32 test.cpp
Output (clang-3.4, compilation is OK):
clang version 3.4
Target: i386-unknown-linux-gnu
Thread model: posix
"-cc1" "-triple" "i386-unknown-linux-gnu" "-emit-obj" "-mrelax-all"
"-disable-free" "-main-file-name" "01.cpp" "-mrelocation-model" "static"
"-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-fuse-init-array" "-target-cpu" "pentium4"
"-coverage-file" "/media/partition/android-4.2.1/01.o" "-resource-dir"
"/media/build/smrc-llvm/llvm-new/qtcreator-build/bin/../lib/clang/3.4"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu/32"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/32"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/media/build/smrc-llvm/llvm-new/qtcreator-build/bin/../lib/clang/3.4/include"
"-internal-externc-isystem" "/usr/include/i386-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/media/partition/android-4.2.1" "-ferror-limit" "19" "-fmessage-length"
"229" "-mstackrealign" "-fobjc-runtime=gcc" "-fcxx-exceptions"
"-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics"
"-vectorize-slp" "-o" "01.o" "-x" "c++" "01.cpp"
Output(clang-3.5):
clang version 3.5.0
Target: i386-unknown-linux-gnu
Thread model: posix
"-cc1" "-triple" "i386-unknown-linux-gnu" "-emit-obj" "-mrelax-all"
"-disable-free" "-main-file-name" "01.cpp" "-mrelocation-model" "static"
"-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-fuse-init-array" "-target-cpu" "pentium4"
"-coverage-file" "/media/partition/android-4.2.1/01.o" "-resource-dir"
"/media/build/smrc-llvm/master/qtcreator-build/bin/../lib/clang/3.5.0"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"
"-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/media/build/smrc-llvm/master/qtcreator-build/bin/../lib/clang/3.5.0/include"
"-internal-externc-isystem" "/usr/include/i386-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir"
"/media/partition/android-4.2.1" "-ferror-limit" "19" "-fmessage-length"
"229" "-mstackrealign" "-fobjc-runtime=gcc" "-fcxx-exceptions"
"-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics"
"-vectorize-slp" "-o" "01.o" "-x" "c++" "01.cpp"
(no /32 suffix).
and it fails to compile this file:
In file included from test.cpp:2:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1405:27:
error: __int128 is not supported on this target
struct numeric_limits<__int128>
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1409:33:
error: __int128 is not supported on this target
static _GLIBCXX_CONSTEXPR __int128
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1412:33:
error: __int128 is not supported on this target
static _GLIBCXX_CONSTEXPR __int128
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1421:28:
error: __int128 is not supported on this target
= __glibcxx_digits (__int128);
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:138:11:
note: expanded from macro '__glibcxx_digits'
(sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1421:28:
error: __int128 is not supported on this target
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:138:49:
note: expanded from macro '__glibcxx_digits'
(sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:128:31:
note: expanded from macro '__glibcxx_signed'
#define __glibcxx_signed(T) ((T)(-1) < 0)
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1423:30:
error: __int128 is not supported on this target
= __glibcxx_digits10 (__int128);
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:142:22:
note: expanded from macro '__glibcxx_digits10'
(__glibcxx_digits (T) * 643L / 2136)
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:138:11:
note: expanded from macro '__glibcxx_digits'
(sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
^
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:1423:30:
error: __int128 is not supported on this target
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/limits:142:22:
note: expanded from macro '__glibcxx_digits10'
(__glibcxx_digits (T) * 643L / 2136)
....
I fixed this problem for me with attached patch but I'm not sure if it
breaks something else (the logic of toolchain selection is complicated).
Please check if this fix is right or not.
--
Best regards,
Aleksei Sidorin
Software Engineer,
IMSWL-IMCG, SRR, Samsung Electronics
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m32-fix.patch
Type: text/x-patch
Size: 6254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140430/b6677def/attachment.bin>
More information about the cfe-dev
mailing list