Re: [PATCH V2 0/2] Add C-SKY support

2019-06-26 Thread Mao Han
On Tue, Jun 25, 2019 at 12:26:55AM +0200, Mark Wielaard wrote:
> Hi,
> 
> On Wed, 2019-04-17 at 14:41 +0800, Mao Han wrote:
> > I'v just spent sometime debuging this. Core dump backtrace on C-SKY
> > seems
> > can't be supported with current generic routine. DWARF register order is
> > different from the order in core notes. The initialization of frame
> > registers is totally incorrect. As the comment says some fix with
> > private function is needed.
> 
> My apologies for taking so long to reply. I am looking at your latest
> patch and found this discussion. It will take me a bit to properly
> review everything. But I didn't forget.
Thanks for remembering that and the careful review, looking forward to
seeing the review comments :).

Best Regards,
Mao Han


Re: Elf64_Phdr

2019-06-26 Thread Sasha Da Rocha Pinheiro
So, I need to write an elf file. I have an open Elf * handle with read only 
permission. I then need to update the program headers and next add a new 
program header entry.
For that we create an Elf * handle with write permission, and create the 
headers doing:
elf64_newphdr(new_elf, old_elf->e_phnum)
for loop: memcpy(newPhdr, oldPhdr, oldEhdr->e_phentsize);

This is done because prior to memcpy, I perform changes (updates) in the values 
in the copied program headers.

Now I need to add a new program header. How can I insert a new program header 
to the ones copied to newPhdr? The problem here is that I need to assess with 
the updated headers where to place a new header. It seems I can't call 
elf64_newphdr again on the new_elf handle.

Sasha




  
From: Sasha Da Rocha Pinheiro
 Sent: Tuesday, June 25, 2019 5:09 PM
 To: Mark Wielaard; Frank Ch. Eigler
 Cc: elfutils-devel@sourceware.org
 Subject: Re: Elf64_Phdr 
   
 

  What happens if I call elf64_newphdr() on the same Elf * but with different 
size_t __cnt? 
  What happens to the previous headers?
  
  
  Sasha
  
    
 From: Mark Wielaard 
  Sent: Tuesday, June 25, 2019 12:56:04 AM
  To: Sasha Da Rocha Pinheiro; Frank Ch. Eigler
  Cc: elfutils-devel@sourceware.org
  Subject: Re: Elf64_Phdr 
    
  
 On Tue, 2019-06-25 at 05:22 +, Sasha Da Rocha Pinheiro wrote:
  >   Oh, of course, that might be it. 
  >    
  >  Do you know if when it's open with write permission, changes will be
  > mapped back to the file?
  
  That depends on whether it is opened with mmap MAP_PRIVATE
  (ELF_C_READ_MMAP_PRIVATE,) or not.
  
  Cheers,
  
  Mark