Bug#1021926: clang-14 fails to run with "Illegal Instruction" at i386 (pre SSE2), is linking to libz3 really needed.

Bernhard Übelacker bernhardu at mailbox.org
Mon Oct 17 13:23:16 BST 2022


Package: clang-14
Version: 1:14.0.6-2
Severity: normal
X-Debbugs-Cc: bernhardu at mailbox.org


Dear Maintainer,
clang-14 is currently not able to run at a pre-SSE2 cpu.

This is because clang-14 links to libLLVM-14.so.1 which links to libz3.so.4.
Unfortunately libz3-4 is currently compiled with sse2 enabled,
making even the static initialization functions using such instructions.

This static initialization also affects other programs as Xorg via Mesa [2],
lightdm [3] or kalgebra, and maybe all that links somehow to libLLVM-14.so.


As upstream "does not want" libz3-4 to be compiled without sse2 enabled [1],
this bug report might be used to clarify if libLLVM-14 really needs to link
with libz3 at i386, as there is an option to just disable it (which would
get used for old libz3 versions or when compiling for Ubuntu) [5].

What would be the downsides for i386 dropping libz3 usage,
until Debian i386 baseline is raised to require sse2 cpu support?

Kind regards
Bernhard


[1] https://github.com/Z3Prover/z3/issues/6369#issuecomment-1259419466
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020802
[3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020516
[4] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016658
[5] https://sources.debian.org/src/llvm-toolchain-14/1%3A14.0.6-5/debian/rules/#L111
[6] https://sources.debian.org/src/llvm-toolchain-14/1%3A14.0.6-5/debian/changelog/#L2618


$ clang-14
Ungültiger Maschinenbefehl (Speicherabzug geschrieben)

$ libtree /usr/bin/clang-14
/usr/bin/clang-14
├── libLLVM-14.so.1 [ld.so.conf]
│   ├── libz3.so.4 [ld.so.conf]
...

# coredumpctl gdb
...
     Executable: /usr/lib/llvm-14/bin/clang
...
                 Module libz3.so.4 with build-id 4299dc7fc78e26403fe929ee917098aea874c694
...
                 Module libLLVM-14.so.1 with build-id cb6ea80210dda487742b87e116cb7c646a58024e
...
Core was generated by `clang-14'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0xab1672de in ?? () from /lib/i386-linux-gnu/libz3.so.4
(gdb) bt
#0  0xab1672de in ?? () from /lib/i386-linux-gnu/libz3.so.4
#1  0xb7f62d6b in call_init (env=0xbfda8edc, argv=0xbfda8ed4, argc=1, l=<optimized out>) at ./elf/dl-init.c:70
#2  call_init (l=<optimized out>, argc=1, argv=0xbfda8ed4, env=0xbfda8edc) at ./elf/dl-init.c:26
#3  0xb7f62e5c in _dl_init (main_map=<optimized out>, argc=1, argv=0xbfda8ed4, env=0xbfda8edc) at ./elf/dl-init.c:117
#4  0xb7f796aa in _dl_start_user () from /lib/ld-linux.so.2

# with libz3-4-dbgsym
(gdb) bt
#0  std::__mutex_base::__mutex_base (this=0x914dbb0) at /usr/include/c++/12/bits/std_mutex.h:65
#1  std::mutex::mutex (this=0x914dbb0) at /usr/include/c++/12/bits/std_mutex.h:91
#2  __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at ./src/util/memory_manager.cpp:39
#3  _GLOBAL__sub_I_memory_manager.cpp(void) () at ./src/util/memory_manager.cpp:373
#4  0xb7f62d6b in call_init (env=0xbfda8edc, argv=0xbfda8ed4, argc=1, l=<optimized out>) at ./elf/dl-init.c:70
#5  call_init (l=<optimized out>, argc=1, argv=0xbfda8ed4, env=0xbfda8edc) at ./elf/dl-init.c:26
#6  0xb7f62e5c in _dl_init (main_map=<optimized out>, argc=1, argv=0xbfda8ed4, env=0xbfda8edc) at ./elf/dl-init.c:117
#7  0xb7f796aa in _dl_start_user () from /lib/ld-linux.so.2
(gdb) display/i $pc
1: x/i $pc
=> 0xab1672de <_GLOBAL__sub_I_memory_manager.cpp(void)+62>:     pxor   %xmm0,%xmm0



(Could be reproduced in qemu VM by using
a non-pae kernel,
no kvm acceleration,
and e.g. "qemu-system-i386 -cpu pentium2-v1 ...".)





-- System Information:
Debian Release: bookworm/sid
   APT prefers testing-debug
   APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 5.19.0-2-686 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages clang-14 depends on:
ii  binutils                2.39-8
ii  libatomic1              12.2.0-3
ii  libc6                   2.35-3
ii  libc6-dev               2.35-3
ii  libclang-common-14-dev  1:14.0.6-2
ii  libclang-cpp14          1:14.0.6-2
ii  libclang1-14            1:14.0.6-2
ii  libgcc-12-dev           12.2.0-3
ii  libgcc-s1               12.2.0-3
ii  libllvm14               1:14.0.6-2
ii  libobjc-12-dev          12.2.0-3
ii  libstdc++-12-dev        12.2.0-3
ii  libstdc++6              12.2.0-3
ii  llvm-14-linker-tools    1:14.0.6-2

Versions of packages clang-14 recommends:
ii  llvm-14-dev  1:14.0.6-2
ii  python3      3.10.6-1

Versions of packages clang-14 suggests:
pn  clang-14-doc  <none>

-- no debconf information
Thank you for using reportbug



More information about the Pkg-llvm-team mailing list