Folks,

I am looking for information on the different sections that are generated
by the GNU compiler when compiling C code for an embedded PowerPC,
specifically an MPC860.

I need to understand the GOT, GOT2 and FIXUP sections in order to
modify the boot loader for my embedded board.

I should first of all acknowledge that, on searching the archive,
my question, or at least a very similar one, has come up before (~1999)
However, I could not obtain enough information from the responses
at that time nor from reading the PowerPC ABI and EABI documents
nor from reading various web resources on the GNU linker.

My understanding so far is:

        GOT: most architectures have a .got section in their ELF files.

                 The global offset table (GOT) holds the addresses 
                 of variables. Thus code can be written to independent 
                 of the actual addresses of the variables as long as 
                 it accesses them via the GOT.

        -mrelocatable is an option flag on the GNU C compiler for 
                      PowerPC architectures. When used, this generates 
                      a .got2 and a .fixup section.

                      I note that the .got2 and .fixup are themselves     
                      defined within the GOT.

I saw one article that mentioned that .got2 and .fixup sections are 
needed when code has to be relocated in memory – which is exactly what
happens at boot time when the code is copied from Flash memory to RAM on my
board.


Is the GOT not sufficient to do this though ? I can’t see why 
it is necessary to define two new sections ?  What goes into those 
sections ?

Thanks, in advance, for any explanations.

Charles.

--------------------------------------------------------------------------- 
Dr Charles J Gillan
The Institute of Electronics, Communications and Information Technology
(ECIT),               
Queen's University Belfast,
Titanic Quarter
Queen’s Road, Queen’s Island, 
Belfast, BT3 9DT
Northern Ireland, UK
---------------------------------------------------------------------------



Reply via email to