Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3591104rwo; Fri, 4 Aug 2023 07:12:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBw8yXkp3X/KdGKzEI1+/oc7StfO292XI4b9dmmefDyBFprBQqdMvSAGvTIoZ0Me23eLl5 X-Received: by 2002:a17:906:3110:b0:99c:7134:ab6e with SMTP id 16-20020a170906311000b0099c7134ab6emr1793075ejx.38.1691158333277; Fri, 04 Aug 2023 07:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691158333; cv=none; d=google.com; s=arc-20160816; b=LKO0E1PEdjoQ8Cc32A+pEVk9Fw8dDpxySYGwknObG67gGuW9dyONKsuegVbjWlPL1q gymbjSCKm6i4bK3L8tb9NApL60zlE7/GP9VRYQdvspIKBkwoQ4oe1HJWbOkM/cC7wX1X x+J38bCOziII3QvbyxZxJyp+7mNRk0VRj/dc/g5M29wxE+4ASG8dzNrhlrMQD6whE/8w btaP+NeznPi7bzMzMFkgZAnrzyXZjP7frMZPSm+sTlz/BThoyvcz2qdHzSWl00AstWaN fI5+e+OpZj0E1L0G2gWn0AOkzvLTxFZkUYFTNKYhvDYslyiaQJMV691WAkUU1uA0fMsC suIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xivhDn54ytBj5lRjxATuxBQaYynJ/6kiRnbUDUVvtFk=; fh=Fu+RTI6sw8r5cKo+x7uUFGxwO2V3H27sv1xAARZQtZU=; b=wYhEbXp53PrIi4qKkFT20DJijYiZvKdOXfD8vJvD+8FPfa+x9qYQ3bcxyQI2AxV8lb pf3ygUSbWsLVyyfilqzWv0n+N0V2odopFb8RU1PKZc60mMPpn96sF/jiKfEdvSKdHxIT GOViL20ZDE7c0IbKRFM1NGlEkvK4rB03FsG7fa9BHbMtuMm3D87jF3z4tDeJo+P3lgiq yLmi44nCfhFO8J3iKAmBX0n4mnjW6+2iGIL7kJpiU9SgXl6cSIoHx4zlLCCm06ISulkX DUFaHNVwHOL3Ib/q6YiQkU6Sr4ZSxOaiFwWqToM3YReHp4F/c1T6MBKdPLNA3S9fum3U WT/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=j52ZqcX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a170906129300b00992bf8cc68csi1608784ejb.973.2023.08.04.07.11.43; Fri, 04 Aug 2023 07:12:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=j52ZqcX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229447AbjHDM4U (ORCPT + 99 others); Fri, 4 Aug 2023 08:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbjHDM4S (ORCPT ); Fri, 4 Aug 2023 08:56:18 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74F9946A8 for ; Fri, 4 Aug 2023 05:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1691153771; bh=ZMXn8jVebSrtDL/LBnjGzGXwPqNhsZz6dbtGGMrDzdM=; h=From:To:Cc:Subject:Date:From; b=j52ZqcX3hlCsROiovI7K3ufrvQbD4+1eZJDWNURt85bBy5bhkdRCnJseSXRxqlI/C w5poC7S7IF8ag+vZ2ZxtjeF+uk87kX1lA/UCuvsFa0UeRC2ZHaOfdjmJedckrLjde3 2NTodXEeSykH3g9dARM29xIURFvU61z/MSAS0pDk= Received: from ld50.lan (unknown [101.88.28.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 79398600CE; Fri, 4 Aug 2023 20:56:11 +0800 (CST) From: WANG Xuerui To: Huacai Chen Cc: Nathan Chancellor , loongarch@lists.linux.dev, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, WANG Xuerui , Nick Desaulniers Subject: [PATCH] LoongArch: Drop -ffreestanding from CFLAGS Date: Fri, 4 Aug 2023 20:56:09 +0800 Message-Id: <20230804125609.2054719-1-kernel@xen0n.name> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: WANG Xuerui 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 Suggested-by: Nick Desaulniers Signed-off-by: WANG Xuerui --- 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