bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objcopy and strip incorrectly zero ELF virtual address


From: nick clifton
Subject: Re: Objcopy and strip incorrectly zero ELF virtual address
Date: Thu, 28 Jun 2012 15:35:20 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

Hi Juho,

If objcopy or strip is applied to an ELF executable which has a LOAD
segment in the program header, but none of the sections refer to it, the
virtual address of the segment is set to zero. This behavior is
incorrect, as the virtual address is not supposed to be used like this
according to the ELF standard. If the segment is to be ignored, its type
should be set to NULL or the segment should be discarded altogether, but
I prefer that the segment should just be preserved as is. This behavior
is probably caused by assign_file_positions_for_load_sections in elf.c:
       if (m->count == 0)
         p->p_vaddr = 0;
       else
         p->p_vaddr = m->sections[0]->vma - m->p_vaddr_offset;

Please could you file a bug report about this problem here:

http://sourceware.org/bugzilla/

Including a simple test case to reproduce the problem will really help.

Cheers
  Nick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]