Skip to contentSkip to conversation

building openbios-qemu.elf?

Qemu-devel Hollis Blanchard 4 participants 8 messages Feb 23, 2009 – Feb 26, 2009

lore
Share & tools
lore
#0 lore raw

Hi, I just tried to build openbios-qemu.elf, but it is a little too big (1MB + 4 bytes):

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000094 0xfff00000 0xfff00000 0x100000 0x100000 RWE 0x4
  LOAD           0x100094 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss
01 .romentry
02

In contrast, the openbios-ppc binary in qemu looks like this:

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 2 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000074 0xfff00000 0xfff00000 0x41044 0x4bc44 RWE 0x4
  LOAD           0x0410b8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss.1 .sbss.2 .sbss.3 .sbss.4 .sbss.5 .sbss.6 .sbss.7 .sbss.8
01 .romentry

I'm building with gcc 4.2.3. Any ideas?

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#1 lore raw

Hi,

Do you use source from SVN head ?
Do you have any information in obj-ppc/build.log ?

I use gcc-4.3.2 on my powerPC G4, powerpc-linux-gnu-gcc-4.2.4 on intel T5500 and size is fine.

Regards,
Laurent

Quoted 50 lines · Hollis Blanchard

Hi, I just tried to build openbios-qemu.elf, but it is a little too big (1MB + 4 bytes):

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
Align
LOAD 0x000094 0xfff00000 0xfff00000 0x100000 0x100000 RWE
0x4
LOAD 0x100094 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss
01 .romentry
02

In contrast, the openbios-ppc binary in qemu looks like this:

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 2 program headers, starting at offset 52

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
Align
LOAD 0x000074 0xfff00000 0xfff00000 0x41044 0x4bc44 RWE 0x4
LOAD 0x0410b8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss.1 .sbss.
2 .sbss.3 .sbss.4 .sbss.5 .sbss.6 .sbss.7 .sbss.8
01 .romentry

I'm building with gcc 4.2.3. Any ideas?

Signature · 8 lines
Hollis Blanchard
IBM Linux Technology Center


--
OpenBIOS                 http://openbios.org/
Mailinglist:  http://lists.openbios.org/mailman/listinfo
Free your System - May the Forth be with you
#2 lore raw
Quoted 3 lines · Laurent Vivier

Hi,

Do you use source from SVN head ?

Yes.

Quoted 1 line

Do you have any information in obj-ppc/build.log ?

This is somewhat interesting:

powerpc-440-linux-gnu-strip openbios-qemu.elf
BFD: st4PszLi: warning: allocated section `.bss' not in segment
BFD: st4PszLi: warning: allocated section `.sbss' not in segment

The "nostrip" version of openbios-qemu.elf looks much better:

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000094 0xfff00000 0xfff00000 0x42044 0x4bcb4 RWE 0x4
  LOAD           0x0420d8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata
01 .romentry
02

So something goes wrong in the strip process.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
Quoted 61 lines

I use gcc-4.3.2 on my powerPC G4, powerpc-linux-gnu-gcc-4.2.4 on intel T5500 and size is fine.

Regards,
Laurent

Quoted 51 lines · Hollis Blanchard

Hi, I just tried to build openbios-qemu.elf, but it is a little too big
(1MB + 4 bytes):

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
Align
LOAD 0x000094 0xfff00000 0xfff00000 0x100000 0x100000 RWE
0x4
LOAD 0x100094 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss
01 .romentry
02

In contrast, the openbios-ppc binary in qemu looks like this:

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 2 program headers, starting at offset 52

Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
Align
LOAD 0x000074 0xfff00000 0xfff00000 0x41044 0x4bc44 RWE 0x4
LOAD 0x0410b8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss.1 .sbss.
2 .sbss.3 .sbss.4 .sbss.5 .sbss.6 .sbss.7 .sbss.8
01 .romentry

I'm building with gcc 4.2.3. Any ideas?

Signature · 8 lines
Hollis Blanchard
IBM Linux Technology Center


--
OpenBIOS                 http://openbios.org/
Mailinglist:  http://lists.openbios.org/mailman/listinfo
Free your System - May the Forth be with you
#3 lore raw
In reply to Hollis Blanchard
Quoted 30 lines · Hollis Blanchard

Hi, I just tried to build openbios-qemu.elf, but it is a little too big
(1MB + 4 bytes):

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000094 0xfff00000 0xfff00000 0x100000 0x100000 RWE 0x4
  LOAD           0x100094 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss
01 .romentry
02

In contrast, the openbios-ppc binary in qemu looks like this:

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 2 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000074 0xfff00000 0xfff00000 0x41044 0x4bc44 RWE 0x4
  LOAD           0x0410b8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
Quoted 6 lines

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss.1 .sbss.2 .sbss.3 .sbss.4 .sbss.5 .sbss.6 .sbss.7 .sbss.8
01 .romentry

