Add x86_64-linux-gnu emulator

I wanted a tiny scriptable meltdown proof way to run userspace programs
and visualize how program execution impacts memory. It helps to explain
how things like Actually Portable Executable works. It can show you how
the GCC generated code is going about manipulating matrices and more. I
didn't feel fully comfortable with Qemu and Bochs because I'm not smart
enough to understand them. I wanted something like gVisor but with much
stronger levels of assurances. I wanted a single binary that'll run, on
all major operating systems with an embedded GPL barrier ZIP filesystem
that is tiny enough to transpile to JavaScript and run in browsers too.

https://justine.storage.googleapis.com/emulator625.mp4
This commit is contained in:
Justine Tunney 2020-08-25 04:23:25 -07:00
parent 467504308a
commit f4f4caab0e
1052 changed files with 65667 additions and 7825 deletions

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall __utimensat$sysv 0x00540223ffff0118 globl hidden

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall futimens$sysv 0x00550222ffffffff globl hidden

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall futimens 0x00550222ffffffff globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall futimes$sysv 0x004d00ce208bffff globl hidden

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall futimes 0x004d00ce208bffff globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.inc"
.scall futimesat$sysv 0xffff01eeffff0105 globl hidden

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall futimesat 0xffff01eeffff0105 globl hidden

View file

@ -1,2 +0,0 @@
.include "o/libc/sysv/macros.inc"
.scall utimensat 0x00540223ffff0118 globl hidden

View file

@ -410,15 +410,21 @@ syscon fcntl F_GETPIPE_SZ 0x0408 0 0 0 0
#
# group name GNU/Systemd XNU's Not UNIX FreeBSD OpenBSD XENIX Commentary
syscon at AT_FDCWD -100 -2 -100 -100 -100 # faked nt
syscon at AT_SYMLINK_FOLLOW 0x0400 0x40 0x0400 4 0
syscon at AT_SYMLINK_NOFOLLOW 0x0100 0x20 0x0200 2 0 # TODO(jart): What should NT do?
syscon at AT_REMOVEDIR 0x0200 0x80 0x0800 8 0x0200 # faked nt
syscon at AT_EACCESS 0x0200 0x10 0x0100 1 0
syscon at AT_SYMLINK_FOLLOW 0x0400 0x40 0x0400 4 0
syscon at AT_EMPTY_PATH 0x1000 0 0 0 0 # linux 2.6.39+; see unlink, O_TMPFILE, etc.
syscon memfd MFD_CLOEXEC 1 0 0 0 0
syscon memfd MFD_ALLOW_SEALING 2 0 0 0 0
# utimensat()
#
# group name GNU/Systemd XNU's Not UNIX FreeBSD OpenBSD XENIX Commentary
syscon utime UTIME_NOW 0x3fffffff 0x3fffffff -1 -2 0x3fffffff # polyfilled xnu/nt
syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe -2 -1 0x3ffffffe # polyfilled xnu/nt
# getauxval() keys
#
# group name GNU/Systemd XNU's Not UNIX FreeBSD OpenBSD XENIX Commentary
@ -2701,9 +2707,6 @@ syscon misc T_FMT_AMPM 0x02002b 4 4 3 0
syscon misc UL_GETFSIZE 1 1 1 0 0
syscon misc UL_SETFSIZE 2 2 2 0 0
syscon misc UTIME_NOW 0x3fffffff 0 -1 -2 0
syscon misc UTIME_OMIT 0x3ffffffe 0 -2 -1 0
syscon misc XATTR_CREATE 1 2 0 0 0
syscon misc XATTR_REPLACE 2 4 0 0 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_ABORTED 2 -2 -2 -2 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_APPEND 0x20 1 1 1 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_DOOFFS 8 2 2 2 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_ERR 1 4 4 4 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_MARK 2 8 8 8 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_NOCHECK 0x10 0x10 0x10 0x10 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_NOESCAPE 0x40 0x2000 0x2000 0x1000 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_NOMATCH 3 -3 -3 -3 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_NOSORT 4 0x20 0x20 0x20 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_NOSPACE 1 -1 -1 -1 0

View file

@ -1,2 +0,0 @@
.include "libc/sysv/consts/syscon.inc"
.syscon glob GLOB_NOSYS 4 -4 -4 -4 0

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon misc UTIME_NOW 0x3fffffff 0 -1 -2 0
.syscon utime UTIME_NOW 0x3fffffff 0x3fffffff -1 -2 0x3fffffff

