This is the mail archive of the binutils@sourceware.org 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: A question about objcopy


Hi, Alan,

	Thanks very much for your reply, I am new to BFD so there are
some concept misunderstanding, for the patch you mentioned, it seems
objcopy will remove the padding before the first section. Is it right?

	My question is, why objcopy must adjust vaddr of program
headers? Is it for elf specification? (the object file should have been
complient to ELF), or is it for program loading?

	I met one issue: one object file, which use linked as ePAPR
fixed format, in which vaddrs should be keep unchanged. But after
running strip, the vaddr of one program header is changed, then it
failed to execute.

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00
0   0  0
  [ 1] .text             PROGBITS        0c010000 010000 0f0000 00  AX
0   0 65536
  [ 2] .data             PROGBITS        00200000 100000 100000 00  WA
0   0 16

  [17] .bss              NOBITS          08000000 200000 4000000 00  WA
0   0 64
  [18] .stats_heap       NOBITS          10000000 000000 4000000 00  WA
0   0  1
  [19] .dpa_mem          NOBITS          28000000 000000 4000000 00  WA
0   0  1
  [20] .whiteboard1      NOBITS          2c000000 000000 002848 00  WA
0   0  8
  [21] .whiteboard2      NOBITS          2c002848 000000 3ffd7b8 00  WA
0   0  1

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg
Align
  LOAD           0x000000 0x0c000000 0x00100000 0x100000 0x100000 R E
0x10000
  LOAD           0x100000 0x00200000 0x00200000 0x100000 0x100000 RW
0x10000
  LOAD           0x200000 0x08000000 0x08000000 0x00000 0x4000000 RW
0x10000
  LOAD           0x200000 0x00300000 0x00300000 0x10000 0x70000 RW
0x10000
  <unknown>: 8   0x000000 0x01000000 0x01000000 0x00000 0x7000000 RW
0x1
  <unknown>: 8   0x000000 0x2c000000 0x2c000000 0x00000 0x4000000 RW
0x8
  <unknown>: 8   0x000000 0x10000000 0x10000000 0x00000 0x4000000 RW
0x1
  <unknown>: 8   0x000000 0x28000000 0x28000000 0x00000 0x4000000 RW
0x1 


After stripped, the 6th program header is changed to:
  <unknown>: 8   0x000000 0x37f00000 0x2c000000 0x00000 0x4000000 RW
0x8


B.R.
Harry


-----Original Message-----
From: Alan Modra [mailto:amodra@bigpond.net.au] 
Sent: Wednesday, August 05, 2009 1:56 PM
To: He Yunlong-B20256
Cc: binutils@sourceware.org
Subject: Re: A question about objcopy

On Wed, Aug 05, 2009 at 10:09:27AM +0800, He Yunlong-B20256 wrote:
>  /* There is some other padding before the first section.  */  
> map->p_vaddr_offset = ((lowest_section ? lowest_section->lma : 0)
>           - segment->p_paddr);

http://sourceware.org/ml/binutils/2006-12/msg00165.html

--
Alan Modra
Australia Development Lab, IBM


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