Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp437102imn; Thu, 28 Jul 2022 05:30:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sqISTOFVrtxie9ZJYI97l5fm0BuPmGNyfr3/6akI8Krao+0IxQWyf0anz6dWih8vA7CFM0 X-Received: by 2002:a17:907:d07:b0:72e:ec79:ad0f with SMTP id gn7-20020a1709070d0700b0072eec79ad0fmr21297359ejc.296.1659011428222; Thu, 28 Jul 2022 05:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659011428; cv=none; d=google.com; s=arc-20160816; b=yVrEk0bOdUu6D3aOetrN7XM0lgCE4xkB5RvzE7SB2T/P3gizXfriKqj4/Pz2VE+zaL dhMJrPUuRCHiTNJ0gBw6EWs1oJEs4j/Fmbc6MUeW7vCJtL46hDMaGYXfnJfs0V3YZARH IzDwxs7j/2pD/nIedVGhVe399t57bg0QNqVbRn+6DL6XfJ+T5/i6BWti9Y3BdLHmh/II Kfkzok1qJ0xrQkRhQJsGo1W8VCoFJVeUEoQo7Db2VbxfQ23vTIaE3/pdxMdjJntpuLDp Wplu1UeyZIrl1AoX+eHw5V9a5o2gTZP7+6HKjjz5HSBFMrZEkbQWyCpZYRyfucJbkuo7 VMFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=iV014QAVIjCecST5nZ4n1zblCK/1OOS60XwljQwfsjQ=; b=LfX5ZDtsMivpzWwb+7S3znoH1FZFDgK79QOxqeKcuGKI0tyJ1JnJUwbw2jSNJNpbu+ ViqCsQ0a2r5smhvUScdhPtNZUqvaEJlLjooVME+QFpc0/5yeIRV3qwCzVOGDpP11VTeV cvk0EMoRkud4VE3IpxLg1dSOL1tbAMhVV9T0sGpOVWvrNlNcPHNEodlcO0RutWbaoXVS seWP9yMz0AB1w1OaYawXt91ojOknUC/oWt8LgYQ0jJHKyj5BoaLjN+40VVwZFEiWvjqK tGQ9XQtEWG0wGrgGlxT/rh/nPloAyby243ykDyAm9BEKwRp11hoqPcIGdNOBs+8fAMEI TFnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jO3kLyLg; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wc8-20020a170907124800b0072b9cdb8789si479505ejb.679.2022.07.28.05.30.03; Thu, 28 Jul 2022 05:30:28 -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=@kernel.org header.s=k20201202 header.b=jO3kLyLg; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237412AbiG1MZb (ORCPT + 99 others); Thu, 28 Jul 2022 08:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238371AbiG1MZ1 (ORCPT ); Thu, 28 Jul 2022 08:25:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB52A2BEC for ; Thu, 28 Jul 2022 05:25:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A2BC61CA0 for ; Thu, 28 Jul 2022 12:25:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8514C43470 for ; Thu, 28 Jul 2022 12:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659011122; bh=g5InCYzCGrDsbPmc+ADfWHf+9LhwtsQs5DQCtq4x3RU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jO3kLyLgR+n8cMt9gOJShwFvtFGDYvS4eeGB4xuZezR2yy9CaAp6008KcP72+wn4o v3IFjw7o9pHXr2AksMzkAl+smt9NBPvmE0HU+dfRqtyTTWQYjW63WsZnP5Sd4QUkHC GR3+rmLwiGQH4YHHaK3EfWl1DMDUyfk9kqKmlMiKN2MwaVLnvWICtjk+QmwB4T9rQT h3W/GPRj95XCmWO8UgSyHAViTuy4Xh26hcgKesfMXAEtGhGTct322FjSVoyVNFeWeo 8bve5R8tpcW3TVRxySFqf2CKJ/QjHtj96/Y9UXq+nVKgWvsaQzgNEx1Rd2VF4gtpUS Mx5M0oPDeWkZg== Received: by mail-vk1-f181.google.com with SMTP id r188so754018vkf.13 for ; Thu, 28 Jul 2022 05:25:22 -0700 (PDT) X-Gm-Message-State: AJIora/DjCuqsl9+zRGKGDOFv6RMD0TEC4q54RrSdTsb7eKkpV3Ylhq7 ozD7ujoQak8C6peFoIp6RUbo/gqIl8KrhUkOY2k= X-Received: by 2002:a1f:aa8b:0:b0:376:e14b:c10e with SMTP id t133-20020a1faa8b000000b00376e14bc10emr953045vke.19.1659011121683; Thu, 28 Jul 2022 05:25:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Huacai Chen Date: Thu, 28 Jul 2022 20:25:08 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/4] LoongArch: Stop using undocumented assembler options To: Xi Ruoyao Cc: loongarch@lists.linux.dev, LKML , WANG Xuerui , Youling Tang , Jinyang He Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Hi, Ruoyao, On Thu, Jul 28, 2022 at 8:03 PM Xi Ruoyao wrote: > > Now we can handle GOT and GOT-based relocations properly, remove the > undocumented `-Wa,-mla-{global,local}-with-{pcrel,abs}` assembler hacks. I think "-Wa,-mla-{global,local}-with-{pcrel,abs}" may be regular options rather than "hacks". If I'm right, the title and commit message should be updated. And we can send patches to binutils to make them "documented". Huacai > > 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 > > cflags-y += -G0 -pipe -msoft-float > LDFLAGS_vmlinux += -G0 -static -n -nostdlib > -KBUILD_AFLAGS_KERNEL += -Wa,-mla-global-with-pcrel > -KBUILD_CFLAGS_KERNEL += -Wa,-mla-global-with-pcrel > -KBUILD_AFLAGS_MODULE += -Wa,-mla-global-with-abs > -KBUILD_CFLAGS_MODULE += -fplt -Wa,-mla-global-with-abs,-mla-local-with-abs > > cflags-y += -ffreestanding > cflags-y += $(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 > > - 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 > > /* 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 > > - 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 > -- > 2.37.0 > > >