View file

@ -1,2 +1,2 @@
.include "libc/sysv/consts/syscon.inc"
.syscon misc UTIME_OMIT 0x3ffffffe 0 -2 -1 0
.syscon utime UTIME_OMIT 0x3ffffffe 0x3ffffffe -2 -1 0x3ffffffe

View file

@ -14,14 +14,16 @@ hidden extern const long AT_SYMLINK_FOLLOW;
hidden extern const long AT_SYMLINK_NOFOLLOW;
hidden extern const long AT_REMOVEDIR;
hidden extern const long AT_EACCESS;
hidden extern const long AT_EMPTY_PATH;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define AT_FDCWD SYMBOLIC(AT_FDCWD)
#define AT_SYMLINK_FOLLOW SYMBOLIC(AT_SYMLINK_FOLLOW)
#define AT_FDCWD SYMBOLIC(AT_FDCWD)
#define AT_SYMLINK_FOLLOW SYMBOLIC(AT_SYMLINK_FOLLOW)
#define AT_SYMLINK_NOFOLLOW SYMBOLIC(AT_SYMLINK_NOFOLLOW)
#define AT_REMOVEDIR SYMBOLIC(AT_REMOVEDIR)
#define AT_EACCESS SYMBOLIC(AT_EACCESS)
#define AT_REMOVEDIR SYMBOLIC(AT_REMOVEDIR)
#define AT_EACCESS SYMBOLIC(AT_EACCESS)
#define AT_EMPTY_PATH SYMBOLIC(AT_EMPTY_PATH)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_AT_H_ */

View file

@ -9,7 +9,6 @@ hidden extern const long AT_BASE_PLATFORM;
hidden extern const long AT_CLKTCK;
hidden extern const long AT_DCACHEBSIZE;
hidden extern const long AT_EGID;
hidden extern const long AT_EMPTY_PATH;
hidden extern const long AT_ENTRY;
hidden extern const long AT_EUID;
hidden extern const long AT_EXECFD;
@ -33,30 +32,29 @@ hidden extern const long AT_UID;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define AT_BASE SYMBOLIC(AT_BASE)
#define AT_BASE SYMBOLIC(AT_BASE)
#define AT_BASE_PLATFORM SYMBOLIC(AT_BASE_PLATFORM)
#define AT_CLKTCK SYMBOLIC(AT_CLKTCK)
#define AT_DCACHEBSIZE SYMBOLIC(AT_DCACHEBSIZE)
#define AT_EGID SYMBOLIC(AT_EGID)
#define AT_EMPTY_PATH SYMBOLIC(AT_EMPTY_PATH)
#define AT_ENTRY SYMBOLIC(AT_ENTRY)
#define AT_EUID SYMBOLIC(AT_EUID)
#define AT_EXECFD SYMBOLIC(AT_EXECFD)
#define AT_EXECFN SYMBOLIC(AT_EXECFN)
#define AT_GID SYMBOLIC(AT_GID)
#define AT_ICACHEBSIZE SYMBOLIC(AT_ICACHEBSIZE)
#define AT_NOTELF SYMBOLIC(AT_NOTELF)
#define AT_NO_AUTOMOUNT SYMBOLIC(AT_NO_AUTOMOUNT)
#define AT_OSRELDATE SYMBOLIC(AT_OSRELDATE)
#define AT_PAGESZ SYMBOLIC(AT_PAGESZ)
#define AT_PHDR SYMBOLIC(AT_PHDR)
#define AT_PHENT SYMBOLIC(AT_PHENT)
#define AT_PHNUM SYMBOLIC(AT_PHNUM)
#define AT_PLATFORM SYMBOLIC(AT_PLATFORM)
#define AT_RANDOM SYMBOLIC(AT_RANDOM)
#define AT_SECURE SYMBOLIC(AT_SECURE)
#define AT_SYSINFO_EHDR SYMBOLIC(AT_SYSINFO_EHDR)
#define AT_UCACHEBSIZE SYMBOLIC(AT_UCACHEBSIZE)
#define AT_UID SYMBOLIC(AT_UID)
#define AT_CLKTCK SYMBOLIC(AT_CLKTCK)
#define AT_DCACHEBSIZE SYMBOLIC(AT_DCACHEBSIZE)
#define AT_EGID SYMBOLIC(AT_EGID)
#define AT_ENTRY SYMBOLIC(AT_ENTRY)
#define AT_EUID SYMBOLIC(AT_EUID)
#define AT_EXECFD SYMBOLIC(AT_EXECFD)
#define AT_EXECFN SYMBOLIC(AT_EXECFN)
#define AT_GID SYMBOLIC(AT_GID)
#define AT_ICACHEBSIZE SYMBOLIC(AT_ICACHEBSIZE)
#define AT_NOTELF SYMBOLIC(AT_NOTELF)
#define AT_NO_AUTOMOUNT SYMBOLIC(AT_NO_AUTOMOUNT)
#define AT_OSRELDATE SYMBOLIC(AT_OSRELDATE)
#define AT_PAGESZ SYMBOLIC(AT_PAGESZ)
#define AT_PHDR SYMBOLIC(AT_PHDR)
#define AT_PHENT SYMBOLIC(AT_PHENT)
#define AT_PHNUM SYMBOLIC(AT_PHNUM)
#define AT_PLATFORM SYMBOLIC(AT_PLATFORM)
#define AT_RANDOM SYMBOLIC(AT_RANDOM)
#define AT_SECURE SYMBOLIC(AT_SECURE)
#define AT_SYSINFO_EHDR SYMBOLIC(AT_SYSINFO_EHDR)
#define AT_UCACHEBSIZE SYMBOLIC(AT_UCACHEBSIZE)
#define AT_UID SYMBOLIC(AT_UID)
#endif /* COSMOPOLITAN_LIBC_CALLS_AUXV_H_ */

