Skip to contentSkip to conversation

qemu/pc-bios README openbios-sparc32 openbios-s...

Qemu-devel Blue Swirl 5 participants 12 messages Apr 15, 2007 – Apr 16, 2007

lore
Share & tools
lore

Blue Swirl

author
#0 lore raw

CVSROOT: /cvsroot/qemu
Module name: qemu
Changes by: Blue Swirl <blueswir1> 07/04/15 06:38:29

Modified files:
pc-bios : README openbios-sparc32
Added files:
pc-bios : openbios-sparc64

Log message:
Update OpenBIOS for Sparc32 and add a Sparc64 image

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/pc-bios/README?cvsroot=qemu&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/qemu/pc-bios/openbios-sparc32?cvsroot=qemu&rev=1.4
http://cvs.savannah.gnu.org/viewcvs/qemu/pc-bios/openbios-sparc64?cvsroot=qemu&rev=1.1

#1 lore raw

The Sparc64 image is much larger than the Sparc32 image, but the size command displays a much smaller text and data size (about the same size as for the Sparc32 image).

Maybe it contains some unneeded parts?

Stefan

Quoted 11 lines · Blue Swirl

CVSROOT: /cvsroot/qemu
Module name: qemu
Changes by: Blue Swirl <blueswir1> 07/04/15 06:38:29

Modified files:
pc-bios : README openbios-sparc32
Added files:
pc-bios : openbios-sparc64

Log message:
Update OpenBIOS for Sparc32 and add a Sparc64 image

author
#2 lore raw
Quoted 5 lines · Stefan Weil

The Sparc64 image is much larger than the Sparc32 image, but the size command displays a much smaller text and data size (about the same size as for the Sparc32 image).

Maybe it contains some unneeded parts?

Thanks for the report. There is indeed a whole lot of unused space between ELF header and start of .text segment.

But I don't see what in the ldscript (attached) causes the gap to appear. Suggestions?

#3 lore raw
Quoted 5 lines · Blue Swirl
Quoted 4 lines · Stefan Weil

The Sparc64 image is much larger than the Sparc32 image, but the size command displays a much smaller text and data size (about the same size as for the Sparc32 image).

Quoted 7 lines
Quoted 1 line

Maybe it contains some unneeded parts?

Thanks for the report. There is indeed a whole lot of unused space between ELF header and start of .text segment.

But I don't see what in the ldscript (attached) causes the gap to appear. Suggestions?

Probably the linker is making sure the file offset and VMA are the same modulo the page size.

For our purposes we don't care about this. On an OS with virtual memory this means the image can be mmapped drectly into memory.

Paul

author
#4 lore raw
Quoted 2 lines

Probably the linker is making sure the file offset and VMA are the same modulo the page size.

But that would be one huge file, as the VMA is near 2TB:

pc-bios/openbios-sparc64: file format elf64-sparc
pc-bios/openbios-sparc64
architecture: sparc:v9, flags 0x00000102:
EXEC_P, D_PAGED
start address 0x000001fff0000000

Program Header:
LOAD off 0x0000000000100000 vaddr 0x000001fff0000000 paddr
0x000001fff0000000 align 2**20

        filesz 0x00000000000600c0 memsz 0x00000000000f5000 flags rwx
  STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr
0x0000000000000000 align 2**3
        filesz 0x0000000000000000 memsz 0x0000000000000000 flags rwx

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00028bd0 000001fff0000000 000001fff0000000 00100000 2**14
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 0002cdbc 000001fff0030000 000001fff0030000 00130000 2**3
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 000000c0 000001fff0060000 000001fff0060000 00160000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00094000 000001fff0061000 000001fff0061000 001600c0 2**3
ALLOC
SYMBOL TABLE:
no symbols

#5 lore raw
Quoted 4 lines · Blue Swirl
Quoted 2 lines

Probably the linker is making sure the file offset and VMA are the same modulo the page size.

But that would be one huge file, as the VMA is near 2TB:

I said *modulo the pace size* :-)
Lets say ld thinks the page size for your system is 1Mb (nor an unreasonable assumption). The vma of .text is aligned on a 1Mb boundary. In order to allow loading via mmap, the location of .text within the file must also be aligned on a 1Mb boundary. It can't put it at address zero because the ELF headers get in the way, so the first viable location is 1Mb into the file.

Paul

author
#6 lore raw
Quoted 4 lines · Paul Brook
Quoted 3 lines · Blue Swirl
Quoted 2 lines

Probably the linker is making sure the file offset and VMA are the same modulo the page size.

Quoted 8 lines
Quoted 1 line

