diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-02-25 10:50:28 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-02-25 10:50:28 +0100 |
| commit | 5e058cf1a0f66082ecb6f255d2b346c0dfa441c9 (patch) | |
| tree | d2ebf98e79e350fac4f2cef7d5db75b265aef6ef | |
| parent | a2347a0780a90d9f7add3f63a9752229262eedc2 (diff) | |
| download | libasm-5e058cf1a0f66082ecb6f255d2b346c0dfa441c9.tar.gz libasm-5e058cf1a0f66082ecb6f255d2b346c0dfa441c9.tar.bz2 libasm-5e058cf1a0f66082ecb6f255d2b346c0dfa441c9.zip | |
Fixing compilation on Linux by removing wrt ..plt in extern declaration
| -rw-r--r-- | ft_list_push_front.s | 6 | ||||
| -rw-r--r-- | ft_list_remove_if.s | 6 | ||||
| -rw-r--r-- | ft_read.s | 6 | ||||
| -rw-r--r-- | ft_strdup.s | 5 | ||||
| -rw-r--r-- | ft_write.s | 6 | ||||
| -rw-r--r-- | libasm.s | 18 |
6 files changed, 37 insertions, 10 deletions
diff --git a/ft_list_push_front.s b/ft_list_push_front.s index 072f1e7..048a776 100644 --- a/ft_list_push_front.s +++ b/ft_list_push_front.s @@ -10,9 +10,11 @@ ; ; ; **************************************************************************** ; +%include "libasm.s" + %ifdef __LINUX__ %define M_FT_LIST_PUSH_FRONT ft_list_push_front - %define M_MALLOC malloc wrt ..plt + %define M_MALLOC malloc %else %define M_FT_LIST_PUSH_FRONT _ft_list_push_front %define M_MALLOC _malloc @@ -31,7 +33,7 @@ M_FT_LIST_PUSH_FRONT: push rsi xor rdi, rdi mov edi, 16 - call M_MALLOC + call M_MALLOC M_EXTERN_CALL_SUFFIX pop rsi pop rdi cmp rax, 0 diff --git a/ft_list_remove_if.s b/ft_list_remove_if.s index e415768..c9072a6 100644 --- a/ft_list_remove_if.s +++ b/ft_list_remove_if.s @@ -10,9 +10,11 @@ ; ; ; **************************************************************************** ; +%include "libasm.s" + %ifdef __LINUX__ %define M_FT_LIST_REMOVE_IF ft_list_remove_if - %define M_FREE free wrt ..plt + %define M_FREE free %else %define M_FT_LIST_REMOVE_IF _ft_list_remove_if %define M_FREE _free @@ -88,7 +90,7 @@ FT_LIST_REMOVE_IF_REMOVE: EXTERN_FUNCTION_SAVE mov rdi, [rdi] - call M_FREE ; free(*begin_list) + call M_FREE M_EXTERN_CALL_SUFFIX ; free(*begin_list) EXTERN_FUNCTION_SAVE_END mov rax, [rbp - 8] @@ -10,9 +10,11 @@ ; ; ; **************************************************************************** ; +%include "libasm.s" + %ifdef __LINUX__ %define M_FT_READ ft_read - %define M_ERRNO_LOCATION __errno_location wrt ..plt + %define M_ERRNO_LOCATION __errno_location %define M_SYSCALL_READ 0x0 %else %define M_FT_READ _ft_read @@ -41,7 +43,7 @@ FT_READ_ERROR: neg rax %endif push rax - call M_ERRNO_LOCATION + call M_ERRNO_LOCATION M_EXTERN_CALL_SUFFIX pop qword [rax] mov rax, -1 ret diff --git a/ft_strdup.s b/ft_strdup.s index 7de9077..6690819 100644 --- a/ft_strdup.s +++ b/ft_strdup.s @@ -10,12 +10,13 @@ ; ; ; **************************************************************************** ; +%include "libasm.s" %ifdef __LINUX__ %define M_FT_STRDUP ft_strdup %define M_FT_STRLEN ft_strlen %define M_FT_STRCPY ft_strcpy - %define M_MALLOC malloc wrt ..plt + %define M_MALLOC malloc %else %define M_FT_STRDUP _ft_strdup %define M_FT_STRLEN _ft_strlen @@ -38,7 +39,7 @@ M_FT_STRDUP: inc rax ; len++ for '\0' mov rdi, rax ; size to malloc - call M_MALLOC + call M_MALLOC M_EXTERN_CALL_SUFFIX cmp rax, 0 je FT_STRDUP_ERROR @@ -10,9 +10,11 @@ ; ; ; **************************************************************************** ; +%include "libasm.s" + %ifdef __LINUX__ %define M_FT_WRITE ft_write - %define M_ERRNO_LOCATION __errno_location wrt ..plt + %define M_ERRNO_LOCATION __errno_location %define M_SYSCALL_WRITE 0x1 %else %define M_FT_WRITE _ft_write @@ -41,7 +43,7 @@ FT_WRITE_ERROR: neg rax %endif push rax - call M_ERRNO_LOCATION + call M_ERRNO_LOCATION M_EXTERN_CALL_SUFFIX pop qword [rax] mov rax, -1 ret diff --git a/libasm.s b/libasm.s new file mode 100644 index 0000000..78b5736 --- /dev/null +++ b/libasm.s @@ -0,0 +1,18 @@ +; ############################################################################ ; +; ; +; ::: :::::::: ; +; libasm.s :+: :+: :+: ; +; +:+ +:+ +:+ ; +; By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ ; +; +#+#+#+#+#+ +#+ ; +; Created: 2021/02/25 10:38:57 by cacharle #+# #+# ; +; Updated: 2021/02/25 10:45:55 by cacharle ### ########.fr ; +; ; +; ############################################################################ ; + + +%ifdef __LINUX__ + %define M_EXTERN_CALL_SUFFIX wrt ..plt +%else + %define M_EXTERN_CALL_SUFFIX +%endif |
