Win64 C & ASM

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.
CopperMan

Win64 C & ASM

Post by CopperMan »

Hi All.

Does some one use Windows x64 (AMD64 platform) for OS deving, if so then please tell me what free 64-bit C/C++ compiler and Assembler is available for this platform?

Thanks,

CopperMan.
FlashBurn

Re:Win64 C & ASM

Post by FlashBurn »

GCC is able to compile to x86-64 and so I think that GAS is able to compile 64bit assembly. If you can also use an extern assembler than FASM can be your assembler - it is also able to compile 64bit assembly -
AR

Re:Win64 C & ASM

Post by AR »

By WindowsXP x64, you mean a compiler that runs on it? All 32bit compilers function perfectly, the only one that I'm aware of that can produce binaries for WinXPx64 is the MS one.

If you want to compile for AMD64 CPUs then refer to FlashBurn's post.
Tora OS

Re:Win64 C & ASM

Post by Tora OS »

Only problem you may face with XP x8664 is that if you have a compiler which is 16-bit (like some versions of NASM) then it wont run, since they removed NTVDM from it.
CopperMan

Re:Win64 C & ASM

Post by CopperMan »

Hi, All.

To assemble my sources I'll use NASM64 (comming soon).

I'am looking for a free C compiler that can produce a 64-bit PE executables and runs under Win64 ( even for OS deving I don't need runtime or other libraries ).

I've used MinGW but it can't produce 64-bit code now.
When I'am set -m64 it says something like :
Sorry, not implemented yet.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Win64 C & ASM

Post by Solar »

Have you tried buiding a GCC Cross-Compiler using the 4.0.1 sources, for the ia64-pe target?
Every good solution is obvious once you've found it.
Code

Re:Win64 C & ASM

Post by Code »

CopperMan

Re:Win64 C & ASM

Post by CopperMan »

Solar wrote: Have you tried buiding a GCC Cross-Compiler using the 4.0.1 sources, for the ia64-pe target?
I need an AMD64 C compiler not IA-64. If it is possible to build a cross-compiler for AMD64 platform that produces PE executables under Windows (32/64 don't care) please tell me how to build such compiler.
CopperMan

Re:Win64 C & ASM

Post by CopperMan »

Code wrote: Here you can download an AMD64 gcc cross compiler for cygwin:
http://64bit-os.jp/AireOS/s.i/0f944a9605f85bd3303c90cf8689f5b9b1ff81247373723f637f28e90619dd61
Your server does'nt support download restoring, so with my bad dial-up connection I can't download this binaries.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Win64 C & ASM

Post by Solar »

AMD64 is definitely supported by GCC, at least in its x86_64-unknown-linux-gnu variant. I don't think they broke PE support either.

I don't have an AMD64 for testing, nor indeed a Cygwin installation at this point of time, so I can't be positive about the Cross-Compiler tutorial working for Cygwin / x86_64-pe. But I'll be happy to help with any problems you might encounter while trying it out.

(Damn, I have to get that Cygwin running again on my machine...)
Every good solution is obvious once you've found it.
CopperMan

Re:Win64 C & ASM

Post by CopperMan »

I'll try to build GCC with AMD64-PE support.
I'll try it in different ways.

In case of success or fail I'll post about that.
CopperMan

Re:Win64 C & ASM

Post by CopperMan »

Before starting I've tried to build a 32-bit version GCC 4.0.1 under MinGW.

Configuration : ../gcc-4.0.0/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++ --disable-win32-registry --disable-shared --enable-sjlj-exceptions

During configure stage of libsdc++-v3 it gives following error:

configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

Does some one already knows what to do with this.
CopperMan

Re:Win64 C & ASM

Post by CopperMan »

Report from the battlefield:

I've tried to build :

1. Binutils-2.16.1(last one) for AMD64-PE (with GCC 3.4.4/MinGW/MSYS):

configured with : configure --target=x86_64-pc-pe --prefix=/usr/gcc-amd64 --disable-nls --enable-64-bit-bfd

base configuration is ok but ...
on configuration stage of BFD it says :
target x86_64-pc-pe is not supported ...


2. GCC-4.0.1 for AMD64-PE ( with GCC 3.4.4/MinGW/MSYS ):

configured with : configure --target=x86_64-pc-pe --prefix=/usr/gcc-amd64 --disable-nls --enable-languages=c,c++ --without-headers

base configuration is ok but ...
on configuration stage of GCC it says :
target x86_64-pc-pe is not supported ...
CopperMan

Re:Win64 C & ASM

Post by CopperMan »

As you can see x86_64-pc-pe is not supported yet (look at previous post).

So I try to build binutils and gcc for x86_64-unknown-linux-gnu target.

Binary packages used (can be downloaded from www.mingw.org):
MinGW-4.1.0.exe
MSYS-1.0.10.exe
MSYSDTK-1.0.1.exe
binutils-2.15.94-20050118-1.tar.gz
bison-2.0-MSYS.tar.gz
gcc-core-3.4.4-20050522-1.tar.gz
gcc-g++-3.4.4-20050522-1.tar.gz
mingw-runtime-3.7.tar.gz
w32api-3.2.tar.gz

Source packages used (can be downloaded from gcc.gnu.org and www.gnu.org/software/binutils/):
binutils-2.16.1.tar.bz2
gcc-core-4.0.0.tar.bz2
gcc-g++-4.0.0.tar.bz2
gcc-core-4.0.1.tar.bz2
gcc-g++-4.0.1.tar.bz2

Configuration :

binutils : configure --host=i686-pc-mingw32 --target=x86_64-unknown-linux-gnu --prefix=/(your path) --disable-nls

binutils MUST be installed before building gcc.

gcc : configure --host=i686-pc-mingw32 --target=x86_64-unknown-linux-gnu --prefix=/(your path) --disable-nls --enable-languages=c,c++ --without-headers --disable-threads --disable-shared --with-gcc --with-gnu-as --with-gnu-ld

Now I need to find good documentation for elf and elf64.
If some one knows where those documents can be found let me know.

Thanks to ALL.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Win64 C & ASM

Post by Solar »

Had I known that switching to ELF wouldn't be a show-stopper for you... :P ;)

This link should answer your questions regarding ELF.
Every good solution is obvious once you've found it.
Post Reply