16
libc/sysv/consts/utime.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_
#include "libc/runtime/symbolic.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
hidden extern const int UTIME_NOW;
hidden extern const int UTIME_OMIT;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#define UTIME_NOW SYMBOLIC(UTIME_NOW)
#define UTIME_OMIT SYMBOLIC(UTIME_OMIT)
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_UTIME_H_ */

View file

@ -1,51 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney
This program is free software; you can redistribute it and/or modify │
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License. │
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of │
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software │
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "libc/macros.h"
#include "libc/notice.inc"
#include "libc/sysv/consts/auxv.h"
.source __FILE__
/ Canary for -fstack-protector.
/
/ This global is referenced by synthetic code generated by GCC.
/ The -mstack-protector-guard=global flag might need to be passed.
/
/ @note this value is protected by piro
.initbss 301,_init___stack_chk_guard
__stack_chk_guard:
.quad 0
.endobj __stack_chk_guard,globl
.previous
.init.start 301,_init___stack_chk_guard
mov kStartTsc(%rip),%rax
mov AT_RANDOM,%edx # modern linux provides this
test %edx,%edx
jz 1f
pushpop -16,%rcx
0: add $16,%rcx # ax ^= di[1][0] if di[0]=AT_RANDOM
cmpq $0,(%r15,%rcx) # %r15 is qword(*auxv)[2]
jz 1f # @see libc/crt/crt.S
cmp %rdx,(%r15,%rcx)
jne 0b
mov 8(%r15,%rcx),%rcx
xor (%rcx),%rax
1: stosq
.init.end 301,_init___stack_chk_guard

View file

@ -18,6 +18,7 @@
02110-1301 USA
*/
#include "libc/macros.h"
.source __FILE__
/ Performs raw System Five system call.
/
@ -41,4 +42,3 @@ syscall:mov %rdi,%rax
mov 8(%rsp),%r9
jmp *systemfive(%rip)
.endfn syscall,globl
.source __FILE__

View file

