mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
lib/string: Use freestanding environment
gcc can transform the loop in a naive implementation of memset/memcpy etc into a call to the function itself. This optimization is enabled by -ftree-loop-distribute-patterns. This has been the case for a while, but gcc-10.x enables this option at -O2 rather than -O3 as in previous versions. Add -ffreestanding, which implicitly disables this optimization with gcc. It is unclear whether clang performs such optimizations, but hopefully it will also not do so in a freestanding environment. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888 Change-Id: I9dc26de8617d7417de2a60c40fcc05687abb3f68 Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
parent
cc3eba949c
commit
7afd08666e
@ -17,6 +17,11 @@ KCOV_INSTRUMENT_list_debug.o := n
|
||||
KCOV_INSTRUMENT_debugobjects.o := n
|
||||
KCOV_INSTRUMENT_dynamic_debug.o := n
|
||||
|
||||
# string.o implements standard library functions like memset/memcpy etc.
|
||||
# Use -ffreestanding to ensure that the compiler does not try to "optimize"
|
||||
# them into calls to themselves.
|
||||
CFLAGS_string.o := -ffreestanding
|
||||
|
||||
# Early boot use of cmdline, don't instrument it
|
||||
ifdef CONFIG_AMD_MEM_ENCRYPT
|
||||
KASAN_SANITIZE_string.o := n
|
||||
@ -25,7 +30,7 @@ ifdef CONFIG_FUNCTION_TRACER
|
||||
CFLAGS_REMOVE_string.o = -pg
|
||||
endif
|
||||
|
||||
CFLAGS_string.o := $(call cc-option, -fno-stack-protector)
|
||||
CFLAGS_string.o += $(call cc-option, -fno-stack-protector)
|
||||
endif
|
||||
|
||||
ccflags-y += -Ofast
|
||||
|
Loading…
x
Reference in New Issue
Block a user