From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by sourceware.org (Postfix) with ESMTPS id 9F0D33858427 for ; Fri, 13 May 2022 01:50:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F0D33858427 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=xen0n.name Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xen0n.name DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1652406636; bh=x5NUFDeK7sh9TSFqnRFdt8rD9XafZhmHTmZFnKBZczw=; h=Date:Subject:To:References:From:In-Reply-To:From; b=fvLNVLbdi3UmEfyxFS6IVqdtYzh/MbUlsfGcsBPfQLMEhGw+hjomAXsvLKfhGCbLR ldo5FtW9HVZwhE8HqQHnGt3QUEU2aHD2Xo0rzSBrE8Ju0XhzWh0m1uLLNTe+IPJS3u q++yQ5CW0CwqgmA1a6YyJRCb8Ql0c0uUfGZGX2M4= Received: from [192.168.9.172] (unknown [101.88.28.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 08E43600B5; Fri, 13 May 2022 09:50:36 +0800 (CST) Message-ID: <382c2224-7d0b-4a5c-803b-85580f35976b@xen0n.name> Date: Fri, 13 May 2022 09:50:35 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0a1 Subject: Re: [PATCH 1/2] remove R_LARCH_{SUB,ADD}24, since LA does not need them Content-Language: en-US To: Huang Pei , Zhensong Liu , binutils , Chenghua Xu References: <20220513013523.85151-1-huangpei@loongson.cn> From: WANG Xuerui In-Reply-To: <20220513013523.85151-1-huangpei@loongson.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-15.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 01:50:42 -0000 Hi, On 5/13/22 09:35, Huang Pei wrote: > --- > bfd/bfd-in2.h | 2 -- > bfd/elfnn-loongarch.c | 4 ---- > bfd/elfxx-loongarch.c | 34 ++-------------------------------- > bfd/libbfd.h | 2 -- > bfd/reloc.c | 4 ---- > gas/config/tc-loongarch.c | 15 +++++---------- > include/elf/loongarch.h | 4 ++-- > 7 files changed, 9 insertions(+), 56 deletions(-) > > diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h > index 50e26fc691d..be00a4e5514 100644 > --- a/bfd/bfd-in2.h > +++ b/bfd/bfd-in2.h > @@ -6297,12 +6297,10 @@ assembler and not (currently) written to any object files. */ > BFD_RELOC_LARCH_SOP_POP_32_U, > BFD_RELOC_LARCH_ADD8, > BFD_RELOC_LARCH_ADD16, > - BFD_RELOC_LARCH_ADD24, > BFD_RELOC_LARCH_ADD32, > BFD_RELOC_LARCH_ADD64, > BFD_RELOC_LARCH_SUB8, > BFD_RELOC_LARCH_SUB16, > - BFD_RELOC_LARCH_SUB24, > BFD_RELOC_LARCH_SUB32, > BFD_RELOC_LARCH_SUB64, > BFD_RELOC_UNUSED }; > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > index 5b44901b9e0..e4cd9fa107e 100644 > --- a/bfd/elfnn-loongarch.c > +++ b/bfd/elfnn-loongarch.c > @@ -1768,7 +1768,6 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, > > case R_LARCH_ADD8: > case R_LARCH_ADD16: > - case R_LARCH_ADD24: > case R_LARCH_ADD32: > case R_LARCH_ADD64: > r = loongarch_check_offset (rel, input_section); > @@ -1781,7 +1780,6 @@ perform_relocation (const Elf_Internal_Rela *rel, asection *input_section, > > case R_LARCH_SUB8: > case R_LARCH_SUB16: > - case R_LARCH_SUB24: > case R_LARCH_SUB32: > case R_LARCH_SUB64: > r = loongarch_check_offset (rel, input_section); > @@ -2181,12 +2179,10 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, > > case R_LARCH_ADD8: > case R_LARCH_ADD16: > - case R_LARCH_ADD24: > case R_LARCH_ADD32: > case R_LARCH_ADD64: > case R_LARCH_SUB8: > case R_LARCH_SUB16: > - case R_LARCH_SUB24: > case R_LARCH_SUB32: > case R_LARCH_SUB64: > if (resolved_dynly) > diff --git a/bfd/elfxx-loongarch.c b/bfd/elfxx-loongarch.c > index 6f7c82297c5..c0c4b477af6 100644 > --- a/bfd/elfxx-loongarch.c > +++ b/bfd/elfxx-loongarch.c > @@ -524,23 +524,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = > false, /* pcrel_offset */ > BFD_RELOC_LARCH_ADD16, /* bfd_reloc_code_real_type */ > NULL), /* adjust_reloc_bits */ > - > - LOONGARCH_HOWTO (R_LARCH_ADD24, /* type (49). */ > - 0, /* rightshift. */ > - 2, /* size. */ > - 24, /* bitsize. */ > - false, /* pc_relative. */ > - 0, /* bitpos. */ > - complain_overflow_signed, /* complain_on_overflow. */ > - bfd_elf_generic_reloc, /* special_function. */ > - "R_LARCH_ADD24", /* name. */ > - false, /* partial_inplace. */ > - 0, /* src_mask */ > - ALL_ONES, /* dst_mask */ > - false, /* pcrel_offset */ > - BFD_RELOC_LARCH_ADD24, /* bfd_reloc_code_real_type */ > - NULL), /* adjust_reloc_bits */ > - > + LOONGARCH_EMPTY_HOWTO(49), > LOONGARCH_HOWTO (R_LARCH_ADD32, /* type (50). */ > 0, /* rightshift. */ > 2, /* size. */ > @@ -605,21 +589,7 @@ static loongarch_reloc_howto_type loongarch_howto_table[] = > BFD_RELOC_LARCH_SUB16, /* bfd_reloc_code_real_type */ > NULL), /* adjust_reloc_bits */ > > - LOONGARCH_HOWTO (R_LARCH_SUB24, /* type (54). */ > - 0, /* rightshift. */ > - 2, /* size. */ > - 24, /* bitsize. */ > - false, /* pc_relative. */ > - 0, /* bitpos. */ > - complain_overflow_signed, /* complain_on_overflow. */ > - bfd_elf_generic_reloc, /* special_function. */ > - "R_LARCH_SUB24", /* name. */ > - false, /* partial_inplace. */ > - 0, /* src_mask */ > - ALL_ONES, /* dst_mask */ > - false, /* pcrel_offset */ > - BFD_RELOC_LARCH_SUB24, /* bfd_reloc_code_real_type */ > - NULL), /* adjust_reloc_bits */ > + LOONGARCH_EMPTY_HOWTO(54), > > LOONGARCH_HOWTO (R_LARCH_SUB32, /* type (55). */ > 0, /* rightshift. */ > diff --git a/bfd/libbfd.h b/bfd/libbfd.h > index 8c02e29eebd..ab35ef6518f 100644 > --- a/bfd/libbfd.h > +++ b/bfd/libbfd.h > @@ -3453,12 +3453,10 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", > "BFD_RELOC_LARCH_SOP_POP_32_U", > "BFD_RELOC_LARCH_ADD8", > "BFD_RELOC_LARCH_ADD16", > - "BFD_RELOC_LARCH_ADD24", > "BFD_RELOC_LARCH_ADD32", > "BFD_RELOC_LARCH_ADD64", > "BFD_RELOC_LARCH_SUB8", > "BFD_RELOC_LARCH_SUB16", > - "BFD_RELOC_LARCH_SUB24", > "BFD_RELOC_LARCH_SUB32", > "BFD_RELOC_LARCH_SUB64", > "@@overflow: BFD_RELOC_UNUSED@@", > diff --git a/bfd/reloc.c b/bfd/reloc.c > index 5098e0ab09f..4aea37f8620 100644 > --- a/bfd/reloc.c > +++ b/bfd/reloc.c > @@ -8245,8 +8245,6 @@ ENUMX > BFD_RELOC_LARCH_ADD8 > ENUMX > BFD_RELOC_LARCH_ADD16 > -ENUMX > - BFD_RELOC_LARCH_ADD24 > ENUMX > BFD_RELOC_LARCH_ADD32 > ENUMX > @@ -8255,8 +8253,6 @@ ENUMX > BFD_RELOC_LARCH_SUB8 > ENUMX > BFD_RELOC_LARCH_SUB16 > -ENUMX > - BFD_RELOC_LARCH_SUB24 > ENUMX > BFD_RELOC_LARCH_SUB32 > ENUMX > diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c > index 08203d291bd..4808c73fc70 100644 > --- a/gas/config/tc-loongarch.c > +++ b/gas/config/tc-loongarch.c > @@ -1141,13 +1141,12 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) > fix_reloc_insn (fixP, (bfd_vma)stack_top, buf); > break; > > - case BFD_RELOC_64: > case BFD_RELOC_32: > - if (fixP->fx_subsy) > - { > - case BFD_RELOC_24: > + case BFD_RELOC_64: > case BFD_RELOC_16: > case BFD_RELOC_8: > + if (fixP->fx_subsy) > + { > fixP->fx_next = xmemdup (fixP, sizeof (*fixP), sizeof (*fixP)); > fixP->fx_next->fx_addsy = fixP->fx_subsy; > fixP->fx_next->fx_subsy = NULL; > @@ -1164,10 +1163,6 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) > fixP->fx_r_type = BFD_RELOC_LARCH_ADD32; > fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB32; > break; > - case BFD_RELOC_24: > - fixP->fx_r_type = BFD_RELOC_LARCH_ADD24; > - fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB24; > - break; > case BFD_RELOC_16: > fixP->fx_r_type = BFD_RELOC_LARCH_ADD16; > fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB16; > @@ -1176,8 +1171,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) > fixP->fx_r_type = BFD_RELOC_LARCH_ADD8; > fixP->fx_next->fx_r_type = BFD_RELOC_LARCH_SUB8; > break; > - default: > - break; > + default: > + break; > } > md_number_to_chars (buf, 0, fixP->fx_size); > if (fixP->fx_next->fx_addsy == NULL) > diff --git a/include/elf/loongarch.h b/include/elf/loongarch.h > index b7aa4ff069c..796ef8b8614 100644 > --- a/include/elf/loongarch.h > +++ b/include/elf/loongarch.h > @@ -77,12 +77,12 @@ RELOC_NUMBER (R_LARCH_SOP_POP_32_U, 46) > /* Used by the static linker for relocating non .text. */ > RELOC_NUMBER (R_LARCH_ADD8, 47) > RELOC_NUMBER (R_LARCH_ADD16, 48) > -RELOC_NUMBER (R_LARCH_ADD24, 49) > +/* deprecated, 49 not used */ > RELOC_NUMBER (R_LARCH_ADD32, 50) > RELOC_NUMBER (R_LARCH_ADD64, 51) > RELOC_NUMBER (R_LARCH_SUB8, 52) > RELOC_NUMBER (R_LARCH_SUB16, 53) > -RELOC_NUMBER (R_LARCH_SUB24, 54) > +/* deprecated, 54 not used */ > RELOC_NUMBER (R_LARCH_SUB32, 55) > RELOC_NUMBER (R_LARCH_SUB64, 56) > It may be better to accompany this commit with a corresponding amendment to the LoongArch ELF psABI spec document. Ideally merge that psABI spec update before submitting this patch, so you get to include a link to the relevant PR in the commit message.