Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Juergen Christ <jchrist@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
Subject: [PATCH v3 3/9] s390/string: Add -ffreestanding compile option to string.o
Date: Tue,  9 Jun 2026 12:33:37 +0200	[thread overview]
Message-ID: <20260609103343.107325-4-hca@linux.ibm.com> (raw)
In-Reply-To: <20260609103343.107325-1-hca@linux.ibm.com>

Use -ffreestanding for string.o to avoid that the compiler generates
calls into themselves for standard library functions like memset().

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
 arch/s390/boot/Makefile | 5 +++++
 arch/s390/lib/Makefile  | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index a1e719a79d38..e1f82d118bc9 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile
@@ -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
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index 2bf47204f6ab..c82aedef0272 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -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
-- 
2.53.0


  parent reply	other threads:[~2026-06-09 10:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 10:33 [PATCH v3 0/9] s390/string: Convert various functions to C Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 1/9] s390/purgatory: Enforce z10 minimum architecture level Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 2/9] s390: Add .noinstr.text to boot and purgatory linker scripts Heiko Carstens
2026-06-09 10:33 ` Heiko Carstens [this message]
2026-06-09 12:23   ` [PATCH v3 3/9] s390/string: Add -ffreestanding compile option to string.o Juergen Christ
2026-06-09 13:39     ` Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 4/9] s390/string: Convert memmove() to C Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 5/9] s390/string: Convert memset() " Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 6/9] s390/string: Convert memcpy() " Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 7/9] s390/string: Convert memset(16|32|64)() " Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 8/9] s390/memmove: Optimize backward copy case Heiko Carstens
2026-06-09 10:33 ` [PATCH v3 9/9] s390/tishift: Convert __ashlti3(), __ashrti3(), __lshrti3() to C Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260609103343.107325-4-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=jchrist@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox