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

Re: [MiNT] Wrong basepage pointer?



On 02/01/2013 20:47, Miro Kropáček wrote:
If I'm not mistaken, on the relative position 28, where usually *my*
instructions are is now a relative jump into the "new" code position
(28+228).

You are right.

That's why I'm not sure if it's a bug or feature.

That's a feature of the a.out-mintprg executable file format produced by the GNU ld.

The standard PRG header is 28 bytes.

Guido Flohr has invented the new a.out-mintprg file format with a 256-byte header. The additional 228 bytes are referred as the "Extended MiNT header". This new header brings new features such as modifiable stack size (with the stack tool), alternate entry point (feature never used), and compatibility with standard a.out tools such as objdump, GDB, etc.

To be compatible with the standard loaders (including TOS), there is the trick you have seen. At position 28, there is a jump to the actual entry point, which is virtually always at position 256.

The bad news is that currently, the GNU ld produces only executables with 256-byte header. There is no way to put your code at offset 28.

The good news is that the vbcc linker can produce both formats using the appropriate options.

--
Vincent Rivière