Skip to content

Using rustc with an LLVM compiled with -Os results in SIGSEGVs/infinite loops #160393

Description

@ErichLoew

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.

  1. I recompiled whole CLANG 24 toolchain with -Os
  2. This conflicts with recompiling the rust toolchain latest.
  3. 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:

  1. clang version 24.0.0git (https://github.com/llvm/llvm-project.git f8ebdb4dc6049f29e449a7e943b1eb914b0950ee) Target: x86_64-unknown-linux-gnu Thread model: posix
  2. 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.
  3. 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.

20260802 ARCH Report.pdf

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions