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

Re: [microblaze-uclinux] Setting up for Microblaze work.



Hi John, David,

John Williams wrote:
David H. Lynch Jr wrote:

I am still trying to sort out whether and why MMUless cpu can not use an ELF file.

ELF application binaries have no relocation info - All relocations are resolved to a base address of zero. The final link phase of building an ELF app strips out all relocation data - gone.

Try this:

[jwilliams@g512-9423 Core]$ objdump -r /bin/sh

/bin/sh:     file format elf32-i386


No relocations.

MMU-full CPUs map applications into their own zero-based virtual address space, and the MMU + kernel page fault handlers do the rest.

It is possible to use ELF format binaries in non-MMU targets.
There is a new binary format called binfmt_elf_fdpic in 2.6 kernels.
Currently I think only the FRV architecture in MMU-less mode
uses it in tree (and Blackfin out of tree).

Ofcourse you cannot use the existing linux kernel ELF loader since
it cannot do any relocation. Thus part of the impetus to create
the original flat format files. (The other driver being to reduce
binary file size).

Regards
Greg


On NOMMU, we can't do that. Each app runs in a physical address space, based at whatever address is given by the kernel when memory is allocated for the text segment.

At load time, the binfmt_flat loader must instead go through the binary, and relocate all the jumps, address references - anything that needs relocation.

So, a flat binary is sort of a binary dump of the object code, plus a relocation table to allow the kernel to do its job, relocating the binary to whatever address the text, data and bss segments ultimately get placed at.

As an aside, this is why PIC compilers are so useful for NOMMU targts - if you can generate fully position independent code, you can get away with few, or no relocations. That speeds app load time, and lets you do great things like directly mmap()ing the filesystem backing store into the app's text segment - load time is zero, just start executing straight off the "disk" (or rather flash, or mem file system).

See fs/binfmt_flat.c for the gory details.

Regards,

John
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/



--
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg@xxxxxxxxxxxx
Secure Computing Corporation                PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/