Use Make files to Resolve Win64 Porting Issues

Submit New Article

March 11, 2009 1:00 AM PDT



Challenge

Identify issues associated with porting an application to the Win64 environment. Once an appropriate model has been chosen for porting an application to the Win64 environment, which is addressed in a separate item, "How to Select a Win64 Porting Model," warnings should be identified and addressed to prepare the application to run in the Win64 environment.


Solution

Compile the application in the Win32* environment and then alter and run the makefile to generate and address warnings. The following steps provide basic support for getting an application ready for the Itanium® processor running 64-bit Windows*.

  • Select the appropriate Porting Model, which is addressed in a separate item, "How to Select a Win64 Porting Model."
  • Compile the application under the Win32 environment. Verify that the program works under the base platform. Take a note of the existing warnings and try to fix them. (These are low priority; the prime directive is successful removal of Win64 related warnings.)
  • Backup the existing makefile(s) for the application.
  • Make the following changes to the makefile(s) for Win64:
  • Remove the /FD compiler flag. The /FD flag is generated when exporting makefile(s) from Visual Studio* and should be deleted.

 

  •  
    • Change the linker option, which specifies the machine type:
  • change machine:I386 to machine:IA64
  • change machine:IX86 to machine:IA64
  • change machine:x86 to machine:IA64

 

  •  
    • Remove the /Gm compiler flag. The /Gm option controls minimal rebuild and is ignored by the IA-64 compiler.
    • Add the following compiler flags to enable the most sensitive compiler warnings related to the 64-bit Intel architecture: -Wp64 and -W4
    • If, in step 1, you decided to use 32-bit pointer variables, add the following compiler option: -Ap32 (default is -Ap64).
    • If, in step 1, you decided to use a maximum of 4 GB (2 ^ 32) of virtual address space (Small Address Space), add the following compiler option: -As32 (default is -As64).
  • Clean the existing .obj files from the Win32 build and any existing Win64 builds: nmake -f makefilename clean
  • Run the modified Win64 makefile:
    nmake -f makefilename You might want to output all the Win64 warnings that are produced to a text file:
    nmake -f makefilename > warnings.txt As changes are made to the source code, these warnings will fluctuate. The warnings.txt file will provide a base reference.
  • Make changes to the application code, one at a time, to fix the IA-64 related warnings. The changes that are made should not impact the IA-32 functionality. Use code guards to protect and isolate changes:
    #ifdef _WIN64...#else...#endif Some of the commonly encountered Win64 warnings and ways to fix them are addressed in the following separate items:

 

 


Source

Porting Microsoft Windows Applications to Intel® Itanium® Processor Systems