Hi, Standa Opichal wrote:
Hmm, PIC? How's the code generated by a current gcc 2.95.x supported by SpareMiNT dependent on a memory address that is loaded to? We don't have VM and so we do relocation by each exec(), right? In case the binary is made using -fPIC. Do we have to do any relocation at all?
You have to distinguish between two fundamentally different types of relocations. The linker relocates addresses in the various object files, i. e. it replaces references to abstract symbol names with the real address references. This is always needed because the compiler does not know about the order the various object files are later linked together.
Other operating systems are ready here, since their executables have a constant start address. This start address is virtual, the mapping between virtual and physical addresses is handled by the MMU.
TOS is different. Each process can (should) have its distinct address space and therefore a distinct start address. Attached to the image on disk is a table with file offsets (also called "relocation table" although it is a completely different kind of relocation), that have to be corrected by the offset from the program basepage in physical memory minus the constant start address that was assumed while linking.
Theoretically (I think so) the second type of relocation could be avoided. But this would result in bigger and slower executables. And you still weren't able to share anything.
Ciao Guido -- Imperia AG, Development Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.net/