@ -184,8 +184,6 @@ scall settimeofday 0x0044007a207a00a4 globl
scall mount 0x0015001520a700a5 globl
scall reboot 0x00370037203700a9 globl
scall quotactl 0x0094009420a500b3 globl
scall 'utime$sysv' 0xffffffffffff0084 globl hidden
scall 'utimes$sysv' 0x004c008a208a00eb globl hidden
scall setfsuid 0xffffffffffff007a globl
scall setfsgid 0xffffffffffff007b globl
scall capget 0xffffffffffff007d globl
@ -282,7 +280,11 @@ scall inotify_rm_watch 0xffffffffffff00ff globl
scall 'openat$sysv' 0x014101f321cf0101 globl hidden # Linux 2.6.16+ (c. 2007)
scall 'mkdirat$sysv' 0x013e01f021db0102 globl hidden
scall 'fchownat$sysv' 0x013b01eb21d40104 globl hidden # @asyncsignalsafe
scall futimesat 0xffff01eeffff0105 globl hidden # @asyncsignalsafe
scall 'utime$sysv' 0xffffffffffff0084 globl hidden
scall 'utimes$sysv' 0x004c008a208a00eb globl hidden
scall 'futimesat$sysv' 0xffff01eeffff0105 globl hidden # @asyncsignalsafe
scall 'futimes$sysv' 0x004d00ce208bffff globl hidden
scall 'futimens$sysv' 0x00550222ffffffff globl hidden
scall '__fstatat$sysv' 0x002a022821d60106 globl hidden # a.k.a. newfstatat(); FreeBSD 12+; needs stat2linux()
scall 'unlinkat$sysv' 0x014501f721d80107 globl hidden
scall 'renameat$sysv' 0x014301f521d10108 globl hidden
@ -301,7 +303,7 @@ scall move_pages 0xffffffffffff0117 globl # NOTE: We view Red Hat versio
#──────────────────────RHEL 5.0 LIMIT──────────────────────── # ←┬─ last gplv2 distro w/ sysv init was rhel5 c. 2007
scall '__preadv$sysv' 0x010b0121ffff0127 globl hidden # ├─ cosmopolitan at minimum requires rhel5
scall '__pwritev$sysv' 0x010c0122ffff0128 globl hidden # ├─ python modules need to work on this (pep513)
scall utimensat 0x00540223ffff0118 globl hidden # └─ end of life 2020-11-30 (extended)
scall '__utimensat$sysv' 0x00540223ffff0118 globl hidden # └─ end of life 2020-11-30 (extended)
scall 'fallocate$sysv' 0xffffffffffff011d globl hidden
scall 'posix_fallocate$sysv' 0xffff0212ffffffff globl hidden
scall '__accept4$sysv' 0x005d021dffff0120 globl hidden # Linux 2.6.28+
@ -380,7 +382,6 @@ scall getfh 0x00a100a120a1ffff globl
scall chflags 0x002200222022ffff globl
scall getfsstat 0x003e022d215bffff globl
scall nfssvc 0x009b009b209bffff globl
scall futimes 0x004d00ce208bffff globl
scall adjtime 0x008c008c208cffff globl
scall fchflags 0x002300232023ffff globl
scall '__seteuid$bsd' 0x00b700b720b7ffff globl hidden # wrapped via setreuid()
@ -424,7 +425,6 @@ scall auditon 0xffff01be215fffff globl
scall msgsys 0xffff00aa20fcffff globl
scall shmsys 0xffff00ab20fdffff globl
#─────────────────────FREEBSD & OPENBSD──────────────────────
scall futimens 0x00550222ffffffff globl
scall fhstat 0x01260229ffffffff globl
scall chflagsat 0x006b021cffffffff globl
scall profil 0x002c002cffffffff globl

View file

