[PATCH] x86: Remove duplicated I386_PCREL_TYPE_P/X86_64_PCREL_TYPE_P

H.J. Lu hjl.tools@gmail.com
Thu Jan 5 16:50:20 GMT 2023


On Wed, Jan 4, 2023 at 11:42 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 04.01.2023 20:14, H.J. Lu via Binutils wrote:
> > I386_PCREL_TYPE_P and X86_64_PCREL_TYPE_P are defined twice.  Remove
> > the duplications.
>
> I recall noticing this as well, quite some time back, but I didn't feel
> like touching it because I was puzzled by ...
>
> > --- a/bfd/elfxx-x86.h
> > +++ b/bfd/elfxx-x86.h
> > @@ -97,13 +97,6 @@
> >  #define PLT_FDE_START_OFFSET 4 + PLT_CIE_LENGTH + 8
> >  #define PLT_FDE_LEN_OFFSET   4 + PLT_CIE_LENGTH + 12
> >
> > -#define I386_PCREL_TYPE_P(TYPE) ((TYPE) == R_386_PC32)
>
> ... this not including PC8 and PC16 when ...

This is I386_PCREL_TYPE_P.

> > -#define X86_64_PCREL_TYPE_P(TYPE) \
> > -  ((TYPE) == R_X86_64_PC8 \
> > -   || (TYPE) == R_X86_64_PC16 \
> > -   || (TYPE) == R_X86_64_PC32 \
> > -   || (TYPE) == R_X86_64_PC64)
>
> ... this does.

This is X86_64_PCREL_TYPE_P, not I386_PCREL_TYPE_P.

> Jan

The current ones have

#define X86_64_PCREL_TYPE_P(TYPE) \
  ((TYPE) == R_X86_64_PC8 \
   || (TYPE) == R_X86_64_PC16 \
   || (TYPE) == R_X86_64_PC32 \
   || (TYPE) == R_X86_64_PC64)
#define I386_PCREL_TYPE_P(TYPE) ((TYPE) == R_386_PC32)

and the ones I removed are

-#define I386_PCREL_TYPE_P(TYPE) ((TYPE) == R_386_PC32)
-#define X86_64_PCREL_TYPE_P(TYPE) \
-  ((TYPE) == R_X86_64_PC8 \
-   || (TYPE) == R_X86_64_PC16 \
-   || (TYPE) == R_X86_64_PC32 \
-   || (TYPE) == R_X86_64_PC64)

They are identical.

-- 
H.J.


More information about the Binutils mailing list