commit f52c82446e6fd25cd76d814920b39caf14e5460a
parent d6f33dfcbdda067c5d2bdc3f3c35a93a905c3e70
Author: afify <hassan@afify.dev>
Date: Wed, 23 Mar 2022 09:58:32 +0300
[ref] portable.s
Diffstat:
7 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/abc.s b/abc.s
@@ -1,6 +1,7 @@
; See LICENSE file for copyright and license details.
BITS 64
%include "syscalls.s"
+%include "portable.s"
section .text
global _start
diff --git a/execve.s b/execve.s
@@ -1,6 +1,7 @@
; See LICENSE file for copyright and license details.
BITS 64
%include "syscalls.s"
+%include "portable.s"
section .text
global _start
diff --git a/hi.s b/hi.s
@@ -1,6 +1,7 @@
; See LICENSE file for copyright and license details.
BITS 64
%include "syscalls.s"
+%include "portable.s"
section .text
global _start
diff --git a/macros.s b/macros.s
@@ -8,20 +8,6 @@
%define STDOUT 1
%define STDERR 2
-%macro CHECK_BSD 0
-%ifdef OpenBSD
-section .note.openbsd.ident note
- dd 8, 4, 1
- db "OpenBSD", 0
- dd 0
-%elifdef NetBSD
-section .note.openbsd.ident note
- dd 7, 4, 1
- db "NetBSD", 0, 0
- dd 0
-%endif
-%endmacro
-
%macro EEXIT 1
mov rax, SYS_exit
mov rdi, %1
diff --git a/portable.s b/portable.s
@@ -0,0 +1,20 @@
+; See LICENSE file for copyright and license details.
+
+%ifndef PORTABLE_S
+%define PORTABLE_S
+
+%ifdef OpenBSD
+section .note.openbsd.ident note
+ align 2
+ dd 8, 4, 1
+ db "OpenBSD", 0
+ dd 0
+ align 2
+%elifdef NetBSD
+section .note.openbsd.ident note
+ dd 7, 4, 1
+ db "NetBSD", 0, 0
+ dd 0
+%endif
+
+%endif ;PORTABLE_S
diff --git a/tiny.asm b/tiny.s
diff --git a/tiny64.asm b/tiny64.s