static link with relocations

b95705030@ntu.edu.tw b95705030@ntu.edu.tw
Sat Apr 17 18:40:00 GMT 2010


Hello

[顯示引述 - 13 行][隱藏引述]
I want to port binutils to a platform(EFI Binary Code Virtual Machine). The
image of that platform is static link, but they contain relocations.

Does binutils have build in assumption that static image don't contain
relocations??(ie. Does binutils support the model that static image contain
relocations??)
Do they use the same format as native EFI codes? If yes,
you need to link as PIE. I fixed an PIE bug recently for EFI:

http://www.sourceware.org/bugzilla/show_bug.cgi?id=11396
Yes, they use the same format as native EFI codes(object file format  
COFF, excutable format PE32+).
The problem I ask is because of a discussion of EDK mailing list.
http://sourceforge.net/mailarchive/forum.php?thread_name=7C0E3215-191D-4B58-BC2B-D273281608F1%40apple.com&forum_name=edk2-devel

The memory model of EFI in IA32 is Basic Flat Model(3.2.1 in Intel® 64  
and IA-32 Architectures Software Developer’s Manual Volume 3A:System  
Programming Guide, Part 1), which means every selector defines the  
entire address space.

Because PE/COFF is designed to be run at any address, and determined  
the relocations at loading time. The load address could also change if  
the sequence of loads was different. The source code of loader in EFI  
is:
https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdePkg/Library/BasePeCoffLib/BasePeCoff.c

So I wondering whether binutils support static link image with  
relocation model. I have survey the bug you fixed. In my opinion,  
binutils support this model, Is it??

tnanks for you to be my mentor.

yi-hong




More information about the Binutils mailing list