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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:47:00+00:00 2026-05-18T09:47:00+00:00

I am trying to dive into some x86 assembly programming on my Mac, but

  • 0

I am trying to dive into some x86 assembly programming on my Mac, but am having trouble producing an executable. The problem seems to be at the linking stage.

helloWorld.s:

.data

    HelloWorldString:
    .ascii "Hello World\n"

.text

.globl _start

_start:
    # load all the arguments for write()
    movl $4, %eax
    movl $1, %ebx
    movl $HelloWorldString, %ecx
    movl $12, %edx
    # raises software interrupt to call write()
    int $0x80

    # call exit()
    movl $1, %eax
    movl $0, %ebx
    int $0x80

Assemble the program:

as -o helloWorld.o helloWorld.s

Link the object file:

ld -o helloWorld helloWorld.o

The error I get at this point is:

ld: could not find entry point "start" (perhaps missing crt1.o) for inferred architecture x86_64

Any advice on what I’m doing wrong / missing would be very helpful. thanks

  • 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-05-18T09:47:01+00:00Added an answer on May 18, 2026 at 9:47 am

    You’ll probably find it easier to build with gcc rather than trying to micro-manage the assembler and linker, e.g.

    $ gcc helloWorld.s -o helloWorld
    

    (You’ll probably want to change _start to _main if you go this route.)

    Incidentally, it can be instructive to start with a working C program, and study the generated asm from this. E.g.

    #include <stdio.h>
    
    int main(void)
    {
        puts("Hello world!\n");
    
        return 0;
    }
    

    when compiled with gcc -Wall -O3 -m32 -fno-PIC hello.c -S -o hello.S generates:

        .cstring
    LC0:
        .ascii "Hello world!\12\0"
        .text
        .align 4,0x90
    .globl _main
    _main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $24, %esp
        movl    $LC0, (%esp)
        call    _puts
        xorl    %eax, %eax
        leave
        ret
        .subsections_via_symbols
    

    You might want to consider using this as a template for your own “Hello world” or other experimental asm programs, especially given that it already builds and runs:

    $ gcc -m32 hello.S -o hello
    $ ./hello 
    Hello world!
    

    One final comment: beware of taking examples from Linux-oriented asm books or tutorials and trying to apply them under OS X – there are important differences !

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

Sidebar

Related Questions

Trying to dive into Qt big time but haven't done a large project with
This is my first real dive into JavaScript. Sure I've used it before, but
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I'm trying to work my way through some frustrating encoding issues by going back
Greetings, I'm trying to develop some tests for Mason components which requires running them
I'm very new to Python, sort of following Dive into Python 2 and wanted
This is my first dive into MSBuild so I'm feeling pretty lost. The end

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.