Using rustc with an LLVM compiled with `-Os` results in SIGSEGVs/infinite loops
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Summary
Command used
<CMAKE_ARGS="-DCMAKE_CXX_FLAGS_RELEASE=-Os -DCMAKE_C_FLAGS_RELEASE=-Os" ./x.py install --jobs 32>
Expected behaviour
Actual behaviour
./x.py install fails with SIGSEGV 11 at compiling the core builtins.
- I recompiled whole CLANG 24 toolchain with -Os
- This conflicts with recompiling the rust toolchain latest.
- Root cause: rust toolchain is compiled hard coded with -O3; this conflicts with the VTable based interfacing to the compiler and LLVM backend.
In addition the -O3 is deeply hidden inside of src/bootstrap/src/core/build_steps/llvm.rs::configure_llvm().
In addition there is no mechanism via bootstrap.toml and/or env variables available to convince the toolchain to compile with -Os instead of -O3.
See for details the attached 20260802 ARCH Report.pdf.
Bootstrap configuration (bootstrap.toml)
<config>
Operating system et al
OS: OpenSUSE Leap 15.2
Kernel: Linux Korn55 7.1.4-Woessel-CL #1 SMP PREEMPT Thu Jul 23 00:07:04 CEST 2026 x86_64 GNU/Linux
Compilers:
- clang version 24.0.0git (https://github.com/llvm/llvm-project.git f8ebdb4dc6049f29e449a7e943b1eb914b0950ee) Target: x86_64-unknown-linux-gnu Thread model: posix
- gcc (GCC) 17.0.0 20260727 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - ld (GNU Binutils) 2.47.20260726 Copyright (C) 2026 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty
Additional context
I described in detail my observation within the attached PDF.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the command from the issue with the stated CMake release flags, then read src/bootstrap/src/core/build_steps/llvm.rs::configure_llvm(). Compare the failing build with the default optimization settings and inspect the attached report for the SIGSEGV or infinite-loop details. Done should mean the reported build completes reliably or the required optimization setting is clearly configurable, but the issue does not define which outcome is expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, rust
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100