GNU linker no success to make a relocatable module with calls to absolute addresses

70 Views Asked by At

I work on a MC68360 platform using GNU development tools.

What I need is a relocatable execution module that can make calls to absolute addresses, i.e to functions that are already in memory (ROM).

I can't get the GNU linker to do so. The place of the function call in the application is a relocatable address and the provided function address is an absolute address. The end result is a relocatable address.

How did I do it so far: I extract the Global Functions from the rom-image and make a file out of this, say rom_functions.S. This file looks like this:

    .text
    
    .globl sqrt
    .equ    sqrt, 0x<abs addr>

A check with readelf on rom_functions.o confirms all symbols are absolute addresses, there is no relocation table either.

rom_functions.o is used to link with the application into a relocatable module with the following command line:

ld -d -r -Rrom_functions.o -uappl_start -Tmyscript @$objs -o appl.rel appl.o

The -R is used to include and preserve absolute addresses as is the purpose of this option I guess. Possibly I have mis-interpreted the -R option. I have tried -R<rom.img> but yields similar result , the called function address is made relocatable in the output and is thus - when loading - modified with the loadaddress; eventulally a the call will nog enter the desired function.

Is there a solution to achieve what I want: a relocatable module with calls to absolute addresses?

0

There are 0 best solutions below