Page 1 of 1
ELF64 Compiling - Help Please
Posted: Sat Dec 08, 2007 4:11 am
by Kieran
Hi guys, can anyone post a tutorial for compiling to ELF64 format.
I have read some of the tutorials on here, but failed to understand them.
Posted: Sat Dec 08, 2007 4:30 am
by AJ
What is your toolchain? Assuming binutils with elf64 support/nasm v2.00:
Code: Select all
nasm -f elf64 [inputfiles] -o [outputfiles]
or
x86_64-pc-elf-g++ [yourflags] -o [outputfile] -c [inputfile]
then link with:
Code: Select all
x86_64-pc-elf-ld [inputfiles] -o [outputfile]
It really is that simple. Of course, for ld you can specify -T link.ld and have a linker script specifying the output format elf64-x86-64, but if you have followed
GCC Cross-Compiler for x86 64, this should be the default. As it stated in the tutorial, you are advised to be familiar with your toolchain first - you can get more familiar by following the standard cross-compiler article before you attempt the x86_64 one.
Cheers,
Adam
Posted: Sat Dec 08, 2007 4:54 am
by Kieran
Thanks for the reply Adam, I am following the cross-compiler tutorial now.
Posted: Sat Dec 08, 2007 6:49 pm
by Kieran
I have tried all of the x86_64 tutorial, including trying the patch listed in the wiki, neither have worked. I just keep getting errors.
Has anyone done this before?
Posted: Sun Dec 09, 2007 12:16 pm
by bluecode
Kieran wrote:Has anyone done this before?
Yes, I did it several times (for several gcc & binutils versions) and it always worked perfectly. I wrote a bash script to automagically build a gcc x86 and x86-64 cross-compiler. It can be found in the
lightOS svn repository. It is exactly the same as in the wiki iirc. I have tested the script under cygwin and a normal gnu/linux and it worked perfectly for me.
Posted: Sun Dec 09, 2007 2:02 pm
by Combuster
I followed the guide to the letter and didn't encounter any problems. (I have even adapted it for 68000 targets without problems)
Have you checked the troubleshooting section of the
GCC Cross-Compiler page for hints. Many are not limited to a 32-bit x86 toolchain.
If that doesn't work, would you please post the (topmost) error you get?