Re: [PATCH] Fix ELF entry point (i386)

From: Eric W. Biederman
Date: Mon Mar 06 2006 - 14:09:39 EST


Gerd Hoffmann <kraxel@xxxxxxx> writes:

> Eric W. Biederman wrote:
>>
>> We load the kernel at physical addresses and we enter
>> the kernel at a physical address. Even the entry point
>> expects that.
>>
>> Is there some reason you think the entry point is virtual?
>
> Elf specs say so. The paragraph in question mentions processes not OS
> kernels though ...

The ELF spec only defines how ELF is interpreted for processes running under
an OS if I remember correctly. Stand-alone executable that run without an
OS (like an OS kernel) play be slightly different rules, and I don't know if
anyone has ever formalized them. As a consequence those rules like vary
between bootloaders and between architectures.

Currently my assumptions are:

Standalone executables load at the physical not the virtual addresses.
Standalone executables start executing at a physical address and not at
a virtual address.

In most cases virtual==physical in ELF binaries. Which if you are throwing
something quick together means they will work in either circumstance. Also
it is unfortunate that ld currently emits relocations for absolute symbols
in ET_DYN executables.

Of practical consequence currently /sbin/kexec makes the assumptions I have
outlined above. So if you change that you not be able to boot vmlinx with
/sbin/kexec.

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/