This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH] Tiny 64-bit Dwarf2 glitch
- From: Jason Eckhardt <jle at owlnet dot rice dot edu>
- To: Kevin Buettner <kevinb at redhat dot com>
- Cc: Jason Lee Eckhardt <jle at owlnet dot rice dot edu>, <binutils at sources dot redhat dot com>
- Date: Tue, 25 Jun 2002 15:15:05 -0500 (CDT)
- Subject: Re: [PATCH] Tiny 64-bit Dwarf2 glitch
On Tue, 25 Jun 2002, Kevin Buettner wrote:
> >
> > /* Read in the prologue. */
> > ! lh.total_length = read_4_bytes (abfd, line_ptr);
> > ! line_ptr += 4;
> > ! offset_size = 4;
> > ! if (lh.total_length == 0xffffffff)
>
> Why are you eliminating the escape mechanism that indicates 64-bit
> offsets?
Note that I didn't eliminate it, I replaced it with a check of
unit->addr_size. I chose to do this because:
1. The "escape mechanism" isn't working for at least one back-end
(elf64-bigmips). That is, it isn't returning 0xffffffff to
indicate 64-bit offsets (this probably needs investigating too,
but it is peripheral to what I'm currently trying to solve).
2. Even if it did work, I believe the new check is more explanatory/
explicit than checking if read_4_bytes returned some hard-coded
escape constant value. If this is incorrect, or undesirable,
please explain why.
But setting that issue aside, the original code appears bogus
(even assuming the escape mechanism works):
/* Read in the prologue. */
lh.total_length = read_4_bytes (abfd, line_ptr);
line_ptr += 4;
offset_size = 4;
if (lh.total_length == 0xffffffff)
{
lh.total_length = read_8_bytes (abfd, line_ptr);
line_ptr += 8;
offset_size = 8;
}
Can you see the obvious problem?
The current patch solved my problem for both 32 and 64-bit ELF64/mips
binaries, whereas the original code fails miserably.
If someone has a better way to correct the defect, please let me know.
This defect prevents a binary analysis tool I'm working on from
functioning properly.