Get aarch64 hello world working

$ m=aarch64-tiny
    $ make -j8 m=$m o/$m/tool/hello/hello.com o/third_party/qemu/qemu-aarch64
    $ o/third_party/qemu/qemu-aarch64 o/$m/tool/hello/hello.com
    hello world
    $ ls -hal o/$m/tool/hello/hello.com
    -rwxr-xr-x 1 jart jart 4.0K May  9 05:04 o/aarch64-tiny/tool/hello/hello.com
This commit is contained in:
Justine Tunney 2023-05-09 02:35:05 -07:00
parent e5e3cdf447
commit ae0ee59614
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
174 changed files with 1454 additions and 851 deletions

View file

@ -132,6 +132,7 @@ include libc/calls/calls.mk #─┐
include third_party/getopt/getopt.mk # │ include third_party/getopt/getopt.mk # │
include libc/runtime/runtime.mk # ├──SYSTEMS RUNTIME include libc/runtime/runtime.mk # ├──SYSTEMS RUNTIME
include libc/crt/crt.mk # │ You can issue system calls include libc/crt/crt.mk # │ You can issue system calls
include tool/hello/hello.mk # │
include third_party/nsync/nsync.mk # │ include third_party/nsync/nsync.mk # │
include third_party/dlmalloc/dlmalloc.mk #─┘ include third_party/dlmalloc/dlmalloc.mk #─┘
include libc/mem/mem.mk #─┐ include libc/mem/mem.mk #─┐

View file

@ -42,6 +42,7 @@
#include "libc/nexgen32e/uart.internal.h" #include "libc/nexgen32e/uart.internal.h"
#include "libc/nt/pedef.internal.h" #include "libc/nt/pedef.internal.h"
#include "libc/runtime/pc.internal.h" #include "libc/runtime/pc.internal.h"
#include "ape/ape.internal.h"
#include "libc/sysv/consts/prot.h" #include "libc/sysv/consts/prot.h"
#define USE_SYMBOL_HACK 1 #define USE_SYMBOL_HACK 1
@ -587,7 +588,7 @@ ape_disk:
the bourne executable & linkable format */ the bourne executable & linkable format */
#if SupportsWindows() || SupportsMetal() || SupportsXnu() #ifdef APE_IS_SHELL_SCRIPT
apesh: .ascii "\n@\n#'\"\n" // sixth edition shebang apesh: .ascii "\n@\n#'\"\n" // sixth edition shebang
.ascii "m=\"$(uname -m)\"\n" .ascii "m=\"$(uname -m)\"\n"
@ -698,6 +699,8 @@ apesh: .ascii "\n@\n#'\"\n" // sixth edition shebang
.ascii "PHDRS='' <<'@'\n" .ascii "PHDRS='' <<'@'\n"
.endobj apesh .endobj apesh
#if !IsTiny()
// elf program headers get inserted here // elf program headers get inserted here
// because they need to be in the first 4096 bytes // because they need to be in the first 4096 bytes
.section .emush,"a",@progbits .section .emush,"a",@progbits
@ -786,6 +789,8 @@ emush: .ascii "\n@\n#'\"\n"
.ascii "exit 1\n" .ascii "exit 1\n"
.endobj emush .endobj emush
#endif /* !IsTiny() */
#ifdef APE_LOADER #ifdef APE_LOADER
.section .ape.loader,"a",@progbits .section .ape.loader,"a",@progbits
.balign 64 .balign 64
@ -798,7 +803,7 @@ ape_loader_end:
.endobj ape_loader_end,globl .endobj ape_loader_end,globl
.previous .previous
#endif /* APE_LOADER */ #endif /* APE_LOADER */
#endif /* SupportsWindows() || SupportsMetal() || SupportsXnu() */ #endif /* APE_IS_SHELL_SCRIPT */
#if SupportsSystemv() || SupportsMetal() #if SupportsSystemv() || SupportsMetal()
.section .elf.phdrs,"a",@progbits .section .elf.phdrs,"a",@progbits
@ -1024,6 +1029,7 @@ ape_macho:
.previous /* .macho */ .previous /* .macho */
#endif /* SupportsXnu() */ #endif /* SupportsXnu() */
#if SupportsWindows() || SupportsMetal()
/* /*
@ -1100,8 +1106,6 @@ PETEXT = 0b01100000000000000000000001100000
PEDATA = 0b11000000000000000000000011000000 PEDATA = 0b11000000000000000000000011000000
PEIMPS = 0b11000000000000000000000001000000 PEIMPS = 0b11000000000000000000000001000000
#if SupportsWindows() || SupportsMetal()
.section .pe.header,"a",@progbits .section .pe.header,"a",@progbits
.balign __SIZEOF_POINTER__ .balign __SIZEOF_POINTER__
ape_pe: .ascin "PE",4 ape_pe: .ascin "PE",4
@ -1190,6 +1194,8 @@ ape_pe: .ascin "PE",4
#endif /* SupportsWindows() || SupportsMetal() */ #endif /* SupportsWindows() || SupportsMetal() */
#if SupportsWindows()
.section .idata.ro.idt.1,"a",@progbits .section .idata.ro.idt.1,"a",@progbits
.type ape_idata_idtend,@object .type ape_idata_idtend,@object
.type ape_idata_idt,@object .type ape_idata_idt,@object
@ -1205,6 +1211,24 @@ ape_idata_idt:
ape_idata_idtend: ape_idata_idtend:
.previous .previous
.section .piro.data.sort.iat.1,"aw",@progbits
.type ape_idata_iatend,@object
.type ape_idata_iat,@object
.globl ape_idata_iat,ape_idata_iatend
.hidden ape_idata_iat,ape_idata_iatend
ape_idata_iat:
.previous/*
...
decentralized content
...
*/.section .piro.data.sort.iat.3,"aw",@progbits
ape_idata_iatend:
.previous
#endif /* SupportsWindows() */
#if SupportsMetal()
.section .piro.data.sort.metal_gdt,"aw",@progbits .section .piro.data.sort.metal_gdt,"aw",@progbits
.balign 8 .balign 8
_gdt: _gdt:
@ -1241,21 +1265,6 @@ _gdt_end:
.endobj _gdt,global,hidden .endobj _gdt,global,hidden
.previous .previous
.section .piro.data.sort.iat.1,"aw",@progbits
.type ape_idata_iatend,@object
.type ape_idata_iat,@object
.globl ape_idata_iat,ape_idata_iatend
.hidden ape_idata_iat,ape_idata_iatend
ape_idata_iat:
.previous/*
...
decentralized content
...
*/.section .piro.data.sort.iat.3,"aw",@progbits
ape_idata_iatend:
.previous
#if SupportsMetal()
/* /*
αcτµαlly pδrταblε εxεcµταblε § early-stage read-only data αcτµαlly pδrταblε εxεcµταblε § early-stage read-only data
@ -1882,7 +1891,6 @@ ape_pad_text:
.type ape_pad_privileged,@object .type ape_pad_privileged,@object
.hidden ape_pad_privileged .hidden ape_pad_privileged
ape_pad_privileged: ape_pad_privileged:
.balign 4096
.previous .previous
.section .ape.pad.rodata,"a",@progbits .section .ape.pad.rodata,"a",@progbits
@ -1897,11 +1905,13 @@ ape_pad_rodata:
ape_pad_data: ape_pad_data:
.previous .previous
#if SupportsWindows()
.section .idata.ro,"a",@progbits .section .idata.ro,"a",@progbits
.type ape_idata_ro,@object .type ape_idata_ro,@object
.hidden ape_idata_ro .hidden ape_idata_ro
ape_idata_ro: ape_idata_ro:
.previous .previous
#endif /* SupportsWindows() */
.section .dataprologue,"aw",@progbits .section .dataprologue,"aw",@progbits
.type __data_start,@object .type __data_start,@object
@ -1931,6 +1941,8 @@ __bss_start:
__bss_end: __bss_end:
.previous .previous
#ifdef APE_IS_SHELL_SCRIPT
.section .blink,"a",@progbits .section .blink,"a",@progbits
.globl blink_aarch64_size .globl blink_aarch64_size
blink_aarch64: blink_aarch64:
@ -1947,5 +1959,7 @@ blink_darwin_arm64:
blink_darwin_arm64_size = . - blink_darwin_arm64 blink_darwin_arm64_size = . - blink_darwin_arm64
.previous .previous
#endif /* APE_IS_SHELL_SCRIPT */
.end .end
 

9
ape/ape.internal.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef COSMOPOLITAN_APE_APE_INTERNAL_H_
#define COSMOPOLITAN_APE_APE_INTERNAL_H_
#include "libc/dce.h"
#if SupportsWindows() || SupportsMetal() || SupportsXnu()
#define APE_IS_SHELL_SCRIPT
#endif
#endif /* COSMOPOLITAN_APE_APE_INTERNAL_H_ */

