From 380d21d45f4f7fd95b48ccf59ac31d35f1a9a6b0 Mon Sep 17 00:00:00 2001 From: William Brown Date: Wed, 15 Sep 2021 12:14:52 +1000 Subject: [PATCH] Issue 4596 - BUG - lto linking issues Bug Description: Fedora is introducing lto by default which may affect our build especially with rust and asan Fix Description: Adapt how we use lto and how we link in our builds so that lto works for gcc. fixes: https://github.com/389ds/389-ds-base/issues/4596 Author: William Brown Review by: ??? --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3e68d78390..9b644ea2e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,11 +63,11 @@ CARGO_FLAGS = @cargo_defs@ if CLANG_ENABLE RUSTC_FLAGS = @asan_rust_defs@ @msan_rust_defs@ @tsan_rust_defs@ @debug_rust_defs@ -RUSTC_LINK_FLAGS = -C link-arg=-fuse-ld=lld +RUSTC_LINK_FLAGS = -Clink-arg=-fuse-ld=lld RUST_LDFLAGS = -ldl -lpthread -lc -lm -lrt -lutil else RUSTC_FLAGS = @asan_rust_defs@ @msan_rust_defs@ @tsan_rust_defs@ @debug_rust_defs@ -RUSTC_LINK_FLAGS = +RUSTC_LINK_FLAGS = -Clink-arg=-fuse-ld=ld # This avoids issues with stderr being double provided with clang + asan. RUST_LDFLAGS = -ldl -lpthread -lgcc_s -lc -lm -lrt -lutil endif @@ -92,7 +92,7 @@ CLANG_LDFLAGS = -latomic -fuse-ld=lld EXPORT_LDFLAGS = else CLANG_ON = 0 -CLANG_LDFLAGS = +CLANG_LDFLAGS = -flto if DEBUG EXPORT_LDFLAGS = -rdynamic endif