Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Relocate ELF

Dear all,

does anyone know how to relocate a Nios Executable, so it can be launched from addresses other than offset zero of memory?

I think the best way should be the GCC option -pie (position independent executable) but it appears not supported by Nios.

At this time I manually edit the generated.x file fixing memory start addresses and rebuild. However this approach appears too tricky and error prone to me .

In addition (I tried to relocate the ELF by myself), looking at the Nios Processor reference I read:

--- Quote Start ---

In a Nios II object file, each relocatable address reference possesses a relocation type. The relocation type specifies how to calculate the relocated address.Table 7–3 lists the calculation for address relocation for each Nios II relocation type. The bit mask specifies where the address is found in the

instruction.

--- Quote End ---

when it talks about object I assume it refers to "obj/*.o" file that is a "relocate elf". But in this file I can't retrieve enough relocation information, not all jumps are referred, neither those relative to HAL calls.

Thank you,

regards
No RepliesBe the first to reply