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]

Re: Problem with _bfd_elf_find_nearest_line on ia64



Hi!

>> 
>> Running /work/gnu/src/binutils/ld/testsuite/ld-undefined/undefined.exp ...
>> FAIL: undefined function
>> 
>
>This problem is caused by _bfd_elf_find_nearest_line in bfd/elf.c. It
>calls
>
>if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, 
>                                     filename_ptr, functionname_ptr,
>                                     line_ptr, 0,
>                                     &elf_tdata (abfd)->dwarf2_find_line_info))
>
>If you pass 0 as addr_size to _bfd_dwarf2_find_nearest_line, it will
>use the default addr_size, which is 4. It seems incorrect for ia64.
>Setting addr_size to 8 fixes the problem. Could someone please fix
>it?
>

The term 'addr_size' is completely missleading.  It does not correspond
to the target CPU address size.  This is the size of offsets in the Dwarf2
sections, that is either 32 or 64 (4 or 8 if you like).  So, it has nothing
to do with the target really.


As such, this value *should* be computed either from the elf_size_info 
structure that we can access from the abfd struct, or, by looking at the
.debug_info content.  That is, the easy way is something like:  

  struct elf_backend_data *bed = get_elf_backend_data (abfd);

  addr_size = bed->s->arch_size / 8;


	[And by the way, we could rename the local variable to 
	 'arch_size', which would have more sense (or object_size).]


For the hard way (.debug_info), have a look at read_initial_length() 
function in gdb/dwarf2read.c, and also in the Dwarf2.1 draft.


Note, the target CPU address size is obtained from the .debug_info section
(see parse_comp_unit()).

	Stephane

-	-	-	-	-	-	-	-	-	-
Stephane |Sun Microsystems			|
 Carrez	 |Network Service Provider Division	| http://www.sun.com
	 |6 avenue Gustave Eiffel		|
	 |F-78182, St-Quentin-en-Yvelines-Cedex |

email: Stephane.Carrez@France.Sun.COM



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