Skip to content

Conversation

dpaoliello
Copy link

@dpaoliello dpaoliello commented Sep 23, 2025

Attempting to update cc in the Rust compiler is causing the build script in tikv-jemalloc-sys to fail to run gold. gold failing (or running at all) is unexpected, but the root cause is that the compiler flags now include -flto where they didn't before.

Fix for this is to strip out any -flto args when jemalloc gets the compiler command from cc - since jemalloc isn't producing object files to be linked into the final Rust compilation, it doesn't need to use LTO.

Additionally, setting the CPPFLAGS and LDFLAGS are redundant to setting CFLAGS for the purposes of running configure: this results in the flags being triplicated in the C Compiler invocation.

Validated by building the Rust compiler with this branch patched for jemalloc.

Signed-off-by: Daniel Paoliello <danpao@microsoft.com>
@dpaoliello dpaoliello changed the title Filter out -flto args form cc, don't set env vars that result in duplicated args Filter out -flto args from cc, don't set env vars that result in duplicated args Sep 24, 2025
@dpaoliello
Copy link
Author

Ping... this is blocking updating cc in Rust

@BusyJay
Copy link
Member

BusyJay commented Oct 6, 2025

I don't think this is an appropriate fix as link time optimization requires -flto appears in both compile time and link time. Check https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-flto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants