This is the mail archive of the binutils@sources.redhat.com 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] elf64-hppa handling for undefweak symbols


On Wed, Jul 23, 2003 at 09:50:24PM -0700, Randolph Chung wrote:
> 2003-07-15  Randolph Chung <tausq@debian.org>
> 
> 	* elf-hppa.h: fill in dyn_h to pass to 
> 	elf_hppa_final_link_relocate
> 	* elf64-hppa.c: check to make sure symbol is
> 	defined before applying relocation

ChangeLog needs to include function.

	* elf-hppa.h (elf_hppa_relocate_section): Look up dyn_h for undefweak.
	* elf64-hppa.c (elf64_hppa_finalize_dlt): Check h->root.type.

Applied with some tweaks.

> Index: elf-hppa.h
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf-hppa.h,v
> retrieving revision 1.62
> diff -u -p -r1.62 elf-hppa.h
> --- elf-hppa.h	25 Jun 2003 06:40:19 -0000	1.62
> +++ elf-hppa.h	16 Jul 2003 05:10:49 -0000
> @@ -1496,7 +1496,22 @@ elf_hppa_relocate_section (output_bfd, i
>  	      relocation = 0;
>  	    }
>  	  else if (h->root.type == bfd_link_hash_undefweak)
> -	    relocation = 0;
> +            {
> +	      dyn_name = get_dyn_name (input_section, h, rel,
> +				       &dynh_buf, &dynh_buflen);
> +	      dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
> +						  dyn_name, FALSE, FALSE);
> +
> +	      if (dyn_h == NULL)
> +		{
> +		  (*_bfd_error_handler)
> +		    (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
> +		     bfd_archive_filename (input_bfd), h->root.root.string,
> +		     bfd_get_section_name (input_bfd, input_section));
> +		  relocation = 0;

Redundant assignment removed.

> +		}
> +	      relocation = 0;
> +	    }
>  	  else
>  	    {
>  	      /* Ignore dynamic loader defined symbols.  */
> Index: elf64-hppa.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 elf64-hppa.c
> --- elf64-hppa.c	25 Jun 2003 06:40:23 -0000	1.33
> +++ elf64-hppa.c	16 Jul 2003 05:10:49 -0000
> @@ -2269,7 +2269,9 @@ elf64_hppa_finalize_dlt (dyn_h, data)
>  		   + hppa_info->opd_sec->output_offset
>  		   + hppa_info->opd_sec->output_section->vma);
>  	}
> -      else if (h->root.u.def.section)
> +      else if (h->root.type != bfd_link_hash_undefined &&
> +               h->root.type != bfd_link_hash_undefweak &&
> +	       h->root.u.def.section)

Formatting!  Hmm, better rewritten as

      else if ((h->root.type == bfd_link_hash_defined
		|| h->root.type == bfd_link_hash_defweak)
	       && h->root.u.def.section)

>  	{
>  	  value = h->root.u.def.value + h->root.u.def.section->output_offset;
>  	  if (h->root.u.def.section->output_section)
> 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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