Yasm working with Win32

Peter Tanski p.tanski at gmail.com
Tue Dec 12 09:18:03 EST 2006


On Dec 12, 2006, at 4:15 AM, Simon Marlow wrote:

> Peter Tanski wrote:
>> The good news is the problem is apparently easy to fix and the result
>> should be compatible with MS tools.
>
> You haven't allayed my fears.  If a Yasm-generated object file has  
> a special .reloc/.stab section to handle complex relocations, and  
> the GNU linker understands this special section, won't the MS  
> linker choke on it?  Or are complex relocations done in the same  
> way by the MS tools too?

The MS linker shouldn't have a problem as long as the format of the  
Yasm-generated file holds to the MS PE-COFF Spec.  That is, the MS  
linker can handle .stab and .stabstr sections fine; complex  
relocation (.reloc) sections are removed from executable "image"  
files and retained for other object files.  Yasm does follow the  
Spec., except gas seems to put the .comment section from the input  
(assembler) file, which Yasm keeps, into an ".rdata$zzz" section so  
it will be (1) used by the linker and (2) not put into the  
executable.  The bad executable produced by the Yasm-object file  
(with the .comment section) becomes a good executable as soon as I  
"strip --remove-section=.comment" on bad file after linking.  If I  
strip the .comment section before linking 'ld' will encounter symbol  
errors, so it is necessary for linking--although I still haven't  
tested this with MS 'link' because I have been too lazy to sort  
through all the dependencies for a GHC-compiled file.  I should write  
a simple asm program with complex relocations so I don't have to work  
through all that...

Cheers,
Pete



More information about the Cvs-ghc mailing list