From 2abc09655793e970a3d05705dc6ff602d3c919d8 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 1 Aug 2023 09:37:56 +0200 Subject: [PATCH] Use build_cflags when setting ASMFLAGS While the current implementation works on Fedora, on c9s/rhel the CFLAGS haven't been set at this point yet, so we are missing the -fcfprotection flag in ASMFLAGS. Using build_cflags avoids this ordering problem. Additionally, add -Wl,-z,cet-report=error to the libLLVM.so linker flags, so we can detect such issues earlier in the future. --- llvm.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm.spec b/llvm.spec index 17fbcdf..ec0390e 100644 --- a/llvm.spec +++ b/llvm.spec @@ -253,7 +253,7 @@ mv %{third_party_srcdir} third-party %endif # Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. -export ASMFLAGS=$CFLAGS +export ASMFLAGS="%{build_cflags}" # force off shared libs as cmake macros turns it on. %cmake -G Ninja \ @@ -329,6 +329,7 @@ export ASMFLAGS=$CFLAGS -DLLVM_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \ -DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \ -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,cet-report=error" \ -DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0" # Build libLLVM.so first. This ensures that when libLLVM.so is linking, there