]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/string: Add -ffreestanding compile option to string.o
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 9 Jun 2026 10:33:37 +0000 (12:33 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Wed, 10 Jun 2026 14:55:20 +0000 (16:55 +0200)
Use -ffreestanding for string.o to avoid that the compiler generates
calls into themselves for standard library functions like memset().

Reviewed-by: Juergen Christ <jchrist@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/boot/Makefile
arch/s390/lib/Makefile

index a1e719a79d38cf85f22c7aaa702ddf42e74ea014..e1f82d118bc95b8ac05b1f931d702ba078df1330 100644 (file)
@@ -25,6 +25,11 @@ KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
 
 CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
 
+# 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
+
 obj-y  := head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o vmem.o
 obj-y  += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
 obj-y  += version.o pgm_check.o ctype.o ipl_data.o relocs.o alternative.o
index 2bf47204f6abd989fb4a866b753354d42b86df36..c82aedef027287fa33e3cd9273688f941fec83ac 100644 (file)
@@ -3,6 +3,11 @@
 # Makefile for s390-specific library files..
 #
 
+# 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
+
 lib-y += delay.o string.o uaccess.o find.o spinlock.o tishift.o
 lib-y += csum-partial.o
 obj-y += mem.o