View file

@ -181,8 +181,15 @@
#include "libc/elf/pf2prot.internal.h" #include "libc/elf/pf2prot.internal.h"
#include "libc/nt/pedef.internal.h" #include "libc/nt/pedef.internal.h"
#include "libc/thread/tls.h" #include "libc/thread/tls.h"
#include "ape/ape.internal.h"
#include "libc/zip.h" #include "libc/zip.h"
#ifdef __x86__
#define CODE_GRANULE 1
#else
#define CODE_GRANULE 4
#endif
ENTRY(_start) ENTRY(_start)
PHDRS { PHDRS {
@ -250,10 +257,11 @@ SECTIONS {
KEEP(*(SORT_BY_NAME(.sort.text.real.*))) KEEP(*(SORT_BY_NAME(.sort.text.real.*)))
/* Code we want earlier in the binary w/o modifications */ /* Code we want earlier in the binary w/o modifications */
KEEP(*(.ape.loader)) KEEP(*(.ape.loader))
. = ALIGN(CODE_GRANULE);
HIDDEN(_ereal = .); HIDDEN(_ereal = .);
/*END: realmode addressability guarantee */ /*END: realmode addressability guarantee */
/*BEGIN: morphable code */ /*BEGIN: morphable code */
. += 1; . += CODE_GRANULE;
/* Normal Code */ /* Normal Code */
*(.start) *(.start)
@ -291,13 +299,12 @@ SECTIONS {
/* Privileged code invulnerable to magic */ /* Privileged code invulnerable to magic */
KEEP(*(.ape.pad.privileged)); KEEP(*(.ape.pad.privileged));
. += . > 0 ? 1 : 0; . = ALIGN(__privileged_end > __privileged_start ? PAGESIZE : 1);
/*END: morphable code */ /*END: morphable code */
HIDDEN(__privileged_start = .); HIDDEN(__privileged_start = .);
. += . > 0 ? 1 : 0;
*(.privileged) *(.privileged)
HIDDEN(__privileged_end = .); HIDDEN(__privileged_end = .);
. += . > 0 ? 1 : 0; . += . > 0 ? CODE_GRANULE : 0;
/*BEGIN: Read Only Data */ /*BEGIN: Read Only Data */
@ -383,7 +390,7 @@ SECTIONS {
KEEP(*(.dataprologue)) KEEP(*(.dataprologue))
*(.data .data.*) *(.data .data.*)
KEEP(*(SORT_BY_NAME(.sort.data.*))) KEEP(*(SORT_BY_NAME(.sort.data.*)))
. += . > 0 ? 1 : 0; . += . > 0 ? CODE_GRANULE : 0;
KEEP(*(.gotprologue)) KEEP(*(.gotprologue))
*(.got) *(.got)
@ -420,7 +427,7 @@ SECTIONS {
*(.piro.bss) *(.piro.bss)
KEEP(*(SORT_BY_NAME(.piro.bss.sort.*))) KEEP(*(SORT_BY_NAME(.piro.bss.sort.*)))
HIDDEN(__piro_end = .); HIDDEN(__piro_end = .);
. += . > 0 ? 1 : 0; . += . > 0 ? CODE_GRANULE : 0;
/*END: Post-Initialization Read-Only */ /*END: Post-Initialization Read-Only */
/* Statically Allocated Empty Space */ /* Statically Allocated Empty Space */
@ -567,6 +574,8 @@ SHSTUB2(ape_loader_dd_count,
? ROUNDUP(ape_loader_end - ape_loader, PAGESIZE) / 64 ? ROUNDUP(ape_loader_end - ape_loader, PAGESIZE) / 64
: 0); : 0);
#if defined(APE_IS_SHELL_SCRIPT) && !IsTiny()
HIDDEN(blink_aarch64_b0 = RVA(blink_aarch64) % 10 + 48); HIDDEN(blink_aarch64_b0 = RVA(blink_aarch64) % 10 + 48);
HIDDEN(blink_aarch64_b1 = RVA(blink_aarch64) < 10 ? 32 : RVA(blink_aarch64) / 10 % 10 + 48); HIDDEN(blink_aarch64_b1 = RVA(blink_aarch64) < 10 ? 32 : RVA(blink_aarch64) / 10 % 10 + 48);
HIDDEN(blink_aarch64_b2 = RVA(blink_aarch64) < 100 ? 32 : RVA(blink_aarch64) / 100 % 10 + 48); HIDDEN(blink_aarch64_b2 = RVA(blink_aarch64) < 100 ? 32 : RVA(blink_aarch64) / 100 % 10 + 48);
@ -611,6 +620,8 @@ HIDDEN(blink_darwin_arm64_size_b7 = blink_darwin_arm64_size < 10000000 ? 32 : bl
HIDDEN(blink_darwin_arm64_size_b8 = blink_darwin_arm64_size < 100000000 ? 32 : blink_darwin_arm64_size / 100000000 % 10 + 48); HIDDEN(blink_darwin_arm64_size_b8 = blink_darwin_arm64_size < 100000000 ? 32 : blink_darwin_arm64_size / 100000000 % 10 + 48);
HIDDEN(blink_darwin_arm64_size_b9 = blink_darwin_arm64_size < 1000000000 ? 32 : blink_darwin_arm64_size / 1000000000 % 10 + 48); HIDDEN(blink_darwin_arm64_size_b9 = blink_darwin_arm64_size < 1000000000 ? 32 : blink_darwin_arm64_size / 1000000000 % 10 + 48);
#endif /* APE_IS_SHELL_SCRIPT */
#if SupportsMetal() #if SupportsMetal()
HIDDEN(v_ape_realsectors = HIDDEN(v_ape_realsectors =
MIN(0x70000 - IMAGE_BASE_REAL, ROUNDUP(RVA(_ezip), 512)) / 512); MIN(0x70000 - IMAGE_BASE_REAL, ROUNDUP(RVA(_ezip), 512)) / 512);

View file

@ -22,7 +22,14 @@ APE_INCS = $(filter %.inc,$(APE_FILES))
APE = o/$(MODE)/ape/ape.o \ APE = o/$(MODE)/ape/ape.o \
o/$(MODE)/ape/ape.lds o/$(MODE)/ape/ape.lds
ifeq ($(MODE), aarch64) APELINK = \
$(COMPILE) \
-ALINK.ape \
$(LINK) \
$(LINKARGS) \
$(OUTPUT_OPTION)
ifeq ($(ARCH), aarch64)
APE_SRCS = ape/ape.S APE_SRCS = ape/ape.S
APE_OBJS = o/$(MODE)/ape/ape.o APE_OBJS = o/$(MODE)/ape/ape.o
@ -42,13 +49,6 @@ APE_COPY_SELF = \
o/$(MODE)/ape/ape.lds \ o/$(MODE)/ape/ape.lds \
o/$(MODE)/ape/ape-copy-self.o o/$(MODE)/ape/ape-copy-self.o
APELINK = \
$(COMPILE) \
-ALINK.ape \
$(LINK) \
$(LINKARGS) \
$(OUTPUT_OPTION)
APE_LOADER_FLAGS = \ APE_LOADER_FLAGS = \
-DNDEBUG \ -DNDEBUG \
-iquote. \ -iquote. \
@ -75,6 +75,7 @@ o/$(MODE)/ape/public/ape.lds: OVERRIDE_CPPFLAGS += -UCOSMO
o/$(MODE)/ape/public/ape.lds: \ o/$(MODE)/ape/public/ape.lds: \
ape/public/ape.lds \ ape/public/ape.lds \
ape/ape.lds \ ape/ape.lds \
ape/ape.internal.h \
ape/macros.internal.h \ ape/macros.internal.h \
ape/relocations.h \ ape/relocations.h \
libc/intrin/bits.h \ libc/intrin/bits.h \
@ -98,6 +99,7 @@ o/$(MODE)/ape/ape-no-modify-self.o: \
ape/macros.internal.h \ ape/macros.internal.h \
ape/notice.inc \ ape/notice.inc \
ape/relocations.h \ ape/relocations.h \
ape/ape.internal.h \
libc/dce.h \ libc/dce.h \
libc/elf/def.h \ libc/elf/def.h \
libc/intrin/asancodes.h \ libc/intrin/asancodes.h \
@ -127,6 +129,7 @@ o/$(MODE)/ape/ape-copy-self.o: \
ape/macros.internal.h \ ape/macros.internal.h \
ape/notice.inc \ ape/notice.inc \
ape/relocations.h \ ape/relocations.h \
ape/ape.internal.h \
libc/dce.h \ libc/dce.h \
libc/elf/def.h \ libc/elf/def.h \
libc/intrin/asancodes.h \ libc/intrin/asancodes.h \
@ -202,6 +205,7 @@ o/$(MODE)/ape/ape.lds: \
ape/ape.lds \ ape/ape.lds \
ape/macros.internal.h \ ape/macros.internal.h \
ape/relocations.h \ ape/relocations.h \
ape/ape.internal.h \
libc/intrin/bits.h \ libc/intrin/bits.h \
libc/thread/tls.h \ libc/thread/tls.h \
libc/calls/struct/timespec.h \ libc/calls/struct/timespec.h \

Binary file not shown.

View file

@ -18,7 +18,7 @@ TARGET_ARCH ?= -msse3
endif endif
ifeq ($(MODE), aarch64) ifeq ($(MODE), aarch64)
CONFIG_CCFLAGS += -O2 # $(BACKTRACES) $(FTRACE) CONFIG_CCFLAGS += -O2 $(BACKTRACES) #$(FTRACE)
CONFIG_CPPFLAGS += -DSYSDEBUG CONFIG_CPPFLAGS += -DSYSDEBUG
endif endif
@ -32,7 +32,7 @@ endif
# - Limited Backtraces # - Limited Backtraces
# - Compiles 28% faster # - Compiles 28% faster
# #
ifeq ($(MODE),fastbuild) ifeq ($(MODE), fastbuild)
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O
CONFIG_CPPFLAGS += -DSYSDEBUG -DDWARFLESS CONFIG_CPPFLAGS += -DSYSDEBUG -DDWARFLESS
CONFIG_OFLAGS += -g0 CONFIG_OFLAGS += -g0
@ -185,6 +185,31 @@ PYFLAGS += \
-B -B
endif endif
ifeq ($(MODE), aarch64-tiny)
CONFIG_CPPFLAGS += \
-DTINY \
-DNDEBUG \
-DTRUSTWORTHY
CONFIG_CCFLAGS += \
-Os \
-fno-align-functions \
-fno-align-jumps \
-fno-align-labels \
-fno-align-loops \
-fschedule-insns2 \
-fomit-frame-pointer \
-momit-leaf-frame-pointer \
-foptimize-sibling-calls \
-DDWARFLESS
CONFIG_OFLAGS += \
-g0
CONFIG_LDFLAGS += \
-S
PYFLAGS += \
-O2 \
-B
endif
# Linux-Only Tiny Mode # Linux-Only Tiny Mode
# #
# - `make MODE=tinylinux` # - `make MODE=tinylinux`

View file

@ -56,6 +56,7 @@ TMPDIR = o/tmp
AR = build/bootstrap/ar.com AR = build/bootstrap/ar.com
CP = build/bootstrap/cp.com CP = build/bootstrap/cp.com
RM = build/bootstrap/rm.com -f RM = build/bootstrap/rm.com -f
GZIP = build/bootstrap/gzip.com
ECHO = build/bootstrap/echo.com ECHO = build/bootstrap/echo.com
TOUCH = build/bootstrap/touch.com TOUCH = build/bootstrap/touch.com
PKG = build/bootstrap/package.com PKG = build/bootstrap/package.com
@ -72,13 +73,20 @@ IMAGE_BASE_VIRTUAL ?= 0x400000
IGNORE := $(shell $(ECHO) -2 ♥cosmo) IGNORE := $(shell $(ECHO) -2 ♥cosmo)
IGNORE := $(shell $(MKDIR) o/tmp) IGNORE := $(shell $(MKDIR) o/tmp)
ifneq ($(findstring aarch64,$(MODE)),)
ARCH = aarch64
VM = o/third_party/qemu/qemu-aarch64
else
ARCH = x86_64
endif
ifneq ("$(wildcard o/third_party/gcc/bin/x86_64-pc-linux-gnu-*)","") ifneq ("$(wildcard o/third_party/gcc/bin/x86_64-pc-linux-gnu-*)","")
PREFIX = o/third_party/gcc/bin/x86_64-pc-linux-gnu- PREFIX = o/third_party/gcc/bin/x86_64-pc-linux-gnu-
else else
IGNORE := $(shell build/bootstrap/unbundle.com) IGNORE := $(shell build/bootstrap/unbundle.com)
PREFIX = o/third_party/gcc/bin/x86_64-linux-musl- PREFIX = o/third_party/gcc/bin/x86_64-linux-musl-
endif endif
ifeq ($(MODE), aarch64) ifeq ($(ARCH), aarch64)
PREFIX = o/third_party/gcc/bin/aarch64-linux-musl- PREFIX = o/third_party/gcc/bin/aarch64-linux-musl-
endif endif
@ -107,7 +115,7 @@ else
TMPSAFE = $(TMPDIR)/ TMPSAFE = $(TMPDIR)/
endif endif
ifneq ($(MODE), aarch64) ifneq ($(ARCH), aarch64)
MNO_FENTRY = -mno-fentry MNO_FENTRY = -mno-fentry
endif endif
@ -115,11 +123,14 @@ FTRACE = \
-pg -pg
BACKTRACES = \ BACKTRACES = \
-fno-schedule-insns2 \
-fno-omit-frame-pointer \ -fno-omit-frame-pointer \
-fno-optimize-sibling-calls \ -fno-optimize-sibling-calls \
-mno-omit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
ifneq ($(ARCH), aarch64)
BACKTRACES += -fno-schedule-insns2
endif
SANITIZER = \ SANITIZER = \
-fsanitize=address -fsanitize=address
@ -159,7 +170,7 @@ DEFAULT_COPTS = \
-fstrict-overflow \ -fstrict-overflow \
-fno-semantic-interposition -fno-semantic-interposition
ifneq ($(MODE), aarch64) ifneq ($(ARCH), aarch64)
DEFAULT_COPTS += \ DEFAULT_COPTS += \
-mno-red-zone \ -mno-red-zone \
-mno-tls-direct-seg-refs -mno-tls-direct-seg-refs
@ -197,7 +208,6 @@ DEFAULT_ASFLAGS = \
DEFAULT_LDFLAGS = \ DEFAULT_LDFLAGS = \
-static \ -static \
-nostdlib \ -nostdlib \
-melf_x86_64 \
--gc-sections \ --gc-sections \
--build-id=none \ --build-id=none \
--no-dynamic-linker \ --no-dynamic-linker \

View file

@ -32,7 +32,7 @@ o/$(MODE)/%.initabi.o: %.initabi.c ; @$(COMPILE) -AOBJECTIFY.init $(OBJECTIFY.in
o/$(MODE)/%.ncabi.o: %.ncabi.c ; @$(COMPILE) -AOBJECTIFY.nc $(OBJECTIFY.ncabi.c) $(OUTPUT_OPTION) $< o/$(MODE)/%.ncabi.o: %.ncabi.c ; @$(COMPILE) -AOBJECTIFY.nc $(OBJECTIFY.ncabi.c) $(OUTPUT_OPTION) $<
o/$(MODE)/%.real.o: %.c ; @$(COMPILE) -AOBJECTIFY.real $(OBJECTIFY.real.c) $(OUTPUT_OPTION) $< o/$(MODE)/%.real.o: %.c ; @$(COMPILE) -AOBJECTIFY.real $(OBJECTIFY.real.c) $(OUTPUT_OPTION) $<
ifneq ($(MODE), aarch64) ifneq ($(ARCH), aarch64)
o/%.o: %.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(OUTPUT_OPTION) $< o/%.o: %.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(OUTPUT_OPTION) $<
o/%.o: o/%.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(OUTPUT_OPTION) $< o/%.o: o/%.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(OUTPUT_OPTION) $<
o/%.s: %.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $< o/%.s: %.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $<
@ -142,8 +142,8 @@ o/$(MODE)/%: o/$(MODE)/%.com o/$(MODE)/tool/build/cp.com o/$(MODE)/tool/build/as
# then the stdout/stderr output, which would normally be suppressed, # then the stdout/stderr output, which would normally be suppressed,
# will actually be displayed. # will actually be displayed.
o/$(MODE)/%.runs: o/$(MODE)/% o/$(MODE)/%.runs: o/$(MODE)/% $(VM)
@$(COMPILE) -ACHECK -wtT$@ $< $(TESTARGS) @$(COMPILE) -ACHECK -wtT$@ $(VM) $< $(TESTARGS)
################################################################################ ################################################################################
# ELF ZIP FILES # ELF ZIP FILES

10
build/run Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
for last; do true; done
if printf '%s\n' "$last" | grep aarch64 >/dev/null 2>&1; then
if [ ! -f o/third_party/qemu/qemu-aarch64 ]; then
make -j8 o/third_party/qemu/qemu-aarch64
fi
exec o/third_party/qemu/qemu-aarch64 "$@"
else
exec "$@"
fi

View file

@ -184,11 +184,10 @@ o/$(MODE)/usr/share/dict/words.zip.o: private ZIPOBJ_FLAGS += -C2
$(EXAMPLES_OBJS): examples/examples.mk $(EXAMPLES_OBJS): examples/examples.mk
o/$(MODE)/usr/share/dict/words: \ o/$(MODE)/usr/share/dict/words: \
usr/share/dict/words.gz \ usr/share/dict/words.gz
o/$(MODE)/tool/build/gzip.com
@$(MKDIR) $(@D) @$(MKDIR) $(@D)
@o/$(MODE)/tool/build/gzip.com $(ZFLAGS) -cd <$< >$@ @$(GZIP) $(ZFLAGS) -cd <$< >$@
################################################################################ ################################################################################

View file

@ -72,9 +72,7 @@ ssize_t write(int fd, const void *buf, size_t size) {
if ((!buf && size) || (IsAsan() && !__asan_is_valid(buf, size))) { if ((!buf && size) || (IsAsan() && !__asan_is_valid(buf, size))) {
rc = efault(); rc = efault();
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) { } else if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
rc = _weaken(__zipos_write)( rc = enotsup();
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle,
&(struct iovec){buf, size}, 1, -1);
} else if (!IsWindows() && !IsMetal()) { } else if (!IsWindows() && !IsMetal()) {
rc = sys_write(fd, buf, size); rc = sys_write(fd, buf, size);
} else if (fd >= g_fds.n) { } else if (fd >= g_fds.n) {

View file

@ -1021,9 +1021,9 @@ static void __asan_trace(struct AsanTrace *bt, const struct StackFrame *bp) {
} }
if (!__asan_checka(SHADOW(bp), sizeof(*bp) >> 3).kind) { if (!__asan_checka(SHADOW(bp), sizeof(*bp) >> 3).kind) {
addr = bp->addr; addr = bp->addr;
if (addr == _weakaddr("__gc") && _weakaddr("__gc")) { if (addr == (uintptr_t)_weaken(__gc) && (uintptr_t)_weaken(__gc)) {
do --gi; do --gi;
while ((addr = garbage->p[gi].ret) == _weakaddr("__gc")); while ((addr = garbage->p[gi].ret) == (uintptr_t)_weaken(__gc));
} }
bt->p[i] = addr; bt->p[i] = addr;
} else { } else {

View file

@ -13,8 +13,6 @@
* ===----------------------------------------------------------------------=== * ===----------------------------------------------------------------------===
*/ */
STATIC_YOINK("huge_compiler_rt_license");
#include "third_party/compiler_rt/int_lib.h" #include "third_party/compiler_rt/int_lib.h"
#ifdef CRT_HAS_128BIT #ifdef CRT_HAS_128BIT

View file

@ -36,7 +36,7 @@
* @vforksafe * @vforksafe
* @noreturn * @noreturn
*/ */
privileged wontreturn void _Exit(int exitcode) { wontreturn void _Exit(int exitcode) {
int i; int i;
STRACE("_Exit(%d)", exitcode); STRACE("_Exit(%d)", exitcode);
#ifdef __x86_64__ #ifdef __x86_64__
@ -67,7 +67,7 @@ privileged wontreturn void _Exit(int exitcode) {
for (;;) asm("ud2"); for (;;) asm("ud2");
#elif defined(__aarch64__) #elif defined(__aarch64__)
register long x0 asm("x0") = exitcode; register long x0 asm("x0") = exitcode;
asm volatile("mov\tx8,%1\n\t" asm volatile("mov\tx8,%0\n\t"
"svc\t0" "svc\t0"
: /* no outputs */ : /* no outputs */
: "i"(94), "r"(x0) : "i"(94), "r"(x0)

View file

@ -75,7 +75,7 @@ privileged wontreturn void _Exit1(int rc) {
notpossible; notpossible;
#elif defined(__aarch64__) #elif defined(__aarch64__)
register long r0 asm("x0") = rc; register long r0 asm("x0") = rc;
asm volatile("mov\tx8,%1\n\t" asm volatile("mov\tx8,%0\n\t"
"svc\t0" "svc\t0"
: /* no outputs */ : /* no outputs */
: "i"(93), "r"(r0) : "i"(93), "r"(r0)

View file

@ -16,9 +16,12 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
privileged wontreturn void _Exitr(int exitcode) { wontreturn void _Exitr(int exitcode) {
#if SupportsWindows()
_restorewintty(); _restorewintty();
#endif
_Exit(exitcode); _Exit(exitcode);
} }

View file

@ -1,12 +0,0 @@
#ifndef COSMOPOLITAN_LIBC_BITS_EZLEA_H_
#define COSMOPOLITAN_LIBC_BITS_EZLEA_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#if __pic__ + __pie__ + __code_model_medium__ + __code_model_large__ + 0 > 1
#define _ezlea(symbol) "lea\t" symbol "(%%rip),%"
#else
#define _ezlea(symbol) "mov\t$" symbol ",%k"
#endif
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_EZLEA_H_ */

View file

@ -29,7 +29,7 @@
feclearexcept: feclearexcept:
#ifdef __x86_64__ #ifdef __x86_64__
# maintain exceptions in the sse mxcsr, clear x87 exceptions // maintain exceptions in the sse mxcsr, clear x87 exceptions
mov %edi,%ecx mov %edi,%ecx
and $0x3f,%ecx and $0x3f,%ecx
fnstsw %ax fnstsw %ax

View file

@ -35,7 +35,7 @@ const unsigned char kConsoleHandles[3] = {
}; };
// Puts cmd.exe gui back the way it was. // Puts cmd.exe gui back the way it was.
privileged noinstrument void _restorewintty(void) { noinstrument void _restorewintty(void) {
if (!IsWindows()) return; if (!IsWindows()) return;
if (__imp_GetCurrentProcessId() != __pid_exec) return; if (__imp_GetCurrentProcessId() != __pid_exec) return;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {

View file

@ -91,7 +91,6 @@ sched_yield:
#elif defined(__aarch64__) #elif defined(__aarch64__)
mov x8,#0x7c mov x8,#0x7c
svc 0 svc 0
mov w0,#0
ret ret
#else #else

View file

@ -1,33 +1,12 @@
#ifndef COSMOPOLITAN_LIBC_BITS_WEAKEN_H_ #ifndef COSMOPOLITAN_LIBC_BITS_WEAKEN_H_
#define COSMOPOLITAN_LIBC_BITS_WEAKEN_H_ #define COSMOPOLITAN_LIBC_BITS_WEAKEN_H_
#include "libc/intrin/ezlea.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifndef __STRICT_ANSI__
#define _weaken(symbol) \ #define _weaken(symbol) \
({ \ __extension__({ \
typeof(&symbol) _p = &symbol; \ extern __typeof__(symbol) symbol __attribute__((__weak__)); \
asm(".weak\t" #symbol : "+r"(_p)); \ &symbol; \
_p; \
}) })
#define _strongaddr(symbolstr) \
({ \
intptr_t waddr; \
asm(_ezlea(symbolstr) "0" : "=r"(waddr)); \
waddr; \
})
#define _weakaddr(symbolstr) \
({ \
intptr_t waddr; \
asm(".weak\t" symbolstr "\n\t" _ezlea(symbolstr) "0" : "=r"(waddr)); \
waddr; \
})
#else
#define _weaken(symbol) symbol
#define _weakaddr(symbolstr) &(symbolstr)
#endif /* __STRICT_ANSI__ */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_BITS_WEAKEN_H_ */ #endif /* COSMOPOLITAN_LIBC_BITS_WEAKEN_H_ */

View file

@ -103,10 +103,10 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
return -1; return -1;
} }
addr = frame->addr; addr = frame->addr;
if (addr == _weakaddr("__gc")) { if (addr == (uintptr_t)_weaken(__gc)) {
do { do {
--gi; --gi;
} while ((addr = garbage->p[gi].ret) == _weakaddr("__gc")); } while ((addr = garbage->p[gi].ret) == (uintptr_t)_weaken(__gc));
} }
argv[i++] = buf + j; argv[i++] = buf + j;
buf[j++] = '0'; buf[j++] = '0';

View file

@ -83,10 +83,10 @@ cosmo: push %rbp
call _init call _init
// call constructors // call constructors
ezlea __init_array_start,ax # static ctors in forward order ezlea __init_array_start,ax // static ctors in forward order
.weak __init_array_start # could be called multiple times .weak __init_array_start // could be called multiple times
ezlea __init_array_end,cx # idempotency recommended ezlea __init_array_end,cx // idempotency recommended
.weak __init_array_end # @see ape/ape.lds .weak __init_array_end // @see ape/ape.lds
1: cmp %rax,%rcx 1: cmp %rax,%rcx
je 2f je 2f
push %rax push %rax
@ -163,8 +163,8 @@ cosmo: push %rbp
// we subtract 8 because the openbsd kernel always checks rsp // we subtract 8 because the openbsd kernel always checks rsp
// is on a MAP_STACK interval non-inclusively of stack + size // is on a MAP_STACK interval non-inclusively of stack + size
leave leave
pop %rcx # return address pop %rcx // return address
sub $8,%r8d # openbsd:stackbound sub $8,%r8d // openbsd:stackbound
lea (%rax,%r8),%rsp lea (%rax,%r8),%rsp
mov $ape_stack_align,%eax mov $ape_stack_align,%eax
neg %rax neg %rax

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#ifndef __x86_64__ #ifndef __x86_64__
@ -34,8 +35,15 @@ static inline long sys_set_tid_address(int *t) {
} }
#endif #endif
typedef int init_f(int argc, char **argv, char **envp, unsigned long *auxv);
extern init_f __strace_init;
extern init_f *__init_array_start[] __attribute__((__weak__));
extern init_f *__init_array_end[] __attribute__((__weak__));
void cosmo(long *sp) { void cosmo(long *sp) {
int argc; int argc;
init_f **fp;
char **argv, **envp; char **argv, **envp;
unsigned long *auxv; unsigned long *auxv;
argc = *sp; argc = *sp;
@ -47,12 +55,19 @@ void cosmo(long *sp) {
break; break;
} }
} }
#ifdef SYSDEBUG
argc = __strace_init(argc, argv, envp, auxv);
#endif
__argc = argc; __argc = argc;
__argv = argv; __argv = argv;
__envp = envp; __envp = envp;
__auxv = auxv; __auxv = auxv;
environ = envp; environ = envp;
if (argc) program_invocation_name = argv[0]; if (argc) program_invocation_name = argv[0];
_init();
for (fp = __init_array_start; fp < __init_array_end; ++fp) {
(*fp)(argc, argv, envp, auxv);
}
exit(main(argc, argv, envp)); exit(main(argc, argv, envp));
} }

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/dce.h"
#include "libc/intrin/strace.internal.h" #include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/runtime/internal.h" #include "libc/runtime/internal.h"
@ -44,5 +45,9 @@ wontreturn void exit(int exitcode) {
for (p = __fini_array_end; p > __fini_array_start;) { for (p = __fini_array_end; p > __fini_array_start;) {
((void (*)(void))(*--p))(); ((void (*)(void))(*--p))();
} }
#if SupportsWindows()
_Exitr(exitcode); _Exitr(exitcode);
#else
_Exit(exitcode);
#endif
} }

View file

@ -48,16 +48,23 @@
.section .initprologue,"ax",@progbits .section .initprologue,"ax",@progbits
.type _init,@function .type _init,@function
.globl _init .globl _init
_init: push %rbp _init:
#ifdef __x86_64__
push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable .profilable
ezlea __init_bss_start,di ezlea __init_bss_start,di
ezlea __init_rodata_start,si ezlea __init_rodata_start,si
#elif defined(__aarch64__)
stp x29,x30,[sp,-16]!
mov x29,sp
#endif
.previous/* .previous/*
... ...
decentralized content decentralized content
... ...
*/.section .initepilogue,"ax",@progbits */.section .initepilogue,"ax",@progbits
#ifdef __x86_64__
#if IsModeDbg() #if IsModeDbg()
_init_check_rdi_rsi: _init_check_rdi_rsi:
jmp 2f jmp 2f
@ -71,9 +78,14 @@ _init_check_rdi_rsi:
3: .endfn _init_check_rdi_rsi 3: .endfn _init_check_rdi_rsi
#endif #endif
_woot: leave _woot: leave
#elif defined(__aarch64__)
ldp x29,x30,[sp],#16
#endif
ret ret
.previous .previous
#ifdef __x86_64__
// Decentralized section for packed data structures & initializers. // Decentralized section for packed data structures & initializers.
// //
// @see .initro (libc/macros.internal.h) // @see .initro (libc/macros.internal.h)
@ -144,3 +156,5 @@ __text_windows_start:
__text_windows_end: __text_windows_end:
int3 int3
.previous .previous
#endif /* __x86_64__ */

View file

@ -33,7 +33,6 @@ void __morph_tls(void);
void __enable_tls(void); void __enable_tls(void);
void __enable_threads(void) _Hide; void __enable_threads(void) _Hide;
void *__cxa_finalize(void *) _Hide; void *__cxa_finalize(void *) _Hide;
void cosmo(int, char **, char **, long (*)[2]) _Hide wontreturn;
void __stack_chk_fail(void) wontreturn relegated; void __stack_chk_fail(void) wontreturn relegated;
void __stack_chk_fail_local(void) wontreturn relegated _Hide; void __stack_chk_fail_local(void) wontreturn relegated _Hide;
void _jmpstack(void *, void *, ...) _Hide wontreturn; void _jmpstack(void *, void *, ...) _Hide wontreturn;

View file

@ -114,6 +114,8 @@ o//libc/runtime/opensymboltable.greg.o: private \
-Os -Os
# these assembly files are safe to build on aarch64 # these assembly files are safe to build on aarch64
o/$(MODE)/libc/runtime/init.o: libc/runtime/init.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/runtime/vfork.o: libc/runtime/vfork.S o/$(MODE)/libc/runtime/vfork.o: libc/runtime/vfork.S
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $< @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
o/$(MODE)/libc/runtime/clone-linux.o: libc/runtime/clone-linux.S o/$(MODE)/libc/runtime/clone-linux.o: libc/runtime/clone-linux.S

View file

@ -66,6 +66,7 @@ __msabi extern typeof(VirtualProtect) *const __imp_VirtualProtect;
extern int64_t __wincrashearly; extern int64_t __wincrashearly;
extern const char kConsoleHandles[3]; extern const char kConsoleHandles[3];
extern void cosmo(int, char **, char **, long (*)[2]) _Hide wontreturn;
static const short kConsoleModes[3] = { static const short kConsoleModes[3] = {
kNtEnableProcessedInput | kNtEnableLineInput | kNtEnableEchoInput | kNtEnableProcessedInput | kNtEnableLineInput | kNtEnableEchoInput |

View file

@ -20,9 +20,20 @@
.text.unlikely .text.unlikely
__errfun: __errfun:
.errno #ifdef __x86_64__
call __errno_location
mov %ecx,(%rax) mov %ecx,(%rax)
push $-1 push $-1
pop %rax pop %rax
.leafepilogue .leafepilogue // .leafprologue is in errfuns/...
#elif defined(__aarch64__)
stp x19,x30,[sp,#-16]!
mov w19,w0
bl __errno_location
str w19,[x0]
mov x0,#-1
ldp x19,x30,[sp],#16
#else
#error "unsupported architecture"
#endif
.endfn __errfun,globl,hidden .endfn __errfun,globl,hidden

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ #ifndef COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_
#define COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ #define COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef __x86_64__
/** /**
* @fileoverview Optimized error return paths. * @fileoverview Optimized error return paths.
@ -296,664 +295,5 @@ intptr_t ehwpoison(void) relegated;
#define ehwpoison() __ERRFUN("ehwpoison") #define ehwpoison() __ERRFUN("ehwpoison")
#endif #endif
#else
#include "libc/errno.h"
static inline intptr_t einval(void) {
errno = EINVAL;
return -1;
}
static inline intptr_t eperm(void) {
errno = EPERM;
return -1;
}
static inline intptr_t enoent(void) {
errno = ENOENT;
return -1;
}
static inline intptr_t esrch(void) {
errno = ESRCH;
return -1;
}
static inline intptr_t eintr(void) {
errno = EINTR;
return -1;
}
static inline intptr_t eio(void) {
errno = EIO;
return -1;
}
static inline intptr_t enxio(void) {
errno = ENXIO;
return -1;
}
static inline intptr_t e2big(void) {
errno = E2BIG;
return -1;
}
static inline intptr_t enoexec(void) {
errno = ENOEXEC;
return -1;
}
static inline intptr_t ebadf(void) {
errno = EBADF;
return -1;
}
static inline intptr_t echild(void) {
errno = ECHILD;
return -1;
}
static inline intptr_t eagain(void) {
errno = EAGAIN;
return -1;
}
static inline intptr_t enomem(void) {
errno = ENOMEM;
return -1;
}
static inline intptr_t eacces(void) {
errno = EACCES;
return -1;
}
static inline intptr_t efault(void) {
errno = EFAULT;
return -1;
}
static inline intptr_t enotblk(void) {
errno = ENOTBLK;
return -1;
}
static inline intptr_t ebusy(void) {
errno = EBUSY;
return -1;
}
static inline intptr_t eexist(void) {
errno = EEXIST;
return -1;
}
static inline intptr_t exdev(void) {
errno = EXDEV;
return -1;
}
static inline intptr_t enodev(void) {
errno = ENODEV;
return -1;
}
static inline intptr_t enotdir(void) {
errno = ENOTDIR;
return -1;
}
static inline intptr_t eisdir(void) {
errno = EISDIR;
return -1;
}
static inline intptr_t enfile(void) {
errno = ENFILE;
return -1;
}
static inline intptr_t emfile(void) {
errno = EMFILE;
return -1;
}
static inline intptr_t enotty(void) {
errno = ENOTTY;
return -1;
}
static inline intptr_t enotsup(void) {
errno = ENOTSUP;
return -1;
}
static inline intptr_t etxtbsy(void) {
errno = ETXTBSY;
return -1;
}
static inline intptr_t efbig(void) {
errno = EFBIG;
return -1;
}
static inline intptr_t enospc(void) {
errno = ENOSPC;
return -1;
}
static inline intptr_t espipe(void) {
errno = ESPIPE;
return -1;
}
static inline intptr_t erofs(void) {
errno = EROFS;
return -1;
}
static inline intptr_t emlink(void) {
errno = EMLINK;
return -1;
}
static inline intptr_t epipe(void) {
errno = EPIPE;
return -1;
}
static inline intptr_t edom(void) {
errno = EDOM;
return -1;
}
static inline intptr_t erange(void) {
errno = ERANGE;
return -1;
}
static inline intptr_t edeadlk(void) {
errno = EDEADLK;
return -1;
}
static inline intptr_t enametoolong(void) {
errno = ENAMETOOLONG;
return -1;
}
static inline intptr_t enolck(void) {
errno = ENOLCK;
return -1;
}
static inline intptr_t enosys(void) {
errno = ENOSYS;
return -1;
}
static inline intptr_t enotempty(void) {
errno = ENOTEMPTY;
return -1;
}
static inline intptr_t eloop(void) {
errno = ELOOP;
return -1;
}
static inline intptr_t enomsg(void) {
errno = ENOMSG;
return -1;
}
static inline intptr_t eidrm(void) {
errno = EIDRM;
return -1;
}
static inline intptr_t echrng(void) {
errno = ECHRNG;
return -1;
}
static inline intptr_t el2nsync(void) {
errno = EL2NSYNC;
return -1;
}
static inline intptr_t el3hlt(void) {
errno = EL3HLT;
return -1;
}
static inline intptr_t el3rst(void) {
errno = EL3RST;
return -1;
}
static inline intptr_t elnrng(void) {
errno = ELNRNG;
return -1;
}
static inline intptr_t eunatch(void) {
errno = EUNATCH;
return -1;
}
static inline intptr_t enocsi(void) {
errno = ENOCSI;
return -1;
}
static inline intptr_t el2hlt(void) {
errno = EL2HLT;
return -1;
}
static inline intptr_t ebade(void) {
errno = EBADE;
return -1;
}
static inline intptr_t ebadr(void) {
errno = EBADR;
return -1;
}
static inline intptr_t exfull(void) {
errno = EXFULL;
return -1;
}
static inline intptr_t enoano(void) {
errno = ENOANO;
return -1;
}
static inline intptr_t ebadrqc(void) {
errno = EBADRQC;
return -1;
}
static inline intptr_t ebadslt(void) {
errno = EBADSLT;
return -1;
}
static inline intptr_t enostr(void) {
errno = ENOSTR;
return -1;
}
static inline intptr_t enodata(void) {
errno = ENODATA;
return -1;
}
static inline intptr_t etime(void) {
errno = ETIME;
return -1;
}
static inline intptr_t enosr(void) {
errno = ENOSR;
return -1;
}
static inline intptr_t enonet(void) {
errno = ENONET;
return -1;
}
static inline intptr_t enopkg(void) {
errno = ENOPKG;
return -1;
}
static inline intptr_t eremote(void) {
errno = EREMOTE;
return -1;
}
static inline intptr_t enolink(void) {
errno = ENOLINK;
return -1;
}
static inline intptr_t eadv(void) {
errno = EADV;
return -1;
}
static inline intptr_t esrmnt(void) {
errno = ESRMNT;
return -1;
}
static inline intptr_t ecomm(void) {
errno = ECOMM;
return -1;
}
static inline intptr_t eproto(void) {
errno = EPROTO;
return -1;
}
static inline intptr_t emultihop(void) {
errno = EMULTIHOP;
return -1;
}
static inline intptr_t edotdot(void) {
errno = EDOTDOT;
return -1;
}
static inline intptr_t ebadmsg(void) {
errno = EBADMSG;
return -1;
}
static inline intptr_t eoverflow(void) {
errno = EOVERFLOW;
return -1;
}
static inline intptr_t enotuniq(void) {
errno = ENOTUNIQ;
return -1;
}
static inline intptr_t ebadfd(void) {
errno = EBADFD;
return -1;
}
static inline intptr_t eremchg(void) {
errno = EREMCHG;
return -1;
}
static inline intptr_t elibacc(void) {
errno = ELIBACC;
return -1;
}
static inline intptr_t elibbad(void) {
errno = ELIBBAD;
return -1;
}
static inline intptr_t elibscn(void) {
errno = ELIBSCN;
return -1;
}
static inline intptr_t elibmax(void) {
errno = ELIBMAX;
return -1;
}
static inline intptr_t elibexec(void) {
errno = ELIBEXEC;
return -1;
}
static inline intptr_t eilseq(void) {
errno = EILSEQ;
return -1;
}
static inline intptr_t erestart(void) {
errno = ERESTART;
return -1;
}
static inline intptr_t estrpipe(void) {
errno = ESTRPIPE;
return -1;
}
static inline intptr_t eusers(void) {
errno = EUSERS;
return -1;
}
static inline intptr_t enotsock(void) {
errno = ENOTSOCK;
return -1;
}
static inline intptr_t edestaddrreq(void) {
errno = EDESTADDRREQ;
return -1;
}
static inline intptr_t emsgsize(void) {
errno = EMSGSIZE;
return -1;
}
static inline intptr_t eprototype(void) {
errno = EPROTOTYPE;
return -1;
}
static inline intptr_t enoprotoopt(void) {
errno = ENOPROTOOPT;
return -1;
}
static inline intptr_t eprotonosupport(void) {
errno = EPROTONOSUPPORT;
return -1;
}
static inline intptr_t esocktnosupport(void) {
errno = ESOCKTNOSUPPORT;
return -1;
}
static inline intptr_t eopnotsupp(void) {
errno = EOPNOTSUPP;
return -1;
}
static inline intptr_t epfnosupport(void) {
errno = EPFNOSUPPORT;
return -1;
}
static inline intptr_t eafnosupport(void) {
errno = EAFNOSUPPORT;
return -1;
}
static inline intptr_t eaddrinuse(void) {
errno = EADDRINUSE;
return -1;
}
static inline intptr_t eaddrnotavail(void) {
errno = EADDRNOTAVAIL;
return -1;
}
static inline intptr_t enetdown(void) {
errno = ENETDOWN;
return -1;
}
static inline intptr_t enetunreach(void) {
errno = ENETUNREACH;
return -1;
}
static inline intptr_t enetreset(void) {
errno = ENETRESET;
return -1;
}
static inline intptr_t econnaborted(void) {
errno = ECONNABORTED;
return -1;
}
static inline intptr_t econnreset(void) {
errno = ECONNRESET;
return -1;
}
static inline intptr_t enobufs(void) {
errno = ENOBUFS;
return -1;
}
static inline intptr_t eisconn(void) {
errno = EISCONN;
return -1;
}
static inline intptr_t enotconn(void) {
errno = ENOTCONN;
return -1;
}
static inline intptr_t eshutdown(void) {
errno = ESHUTDOWN;
return -1;
}
static inline intptr_t etoomanyrefs(void) {
errno = ETOOMANYREFS;
return -1;
}
static inline intptr_t etimedout(void) {
errno = ETIMEDOUT;
return -1;
}
static inline intptr_t econnrefused(void) {
errno = ECONNREFUSED;
return -1;
}
static inline intptr_t ehostdown(void) {
errno = EHOSTDOWN;
return -1;
}
static inline intptr_t ehostunreach(void) {
errno = EHOSTUNREACH;
return -1;
}
static inline intptr_t ealready(void) {
errno = EALREADY;
return -1;
}
static inline intptr_t einprogress(void) {
errno = EINPROGRESS;
return -1;
}
static inline intptr_t estale(void) {
errno = ESTALE;
return -1;
}
static inline intptr_t euclean(void) {
errno = EUCLEAN;
return -1;
}
static inline intptr_t enotnam(void) {
errno = ENOTNAM;
return -1;
}
static inline intptr_t enavail(void) {
errno = ENAVAIL;
return -1;
}
static inline intptr_t eisnam(void) {
errno = EISNAM;
return -1;
}
static inline intptr_t eremoteio(void) {
errno = EREMOTEIO;
return -1;
}
static inline intptr_t edquot(void) {
errno = EDQUOT;
return -1;
}
static inline intptr_t enomedium(void) {
errno = ENOMEDIUM;
return -1;
}
static inline intptr_t emediumtype(void) {
errno = EMEDIUMTYPE;
return -1;
}
static inline intptr_t ecanceled(void) {
errno = ECANCELED;
return -1;
}
static inline intptr_t enokey(void) {
errno = ENOKEY;
return -1;
}
static inline intptr_t ekeyexpired(void) {
errno = EKEYEXPIRED;
return -1;
}
static inline intptr_t ekeyrevoked(void) {
errno = EKEYREVOKED;
return -1;
}
static inline intptr_t ekeyrejected(void) {
errno = EKEYREJECTED;
return -1;
}
static inline intptr_t eownerdead(void) {
errno = EOWNERDEAD;
return -1;
}
static inline intptr_t enotrecoverable(void) {
errno = ENOTRECOVERABLE;
return -1;
}
static inline intptr_t erfkill(void) {
errno = ERFKILL;
return -1;
}
static inline intptr_t ehwpoison(void) {
errno = EHWPOISON;
return -1;
}
#endif /* __x86_64__ */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ */ #endif /* COSMOPOLITAN_LIBC_SYSV_ERRFUNS_H_ */

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
e2big: .leafprologue e2big:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov E2BIG(%rip),%ecx mov E2BIG(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,E2BIG
ldr w0,[x1,#:lo12:E2BIG]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn e2big,globl,hidden .endfn e2big,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eacces: .leafprologue eacces:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EACCES(%rip),%ecx mov EACCES(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EACCES
ldr w0,[x1,#:lo12:EACCES]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eacces,globl,hidden .endfn eacces,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
eaddrinuse: eaddrinuse:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EADDRINUSE(%rip),%ecx mov EADDRINUSE(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EADDRINUSE
ldr w0,[x1,#:lo12:EADDRINUSE]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eaddrinuse,globl,hidden .endfn eaddrinuse,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
eaddrnotavail: eaddrnotavail:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EADDRNOTAVAIL(%rip),%ecx mov EADDRNOTAVAIL(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EADDRNOTAVAIL
ldr w0,[x1,#:lo12:EADDRNOTAVAIL]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eaddrnotavail,globl,hidden .endfn eaddrnotavail,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eadv: .leafprologue eadv:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EADV(%rip),%ecx mov EADV(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EADV
ldr w0,[x1,#:lo12:EADV]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eadv,globl,hidden .endfn eadv,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
eafnosupport: eafnosupport:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EAFNOSUPPORT(%rip),%ecx mov EAFNOSUPPORT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EAFNOSUPPORT
ldr w0,[x1,#:lo12:EAFNOSUPPORT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eafnosupport,globl,hidden .endfn eafnosupport,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eagain: .leafprologue eagain:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EAGAIN(%rip),%ecx mov EAGAIN(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EAGAIN
ldr w0,[x1,#:lo12:EAGAIN]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eagain,globl,hidden .endfn eagain,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ealready: ealready:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EALREADY(%rip),%ecx mov EALREADY(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EALREADY
ldr w0,[x1,#:lo12:EALREADY]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ealready,globl,hidden .endfn ealready,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
ebade: .leafprologue ebade:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EBADE(%rip),%ecx mov EBADE(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADE
ldr w0,[x1,#:lo12:EBADE]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebade,globl,hidden .endfn ebade,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
ebadf: .leafprologue ebadf:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EBADF(%rip),%ecx mov EBADF(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADF
ldr w0,[x1,#:lo12:EBADF]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebadf,globl,hidden .endfn ebadf,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
ebadfd: .leafprologue ebadfd:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EBADFD(%rip),%ecx mov EBADFD(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADFD
ldr w0,[x1,#:lo12:EBADFD]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebadfd,globl,hidden .endfn ebadfd,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ebadmsg: ebadmsg:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EBADMSG(%rip),%ecx mov EBADMSG(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADMSG
ldr w0,[x1,#:lo12:EBADMSG]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebadmsg,globl,hidden .endfn ebadmsg,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
ebadr: .leafprologue ebadr:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EBADR(%rip),%ecx mov EBADR(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADR
ldr w0,[x1,#:lo12:EBADR]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebadr,globl,hidden .endfn ebadr,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ebadrqc: ebadrqc:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EBADRQC(%rip),%ecx mov EBADRQC(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADRQC
ldr w0,[x1,#:lo12:EBADRQC]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebadrqc,globl,hidden .endfn ebadrqc,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ebadslt: ebadslt:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EBADSLT(%rip),%ecx mov EBADSLT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBADSLT
ldr w0,[x1,#:lo12:EBADSLT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebadslt,globl,hidden .endfn ebadslt,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
ebusy: .leafprologue ebusy:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EBUSY(%rip),%ecx mov EBUSY(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EBUSY
ldr w0,[x1,#:lo12:EBUSY]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ebusy,globl,hidden .endfn ebusy,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ecanceled: ecanceled:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ECANCELED(%rip),%ecx mov ECANCELED(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECANCELED
ldr w0,[x1,#:lo12:ECANCELED]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ecanceled,globl,hidden .endfn ecanceled,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
echild: .leafprologue echild:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov ECHILD(%rip),%ecx mov ECHILD(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECHILD
ldr w0,[x1,#:lo12:ECHILD]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn echild,globl,hidden .endfn echild,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
echrng: .leafprologue echrng:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov ECHRNG(%rip),%ecx mov ECHRNG(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECHRNG
ldr w0,[x1,#:lo12:ECHRNG]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn echrng,globl,hidden .endfn echrng,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
ecomm: .leafprologue ecomm:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov ECOMM(%rip),%ecx mov ECOMM(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECOMM
ldr w0,[x1,#:lo12:ECOMM]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ecomm,globl,hidden .endfn ecomm,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
econnaborted: econnaborted:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ECONNABORTED(%rip),%ecx mov ECONNABORTED(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECONNABORTED
ldr w0,[x1,#:lo12:ECONNABORTED]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn econnaborted,globl,hidden .endfn econnaborted,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
econnrefused: econnrefused:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ECONNREFUSED(%rip),%ecx mov ECONNREFUSED(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECONNREFUSED
ldr w0,[x1,#:lo12:ECONNREFUSED]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn econnrefused,globl,hidden .endfn econnrefused,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
econnreset: econnreset:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ECONNRESET(%rip),%ecx mov ECONNRESET(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ECONNRESET
ldr w0,[x1,#:lo12:ECONNRESET]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn econnreset,globl,hidden .endfn econnreset,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
edeadlk: edeadlk:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EDEADLK(%rip),%ecx mov EDEADLK(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EDEADLK
ldr w0,[x1,#:lo12:EDEADLK]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn edeadlk,globl,hidden .endfn edeadlk,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
edestaddrreq: edestaddrreq:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EDESTADDRREQ(%rip),%ecx mov EDESTADDRREQ(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EDESTADDRREQ
ldr w0,[x1,#:lo12:EDESTADDRREQ]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn edestaddrreq,globl,hidden .endfn edestaddrreq,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
edom: .leafprologue edom:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EDOM(%rip),%ecx mov EDOM(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EDOM
ldr w0,[x1,#:lo12:EDOM]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn edom,globl,hidden .endfn edom,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
edotdot: edotdot:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EDOTDOT(%rip),%ecx mov EDOTDOT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EDOTDOT
ldr w0,[x1,#:lo12:EDOTDOT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn edotdot,globl,hidden .endfn edotdot,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
edquot: .leafprologue edquot:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EDQUOT(%rip),%ecx mov EDQUOT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EDQUOT
ldr w0,[x1,#:lo12:EDQUOT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn edquot,globl,hidden .endfn edquot,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eexist: .leafprologue eexist:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EEXIST(%rip),%ecx mov EEXIST(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EEXIST
ldr w0,[x1,#:lo12:EEXIST]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eexist,globl,hidden .endfn eexist,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
efault: .leafprologue efault:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EFAULT(%rip),%ecx mov EFAULT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EFAULT
ldr w0,[x1,#:lo12:EFAULT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn efault,globl,hidden .endfn efault,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
efbig: .leafprologue efbig:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EFBIG(%rip),%ecx mov EFBIG(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EFBIG
ldr w0,[x1,#:lo12:EFBIG]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn efbig,globl,hidden .endfn efbig,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ehostdown: ehostdown:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EHOSTDOWN(%rip),%ecx mov EHOSTDOWN(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EHOSTDOWN
ldr w0,[x1,#:lo12:EHOSTDOWN]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ehostdown,globl,hidden .endfn ehostdown,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ehostunreach: ehostunreach:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EHOSTUNREACH(%rip),%ecx mov EHOSTUNREACH(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EHOSTUNREACH
ldr w0,[x1,#:lo12:EHOSTUNREACH]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ehostunreach,globl,hidden .endfn ehostunreach,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ehwpoison: ehwpoison:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EHWPOISON(%rip),%ecx mov EHWPOISON(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EHWPOISON
ldr w0,[x1,#:lo12:EHWPOISON]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ehwpoison,globl,hidden .endfn ehwpoison,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eidrm: .leafprologue eidrm:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EIDRM(%rip),%ecx mov EIDRM(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EIDRM
ldr w0,[x1,#:lo12:EIDRM]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eidrm,globl,hidden .endfn eidrm,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eilseq: .leafprologue eilseq:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EILSEQ(%rip),%ecx mov EILSEQ(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EILSEQ
ldr w0,[x1,#:lo12:EILSEQ]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eilseq,globl,hidden .endfn eilseq,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
einprogress: einprogress:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EINPROGRESS(%rip),%ecx mov EINPROGRESS(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EINPROGRESS
ldr w0,[x1,#:lo12:EINPROGRESS]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn einprogress,globl,hidden .endfn einprogress,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eintr: .leafprologue eintr:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EINTR(%rip),%ecx mov EINTR(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EINTR
ldr w0,[x1,#:lo12:EINTR]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eintr,globl,hidden .endfn eintr,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
einval: .leafprologue einval:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EINVAL(%rip),%ecx mov EINVAL(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EINVAL
ldr w0,[x1,#:lo12:EINVAL]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn einval,globl,hidden .endfn einval,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eio: .leafprologue eio:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EIO(%rip),%ecx mov EIO(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EIO
ldr w0,[x1,#:lo12:EIO]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eio,globl,hidden .endfn eio,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
eisconn: eisconn:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EISCONN(%rip),%ecx mov EISCONN(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EISCONN
ldr w0,[x1,#:lo12:EISCONN]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eisconn,globl,hidden .endfn eisconn,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eisdir: .leafprologue eisdir:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EISDIR(%rip),%ecx mov EISDIR(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EISDIR
ldr w0,[x1,#:lo12:EISDIR]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eisdir,globl,hidden .endfn eisdir,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eisnam: .leafprologue eisnam:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EISNAM(%rip),%ecx mov EISNAM(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EISNAM
ldr w0,[x1,#:lo12:EISNAM]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eisnam,globl,hidden .endfn eisnam,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ekeyexpired: ekeyexpired:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EKEYEXPIRED(%rip),%ecx mov EKEYEXPIRED(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EKEYEXPIRED
ldr w0,[x1,#:lo12:EKEYEXPIRED]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ekeyexpired,globl,hidden .endfn ekeyexpired,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ekeyrejected: ekeyrejected:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EKEYREJECTED(%rip),%ecx mov EKEYREJECTED(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EKEYREJECTED
ldr w0,[x1,#:lo12:EKEYREJECTED]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ekeyrejected,globl,hidden .endfn ekeyrejected,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
ekeyrevoked: ekeyrevoked:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EKEYREVOKED(%rip),%ecx mov EKEYREVOKED(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EKEYREVOKED
ldr w0,[x1,#:lo12:EKEYREVOKED]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn ekeyrevoked,globl,hidden .endfn ekeyrevoked,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
el2hlt: .leafprologue el2hlt:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EL2HLT(%rip),%ecx mov EL2HLT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EL2HLT
ldr w0,[x1,#:lo12:EL2HLT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn el2hlt,globl,hidden .endfn el2hlt,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
el2nsync: el2nsync:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EL2NSYNC(%rip),%ecx mov EL2NSYNC(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EL2NSYNC
ldr w0,[x1,#:lo12:EL2NSYNC]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn el2nsync,globl,hidden .endfn el2nsync,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
el3hlt: .leafprologue el3hlt:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EL3HLT(%rip),%ecx mov EL3HLT(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EL3HLT
ldr w0,[x1,#:lo12:EL3HLT]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn el3hlt,globl,hidden .endfn el3hlt,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
el3rst: .leafprologue el3rst:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EL3RST(%rip),%ecx mov EL3RST(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EL3RST
ldr w0,[x1,#:lo12:EL3RST]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn el3rst,globl,hidden .endfn el3rst,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
elibacc: elibacc:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ELIBACC(%rip),%ecx mov ELIBACC(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELIBACC
ldr w0,[x1,#:lo12:ELIBACC]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn elibacc,globl,hidden .endfn elibacc,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
elibbad: elibbad:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ELIBBAD(%rip),%ecx mov ELIBBAD(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELIBBAD
ldr w0,[x1,#:lo12:ELIBBAD]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn elibbad,globl,hidden .endfn elibbad,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
elibexec: elibexec:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ELIBEXEC(%rip),%ecx mov ELIBEXEC(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELIBEXEC
ldr w0,[x1,#:lo12:ELIBEXEC]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn elibexec,globl,hidden .endfn elibexec,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
elibmax: elibmax:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ELIBMAX(%rip),%ecx mov ELIBMAX(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELIBMAX
ldr w0,[x1,#:lo12:ELIBMAX]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn elibmax,globl,hidden .endfn elibmax,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
elibscn: elibscn:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ELIBSCN(%rip),%ecx mov ELIBSCN(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELIBSCN
ldr w0,[x1,#:lo12:ELIBSCN]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn elibscn,globl,hidden .endfn elibscn,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
elnrng: .leafprologue elnrng:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov ELNRNG(%rip),%ecx mov ELNRNG(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELNRNG
ldr w0,[x1,#:lo12:ELNRNG]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn elnrng,globl,hidden .endfn elnrng,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
eloop: .leafprologue eloop:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov ELOOP(%rip),%ecx mov ELOOP(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ELOOP
ldr w0,[x1,#:lo12:ELOOP]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn eloop,globl,hidden .endfn eloop,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
emediumtype: emediumtype:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EMEDIUMTYPE(%rip),%ecx mov EMEDIUMTYPE(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EMEDIUMTYPE
ldr w0,[x1,#:lo12:EMEDIUMTYPE]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn emediumtype,globl,hidden .endfn emediumtype,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
emfile: .leafprologue emfile:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EMFILE(%rip),%ecx mov EMFILE(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EMFILE
ldr w0,[x1,#:lo12:EMFILE]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn emfile,globl,hidden .endfn emfile,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
emlink: .leafprologue emlink:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov EMLINK(%rip),%ecx mov EMLINK(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EMLINK
ldr w0,[x1,#:lo12:EMLINK]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn emlink,globl,hidden .endfn emlink,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
emsgsize: emsgsize:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EMSGSIZE(%rip),%ecx mov EMSGSIZE(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EMSGSIZE
ldr w0,[x1,#:lo12:EMSGSIZE]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn emsgsize,globl,hidden .endfn emsgsize,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
emultihop: emultihop:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov EMULTIHOP(%rip),%ecx mov EMULTIHOP(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,EMULTIHOP
ldr w0,[x1,#:lo12:EMULTIHOP]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn emultihop,globl,hidden .endfn emultihop,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
enametoolong: enametoolong:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ENAMETOOLONG(%rip),%ecx mov ENAMETOOLONG(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ENAMETOOLONG
ldr w0,[x1,#:lo12:ENAMETOOLONG]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn enametoolong,globl,hidden .endfn enametoolong,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
enavail: enavail:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ENAVAIL(%rip),%ecx mov ENAVAIL(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ENAVAIL
ldr w0,[x1,#:lo12:ENAVAIL]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn enavail,globl,hidden .endfn enavail,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
enetdown: enetdown:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ENETDOWN(%rip),%ecx mov ENETDOWN(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ENETDOWN
ldr w0,[x1,#:lo12:ENETDOWN]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn enetdown,globl,hidden .endfn enetdown,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
enetreset: enetreset:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ENETRESET(%rip),%ecx mov ENETRESET(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ENETRESET
ldr w0,[x1,#:lo12:ENETRESET]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn enetreset,globl,hidden .endfn enetreset,globl,hidden

View file

@ -2,8 +2,16 @@
.text.unlikely .text.unlikely
enetunreach: enetunreach:
#ifdef __x86_64__
.leafprologue .leafprologue
.profilable .profilable
mov ENETUNREACH(%rip),%ecx mov ENETUNREACH(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ENETUNREACH
ldr w0,[x1,#:lo12:ENETUNREACH]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn enetunreach,globl,hidden .endfn enetunreach,globl,hidden

View file

@ -1,8 +1,17 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.text.unlikely .text.unlikely
enfile: .leafprologue enfile:
#ifdef __x86_64__
.leafprologue
.profilable .profilable
mov ENFILE(%rip),%ecx mov ENFILE(%rip),%ecx
jmp __errfun jmp __errfun
#elif defined(__aarch64__)
adrp x1,ENFILE
ldr w0,[x1,#:lo12:ENFILE]
b __errfun
#else
#error "unsupported architecture"
#endif
.endfn enfile,globl,hidden .endfn enfile,globl,hidden

Some files were not shown because too many files have changed in this diff Show more