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] 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.



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