@ -97,7 +97,10 @@ systemfive.linux:
test %eax,%eax
js systemfive.enosys
mov %rcx,%r10
push %rbp
mov %rsp,%rbp
syscall
pop %rbp
cmp $-4095,%rax
jae systemfive.error
ret
@ -123,7 +126,10 @@ systemfive.bsd:
cmp $0xfff,%ax
jae systemfive.enosys
mov %rcx,%r10
push %rbp
mov %rsp,%rbp
syscall
pop %rbp
jc systemfive.errno
ret
systemfive.xnu:
@ -160,52 +166,62 @@ systemfive.xnu:
push %rbx
push %rsi
testb $XNU,(%rdi) # @see libc/crt/crt.S
jnz .Lsystemfive.init.xnu
jnz systemfive.init.xnu
testb $FREEBSD,(%rdi) # @see libc/crt/crt.S
jnz .Lsystemfive.init.freebsd
jnz systemfive.init.freebsd
testb $WINDOWS,(%rdi) # @see libc/runtime/winmain.c
jnz .Lsystemfive.init.windows
jnz systemfive.init.windows
cmpq $0,(%r15) # OpenBSD doesn't have auxv
je .Lsystemfive.init.openbsd
je systemfive.init.openbsd
/ default state is safe state
/ 𝑠𝑙𝑖𝑑𝑒
.Lsystemfive.init.linux:
systemfive.init.linux:
pushb systemfive.linux-.Lanchorpoint
push $LINUX
ezlea syscon.linux,si
jmp .Lsystemfive.init.os
.Lsystemfive.init.windows:
jmp systemfive.init.os
systemfive.init.windows:
pushb systemfive.enosys-.Lanchorpoint
push $WINDOWS
ezlea syscon.windows,si
jmp .Lsystemfive.init.os
.Lsystemfive.init.freebsd:
jmp systemfive.init.os
systemfive.init.freebsd:
pushb systemfive.freebsd-.Lanchorpoint
push $FREEBSD
ezlea syscon.freebsd,si
jmp .Lsystemfive.init.os
.Lsystemfive.init.openbsd:
jmp systemfive.init.os
systemfive.init.openbsd:
pushb systemfive.openbsd-.Lanchorpoint
push $OPENBSD
ezlea syscon.openbsd,si
jmp .Lsystemfive.init.os
.Lsystemfive.init.xnu:
jmp systemfive.init.os
systemfive.init.xnu:
pushb systemfive.xnu-.Lanchorpoint
push $XNU
ezlea syscon.xnu,si
/ 𝑠𝑙𝑖𝑑𝑒
.Lsystemfive.init.os:
systemfive.init.os:
ezlea .Lanchorpoint,cx
pop %rax
stosq # hostos
pop %rax
add %rcx,%rax
stosq # systemfive
.Lsystemfive.sleb128unpacker:
push %rdi
ezlea .Lsyscon.start,di
orq $-1,%r9
ezlea .Lsyscon.end,bx
ezlea syscon.start,di
ezlea syscon.end,bx
call systemfive.sleb128unpacker
pop %rdi
/ 𝑠𝑙𝑖𝑑𝑒
systemfive.init.done:
pop %rsi
pop %rbx
.init.end 300,_init_systemfive,globl,hidden
.text.startup
systemfive.sleb128unpacker:
.leafprologue
or $-1,%r9
2: cmp %rbx,%rdi
jnb 5f
xor %ecx,%ecx
@ -228,12 +244,8 @@ systemfive.xnu:
cmovne (%rdi),%rax # @see WinMain() for example
stosq
jmp 2b
5: pop %rdi
/ 𝑠𝑙𝑖𝑑𝑒
.Lsystemfive.init.done:
pop %rsi
pop %rbx
.init.end 300,_init_systemfive,globl,hidden
5: .leafepilogue
.previous
/ Sections for varint encoded numbers.
/
@ -244,11 +256,11 @@ systemfive.xnu:
/ @see libc/sysv/consts/syscon.h
.section .piro.bss.sort.syscon.1,"aw",@nobits
.align 8
.Lsyscon.start:/*
syscon.start:/*
...decentralized quadwords...
*/.previous
.section .piro.bss.sort.syscon.3,"aw",@nobits
.Lsyscon.end:
syscon.end:
.previous
.section .sort.rodata.syscon.linux.1,"a",@progbits
.align 1
@ -275,10 +287,19 @@ syscon.openbsd:/*
syscon.windows:/*
...decentralized leb128...
*/.previous
.type .Lsyscon.start,@object
.type .Lsyscon.end,@object
.type syscon.start,@object
.type syscon.end,@object
.type syscon.linux,@object
.type syscon.xnu,@object
.type syscon.freebsd,@object
.type syscon.openbsd,@object
.type syscon.windows,@object
.globl syscon.start
.globl syscon.end
.globl syscon.linux
.globl syscon.xnu
.globl syscon.freebsd
.globl syscon.openbsd
.globl syscon.windows

View file

