NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: killer13666 on July 04, 2015, 03:03:35 PM

Title: Problem with making x86-64 objects
Post by: killer13666 on July 04, 2015, 03:03:35 PM
I want to assemble some assembly routines for use in my C++ programs, but I am having some issues. When I assemble the file into an ELF object, the linker doesn't have any issues. But if I try to assemble the file into an ELF64 object, the linker says the object is of an unrecognized file format. How can I fix this?
Title: Re: Problem with making x86-64 objects
Post by: Rob Neff on July 04, 2015, 04:38:55 PM
Firstly, are you using the linker/loader called "ld" or some other linker?

If have have gcc installed try executing the following:

nasm -f elf64 yourfilename.asm -o yourfilename.o
gcc -Wall -s -o yourfilename yourfilename.o

Did it link and can you now successfully execute it?
Title: Re: Problem with making x86-64 objects
Post by: killer13666 on July 04, 2015, 05:14:02 PM
Yes, I am using ld.exe. I did try that and it still said that the file is of unrecognized format. I asked this same question on the Code::Blocks forum, thinking it was a problem with the IDE at first, but was told to post it here. The link is http://forums.codeblocks.org/index.php/topic,20394.new.html#new (http://forums.codeblocks.org/index.php/topic,20394.new.html#new), which has everything I have tried so far. I think that the problem might be because I have 32-bit mingw, so I am installing the 64-bit version now.
Title: Re: Problem with making x86-64 objects
Post by: killer13666 on July 04, 2015, 05:29:59 PM
The 64-bit version did work without issues. I didn't know Code::Blocks came with the 32-bit version.
Title: Re: Problem with making x86-64 objects
Post by: Rob Neff on July 04, 2015, 05:31:09 PM
Glad to hear you solved it.  8)