Re: Yasm working with Win32

Peter Tanski <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.all,gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
On Dec 15, 2006, at 4:19 AM, Simon Marlow wrote:
> Peter Tanski wrote:
>> As part of testing Yasm, I looked at the next step for the  
>> Windows  native port: building and testing GHC using Yasm as the  
>> assembler,  which may benefit from changing the option flags in  
>> compiler/main/ DriverPipeline.hs and compiler/main/DynFlags.hs .   
>> I would like to  change the flags to:
>> (1) move the hard-coded option parameters for 'runPhase As ...'  
>> in  DriverPipeline.hs into separate option sets in DynFlags.hs -- 
>> that way  you only have to look in one place to change the hard- 
>> coded options  (or, in this case, to code them conditionally under  
>> a preprocessor  define USE_YASM);
>> (2) include parameters for Yasm ("-ax86", "-pgas", "-fwin32"); and,
>> (3) include Yasm as a configuration option (--enable-yasm).
>> An alternative implementation would be to add a special command  
>> line  option, --yasm, to enable use of yasm, although this would  
>> require  Makefile changes both for building and testing, in the  
>> same way as  using --pgma, --opta ... to use Yasm as is.  What do  
>> you think?
>
> For the native Windows port, we should have a new target, probably  
> i386-unknown-win32 or i386-unknown-windows.  Then we can have an  
> option in config.mk to control whether YASM is used, $(UseYASM),  
> which would be on by default for windows_TARGET_OS.  Later we might  
> want to make it a configure option, but for now I'd leave it as a  
> build.mk option.

Right on.  Would it be good to consolidate the hard-coded build flags  
into one module, i.e., wired-in flags in DriverPipeline.hs should be  
brought together in DynFlags.hs?

To sum up:
  * new target: i386-unknown-windows (Yasm covers Win64, Intel and AMD)
  * windows_TARGET_OS (new cpp define)

Other things may need changing:
  * add code to DriverPhases.hs to allow ".asm" suffix?  (Not necessary)
  * SysTools.lhs:328-329 (as-prog,as-args) are NOT (gcc_prog,gcc_args)
  * (potential bugger): remove default use of mangler on -O and -fvia- 
C on -fglasgow-exts; Yasm chokes on /ARGS, /NO_ARGS gas directives,  
may add to Yasm with special -D macro[=value] options

Cheers,
Pete
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.