Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261912AbVCLOBm (ORCPT ); Sat, 12 Mar 2005 09:01:42 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261915AbVCLOBm (ORCPT ); Sat, 12 Mar 2005 09:01:42 -0500 Received: from relay1.tiscali.de ([62.26.116.129]:57486 "EHLO webmail.tiscali.de") by vger.kernel.org with ESMTP id S261912AbVCLOBe (ORCPT ); Sat, 12 Mar 2005 09:01:34 -0500 Message-ID: <4232F642.2050704@tiscali.de> Date: Sat, 12 Mar 2005 15:01:38 +0100 From: Matthias-Christian Ott User-Agent: Mozilla Thunderbird 1.0 (X11/20050108) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Linux Kernel Mailing List Subject: Strange Linking Problem Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 Lines: 54 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/