[oi-dev] Clang and GCC6 runtime

Alexander Pyhalov alp at sfedu.ru
Tue Jul 30 14:36:47 UTC 2019


Hi.

I've looked at https://www.illumos.org/issues/11507, and first issue is clear, 01-openindiana.patch needs fixing.

diff --git a/components/developer/clang-40/patches/01-openindiana.patch b/components/developer/clang-40/patches/01-openindiana.patch
index cf4548b7e..f18920444 100644
--- a/components/developer/clang-40/patches/01-openindiana.patch
+++ b/components/developer/clang-40/patches/01-openindiana.patch
@@ -65,15 +65,15 @@ diff -ruN llvm-4.0.0.src/tools/clang/lib/Driver/ToolChains.cpp llvm-4.0.0.src.pa
 +  std::string GCCVersion = OPENINDIANA_GCC_VERSION;
    switch (Triple.getArch()) {
    case llvm::Triple::x86:
-+    GCCLibPath += ("i386-" + Triple.getVendorName() + "-" + Triple.getOSName()).str() + "/"+GCCVersion+"/";
++    GCCLibPath += ("/i386-" + Triple.getVendorName() + "-" + Triple.getOSName()).str() + "/"+GCCVersion+"/";
    case llvm::Triple::sparc:
      break;
    case llvm::Triple::x86_64:
-+    GCCLibPath += ("i386-" + Triple.getVendorName() + "-" + Triple.getOSName()).str() + "/"+GCCVersion+"/amd64";
++    GCCLibPath += ("/i386-" + Triple.getVendorName() + "-" + Triple.getOSName()).str() + "/"+GCCVersion+"/amd64";
      LibPath += "amd64/";
      break;
    case llvm::Triple::sparcv9:
-+    GCCLibPath += ("sparc-" + Triple.getVendorName() + "-" + Triple.getOSName()).str() + "/"+GCCVersion+"/sparcv9";
++    GCCLibPath += ("/sparc-" + Triple.getVendorName() + "-" + Triple.getOSName()).str() + "/"+GCCVersion+"/sparcv9";
      LibPath += "sparcv9/";
      break;
    default:


The second issue is worse. After applying this patch I see the following issues with simple c++ programs:

clang++ 1.cc -o 1
(or  clang++ 1.cc -Wl,-L/usr/gcc/6/lib -Wl,-R/usr/gcc/6/lib -o 1), doesn't matter much.

$ ./1
Segmentation Fault (core dumped)
$ pstack core
core 'core' of 18083:	./1
 feee60d2 _ZNSo6sentryC1ERSo (8047b48, 8061480, 200, 40) + 22
 feee67c8 _ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i (8061480, 8051181, 1, 30) + 28
 feee6c22 _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc (8061480, 8051181, 8047c1c, 805114f, 8061184, 8050e5e) + 32
 08051122 main     (1, 8047c1c, 8047c24, 8050f52, 0, 0) + 32
 08050f77 _start_crt (1, 8047c1c, fefcfed4, 0, 0, 0) + 96
 08050e4a _start   (1, 8047d10, 0, 8047d14, 8047d28, 8047d41) + 1a


Do I understand correctly that it's issue with GCC C++ ABI and we either have to use GCC 4 runntime libraries for clang or update clang ? 


С уважением,
Александр Пыхалов,
программист отдела телекоммуникационной инфраструктуры
управления информационно-коммуникационной инфраструктуры ЮФУ



More information about the oi-dev mailing list