Makefile: Use pipes rather than temporary files for intermediate steps
GCC supports the use of pipes for intermediate compilation steps (e.g. passing the generated assembly code to the assembler) as a replacement for temporary files. This bypasses VFS and other layers which can introduce substantial amounts of overhead and instead redirects data directly between processes. The final product and generated code are unaffected. Memory usage while compiling is slightly higher. Tests showed a substantial reduction in build time when using GCC to compile an x86 4.19 kernel: Using temporary files in tmpfs: 2m41s Using pipes: 2m36s Similar benefits were observed with an Android arm64 4.9 kernel: Using tmpfs: 5m34s Using pipes: 4m33s Enable the feature when possible (i.e. when the compiler supports it) to speed up builds at effectively no cost for many setups, particularly those with weaker CPUs. Test: kernel compiles and boots Signed-off-by: Danny Lin <danny@kdrag0n.dev> Signed-off-by: Carlos Jimenez (JavaShin-X) <javashin1986@gmail.com> Change-Id: Id7860154edd5547dc686e1320a25892e8c4906a6 Signed-off-by: starlight5234 <starlight5234@protonmail.ch>
This commit is contained in:
parent
98f2aee7a5
commit
f9681240cf
1 changed files with 2 additions and 2 deletions
4
Makefile
4
Makefile
|
@ -366,7 +366,7 @@ HOSTCC = gcc
|
|||
HOSTCXX = g++
|
||||
endif
|
||||
KBUILD_HOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 \
|
||||
-fomit-frame-pointer -std=gnu89 $(HOST_LFS_CFLAGS) \
|
||||
-fomit-frame-pointer -std=gnu89 -pipe $(HOST_LFS_CFLAGS) \
|
||||
$(HOSTCFLAGS)
|
||||
KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
|
||||
KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
|
||||
|
@ -439,7 +439,7 @@ LINUXINCLUDE := \
|
|||
$(USERINCLUDE)
|
||||
|
||||
KBUILD_AFLAGS := -D__ASSEMBLY__
|
||||
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
|
||||
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -pipe \
|
||||
-fno-strict-aliasing -fno-common -fshort-wchar \
|
||||
-Werror-implicit-function-declaration \
|
||||
-Wno-format-security \
|
||||
|
|
Loading…
Reference in a new issue