@ -25,15 +25,13 @@ LIBC_SYSV_A_SRCS_S = $(filter %.S,$(LIBC_SYSV_A_FILES))
LIBC_SYSV_A_CHECKS = $(LIBC_SYSV_A).pkg
LIBC_SYSV_A_DIRECTDEPS = \
LIBC_STUBS \
LIBC_NEXGEN32E
LIBC_STUBS
LIBC_SYSV_A_FILES := \
libc/sysv/macros.h \
libc/sysv/errfuns.h \
libc/sysv/g_syscount.S \
libc/sysv/restorert.S \
libc/sysv/stackchkguard.S \
libc/sysv/syscall.S \
libc/sysv/systemfive.S \
$(wildcard libc/sysv/stubs/*) \
@ -45,9 +43,12 @@ LIBC_SYSV_A_SRCS = \
$(LIBC_SYSV_A_SRCS_S)
LIBC_SYSV_A_OBJS = \
$(LIBC_SYSV_A_SRCS_A:%.s=o/%.o) \
$(LIBC_SYSV_A_SRCS_A:%.s=o/$(MODE)/%.o) \
$(LIBC_SYSV_A_SRCS_S:%.S=o/$(MODE)/%.o) \
$(LIBC_SYSV_A_SRCS:%=o/$(MODE)/%.zip.o)
o/$(MODE)/libc/sysv/g_syscount.S.zip.o \
o/$(MODE)/libc/sysv/restorert.S.zip.o \
o/$(MODE)/libc/sysv/syscall.S.zip.o \
o/$(MODE)/libc/sysv/systemfive.S.zip.o
LIBC_SYSV_A_DEPS := \
$(call uniq,$(foreach x,$(LIBC_SYSV_A_DIRECTDEPS),$($(x))))
@ -62,8 +63,7 @@ $(LIBC_SYSV_A).pkg: \
$(foreach x,$(LIBC_SYSV_A_DIRECTDEPS),$($(x)_A).pkg)
$(LIBC_SYSV_A_OBJS): \
libc/sysv/consts/syscon.inc \
libc/sysv/sysv.mk
libc/sysv/consts/syscon.inc
libc/sysv/consts/syscon.inc: libc/macros.inc
@ -74,9 +74,9 @@ LIBC_SYSV_CALLS = \
$(LIBC_SYSV_CALLS_A)
LIBC_SYSV_ARTIFACTS += LIBC_SYSV_CALLS_A
LIBC_SYSV_CALLS_A = o/libc/sysv/calls.a
LIBC_SYSV_CALLS_A = o/$(MODE)/libc/sysv/calls.a
LIBC_SYSV_CALLS_A_SRCS := $(wildcard libc/sysv/calls/*.s)
LIBC_SYSV_CALLS_A_OBJS = $(LIBC_SYSV_CALLS_A_SRCS:%.s=o/%.o)
LIBC_SYSV_CALLS_A_OBJS = $(LIBC_SYSV_CALLS_A_SRCS:%.s=o/$(MODE)/%.o)
LIBC_SYSV_CALLS_A_CHECKS = $(LIBC_SYSV_CALLS_A).pkg
LIBC_SYSV_CALLS_A_DIRECTDEPS = \
@ -86,7 +86,6 @@ LIBC_SYSV_CALLS_A_DEPS := \
$(call uniq,$(foreach x,$(LIBC_SYSV_CALLS_A_DIRECTDEPS),$($(x))))
$(LIBC_SYSV_CALLS_A): \
libc/sysv/calls/ \
$(LIBC_SYSV_CALLS_A).pkg \
$(LIBC_SYSV_CALLS_A_OBJS)
@ -104,9 +103,9 @@ LIBC_SYSV_MACHCALLS = \
$(LIBC_SYSV_MACHCALLS_A)
LIBC_SYSV_ARTIFACTS += LIBC_SYSV_MACHCALLS_A
LIBC_SYSV_MACHCALLS_A = o/libc/sysv/machcalls.a
LIBC_SYSV_MACHCALLS_A = o/$(MODE)/libc/sysv/machcalls.a
LIBC_SYSV_MACHCALLS_A_SRCS := $(wildcard libc/sysv/machcalls/*.s)
LIBC_SYSV_MACHCALLS_A_OBJS = $(LIBC_SYSV_MACHCALLS_A_SRCS:%.s=o/%.o)
LIBC_SYSV_MACHCALLS_A_OBJS = $(LIBC_SYSV_MACHCALLS_A_SRCS:%.s=o/$(MODE)/%.o)
LIBC_SYSV_MACHCALLS_A_CHECKS = $(LIBC_SYSV_MACHCALLS_A).pkg
LIBC_SYSV_MACHCALLS_A_DIRECTDEPS = \
@ -129,8 +128,5 @@ $(LIBC_SYSV_MACHCALLS_A_OBJS): \
#───────────────────────────────────────────────────────────────────────────────
.PHONY: o/libc/sysv
o/libc/sysv: $(LIBC_SYSV_CHECKS)
.PHONY: o/$(MODE)/libc/sysv
o/$(MODE)/libc/sysv: $(LIBC_SYSV_CHECKS)