[PATCH] x86-64: Treat PC32 relocation with branch as PLT32

Florian Weimer fweimer@redhat.com
Tue Feb 6 14:55:00 GMT 2018


On 02/06/2018 02:35 PM, H.J. Lu wrote:
> +/* Is the instruction before OFFSET in CONTENTS a 32bit relative
> +   branch?  */
> +
> +static bfd_boolean
> +is_32bit_relative_branch (bfd_byte *contents, bfd_vma offset)
> +{
> +  /* Opcode		Instruction
> +     0xe8		call
> +     0xe9		jump
> +     0x0f 0x8x		conditional jump */
> +  return ((offset > 0
> +	   && (contents [offset - 1] == 0xe8
> +	       || contents [offset - 1] == 0xe9))
> +	  || (offset > 1
> +	      && contents [offset - 2] == 0x0f
> +	      && (contents [offset - 1] & 0xf0) == 0x80));
> +}

How is this safe, considering that R_X86_64_PC32 is also used for jump 
tables and the like?

Thanks,
Florian



More information about the Binutils mailing list