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

  • SEARCH
  • Home
  • 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 9134753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:43:07+00:00 2026-06-17T08:43:07+00:00

NASM compiles just fine, but when i use YASM I’m getting the following error:

  • 0

NASM compiles just fine, but when i use YASM I’m getting the following error:

hello.asm:12: error: macho: sorry, cannot apply 32 bit absolute
relocations in 64 bit mode, consider “[_symbol wrt rip]” for mem
access, “qword” and “dq _foo” for pointers.

Makefile

test: hello
    ./hello
hello:
    yasm -f macho64 hello.asm   
    ld -o hello hello.o
clean:
    rm *.o *.core hello

system.inc

%define stdin       0
%define stdout      1
%define stderr      2

%define SYS_nosys   0
%define SYS_exit    1
%define SYS_fork    2
%define SYS_read    3
%define SYS_write   4

section .text
align 4
access.the.osx.kernel:
    syscall
    ret

%macro  system  1
    mov rax, %1
    call    access.the.osx.kernel
%endmacro

%macro  sys.exit    0
    system  SYS_exit
%endmacro

%macro  sys.write   0
    system  SYS_write
%endmacro

hello.asm

%include 'system.inc'

section .data
hello   db  'Hello, World!', 0Ah
hbytes  equ $-hello

section .text
global  start
start:
mov rax, 0x2000004
mov rdi, stdout
mov rsi, hello
mov rdx, hbytes
syscall
;sys.write

xor rdi, rdi
mov rax, 0x2000001
syscall
;sys.exit

Anyone know what’s going on? And if you could explain why NASM works, but YASM doesn’t that would be a bonus.

  • 1 1 Answer
  • 0 Views
  • 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-06-17T08:43:08+00:00Added an answer on June 17, 2026 at 8:43 am

    I got it working. In yasm you have to explicitly tell it that the address is 64-bit like so:

    mov rsi, qword hello
    

    The documentation talks about the situation here: https://github.com/yasm/yasm/wiki/AMD64

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting started with ASM (NASM), and need some help with the following
I'm using NASM compiler to create small asm applications. I need to load my
I have been dealing with Nasm and GNU C inline asm on a Linux
Let's say we use NASM as they do in this answer: how to write
I've got the following ASM code: USE32 Start: jmp Main struc st .stLong resd
I have written following code in nasm assembly for printing array element on scree.In
I have the following code which assembles and runs fine on Windows XP 32
I try write simple kernel module (v3.6) in nasm, but insmod say me: $
I'm currently using NASM to compile the code but there is not tool to
(I'm writing in pure x86 assembly for NASM, not in C/C++.) I'm getting a

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.