This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch x64 bfd]: Rework dump of pdata/xdata for x64
- From: Richard Henderson <rth at redhat dot com>
- To: Kai Tietz <ktietz70 at googlemail dot com>
- Cc: Binutils <binutils at sourceware dot org>, Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Date: Wed, 15 Sep 2010 10:05:22 -0700
- Subject: Re: [patch x64 bfd]: Rework dump of pdata/xdata for x64
- References: <AANLkTikxtNp6hmr1V1qc3HT=E_Rnpm6ob1OK1j1B3afT@mail.gmail.com>
On 09/15/2010 08:17 AM, Kai Tietz wrote:
> + fprintf (file, " has %s begin address as antecessor\n",
predecessor
> + fprintf (file, " has negate begin address\n");
negative
> +static bfd_vma
> +find_next_xdata_or_end (bfd *abfd, bfd_byte *pdata, bfd_size_type stop,
> + int onaline, bfd_vma cur_address, bfd_vma max_size)
I do wonder if a linear search is the right thing here.
What about something like
N = number of pdata entries;
A = new rva[N + 1];
for (i = 0; i < N; i++)
A[i] = pdata[i].xdata_rva;
A[N] = xdata_end;
sort(A);
rva find_next_xdata(rva user_data)
{
Binary search for user_data in A.
If there is an exact match, the user_data
section is empty. Otherwise, the end of
the user_data is the next highest value.
}
I'm ok with this being done as a follow-on patch.
r~