mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: WANG Xuerui <kernel@xen0n.name>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
	loongarch@lists.linux.dev, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org, WANG Xuerui <git@xen0n.name>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: [PATCH] LoongArch: Drop -ffreestanding from CFLAGS
Date: Fri,  4 Aug 2023 20:56:09 +0800	[thread overview]
Message-ID: <20230804125609.2054719-1-kernel@xen0n.name> (raw)

From: WANG Xuerui <git@xen0n.name>

As explained by Nick in the original issue: the kernel usually does a
good job of providing library helpers that have similar semantics as
their ordinary userspace libc equivalents, but -ffreestanding disables
such libcall optimization and other related features in the compiler,
which can lead to unexpected things such as CONFIG_FORTIFY_SOURCE not
working (!).

As it turns out to be the case, removing the flag does not impact the
LoongArch kernel's normal operation at all; so just remove it to
restore expected libcall semantics globally on this architecture.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1897
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: WANG Xuerui <git@xen0n.name>
---
 arch/loongarch/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index b1e5db51b61c..db0d7210272d 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -83,7 +83,6 @@ KBUILD_CFLAGS_KERNEL		+= -fPIE
 LDFLAGS_vmlinux			+= -static -pie --no-dynamic-linker -z notext
 endif
 
-cflags-y += -ffreestanding
 cflags-y += $(call cc-option, -mno-check-zero-division)
 
 load-y		= 0x9000000000200000
-- 
2.40.0


             reply	other threads:[~2023-08-04 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 12:56 WANG Xuerui [this message]
2023-08-04 15:25 ` Huacai Chen
2023-08-04 15:46   ` Nick Desaulniers
2023-08-04 15:56     ` Xi Ruoyao
2023-08-04 16:15       ` Nick Desaulniers
2023-08-04 20:46 ` kernel test robot

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=20230804125609.2054719-1-kernel@xen0n.name \
    --to=kernel@xen0n.name \
    --cc=chenhuacai@kernel.org \
    --cc=git@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=loongarch@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.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

all inboxes | Powered by JetHome®