Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 620533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:46:28+00:00 2026-05-13T18:46:28+00:00

I have a sample assembly file that I compile with nasm: nasm -f elf

  • 0

I have a sample assembly file that I compile with nasm:

nasm -f elf syscall.asm 

This generates a syscall.o file. I try to link it with ld:

ld -o syscall syscall.o

The ld command fails with the following error:

ld: i386 architecture of input file `syscall.o' is incompatible with i386:x86-64 output

However, if I do

ld -o syscall syscall.o -melf_i386

the command succeeds and I get a syscall executable.

Figuring out that nasm is not generating object code in x86-64 format I added “BITS 64” directive to the beginning of the syscall.asm file.

Then attempting to assemble syscall.asm with nasm gave the following error:

error: elf output format does not support 64-bit code

That seems strange because doing “file /usr/bin/nasm” on my terminal gives:

/usr/bin/nasm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

My 64-bit Fedora Core 11 has the latest version of nasm installed and my CPU is Intel Core 2 Duo E7200.

[EDIT]

My question is how do I get nasm to emit object files that is compatible with i386:x86-64.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:46:28+00:00Added an answer on May 13, 2026 at 6:46 pm

    Try using elf64 as the output format.

    Example run:

    $ cat elf64.asm
    section .text
            jmp [rax]
    $ nasm -f elf64 elf64.asm
    $ objdump -Sr elf64.o
    
    elf64.o:     file format elf64-x86-64
    
    
    Disassembly of section .text:
    
    0000000000000000 <.text>:
       0:   ff 20                   jmpq   *(%rax)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple assembly code file called exit.s that looks like the following:
I have a small assembly bootloader that I got from this Tutorial . The
Beginner to assembly programming for x86. I have a simple asm file which I
I've started working on a little ruby project that will have sample implementations of
I have a sample file like the following: CREATE GLOBAL TEMPORARY TABLE tt_temp_user_11 (
I have this sample code for async operations (copied from the interwebs) public class
Can I have a simple example of an assembly code that when compiled into
I have problem to make work a resource file. This is my simple code
I have an ASP.NET website that generates documents. Each document takes a while to
I have a simple managed C++ assembly which I am providing unmanaged wrappers for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.