This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Check invalid x32 relocations.


>>> On 15.01.11 at 16:50, "H.J. Lu" <hongjiu.lu@intel.com> wrote:
> --- a/bfd/elf64-x86-64.c
> +++ b/bfd/elf64-x86-64.c
> @@ -1179,6 +1179,39 @@ elf_x86_64_check_relocs (bfd *abfd, struct 
> bfd_link_info *info,
>  	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
>  	}
>  
> +      /* Check invalid x32 relocations.  */
> +      if (!ABI_64_P (abfd))
> +	switch (r_type)
> +	  {
> +	  default:
> +	    break;
> +
> +	  case R_X86_64_64:

While I buy that all the below ones are meaningless, excluding
the one above seems questionable (and exposes one further
reason why tying the ABI to object file format is bogus). An
obvious use case is to initialize a 64-bit variable with a constant
defined in another object.

Jan

> +	  case R_X86_64_DTPOFF64:
> +	  case R_X86_64_TPOFF64:
> +	  case R_X86_64_PC64:
> +	  case R_X86_64_GOTOFF64:
> +	  case R_X86_64_GOT64:
> +	  case R_X86_64_GOTPCREL64:
> +	  case R_X86_64_GOTPC64:
> +	  case R_X86_64_GOTPLT64:
> +	  case R_X86_64_PLTOFF64:
> +	      {
> +		if (h)
> +		  name = h->root.root.string;
> +		else
> +		  name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
> +					   NULL);
> +		(*_bfd_error_handler)
> +		  (_("%B: relocation %s against symbol `%s' isn't "
> +		     "supported in x32 mode"), abfd,
> +		   x86_64_elf_howto_table[r_type].name, name);
> +		bfd_set_error (bfd_error_bad_value);
> +		return FALSE;
> +	      }
> +	    break;
> +	  }
> +
>        if (h != NULL)
>  	{
>  	  /* Create the ifunc sections for static executables.  If we




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]