Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp444282imn; Thu, 28 Jul 2022 05:43:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u1mU92uYqnl/yloqammyxGEVefuV24Lt43iFfMTvXHuibuSBt59H60b9EG2cNfAr/60xym X-Received: by 2002:a17:907:7209:b0:72b:924b:60a8 with SMTP id dr9-20020a170907720900b0072b924b60a8mr21834298ejc.442.1659012216788; Thu, 28 Jul 2022 05:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659012216; cv=none; d=google.com; s=arc-20160816; b=Y+68otmtTfI239dCqZGmVjaEGYSonRmwi1V2mpaNE4eobXs8ik9YdDnRMnhBSJPhGl 3JT6Qzte0GxzOn7h7k0V6NZIGD53PhFQagTyeHXIXm7VJSEZWTNHYY2Di6gDcKacBN3P RIRbm1VikJ6LvCsiP6F0lWSQppQnxRFpIW7acvkanjKFYBAfmlfeTVeJa83t/1d84VUx D/o/DrAJS0w8tQUTP6qJVwXWE+fjyAoBMZrhEAjcfcaYrhB3RuXU96+J1mOQ00Je2S6G MelSIH6MwgA8DnxStSEDIp3WR3qdBbJuSb0OYzm2Io0Q8hgelsIJ5YS16a4Rg/PAdxuU VUxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=+emSW0p7BwktGOXn5yRIG6tXKxRDyGmBeVZsOE7Nkec=; b=NPr3ulx8NcuJnUZjjoqh4hg2XvLO0ElhzttQ5VS7nnLs/cVaERnwHbvo6io5KfJuF/ XodquRkjiNDLqh2GrsiC8cJ9hqt+jqJSzgWNChVcn4DuSjoKtTsyWet+duT1KvSUUKjO zsllSM8dDiU9OOoExB+h1zyQwzKVp71pSDFhWtveRZf4SE8EETW0LaP2IfiiSEfPJuOV weQpHA8Deco1ha2+EJ/33qTECOV7nCx0J0rw1VddHvbiH5PM+xekz/XadsvnSdyvcfeo SxcHRYRpHgEok2pYhW8yiOZN/Ww6oiiBqHiv5XfZ8C/hZUlxzBQ2eT/e1937kUUQAc5k mdlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=hXenhSPs; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs8-20020a0564020c4800b0043c2919cfcesi676027edb.122.2022.07.28.05.43.09; Thu, 28 Jul 2022 05:43:36 -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=@xry111.site header.s=default header.b=hXenhSPs; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237411AbiG1MDY (ORCPT + 99 others); Thu, 28 Jul 2022 08:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236715AbiG1MDW (ORCPT ); Thu, 28 Jul 2022 08:03:22 -0400 Received: from xry111.site (xry111.site [89.208.246.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE2A69F38 for ; Thu, 28 Jul 2022 05:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1659009800; bh=EZnr0YR7ZPeHRwzChn24PNNI7AiTGk9fxiN8hdbqu60=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=hXenhSPsjPRMpq5CIREu1VrkYsOOPEmswShcZXu3GwJj2sGUc1LvoncO4ESwrFELm FaUfdfZkesyG3d6jMJr+KyGpMXWK/79vvgLqdh2ErOdH2azcj+pdrdA88vEdud1bAL vZ36JUctXypGxlvymR+jU/45MKyWbc1KM7iKCHk8= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 896B466961; Thu, 28 Jul 2022 08:03:19 -0400 (EDT) Message-ID: Subject: [PATCH v2 3/4] LoongArch: Stop using undocumented assembler options From: Xi Ruoyao To: loongarch@lists.linux.dev Cc: linux-kernel@vger.kernel.org, WANG Xuerui , Huacai Chen , Youling Tang , Jinyang He Date: Thu, 28 Jul 2022 20:03:17 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.3 MIME-Version: 1.0 X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD, PDS_OTHER_BAD_TLD,SPF_HELO_PASS,SPF_PASS autolearn=no 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 Now we can handle GOT and GOT-based relocations properly, remove the undocumented `-Wa,-mla-{global,local}-with-{pcrel,abs}` assembler hacks. And, -fplt is the default of all supported compilers (GCC, and maybe Clang in the future), so it can be removed as well. Adjust assembly code to explicitly use "la.pcrel" where necessary. Signed-off-by: Xi Ruoyao --- arch/loongarch/Makefile | 4 ---- arch/loongarch/kernel/head.S | 10 +++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index 039dcc4fe1f3..800349ea9310 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -40,10 +40,6 @@ endif =20 cflags-y +=3D -G0 -pipe -msoft-float LDFLAGS_vmlinux +=3D -G0 -static -n -nostdlib -KBUILD_AFLAGS_KERNEL +=3D -Wa,-mla-global-with-pcrel -KBUILD_CFLAGS_KERNEL +=3D -Wa,-mla-global-with-pcrel -KBUILD_AFLAGS_MODULE +=3D -Wa,-mla-global-with-abs -KBUILD_CFLAGS_MODULE +=3D -fplt -Wa,-mla-global-with-abs,-mla-local-with-= abs =20 cflags-y +=3D -ffreestanding cflags-y +=3D $(call cc-option, -mno-check-zero-division) diff --git a/arch/loongarch/kernel/head.S b/arch/loongarch/kernel/head.S index 74ea7bf6c8d6..193329ed6e8c 100644 --- a/arch/loongarch/kernel/head.S +++ b/arch/loongarch/kernel/head.S @@ -60,17 +60,17 @@ SYM_CODE_START(kernel_entry) # kernel entry point la.abs t0, 0f jirl zero, t0, 0 0: - la t0, __bss_start # clear .bss + la.pcrel t0, __bss_start # clear .bss st.d zero, t0, 0 - la t1, __bss_stop - LONGSIZE + la.pcrel t1, __bss_stop - LONGSIZE 1: addi.d t0, t0, LONGSIZE st.d zero, t0, 0 bne t0, t1, 1b =20 - la t0, fw_arg0 + la.pcrel t0, fw_arg0 st.d a0, t0, 0 # firmware arguments - la t0, fw_arg1 + la.pcrel t0, fw_arg1 st.d a1, t0, 0 =20 /* KSave3 used for percpu base, initialized as 0 */ @@ -78,7 +78,7 @@ SYM_CODE_START(kernel_entry) # kernel entry point /* GPR21 used for percpu base (runtime), initialized as 0 */ or u0, zero, zero =20 - la tp, init_thread_union + la.pcrel tp, init_thread_union /* Set the SP after an empty pt_regs. */ PTR_LI sp, (_THREAD_SIZE - 32 - PT_SIZE) PTR_ADD sp, sp, tp --=20 2.37.0