From: David M. <da...@sn...> - 2003-01-06 21:59:35
|
Jivin Paul Mundt lays it down ... > On Sun, 2003-01-05 at 20:34, David McCullough wrote: > > I suspect that you are still running ELF programs. When you turn off the > > MMU support in the kernel, the rules for applications change a little. > > They cannot be paged in for example, and they have to be loaded (and > > relocated) at run time. Normal elf programs are loaded at a fixed > > addresses and this cannot work without an MMU. > > > > The uClinux guys use a program called elf2flt (ELF to flat) to make flat > > binaries that can be run without an MMU. You can find it at: > > Okay, one issue with elf2flt. I've built a static busybox linked against > uClibc (which was built w/o HAS_MMU set), also using the sh-uclibc- > toolchain (which is also built w/o HAS_MMU). Now, this busybox itself > doesn't have any relocations in it, though it's still an ELF. Ok, I guess it's a possibility that on SH you can generate an executable that doesn't need relocations, but I would be suspicious, especially if it isn't built with PIC. It sounds like elf2flt is not being used correctly as all the SH code I have seen generated would need relocations to run on a non-MMU system. > elf2flt currently bails and refuses to write the flt hdr/file if it sees > that the ELF doesn't have anything needing relocation. This happens > around line 900 of elf2flt.c from current HEAD by way of the > bfd_get_file_flags() HAS_RELOC check. If I comment this out, the flt > file is generated properly. > > This brings up the question, if I have an ELF that was built with PIC > turned off, can binfmt_elf deal with it? or does it still have to pass > through binfmt_flat? binfmt_elf will deal with it, but the program will not run. You would have to link every application at a different address and then make sure that you never ran more than one instance of each. Even then I doubt it would work. You will need to use flat executables to get it going. > > http://cvs.uclinux.org/cgi-bin/cvsweb/elf2flt/ > > > > I don't believe there is SH support in it at the moment, but it isn't a > > huge amount of work. Generally only a few relocation types need to be > > handled, > > Currently I have R_SH_DIR32, R_SH_REL32, R_SH_GOT32 and R_SH_GOTPC > supported. I'll submit patches for this once the above mess is worked > out. Sounds good. By the way, I subscribed to linuxsh-dev a month or so ago and haven't seen any traffic. It is working or am I missing something ? Cheers, Davidm -- David McCullough: Ph: +61 7 3435 2815 http://www.SnapGear.com da...@sn... Fx: +61 7 3891 3630 Custom Embedded Solutions + Security |