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 7716979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:46:05+00:00 2026-06-01T02:46:05+00:00

When attempting to run the following assembly program: .globl start start: pushq $0x0 movq

  • 0

When attempting to run the following assembly program:

.globl start

start:
    pushq $0x0 
    movq $0x1, %rax
    subq $0x8, %rsp
    int $0x80

I am receiving the following errors:

dyld: no writable segment
Trace/BPT trap

Any idea what could be causing this? The analogous program in 32 bit assembly runs fine.

  • 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-01T02:46:06+00:00Added an answer on June 1, 2026 at 2:46 am

    OSX now requires your executable to have a writable data segment with content, so it can relocate and link your code dynamically. Dunno why, maybe security reasons, maybe due to the new RIP register. If you put a .data segment in there (with some bogus content), you’ll avoid the "no writable segment" error. IMO this is an ld bug.

    Regarding the 64-bit syscall, you can do it 2 ways. GCC-style, which uses the _syscall PROCEDURE from libSystem.dylib, or raw. Raw uses the syscall instruction, not the int 0x80 trap. int 0x80 is an illegal instruction in 64-bit.

    The "GCC method" will take care of categorizing the syscall for you, so you can use the same 32-bit numbers found in sys/syscall.h. But if you go raw, you’ll have to classify what kind of syscall it is by ORing it with a type id. Here is an example of both. Note that the calling convention is different! (this is NASM syntax because gas annoys me)

    ; assemble with
    ; nasm -f macho64 -o syscall64.o syscall64.asm && ld -lc -ldylib1.o -e start -o syscall64 syscall64.o
    extern _syscall
    global start
    
    [section .text align=16]
    start:
        ; do it gcc-style
        mov rdi, 0x4 ; sys_write
        mov rsi, 1 ; file descriptor
        mov rdx, hello
        mov rcx, size
        call _syscall ; we're calling a procedure, not trapping.
        
        ;now let's do it raw
        mov rax, 0x2000001 ; SYS_exit = 1 and is type 2 (bsd call)
        mov rdi, 0 ; Exit success = 0
        syscall ; faster than int 0x80, and legal!
        
        
    [section .data align=16]
    hello: db "hello 64-bit syscall!", 0x0a
    size: equ $-hello
    

    check out http://www.opensource.apple.com/source/xnu/xnu-792.13.8/osfmk/mach/i386/syscall_sw.h for more info on how a syscall is typed.

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

Sidebar

Related Questions

I'm attempting to run mongrel_rails, but I get the following: the program can't start
I am attempting to run the following command in KornShell (ksh): set -A INDEXES
I'm attempting to run the following command in PHP (on Ubuntu): <?php if (exec(/home/johnboy/ffmpeg/ffmpeg
I am getting the following error message when compiling or attempting to run my
I'm using gvim and rails.vim and getting the following error when attempting to run
I am attempting to run the following query sqlcmd -STEMP7 -E -devolive_base -w256 -QEXIT(DECLARE
I am attempting to run the following PowerShell command against my Exchange 2010 SP1
while attempting to run rake, I run into the following error: heroku rake db:migrate
I get an error (1064) when attempting to run the following... (MySql 5.5.9) query:
I am attempting to run my make file however i am getting the following

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.