Skip to contentSkip to conversation

ld trouble

DISCUSSION Kirill Ratkine 2 participants 2 messages Jan 29, 2003

lore
Share & tools
lore
#0 lore raw

Hello.

Could somebody explain me where the problem is?

my nasm file:
; ===
section .text
global _start

msg     db      'Dyna Loading!',0xa
len     equ     $ - msg

_start:

        mov     edx,len
        mov     ecx,msg
        mov     ebx,1
        mov     eax,4
        int     0x80
        mov     eax,1
        int     0x80

my Makefile:
#
cg: cg.o
ld -s -o cg cg.o -ldl
cg.o: cg.asm
nasm -f elf cg.asm

I added '-ldl' because I'm going to use dlopen and other functions for
shared lib loading. Compilation is Ok but ... system says 'this is non executable file' when I try to run it. Why??? (If I delete '-ldl' everything is Ok). Do I need to make my myself loader for '.so', indeed?

#1 lore raw

modify the linker command:

	ld --dynamic-linker /lib/ld-linux.so.2 -ldl -s -o cg cg.o

Kirill Ratkine am Mittwoch, 29. Januar 2003 10:08:

Quoted 39 lines

Hello.

Could somebody explain me where the problem is?

my nasm file:
; ===
section .text
global _start

msg     db      'Dyna Loading!',0xa
len     equ     $ - msg

_start:

         mov     edx,len
         mov     ecx,msg
         mov     ebx,1
         mov     eax,4
         int     0x80
         mov     eax,1
         int     0x80

my Makefile:
#
cg: cg.o
ld -s -o cg cg.o -ldl
cg.o: cg.asm
nasm -f elf cg.asm

I added '-ldl' because I'm going to use dlopen and other functions for shared lib loading. Compilation is Ok but ... system says 'this is non executable file' when I try to run it. Why??? (If I delete '-ldl' everything is Ok).
Do I need to make my myself loader for '.so', indeed?

-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html