But that would be one huge file, as the VMA is near 2TB:

I said *modulo the pace size* :-)
Lets say ld thinks the page size for your system is 1Mb (nor an unreasonable assumption). The vma of .text is aligned on a 1Mb boundary. In order to allow loading via mmap, the location of .text within the file must also be aligned on a 1Mb boundary. It can't put it at address zero because the ELF headers get in the way, so the first viable location is 1Mb into the file.

Nice theory (and I missed the modulo arithmetic, sorry), but on Ultrasparc the page sizes available are 8k, 64k, 4M and 256M.

#7 lore raw
Quoted 14 lines · Blue Swirl
Quoted 4 lines · Paul Brook
Quoted 3 lines · Blue Swirl
Quoted 2 lines

Probably the linker is making sure the file offset and VMA are the same modulo the page size.

Quoted 8 lines
Quoted 1 line

But that would be one huge file, as the VMA is near 2TB:

I said *modulo the pace size* :-)
Lets say ld thinks the page size for your system is 1Mb (nor an unreasonable assumption). The vma of .text is aligned on a 1Mb boundary. In order to allow loading via mmap, the location of .text within the file must also be aligned on a 1Mb boundary. It can't put it at address zero because the ELF headers get in the way, so the first viable location is 1Mb into the file.

Quoted 2 lines

Nice theory (and I missed the modulo arithmetic, sorry), but on Ultrasparc the page sizes available are 8k, 64k, 4M and 256M.

#define ELF_MAXPAGESIZE 0x100000

BFD and GNU ld think it's 1MB.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
author
#8 lore raw
Quoted 15 lines · Daniel Jacobowitz
Quoted 14 lines · Blue Swirl
Quoted 12 lines · Paul Brook
Quoted 4 lines · Blue Swirl
Quoted 2 lines

Probably the linker is making sure the file offset and VMA are the same modulo the page size.

But that would be one huge file, as the VMA is near 2TB:

I said *modulo the pace size* :-)
Lets say ld thinks the page size for your system is 1Mb (nor an unreasonable assumption). The vma of .text is aligned on a 1Mb boundary. In order to allow loading via mmap, the location of .text within the file must also be aligned on a 1Mb boundary. It can't put it at address zero because the ELF headers get in the way, so the first viable location is 1Mb into the file.

Quoted 6 lines
Quoted 2 lines

Nice theory (and I missed the modulo arithmetic, sorry), but on Ultrasparc the page sizes available are 8k, 64k, 4M and 256M.

#define ELF_MAXPAGESIZE 0x100000

BFD and GNU ld think it's 1MB.

I stand corrected. Is there anything that can be done to reduce this waste?

#9 lore raw
Quoted 1 line · Blue Swirl

I stand corrected. Is there anything that can be done to reduce this waste?

For a BIOS image, you might be OK with ld -N - that should suppress the padding.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
author
#10 lore raw
Quoted 5 lines · Daniel Jacobowitz
Quoted 1 line · Blue Swirl

I stand corrected. Is there anything that can be done to reduce this waste?

For a BIOS image, you might be OK with ld -N - that should suppress the padding.

Thanks, size is smaller and Qemu still accepts the image.

I'll update the image and rules.

#11 lore raw
In reply to Blue Swirl
Quoted 22 lines · Blue Swirl
Quoted 21 lines · Daniel Jacobowitz
Quoted 3 lines · Blue Swirl
Quoted 2 lines · Paul Brook
Quoted 1 line · Blue Swirl
Quoted 1 line

Probably the linker is making sure the file offset and VMA are the

same

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

modulo the page size.

But that would be one huge file, as the VMA is near 2TB:

I said *modulo the pace size* :-)
Lets say ld thinks the page size for your system is 1Mb (nor an

unreasonable

Quoted 1 line
Quoted 1 line

assumption). The vma of .text is aligned on a 1Mb boundary. In order

to

Quoted 1 line
Quoted 1 line

allow loading via mmap, the location of .text within the file must

also be

Quoted 1 line
Quoted 1 line

aligned on a 1Mb boundary. It can't put it at address zero because the

ELF

Quoted 1 line
Quoted 1 line

headers get in the way, so the first viable location is 1Mb into the

file.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Nice theory (and I missed the modulo arithmetic, sorry), but on Ultrasparc the page sizes available are 8k, 64k, 4M and 256M.

#define ELF_MAXPAGESIZE 0x100000

BFD and GNU ld think it's 1MB.

I stand corrected. Is there anything that can be done to reduce this waste?

See ld's -z max-page-size and -z common-page-size.

Thiemo