I've tried the patch and it works fine!
Thank you very much!
On Tue, Mar 2, 2010 at 2:34 PM, Kai Wang <kaiwang27@...> wrote:
> Hi Luca,
> On Tue, Mar 02, 2010 at 02:12:31PM +0100, Luca Pizzamiglio wrote:
>> Hi to all.
>> I'm Luca and I'm using libelf on FreeBSD 7.3 to develop a tool that
>> manipulate ELF binaries. I hope that mailing list is right to post
>> this problem.
>> My tool changes some information in the dynamic symbol table (using
>> gelf_update_sym()), save the elf and quit.
>> elf_update(e, ELF_C_WRITE) fails with a DATA class error (Invalid data
>> buffer descriptor).
>> Investigations revealed that _libelf_xlate() fails because src->d_buf is NULL.
>> Further investigations revealed that the caller function
>> _libelf_write_elf() when wants to write the program header table, use
>> the e_phdr32 field of the _Elf struct. Seems that this field is not
>> correctly initialized.
>> As workaround I call gelf_getphdr() and the problem goes away.
> Thanks for reporting this problem.
> It should be already fixed by elftoolchain svn repository revsion 305.
> However it's not yet been merged back to FreeBSD.
> You can fetch the diff (try svn diff -c305 in trunk/libelf) and apply
> it to the libelf in FreeBSD 7.3.