I'm building with gcc 4.2.3. Any ideas?

The ldscript does not handle sdata and sbss.*?

#4 lore raw
Quoted 36 lines · Blue Swirl
Quoted 35 lines · Hollis Blanchard

Hi, I just tried to build openbios-qemu.elf, but it is a little too big
(1MB + 4 bytes):

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000094 0xfff00000 0xfff00000 0x100000 0x100000 RWE 0x4
  LOAD           0x100094 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss
01 .romentry
02

In contrast, the openbios-ppc binary in qemu looks like this:

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 2 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000074 0xfff00000 0xfff00000 0x41044 0x4bc44 RWE 0x4
  LOAD           0x0410b8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .sdata .bss .sbss.1 .sbss.2 .sbss.3 .sbss.4 .sbss.5 .sbss.6 .sbss.7 .sbss.8
01 .romentry

Quoted 4 lines
Quoted 1 line

I'm building with gcc 4.2.3. Any ideas?

The ldscript does not handle sdata and sbss.*?

Would this patch fix the problem?

arch/ppc/qemu/ldscript +2 -0
Index: openbios-quilt/arch/ppc/qemu/ldscript
===================================================================
@@ -41,6 +41,7 @@
         _data = .;
         *(.data)
         *(.data.*)
+        *(.sdata)
 	_edata = .;
     }
 
@@ -48,6 +49,7 @@
         _bss = .;
 	*(.bss)
 	*(.bss.*)
+	*(.sbss.*)
 	*(COMMON)
 	_ebss = .;
     }
#5 lore raw
Quoted 2 lines · Blue Swirl

Would this patch fix the problem?

Doesn't look like it. After patching and make clean, I see the same warning from strip, and basically the same output:

# tail obj-ppc/build.log
[...]
powerpc-440-linux-gnu-ld --warn-common -N -T ../arch/ppc/qemu/ldscript target/arch/ppc/qemu/start.o target/arch/ppc/timebase.o libqemu.a libbootstrap.a libdrivers.a libmodules.a liblibc.a libfs.a libgcc.a -o openbios-qemu.elf
powerpc-440-linux-gnu-nm openbios-qemu.elf | sort > ./openbios-qemu.syms
cp openbios-qemu.elf openbios-qemu.elf.nostrip
powerpc-440-linux-gnu-strip openbios-qemu.elf
BFD: stzD2J6q: warning: allocated section `.bss' not in segment
BFD: stzD2J6q: warning: allocated section `.sbss' not in segment
# readelf -l obj-ppc/openbios-qemu.elf*

File: obj-ppc/openbios-qemu.elf

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000094 0xfff00000 0xfff00000 0x100000 0x100000 RWE 0x4
  LOAD           0x100094 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data .bss .sbss
01 .romentry
02

File: obj-ppc/openbios-qemu.elf.nostrip

Elf file type is EXEC (Executable file) Entry point 0xfff08000
There are 3 program headers, starting at offset 52

Program Headers:

  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000094 0xfff00000 0xfff00000 0x42044 0x4bcb4 RWE 0x4
  LOAD           0x0420d8 0xfffffffc 0xfffffffc 0x00004 0x00004 R E 0x1
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4

Section to Segment mapping:
Segment Sections...
00 .text.vectors .text .rodata .data
01 .romentry
02

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#6 lore raw
Quoted 6 lines · Hollis Blanchard
Quoted 2 lines · Blue Swirl

Would this patch fix the problem?

Doesn't look like it. After patching and make clean, I see the same warning from strip, and basically the same output:

I think you should try binutils 2.18...

Regards,
Laurent

#7 lore raw
In reply to Hollis Blanchard
Quoted 7 lines · Hollis Blanchard
Quoted 2 lines · Blue Swirl

Would this patch fix the problem?

Doesn't look like it. After patching and make clean, I see the same warning from strip, and basically the same output:

Quoted 8 lines
# tail obj-ppc/build.log
[...]
powerpc-440-linux-gnu-ld --warn-common -N -T ../arch/ppc/qemu/ldscript target/arch/ppc/qemu/start.o target/arch/ppc/timebase.o libqemu.a libbootstrap.a libdrivers.a libmodules.a liblibc.a libfs.a libgcc.a -o openbios-qemu.elf
powerpc-440-linux-gnu-nm openbios-qemu.elf | sort > ./openbios-qemu.syms
cp openbios-qemu.elf openbios-qemu.elf.nostrip
powerpc-440-linux-gnu-strip openbios-qemu.elf
BFD: stzD2J6q: warning: allocated section `.bss' not in segment
BFD: stzD2J6q: warning: allocated section `.sbss' not in segment

I've already this on u-boot too
it's binutils bug sorry I do not remerber which one but if you update it it will work. Personnaly I use now GNU ld (GNU Binutils) 2.18.90.20080910

Best Regards,
J.