Build with LTO
Resolves: rhbz#2188418
This commit is contained in:
		
							parent
							
								
									47aa2a71fc
								
							
						
					
					
						commit
						5df215a555
					
				
							
								
								
									
										19
									
								
								clang.spec
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								clang.spec
									
									
									
									
									
								
							| @ -45,7 +45,7 @@ | ||||
| 
 | ||||
| Name:		%pkg_name | ||||
| Version:	%{clang_version}%{?rc_ver:~rc%{rc_ver}} | ||||
| Release:	3%{?dist} | ||||
| Release:	4%{?dist} | ||||
| Summary:	A C language family front-end for LLVM | ||||
| 
 | ||||
| License:	Apache-2.0 WITH LLVM-exception OR NCSA | ||||
| @ -324,14 +324,17 @@ rm test/CodeGen/profile-filter.c | ||||
| 
 | ||||
| %build | ||||
| 
 | ||||
| %define _lto_cflags %{nil} | ||||
| 
 | ||||
| %if 0%{?__isa_bits} == 64 | ||||
| sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@/64/g' test/lit.cfg.py | ||||
| %else | ||||
| sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py | ||||
| %endif | ||||
| 
 | ||||
| %ifarch %ix86 | ||||
| # Linking libclang.so goes out of memory even with ThinLTO and a single link job. | ||||
| %global _lto_cflags %nil | ||||
| %endif | ||||
| 
 | ||||
| %ifarch s390 s390x %{arm} aarch64 %ix86 ppc64le | ||||
| # Decrease debuginfo verbosity to reduce memory consumption during final library linking | ||||
| %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') | ||||
| @ -350,6 +353,9 @@ mv ../cmake-%{compat_ver}.src ../cmake | ||||
| 
 | ||||
| %global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly" | ||||
| 
 | ||||
| # Disable LTO when building the compat libraries. This would perform LTO across all of LLVM and | ||||
| # Clang, and fails due to "too many open files". We don't particularly care about the performance | ||||
| # of these compat libraries. | ||||
| %cmake -S ../llvm-%{compat_ver}.src -B ../clang-compat-libs -G Ninja \ | ||||
| 	-DLLVM_ENABLE_PROJECTS=clang \ | ||||
| 	-DCMAKE_BUILD_TYPE=Release \ | ||||
| @ -358,7 +364,9 @@ mv ../cmake-%{compat_ver}.src ../cmake | ||||
| 	-DLLVM_ENABLE_RTTI:BOOL=ON \ | ||||
| 	-DCMAKE_SKIP_RPATH:BOOL=ON \ | ||||
| 	-DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \ | ||||
| 	-DLLVM_INCLUDE_BENCHMARKS=OFF | ||||
| 	-DLLVM_INCLUDE_BENCHMARKS=OFF \ | ||||
| 	-DCMAKE_C_FLAGS_RELEASE="-fno-lto" \ | ||||
| 	-DCMAKE_CXX_FLAGS_RELEASE="-fno-lto" | ||||
| 
 | ||||
| %ninja_build -C ../clang-compat-libs libclang.so | ||||
| %ninja_build -C ../clang-compat-libs libclang-cpp.so | ||||
| @ -678,6 +686,9 @@ mv ./libclang-cpp.so.%{compat_maj_ver} "$compat_lib" | ||||
| 
 | ||||
| %endif | ||||
| %changelog | ||||
| * Fri Jun 02 2023 Nikita Popov <npopov@redhat.com> - 16.0.1-4 | ||||
| - Build with LTO | ||||
| 
 | ||||
| * Thu May 25 2023 Nikita Popov <npopov@redhat.com> - 16.0.1-3 | ||||
| - Use ld from gcc-toolset | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user