[RFA] Perform relocations in dwarf2.c

Daniel Berlin dberlin@dberlin.org
Thu Oct 24 11:12:00 GMT 2002


>
>> @@ -1981,28 +2002,14 @@ _bfd_dwarf2_find_nearest_line (abfd, sec
>>      {
>>        bfd_vma length;
>>        boolean found;
>> -      unsigned int offset_size = addr_size;
>> -
>> -      if (addr_size == 4)
>> -	{
>> -	  length = read_4_bytes (abfd, stash->info_ptr);
>> -	  if (length == 0xffffffff)
>> -	    {
>> -	      offset_size = 8;
>> -	      length = read_8_bytes (abfd, stash->info_ptr + 4);
>> -	      stash->info_ptr += 8;
>> -	    }
>> -	  else if (length == 0)
>> -	    {
>> -	      /* Handle (non-standard) 64-bit DWARF2 formats.  */
>> -	      offset_size = 8;
>> -	      length = read_4_bytes (abfd, stash->info_ptr + 4);
>> -	      stash->info_ptr += 4;
>> -	    }
>> -	}
>> -      else
>> -	length = read_8_bytes (abfd, stash->info_ptr);
>> -      stash->info_ptr += addr_size;
>> +      /* All checked 64b platforms use 32b offsets in .debug_info.
>> +       * 32b platforms use this size as well, of course. Seems to be
>> +       * safe to hardcode it here.
>> +       * Checked on x86-64, alpha, ia64, sparc64 -- mludvig */
>> +      unsigned int offset_size = 4;
>> +
>> +      length = read_4_bytes (abfd, stash->info_ptr);
>> +      stash->info_ptr += offset_size;
>>
>>        if (length > 0)
>>  	{
>
> Come on.  Look at the CVS history for this file; two people have
> changed it in the past year.  One branch is for ELF64 and the other is
> for some SGI format, I believe.
Something like that.
The length = 0xfffffffff is standard specified 64 bit "offset" DWARF2, 
though i think it's actually meant for >4g of debug info on 32 bit 
platforms. The pointer size is different and specified elsewhere from 
the offset size, the length == 0x0 is SGI "before the standard" 64 bit 
"offset" DWARF2 on 32 bit platforms.
The other branch is 64 bit DWARF2 on 64 bit platforms.
>  You shouldn't be casually deleting
> code like this if you don't even know what platforms it is for.
>
> The list archives would be glad to tell you.

He's also removing the checks for what the standard specifically says 
is the right thing.

If it doesn't work as is, something else is broken, as the code is 
correct.
--Dan



More information about the Binutils mailing list