hackbert
26-11-2004, 13:55
Hallo!
Ich habe mir eine Assemblerdatei geschrieben, die die funktion printf aus der Standard-C-Library benutzt. Ich habe sie mit NASM ohne Fehler kompiliert. Nun folgt das linken mittels:
ld -s -lc -o ./output/hello ./output/hello.o
Das geht auch ohne Fehler, doch nun kommt ein Problem. Wenn ich die Datei starten will kommt immer ein Fehler, dass die Datei nicht auffindbar sei. ein cat ./output/hello beweist mir aber das Gegenteil. Die Rechte sind natürlich richtig gesetzt. Wenn ich nicht mit der C-Library linke, dann kommt selbstverständlich ein unaufgelöstes Symbol...
Wieso sagt er, dass die Datei nicht existiere?
Hier noch mein Makefile:
# Makefile for the hello-world-example
AS = nasm
ASFLAGS = -f elf
LD = ld
LDFLAGS = -s
LDOUTPUT = hello
OUTPUTPATH = ./output
HELLO = hello.s
all:
clear
$(AS) $(ASFLAGS) -o $(OUTPUTPATH)/hello.o $(HELLO)
$(LD) $(LDFLAGS) -lc -o $(OUTPUTPATH)/$(LDOUTPUT) $(OUTPUTPATH)/hello.o
clean:
cd $(OUTPUTPATH) && rm *.o $(LDOUTPUT) && cd ..
Ich habe mir eine Assemblerdatei geschrieben, die die funktion printf aus der Standard-C-Library benutzt. Ich habe sie mit NASM ohne Fehler kompiliert. Nun folgt das linken mittels:
ld -s -lc -o ./output/hello ./output/hello.o
Das geht auch ohne Fehler, doch nun kommt ein Problem. Wenn ich die Datei starten will kommt immer ein Fehler, dass die Datei nicht auffindbar sei. ein cat ./output/hello beweist mir aber das Gegenteil. Die Rechte sind natürlich richtig gesetzt. Wenn ich nicht mit der C-Library linke, dann kommt selbstverständlich ein unaufgelöstes Symbol...
Wieso sagt er, dass die Datei nicht existiere?
Hier noch mein Makefile:
# Makefile for the hello-world-example
AS = nasm
ASFLAGS = -f elf
LD = ld
LDFLAGS = -s
LDOUTPUT = hello
OUTPUTPATH = ./output
HELLO = hello.s
all:
clear
$(AS) $(ASFLAGS) -o $(OUTPUTPATH)/hello.o $(HELLO)
$(LD) $(LDFLAGS) -lc -o $(OUTPUTPATH)/$(LDOUTPUT) $(OUTPUTPATH)/hello.o
clean:
cd $(OUTPUTPATH) && rm *.o $(LDOUTPUT) && cd ..