public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias-Christian Ott <matthias.christian@tiscali.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Strange Linking Problem
Date: Sat, 12 Mar 2005 15:01:38 +0100	[thread overview]
Message-ID: <4232F642.2050704@tiscali.de> (raw)

Hi!
I hope I'm right here. I've the following assembler code:

SECTION .DATA
        hello:     db 'Hello world!',10
        helloLen:  equ $-hello

SECTION .TEXT
        GLOBAL main

main:



        ; Write 'Hello world!' to the screen
        mov eax,4            ; 'write' system call
        mov ebx,1            ; file descriptor 1 = screen
        mov ecx,hello        ; string to write
        mov edx,helloLen     ; length of string to write
        int 80h              ; call the kernel

        ; Terminate program
        mov eax,1            ; 'exit' system call
        mov ebx,0            ; exit with error code 0
        int 80h              ; call the kernel


Then I run:

nasm -f elf hello.asm


I link it with ld and run it:

ld -s -o hello hello.o
./hello
segmentation fault


I link it with the gcc and run it:

gcc hello.o -o hello
./hello
Hello world!


What's wrong with the ld?

Matthias-Christian Ott

             reply	other threads:[~2005-03-12 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-12 14:01 Matthias-Christian Ott [this message]
2005-03-12 14:34 ` Strange Linking Problem linux-os
2005-03-13  9:33   ` Matthias-Christian Ott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4232F642.2050704@tiscali.de \
    --to=matthias.christian@tiscali.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox