public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: WANG Xuerui <i.swmail@xen0n.name>
To: Huang Pei <huangpei@loongson.cn>,
	Zhensong Liu <liuzhensong@loongson.cn>,
	 binutils <binutils@sourceware.org>,
	Chenghua Xu <xuchenghua@loongson.cn>
Subject: Re: [PATCH 1/2] remove R_LARCH_{SUB,ADD}24, since LA does not need them
Date: Fri, 13 May 2022 09:50:35 +0800	[thread overview]
Message-ID: <382c2224-7d0b-4a5c-803b-85580f35976b@xen0n.name> (raw)
In-Reply-To: <20220513013523.85151-1-huangpei@loongson.cn>

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.

  parent reply	other threads:[~2022-05-13  1:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13  1:35 Huang Pei
2022-05-13  1:35 ` [PATCH 2/2] partial revert 5a91f93b983184c64b3a9332f5f4339d17941d76 Huang Pei
2022-05-13  1:55   ` WANG Xuerui
2022-05-13  8:58     ` Huang Pei
2022-05-13  1:50 ` WANG Xuerui [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-12 12:56 [PATCH 1/2] remove R_LARCH_{SUB,ADD}24, since LA does not need them Huang Pei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=382c2224-7d0b-4a5c-803b-85580f35976b@xen0n.name \
    --to=i.swmail@xen0n.name \
    --cc=binutils@sourceware.org \
    --cc=huangpei@loongson.cn \
    --cc=liuzhensong@loongson.cn \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).