Question concerning objcopy an elf file into a raw binary file

Jie Zhang zhangjie@magima.com.cn
Thu Jul 3 03:30:00 GMT 2003


Hello,
I use objcopy to get a raw binary file from an elf file. Here are the 
section headers and program headers:

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        60004000 000c10 000e44 00 WAX  
0   0  4
  [ 2] .data             PROGBITS        60003400 000074 000000 00  WA  
0   0  1
  [ 3] .bss              NOBITS          60003400 000074 000064 00  WA  
0   0  4
  [ 4] .rodata           PROGBITS        60003464 000074 0000ac 00   A  
0   0  4
  [ 5] .comment          PROGBITS        00000000 001a54 00001b 00      
0   0  1
  [ 6] .shstrtab         STRTAB          00000000 001a6f 00003d 00      
0   0  1
  [ 7] .symtab           SYMTAB          00000000 001c14 000330 10      
8   c  4
  [ 8] .strtab           STRTAB          00000000 001f44 000331 00      
0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000074 0x60003400 0x60003400 0x00000 0x00064 RW  0x4
  LOAD           0x000074 0x60003464 0x60003464 0x019e0 0x019e0 RWE 0x4

 Section to Segment mapping:
  Segment Sections...
   00     .bss
   01     .text .rodata

I expect that the memory dump will start at 60003400, but actually it 
starts at 60003464. It seems that objcopy does not actually copy .bss 
section. But .bss section is in a LOAD type segment and should, I think, 
be part of the memory dump.

Any thoughts on this issue? Thanks a lot!

Jie




More information about the Binutils mailing list