I created this simple NASM program for Ubuntu 18.04 and compiled it to an exe as shown below. When I run with gdb I get "No such file or directory" even though the file exists in the current directory
; Header Section
[BITS 64]
[default rel]
global _start
global NLTK_Gutenberg_fn
extern Lib_Math
section .data align=64
section .rodata align=64
module_name: db 'nltk',0x00
; _________
section .text
; __________
; Main Entry
_start:
push rdi
push rbp
push rbx
lea rdi,[module_name]
call [rel Lib_Math wrt ..got]
NLTK_Gutenberg_fn:
mov rax,0
mov rbx,0
pop rbx
pop rbp
pop rdi
ret
Compile and link:
cd /opt/P01_SH/NLTK_Gutenberg/C_Replica
sudo nasm -f elf64 -g -F dwarf NLTK_Gutenberg-exec.asm
sudo ld NLTK_Gutenberg-exec.o /opt/P01_SH/NLTK_Gutenberg/C_Replica/Python_Math.o -lpython3.8 -ldl -lrt -lpthread -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/ -o NLTK_Gutenberg-exec.exe
cd /opt/P01_SH/NLTK_Gutenberg/C_Replica
gdb NLTK_Gutenberg-exec.exe
I usually create shared objects in NASM and I never have any problems, but with this .exe I am getting the "not found" error and I can't see why.
Thanks.