Linking flat binary in Windows with NASM and Intel C++

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rootop
Posts: 4
Joined: Sat May 07, 2011 10:31 am

Linking flat binary in Windows with NASM and Intel C++

Post by rootop »

Good evening people!

I'm doing my research regarding OS development before I'm getting started, and the first thing that struck my mind is what compilers and other tools I want to use.
My school provides me with a Simics license, so I have somewhere to test my results in. I also have grown very fond of the Intel C++ Composer (former compiler).
For my assembly needs I have always used NASM, both in Linux and Windows. Although, my issue lies in however I'm going to link NASM objects and ICC objects.

ICC creates COFF objects as far as I'm aware, their xilink.exe that does all the linking is basically a wrapper around the MSVC link.exe, which also only outputs PE/COFF files.
Now when I'm first getting to learn OS development I wish to start of easy with flat binary output, however. Is there a linker today that can link COFF objects to flat binary?

Forget about this, I'm sorry I posted prematurely. I learnt from Intel Forum that ICC directly requires the Visual Studio linker. It is possible to create COFF files separately and later on link them by myself but that seems like an awful lot of unnecessary requirements for my taste.

I'll go over to MingW GCC.
Last edited by rootop on Sat May 07, 2011 1:04 pm, edited 1 time in total.
rootop
Posts: 4
Joined: Sat May 07, 2011 10:31 am

Re: Linking flat binary in Windows with NASM and Intel C++

Post by rootop »

Well, I wanted to have a native toolchain to Windows. Up untill moments ago I didn't think there existed a 64-bit GCC port for Windows, I do know however and planing to use that instead.

Does the GNU assembler lack anything that NASM provides?
rootop
Posts: 4
Joined: Sat May 07, 2011 10:31 am

Re: Linking flat binary in Windows with NASM and Intel C++

Post by rootop »

Well, that's what I don't know. I'd love to stick with just the basic GNU toolchain but I'm more used to NASM. Although, I've never really used any fancy stuff in NASM either. Only thing that strikes my mind is TIMES, but as far as I know GAS has the .rep directive for that?
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Linking flat binary in Windows with NASM and Intel C++

Post by Owen »

GAS does quite a lot of things (especially in the emitting debugging info area) that NASM doesn't do, however, prepare yourself for some really bad diagnostics when you make a mistake
rootop
Posts: 4
Joined: Sat May 07, 2011 10:31 am

Re: Linking flat binary in Windows with NASM and Intel C++

Post by rootop »

Much correct, I'm sorry I went a bit of the topic. Anyway, I'm going over to use the GNU toolchain so problem "solved".

And for any other who might encounter this thread after searching, if you're really not up to GCC then use JLoc or GNU linker (ld) for linkage.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Linking flat binary in Windows with NASM and Intel C++

Post by Gigasoft »

I am using Visual Studio 2008 together with JWASM, and after linking I simply extract and relocate all the sections from the resulting EXE file, then fill out some size fields which my boot code uses. It works like a charm.
Post Reply