build: add a config knob to enable LTO for all packages
This enables LTO for all packages which haven't opted-out. Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
		 Andre Heider
					Andre Heider
				
			
				
					committed by
					
						 Christian Marangi
						Christian Marangi
					
				
			
			
				
	
			
			
			 Christian Marangi
						Christian Marangi
					
				
			
						parent
						
							1342afcd27
						
					
				
				
					commit
					9ea7019ffd
				
			| @@ -152,6 +152,13 @@ menu "Global build settings" | |||||||
| 		  garbage collection capabilites. | 		  garbage collection capabilites. | ||||||
| 		  Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections | 		  Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-gc-sections | ||||||
|  |  | ||||||
|  | 	config USE_LTO | ||||||
|  | 		bool | ||||||
|  | 		prompt "Use the link-time optimizer for all packages (EXPERIMENTAL)" | ||||||
|  | 		help | ||||||
|  | 		  Adds LTO flags to the CFLAGS and LDFLAGS. | ||||||
|  | 		  Packages can choose to opt-out via setting PKG_BUILD_FLAGS:=no-lto | ||||||
|  |  | ||||||
| 	config IPV6 | 	config IPV6 | ||||||
| 		def_bool y | 		def_bool y | ||||||
|  |  | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ ifeq ($(call pkg_build_flag,gc-sections,$(if $(CONFIG_USE_GC_SECTIONS),1,0)),1) | |||||||
|   TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections |   TARGET_CXXFLAGS+= -ffunction-sections -fdata-sections | ||||||
|   TARGET_LDFLAGS+= -Wl,--gc-sections |   TARGET_LDFLAGS+= -Wl,--gc-sections | ||||||
| endif | endif | ||||||
| ifeq ($(call pkg_build_flag,lto,0),1) | ifeq ($(call pkg_build_flag,lto,$(if $(CONFIG_USE_LTO),1,0)),1) | ||||||
|   TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects |   TARGET_CFLAGS+= -flto=auto -fno-fat-lto-objects | ||||||
|   TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects |   TARGET_CXXFLAGS+= -flto=auto -fno-fat-lto-objects | ||||||
|   TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin |   TARGET_LDFLAGS+= -flto=auto -fuse-linker-plugin | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user