How to use absolute symbols in position independent code

672 Views Asked by At

I created an elf file using the following commend:

 objcopy -F elf64-x86-64 -B i386 -I binary binary_file output_file.o

The elf has 3 absolute symbols (binary_start, binray_end, binary_size)

I tried to compile this elf into a shared library.

The probelm is that I can't reach the size_symbol and the end_symbol when I'm using -fpic (The addresses of the symbols are wrong).

so, what is the proper way to use this kind of symbols in position independent code?

0

There are 0 best solutions below