Skip to content

Commit

Permalink
Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucien Le Roux committed Feb 28, 2017
0 parents commit 8b97025
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
##
## Makefile for in /home/le-rou_c/docs/asm_minilibc
##
## Made by Lucien Le Roux
## Login <[email protected]>
##
## Started on Tue Feb 28 09:39:50 2017 Lucien Le Roux
## Last update Tue Feb 28 09:43:57 2017 Lucien Le Roux
##

NAME = strlen

SRC = strlen.s
OBJ = $(SRC:.s=.o)

CC = nasm -f elf64
LD = ld

RM = rm -f

all: $(NAME)


$(NAME): $(SRC)
$(CC) $(SRC) -o $(OBJ)
$(LD) $(OBJ) -o $(NAME)

clean:
$(RM) $(OBJ)

fclean: clean
$(RM) $(NAME)

re: fclean all
25 changes: 25 additions & 0 deletions strlen.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
section .data


section .text
global _start

_printRBX:
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, [edi] ; argv[0]
mov r10, 1 ; longueur de la chaine
syscall
ret

_start:
mov rbx, rsp
add rbx, 32 ; argv

call _printRBX

mov rax, 60
mov rdi, 0
syscall
ret

0 comments on commit 8b97025

Please sign in to comment.