From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 47A0A3858D34 for ; Thu, 22 Feb 2024 11:09:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47A0A3858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47A0A3858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708600192; cv=none; b=t+p6g4BoEU3woQWxLTux3jiH3q/+mdZ84QrwLVnrPCHgPfn7WdaWEYKFI2LCy+24f4lUcr0SeKmcfWD/Hj0mDGXYc6kIBQcl3qdPuQirokmkW6i5WlDRwgwF1QCqDEiC5E5kU2Poj0+W+UrwmHtGlbJZmTgZwhiB/sdogE3lqn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708600192; c=relaxed/simple; bh=k4N0jlBBWbqSN0lda4wUkWA30jAiPTAJmeweI0C5gms=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=MWSCvmu73fb1CUggiQBzRt/QAY7bL1v/pGuXRhftW5I5iqub2XZQI1IJkrJRN2czZtIi8D9pWFg8cB0uiIEfEWY9CRbei7+dOkSGLgdp51aPhRxNNgXEDbiyldvC9mFnGwQGMas24AvSoIhbHXkJ3W5SbgkfgGUaDGEcTLe2D8k= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.20.4.107]) by gateway (Coremail) with SMTP id _____8Axuuh2K9dl1C4QAA--.22258S3; Thu, 22 Feb 2024 19:09:43 +0800 (CST) Received: from [10.20.4.107] (unknown [10.20.4.107]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxVMx1K9dl5L0+AA--.36038S3; Thu, 22 Feb 2024 19:09:41 +0800 (CST) Subject: Re: [GCC 13 PATCH] LoongArch: Don't default to -mno-explicit-relocs if -mno-relax To: Xi Ruoyao , gcc-patches@gcc.gnu.org Cc: i@xen0n.name, xuchenghua@loongson.cn References: <20240222102121.180635-1-xry111@xry111.site> From: chenglulu Message-ID: Date: Thu, 22 Feb 2024 19:09:41 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20240222102121.180635-1-xry111@xry111.site> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8BxVMx1K9dl5L0+AA--.36038S3 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoWxJw47Zw13Ary3KrWxZF1UJwc_yoWrtF43pa y7uwn3tr48tFZ7Kw1qqw1fWw45Aw17Gr12g3Waqr18Ca13WryFvF1rtr9xXF9rua15trWI qrn5Ka13u3Z8AacCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUv2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07 AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02 F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw 1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7Cj xVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r 1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8oG QDUUUUU== X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,MIME_CHARSET_FARAWAY,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: ÔÚ 2024/2/22 ÏÂÎç6:20, Xi Ruoyao дµÀ: > To improve Binutils compatibility we've had to backported relaxation > support. But if a user just updates to GCC 13.3 and sticks with > Binutils 2.41, there is no reason to use -mno-explicit-relocs as the > default because we are turning off relaxation for Binutils 2.41 (it > lacks conditional branch relaxation support) anyway. > > So like GCC 14, make the default of -m[no-]explicit-relocs depend on > -m[no-]relax instead of HAVE_AS_MRELAX_OPTION. Also update the doc to > reflect the behavior change. > > gcc/ChangeLog: > > * config/loongarch/genopts/loongarch.opt.in > (TARGET_EXPLICIT_RELOCS): Init to M_OPTION_NOT_SEEN. > * config/loongarch/loongarch.opt: Regenerate. > * config/loongarch/loongarch.cc > (loongarch_option_override_internal): Set the default of > TARGET_EXPLICIT_RELOCS to HAVE_AS_EXPLICIT_RELOCS > && !loongarch_mrelax. > * doc/invoke.texi (-m[no-]explicit-relocs): Update for > LoongArch. > --- > > Ok for releases/gcc-13? LGTM! Thanks! > > gcc/config/loongarch/genopts/loongarch.opt.in | 2 +- > gcc/config/loongarch/loongarch.cc | 4 ++++ > gcc/config/loongarch/loongarch.opt | 2 +- > gcc/doc/invoke.texi | 11 +++++------ > 4 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/gcc/config/loongarch/genopts/loongarch.opt.in b/gcc/config/loongarch/genopts/loongarch.opt.in > index da6fedd153e..76acd35d39c 100644 > --- a/gcc/config/loongarch/genopts/loongarch.opt.in > +++ b/gcc/config/loongarch/genopts/loongarch.opt.in > @@ -155,7 +155,7 @@ Target Joined RejectNegative UInteger Var(loongarch_max_inline_memcpy_size) Init > -mmax-inline-memcpy-size=SIZE Set the max size of memcpy to inline, default is 1024. > > mexplicit-relocs > -Target Var(TARGET_EXPLICIT_RELOCS) Init(HAVE_AS_EXPLICIT_RELOCS & !HAVE_AS_MRELAX_OPTION) > +Target Var(TARGET_EXPLICIT_RELOCS) Init(M_OPTION_NOT_SEEN) > Use %reloc() assembly operators. > > ; The code model option names for -mcmodel. > diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc > index 768e2427285..e78b81cd8fc 100644 > --- a/gcc/config/loongarch/loongarch.cc > +++ b/gcc/config/loongarch/loongarch.cc > @@ -6222,6 +6222,10 @@ loongarch_option_override_internal (struct gcc_options *opts) > gcc_unreachable (); > } > > + if (TARGET_EXPLICIT_RELOCS == M_OPTION_NOT_SEEN) > + TARGET_EXPLICIT_RELOCS = (HAVE_AS_EXPLICIT_RELOCS > + && !loongarch_mrelax); > + > /* Validate the guard size. */ > int guard_size = param_stack_clash_protection_guard_size; > > diff --git a/gcc/config/loongarch/loongarch.opt b/gcc/config/loongarch/loongarch.opt > index 59b1e06d3f2..e61fbaed2c1 100644 > --- a/gcc/config/loongarch/loongarch.opt > +++ b/gcc/config/loongarch/loongarch.opt > @@ -162,7 +162,7 @@ Target Joined RejectNegative UInteger Var(loongarch_max_inline_memcpy_size) Init > -mmax-inline-memcpy-size=SIZE Set the max size of memcpy to inline, default is 1024. > > mexplicit-relocs > -Target Var(TARGET_EXPLICIT_RELOCS) Init(HAVE_AS_EXPLICIT_RELOCS & !HAVE_AS_MRELAX_OPTION) > +Target Var(TARGET_EXPLICIT_RELOCS) Init(M_OPTION_NOT_SEEN) > Use %reloc() assembly operators. > > ; The code model option names for -mcmodel. > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 99657fb44d8..792ce283bb9 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -25830,12 +25830,11 @@ The default code model is @code{normal}. > @itemx -mno-explicit-relocs > Use or do not use assembler relocation operators when dealing with symbolic > addresses. The alternative is to use assembler macros instead, which may > -limit optimization. The default value for the option is determined during > -GCC build-time by detecting corresponding assembler support: > -@code{-mexplicit-relocs} if said support is present, > -@code{-mno-explicit-relocs} otherwise. This option is mostly useful for > -debugging, or interoperation with assemblers different from the build-time > -one. > +limit instruction scheduling but allow linker relaxation. The default > +value for the option is determined with the assembler capability detected > +during GCC build-time and the setting of @code{-mrelax}: > +@code{-mexplicit-relocs} if the assembler supports relocation operators > +but @code{-mrelax} is not enabled, @code{-mno-explicit-relocs} otherwise. > > @opindex mdirect-extern-access > @item -mdirect-extern-access