Author Topic: Problem with making x86-64 objects  (Read 10982 times)

Offline killer13666

  • Jr. Member
  • *
  • Posts: 3
Problem with making x86-64 objects
« 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?

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Problem with making x86-64 objects
« Reply #1 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?

Offline killer13666

  • Jr. Member
  • *
  • Posts: 3
Re: Problem with making x86-64 objects
« Reply #2 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, 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.

Offline killer13666

  • Jr. Member
  • *
  • Posts: 3
Re: Problem with making x86-64 objects
« Reply #3 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.

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Problem with making x86-64 objects
« Reply #4 on: July 04, 2015, 05:31:09 PM »
Glad to hear you solved it.  8)