Get --ftrace working on aarch64

This change implements a new approach to function call logging, that's
based on the GCC flag: -fpatchable-function-entry. Read the commentary
in build/config.mk to learn how it works.
This commit is contained in:
Justine Tunney 2023-06-05 23:35:31 -07:00
parent 5b908bc756
commit eb40cb371d
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
934 changed files with 2259 additions and 1268 deletions

View file

@ -71,6 +71,8 @@ SECTIONS {
KEEP(*(SORT_NONE(.fini))) KEEP(*(SORT_NONE(.fini)))
} =0x1f2003d5 } =0x1f2003d5
. = ALIGN(__privileged_end > __privileged_start ? 0x4000 : 1);
.privileged : { .privileged : {
PROVIDE_HIDDEN(__privileged_start = .); PROVIDE_HIDDEN(__privileged_start = .);
*(.privileged*) *(.privileged*)
@ -271,6 +273,10 @@ SECTIONS {
} }
} }
HIDDEN(__privileged_addr = ROUNDDOWN(__privileged_start, PAGESIZE));
HIDDEN(__privileged_size = (ROUNDUP(__privileged_end, PAGESIZE) -
ROUNDDOWN(__privileged_start, PAGESIZE)));
PROVIDE(ape_stack_memsz = DEFINED(ape_stack_memsz) ? ape_stack_memsz : STACKSIZE); PROVIDE(ape_stack_memsz = DEFINED(ape_stack_memsz) ? ape_stack_memsz : STACKSIZE);
PROVIDE_HIDDEN(_tls_size = _tbss_end - _tdata_start); PROVIDE_HIDDEN(_tls_size = _tbss_end - _tdata_start);
PROVIDE_HIDDEN(_tdata_size = _tdata_end - _tdata_start); PROVIDE_HIDDEN(_tdata_size = _tdata_end - _tdata_start);

View file

@ -89,7 +89,7 @@ APE_SRCS = $(APE_SRCS_C) $(APE_SRCS_S)
APE_OBJS = $(APE_SRCS_S:%.S=o/$(MODE)/%.o) APE_OBJS = $(APE_SRCS_S:%.S=o/$(MODE)/%.o)
APE_CHECKS = $(APE_HDRS:%=o/%.ok) APE_CHECKS = $(APE_HDRS:%=o/%.ok)
o/$(MODE)/ape/public/ape.lds: OVERRIDE_CPPFLAGS += -UCOSMO o/$(MODE)/ape/public/ape.lds: 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 \

Binary file not shown.

View file

@ -12,13 +12,15 @@
# - Reasonably small # - Reasonably small
# #
ifeq ($(MODE),) ifeq ($(MODE),)
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O2 ENABLE_FTRACE = 1
CONFIG_CCFLAGS += $(BACKTRACES) -O2
CONFIG_CPPFLAGS += -DSYSDEBUG CONFIG_CPPFLAGS += -DSYSDEBUG
TARGET_ARCH ?= -msse3 TARGET_ARCH ?= -msse3
endif endif
ifeq ($(MODE), aarch64) ifeq ($(MODE), aarch64)
CONFIG_CCFLAGS += -O2 $(BACKTRACES) #$(FTRACE) ENABLE_FTRACE = 1
CONFIG_CCFLAGS += -O2 $(BACKTRACES)
CONFIG_CPPFLAGS += -DSYSDEBUG CONFIG_CPPFLAGS += -DSYSDEBUG
endif endif
@ -33,7 +35,8 @@ endif
# - Compiles 28% faster # - Compiles 28% faster
# #
ifeq ($(MODE), fastbuild) ifeq ($(MODE), fastbuild)
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O ENABLE_FTRACE = 1
CONFIG_CCFLAGS += $(BACKTRACES) -O
CONFIG_CPPFLAGS += -DSYSDEBUG -DDWARFLESS CONFIG_CPPFLAGS += -DSYSDEBUG -DDWARFLESS
CONFIG_OFLAGS += -g0 CONFIG_OFLAGS += -g0
CONFIG_LDFLAGS += -S CONFIG_LDFLAGS += -S
@ -53,8 +56,9 @@ endif
# - GCC 8+ hoists check fails into .text.cold, thus minimizing impact # - GCC 8+ hoists check fails into .text.cold, thus minimizing impact
# #
ifeq ($(MODE), opt) ifeq ($(MODE), opt)
ENABLE_FTRACE = 1
CONFIG_CPPFLAGS += -DNDEBUG -DSYSDEBUG -msse2avx -Wa,-msse2avx CONFIG_CPPFLAGS += -DNDEBUG -DSYSDEBUG -msse2avx -Wa,-msse2avx
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O3 -fmerge-all-constants CONFIG_CCFLAGS += $(BACKTRACES) -O3 -fmerge-all-constants
TARGET_ARCH ?= -march=native TARGET_ARCH ?= -march=native
endif endif
@ -123,16 +127,18 @@ endif
# - Enormous binaries # - Enormous binaries
# #
ifeq ($(MODE), dbg) ifeq ($(MODE), dbg)
ENABLE_FTRACE = 1
CONFIG_CPPFLAGS += -DMODE_DBG CONFIG_CPPFLAGS += -DMODE_DBG
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -DSYSDEBUG -O -fno-inline CONFIG_CCFLAGS += $(BACKTRACES) -DSYSDEBUG -O -fno-inline
CONFIG_COPTS += -fsanitize=address -fsanitize=undefined CONFIG_COPTS += -fsanitize=address -fsanitize=undefined
TARGET_ARCH ?= -msse3 TARGET_ARCH ?= -msse3
OVERRIDE_CCFLAGS += -fno-pie OVERRIDE_CCFLAGS += -fno-pie
endif endif
ifeq ($(MODE), aarch64-dbg) ifeq ($(MODE), aarch64-dbg)
ENABLE_FTRACE = 1
CONFIG_CPPFLAGS += -DMODE_DBG CONFIG_CPPFLAGS += -DMODE_DBG
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -DSYSDEBUG -O -fno-inline CONFIG_CCFLAGS += $(BACKTRACES) -DSYSDEBUG -O -fno-inline
CONFIG_COPTS += -fsanitize=undefined CONFIG_COPTS += -fsanitize=undefined
endif endif
@ -147,7 +153,8 @@ endif
# - No Windows bloat! # - No Windows bloat!
# #
ifeq ($(MODE), sysv) ifeq ($(MODE), sysv)
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O2 ENABLE_FTRACE = 1
CONFIG_CCFLAGS += $(BACKTRACES) -O2
CONFIG_CPPFLAGS += -DSYSDEBUG -DSUPPORT_VECTOR=121 CONFIG_CPPFLAGS += -DSYSDEBUG -DSUPPORT_VECTOR=121
TARGET_ARCH ?= -msse3 TARGET_ARCH ?= -msse3
endif endif
@ -363,8 +370,9 @@ endif
# GCC11 Mode # GCC11 Mode
# https://justine.lol/compilers/x86_64-linux-musl__x86_64-linux-musl__g++-11.2.0.tar.xz # https://justine.lol/compilers/x86_64-linux-musl__x86_64-linux-musl__g++-11.2.0.tar.xz
ifeq ($(MODE), gcc11) ifeq ($(MODE), gcc11)
ENABLE_FTRACE = 1
.UNVEIL += rx:/opt/gcc11 .UNVEIL += rx:/opt/gcc11
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -DSYSDEBUG -O2 CONFIG_CCFLAGS += $(BACKTRACES) -DSYSDEBUG -O2
AS = /opt/gcc11/bin/x86_64-linux-musl-as AS = /opt/gcc11/bin/x86_64-linux-musl-as
CC = /opt/gcc11/bin/x86_64-linux-musl-gcc CC = /opt/gcc11/bin/x86_64-linux-musl-gcc
CXX = /opt/gcc11/bin/x86_64-linux-musl-g++ CXX = /opt/gcc11/bin/x86_64-linux-musl-g++
@ -376,7 +384,7 @@ STRIP = /opt/gcc11/bin/x86_64-linux-musl-strip
OBJCOPY = /opt/gcc11/bin/x86_64-linux-musl-objcopy OBJCOPY = /opt/gcc11/bin/x86_64-linux-musl-objcopy
OBJDUMP = /opt/gcc11/bin/x86_64-linux-musl-objdump OBJDUMP = /opt/gcc11/bin/x86_64-linux-musl-objdump
ADDR2LINE = /opt/gcc11/bin/x86_64-linux-musl-addr2line ADDR2LINE = /opt/gcc11/bin/x86_64-linux-musl-addr2line
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -O2 -Wno-stringop-overread CONFIG_CCFLAGS += $(BACKTRACES) -O2 -Wno-stringop-overread
CONFIG_CFLAGS += -Wno-old-style-definition CONFIG_CFLAGS += -Wno-old-style-definition
CONFIG_CPPFLAGS += -DNDEBUG -DSYSDEBUG CONFIG_CPPFLAGS += -DNDEBUG -DSYSDEBUG
TARGET_ARCH ?= -msse3 TARGET_ARCH ?= -msse3
@ -385,7 +393,7 @@ endif
# LLVM Mode # LLVM Mode
ifeq ($(MODE), llvm) ifeq ($(MODE), llvm)
TARGET_ARCH ?= -msse3 TARGET_ARCH ?= -msse3
CONFIG_CCFLAGS += $(BACKTRACES) $(FTRACE) -DSYSDEBUG -O2 CONFIG_CCFLAGS += $(BACKTRACES) -DSYSDEBUG -O2
AS = clang AS = clang
CC = clang CC = clang
CXX = clang++ CXX = clang++
@ -432,3 +440,59 @@ CONFIG_CXXFLAGS += -std=c++11
TARGET_ARCH ?= -msse3 TARGET_ARCH ?= -msse3
endif endif
ifneq ($(ENABLE_FTRACE),)
CONFIG_CPPFLAGS += -DFTRACE
FTRACE_CCFLAGS = -fno-inline-functions-called-once
OVERRIDE_CFLAGS += $(FTRACE_CCFLAGS)
OVERRIDE_CXXFLAGS += $(FTRACE_CCFLAGS)
# function prologue nops for --ftrace
ifeq ($(ARCH), x86_64)
# this flag causes gcc to generate functions like this
#
# nop nop nop nop nop nop nop nop nop
# func:
# nop nop
# ...
#
# which tool/build/fixupobj.c improves at build time like this
#
# nop nop nop nop nop nop nop nop nop
# func:
# xchg %ax,%ax
# ...
#
# which --ftrace morphs at runtime like this
#
# ud2 # 2 bytes
# call ftrace_hook # 5 bytes
# jmp +2 # 2 bytes
# func:
# jmp -7 # 2 bytes
# ...
#
CONFIG_CCFLAGS += -fpatchable-function-entry=11,9
endif
ifeq ($(ARCH), aarch64)
# this flag causes gcc to generate functions like this
#
# nop nop nop nop nop nop
# func:
# nop
# ...
#
# which --ftrace morphs at runtime like this
#
# brk #31337
# stp x29,x30,[sp,#-16]!
# mov x29,sp
# bl ftrace_hook
# ldp x29,x30,[sp],#16
# b +1
# func:
# b -5
# ...
#
CONFIG_CCFLAGS += -fpatchable-function-entry=7,6
endif
endif

View file

@ -137,9 +137,6 @@ else
IMAGE_BASE_VIRTUAL ?= 0x400000 IMAGE_BASE_VIRTUAL ?= 0x400000
endif endif
FTRACE = \
-pg
BACKTRACES = \ BACKTRACES = \
-fno-omit-frame-pointer \ -fno-omit-frame-pointer \
-fno-optimize-sibling-calls \ -fno-optimize-sibling-calls \

View file

@ -41,11 +41,11 @@ $(DSP_BMP_A).pkg: \
o/$(MODE)/dsp/bmp/float2short.o \ o/$(MODE)/dsp/bmp/float2short.o \
o/$(MODE)/dsp/bmp/scalevolume.o: private \ o/$(MODE)/dsp/bmp/scalevolume.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
$(MATHEMATICAL) $(MATHEMATICAL)
o/tiny/dsp/bmp/scalevolume.o: private \ o/tiny/dsp/bmp/scalevolume.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os -Os
DSP_BMP_LIBS = $(foreach x,$(DSP_BMP_ARTIFACTS),$($(x))) DSP_BMP_LIBS = $(foreach x,$(DSP_BMP_ARTIFACTS),$($(x)))

View file

@ -40,15 +40,15 @@ o/$(MODE)/dsp/core/magikarp.o \
o/$(MODE)/dsp/core/c93654369.o \ o/$(MODE)/dsp/core/c93654369.o \
o/$(MODE)/dsp/core/float2short.o \ o/$(MODE)/dsp/core/float2short.o \
o/$(MODE)/dsp/core/scalevolume.o: private \ o/$(MODE)/dsp/core/scalevolume.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
$(MATHEMATICAL) $(MATHEMATICAL)
o/tiny/dsp/core/scalevolume.o: private \ o/tiny/dsp/core/scalevolume.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os -Os
o/$(MODE)/dsp/core/det3.o: private \ o/$(MODE)/dsp/core/det3.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-ffast-math -ffast-math
DSP_CORE_LIBS = $(foreach x,$(DSP_CORE_ARTIFACTS),$($(x))) DSP_CORE_LIBS = $(foreach x,$(DSP_CORE_ARTIFACTS),$($(x)))

View file

@ -52,7 +52,7 @@ $(DSP_MPEG_A).pkg: \
$(foreach x,$(DSP_MPEG_A_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(DSP_MPEG_A_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/dsp/mpeg/clamp4int256-k8.o: private \ o/$(MODE)/dsp/mpeg/clamp4int256-k8.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os -Os
DSP_MPEG_LIBS = $(foreach x,$(DSP_MPEG_ARTIFACTS),$($(x))) DSP_MPEG_LIBS = $(foreach x,$(DSP_MPEG_ARTIFACTS),$($(x)))

View file

@ -52,7 +52,7 @@ o/$(MODE)/dsp/scale/cdecimate2xuint8x8.o \
o/$(MODE)/dsp/scale/gyarados.o \ o/$(MODE)/dsp/scale/gyarados.o \
o/$(MODE)/dsp/scale/magikarp.o \ o/$(MODE)/dsp/scale/magikarp.o \
o/$(MODE)/dsp/scale/scale.o: private \ o/$(MODE)/dsp/scale/scale.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
$(MATHEMATICAL) $(MATHEMATICAL)
DSP_SCALE_LIBS = $(foreach x,$(DSP_SCALE_ARTIFACTS),$($(x))) DSP_SCALE_LIBS = $(foreach x,$(DSP_SCALE_ARTIFACTS),$($(x)))

View file

@ -54,12 +54,12 @@ $(DSP_TTY_A).pkg: \
$(foreach x,$(DSP_TTY_A_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(DSP_TTY_A_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/dsp/tty/ttyraster.o: private \ o/$(MODE)/dsp/tty/ttyraster.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
$(MATHEMATICAL) $(MATHEMATICAL)
ifeq ($(ARCH), aarch64) ifeq ($(ARCH), aarch64)
# takes 14 seconds to compile with aarch64 gcc # takes 14 seconds to compile with aarch64 gcc
o/$(MODE)/dsp/tty/ttyraster.o: private OVERRIDE_CFLAGS += -O1 o/$(MODE)/dsp/tty/ttyraster.o: private CFLAGS += -O1
o/$(MODE)/dsp/tty/ttyraster.o: private QUOTA += -C128 o/$(MODE)/dsp/tty/ttyraster.o: private QUOTA += -C128
endif endif

View file

@ -23,10 +23,11 @@
// @param rdi points to nonempty array // @param rdi points to nonempty array
// @param rsi is item count divisible by 16 // @param rsi is item count divisible by 16
// @note needs avx2 (haswell+) // @note needs avx2 (haswell+)
.ftrace1
windex_avx2: windex_avx2:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
and $-32,%rsp and $-32,%rsp
sub $32,%rsp sub $32,%rsp
vmovdqa (%rdi),%ymm1 vmovdqa (%rdi),%ymm1

View file

@ -23,10 +23,11 @@
// @param rdi points to nonempty array // @param rdi points to nonempty array
// @param esi is 16-byte aligned 8+ / 8 multiple array item count // @param esi is 16-byte aligned 8+ / 8 multiple array item count
// @note needs sse4 (nehalem+) // @note needs sse4 (nehalem+)
.ftrace1
windex_sse4: windex_sse4:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov $8,%eax mov $8,%eax
sub $32,%rsp sub $32,%rsp
movdqa (%rdi),%xmm2 movdqa (%rdi),%xmm2

View file

@ -8,6 +8,7 @@
*/ */
#endif #endif
#include "libc/calls/struct/timespec.h" #include "libc/calls/struct/timespec.h"
#include "libc/log/log.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/time/time.h" #include "libc/time/time.h"
@ -16,6 +17,7 @@
*/ */
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
ShowCrashReports();
unsigned long i; unsigned long i;
volatile unsigned long x; volatile unsigned long x;
struct timespec now, start, next, interval; struct timespec now, start, next, interval;

View file

@ -103,7 +103,7 @@ o/$(MODE)/examples/examples.pkg: \
$(foreach x,$(EXAMPLES_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(EXAMPLES_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/examples/unbourne.o: private \ o/$(MODE)/examples/unbourne.o: private \
OVERRIDE_CPPFLAGS += \ CPPFLAGS += \
-DSTACK_FRAME_UNLIMITED \ -DSTACK_FRAME_UNLIMITED \
-fpie -fpie
@ -169,7 +169,7 @@ o/$(MODE)/examples/symtab.com: \
@$(MAKE_SYMTAB_ZIP) @$(MAKE_SYMTAB_ZIP)
o/$(MODE)/examples/picol.o: private \ o/$(MODE)/examples/picol.o: private \
OVERRIDE_CPPFLAGS += \ CPPFLAGS += \
-DSTACK_FRAME_UNLIMITED -DSTACK_FRAME_UNLIMITED
o/$(MODE)/examples/picol.com.dbg: \ o/$(MODE)/examples/picol.com.dbg: \

View file

@ -69,21 +69,21 @@ $(LIBC_CALLS_A).pkg: \
# we can't use asan because: # we can't use asan because:
# siginfo_t memory is owned by kernels # siginfo_t memory is owned by kernels
o/$(MODE)/libc/calls/siginfo2cosmo.o: private \ o/$(MODE)/libc/calls/siginfo2cosmo.o: private \
OVERRIDE_COPTS += \ COPTS += \
-ffreestanding \ -ffreestanding \
-fno-sanitize=address -fno-sanitize=address
# we can't use asan because: # we can't use asan because:
# ucontext_t memory is owned by xnu kernel # ucontext_t memory is owned by xnu kernel
o/$(MODE)/libc/calls/sigenter-xnu.o: private \ o/$(MODE)/libc/calls/sigenter-xnu.o: private \
OVERRIDE_COPTS += \ COPTS += \
-ffreestanding \ -ffreestanding \
-fno-sanitize=address -fno-sanitize=address
# we can't use asan because: # we can't use asan because:
# vdso memory is owned by linux kernel # vdso memory is owned by linux kernel
o/$(MODE)/libc/calls/vdsofunc.greg.o: private \ o/$(MODE)/libc/calls/vdsofunc.greg.o: private \
OVERRIDE_COPTS += \ COPTS += \
-ffreestanding \ -ffreestanding \
-fno-sanitize=address -fno-sanitize=address
@ -92,7 +92,7 @@ o/$(MODE)/libc/calls/vdsofunc.greg.o: private \
o/$(MODE)/libc/calls/ntspawn.o \ o/$(MODE)/libc/calls/ntspawn.o \
o/$(MODE)/libc/calls/mkntcmdline.o \ o/$(MODE)/libc/calls/mkntcmdline.o \
o/$(MODE)/libc/calls/mkntenvblock.o: private \ o/$(MODE)/libc/calls/mkntenvblock.o: private \
OVERRIDE_COPTS += \ COPTS += \
-ffreestanding \ -ffreestanding \
-fno-sanitize=address -fno-sanitize=address
@ -100,7 +100,7 @@ o/$(MODE)/libc/calls/mkntenvblock.o: private \
# windows owns the data structure # windows owns the data structure
o/$(MODE)/libc/calls/wincrash.o \ o/$(MODE)/libc/calls/wincrash.o \
o/$(MODE)/libc/calls/ntcontext2linux.o: private \ o/$(MODE)/libc/calls/ntcontext2linux.o: private \
OVERRIDE_COPTS += \ COPTS += \
-fno-sanitize=all -fno-sanitize=all
# we always want -O3 because: # we always want -O3 because:
@ -111,7 +111,7 @@ o/$(MODE)/libc/calls/sigenter-netbsd.o \
o/$(MODE)/libc/calls/sigenter-openbsd.o \ o/$(MODE)/libc/calls/sigenter-openbsd.o \
o/$(MODE)/libc/calls/sigenter-xnu.o \ o/$(MODE)/libc/calls/sigenter-xnu.o \
o/$(MODE)/libc/calls/ntcontext2linux.o: private \ o/$(MODE)/libc/calls/ntcontext2linux.o: private \
OVERRIDE_COPTS += \ COPTS += \
-O3 -O3
# we must disable static stack safety because: # we must disable static stack safety because:
@ -125,14 +125,14 @@ o/$(MODE)/libc/calls/execve-sysv.o \
o/$(MODE)/libc/calls/readlinkat-nt.o \ o/$(MODE)/libc/calls/readlinkat-nt.o \
o/$(MODE)/libc/calls/execve-nt.greg.o \ o/$(MODE)/libc/calls/execve-nt.greg.o \
o/$(MODE)/libc/calls/mkntenvblock.o: private \ o/$(MODE)/libc/calls/mkntenvblock.o: private \
OVERRIDE_CPPFLAGS += \ CPPFLAGS += \
-DSTACK_FRAME_UNLIMITED -DSTACK_FRAME_UNLIMITED
# we must segregate codegen because: # we must segregate codegen because:
# file contains multiple independently linkable apis # file contains multiple independently linkable apis
o/$(MODE)/libc/calls/ioctl-siocgifconf.o \ o/$(MODE)/libc/calls/ioctl-siocgifconf.o \
o/$(MODE)/libc/calls/ioctl-siocgifconf-nt.o: private \ o/$(MODE)/libc/calls/ioctl-siocgifconf-nt.o: private \
OVERRIDE_COPTS += \ COPTS += \
-ffunction-sections \ -ffunction-sections \
-fdata-sections -fdata-sections
@ -156,7 +156,7 @@ o//libc/calls/ioctl_tiocgwinsz.o \
o//libc/calls/ioctl_tiocswinsz-nt.o \ o//libc/calls/ioctl_tiocswinsz-nt.o \
o//libc/calls/ioctl_tiocswinsz.o \ o//libc/calls/ioctl_tiocswinsz.o \
o//libc/calls/fcntl.o: private \ o//libc/calls/fcntl.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os -Os
# we always want -Os because: # we always want -Os because:
@ -165,7 +165,7 @@ o//libc/calls/getcwd.greg.o \
o//libc/calls/getcwd-nt.greg.o \ o//libc/calls/getcwd-nt.greg.o \
o//libc/calls/getcwd-xnu.greg.o \ o//libc/calls/getcwd-xnu.greg.o \
o//libc/calls/statfs2cosmo.o: private \ o//libc/calls/statfs2cosmo.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os -Os
# we always want -O2 because: # we always want -O2 because:
@ -180,17 +180,17 @@ o/$(MODE)/libc/calls/timespec_frommicros.o \
o/$(MODE)/libc/calls/timeval_tomillis.o \ o/$(MODE)/libc/calls/timeval_tomillis.o \
o/$(MODE)/libc/calls/timeval_frommillis.o \ o/$(MODE)/libc/calls/timeval_frommillis.o \
o/$(MODE)/libc/calls/timeval_frommicros.o: private \ o/$(MODE)/libc/calls/timeval_frommicros.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-O2 -O2
o/$(MODE)/libc/calls/pledge-linux.o \ o/$(MODE)/libc/calls/pledge-linux.o \
o/$(MODE)/libc/calls/unveil.o: private \ o/$(MODE)/libc/calls/unveil.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-DSTACK_FRAME_UNLIMITED -DSTACK_FRAME_UNLIMITED
ifeq ($(ARCH), aarch64) ifeq ($(ARCH), aarch64)
o/$(MODE)/libc/calls/sigaction.o: private OVERRIDE_CFLAGS += -mcmodel=large o/$(MODE)/libc/calls/sigaction.o: private CFLAGS += -mcmodel=large
o/$(MODE)/libc/calls/getloadavg-nt.o: private OVERRIDE_CFLAGS += -ffreestanding o/$(MODE)/libc/calls/getloadavg-nt.o: private CFLAGS += -ffreestanding
endif endif
# we want -Os because: # we want -Os because:
@ -198,7 +198,7 @@ endif
# we need pic because: # we need pic because:
# so it can be an LD_PRELOAD payload # so it can be an LD_PRELOAD payload
o/$(MODE)/libc/calls/pledge-linux.o: private \ o/$(MODE)/libc/calls/pledge-linux.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os \ -Os \
-fPIC -fPIC

View file

@ -26,9 +26,10 @@
// @return remainder ∈ (-|𝑦|,|𝑦|) in %st // @return remainder ∈ (-|𝑦|,|𝑦|) in %st
// @define 𝑥-truncl(𝑥/𝑦)*𝑦 // @define 𝑥-truncl(𝑥/𝑦)*𝑦
// @see emod() // @see emod()
fmodl: push %rbp .ftrace1
fmodl: .ftrace2
push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
fldt 32(%rbp) fldt 32(%rbp)
fldt 16(%rbp) fldt 16(%rbp)
1: fprem 1: fprem

View file

@ -12,7 +12,9 @@ typedef struct Elf64_Sym {
uint8_t st_other; uint8_t st_other;
/* SHN_UNDEF, <section index>, SHN_ABS, SHN_COMMON, etc. */ /* SHN_UNDEF, <section index>, SHN_ABS, SHN_COMMON, etc. */
Elf64_Section st_shndx; Elf64_Section st_shndx;
/* byte offset into GetElfSectionAddress(st_shndx) */
Elf64_Addr st_value; Elf64_Addr st_value;
/* byte length optionally set by .size directive */
Elf64_Xword st_size; Elf64_Xword st_size;
} Elf64_Sym; } Elf64_Sym;

View file

@ -55,14 +55,14 @@ $(LIBC_FMT_A).pkg: \
$(foreach x,$(LIBC_FMT_A_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(LIBC_FMT_A_DIRECTDEPS),$($(x)_A).pkg)
$(LIBC_FMT_A_OBJS): private \ $(LIBC_FMT_A_OBJS): private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fno-jump-tables -fno-jump-tables
o/$(MODE)/libc/fmt/formatint64.o \ o/$(MODE)/libc/fmt/formatint64.o \
o/$(MODE)/libc/fmt/formatint64thousands.o \ o/$(MODE)/libc/fmt/formatint64thousands.o \
o/$(MODE)/libc/fmt/dosdatetimetounix.o \ o/$(MODE)/libc/fmt/dosdatetimetounix.o \
o/$(MODE)/libc/fmt/itoa64radix10.greg.o: private\ o/$(MODE)/libc/fmt/itoa64radix10.greg.o: private\
OVERRIDE_CFLAGS += \ CFLAGS += \
-O3 -O3
o/$(MODE)/libc/fmt/atoi.o \ o/$(MODE)/libc/fmt/atoi.o \
@ -74,7 +74,7 @@ o/$(MODE)/libc/fmt/strtoimax.o \
o/$(MODE)/libc/fmt/strtoumax.o \ o/$(MODE)/libc/fmt/strtoumax.o \
o/$(MODE)/libc/fmt/wcstoimax.o \ o/$(MODE)/libc/fmt/wcstoimax.o \
o/$(MODE)/libc/fmt/wcstoumax.o: private \ o/$(MODE)/libc/fmt/wcstoumax.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os -Os
# we can't use compiler magic because: # we can't use compiler magic because:
@ -82,7 +82,7 @@ o/$(MODE)/libc/fmt/wcstoumax.o: private \
o/$(MODE)/libc/fmt/strerrno.greg.o \ o/$(MODE)/libc/fmt/strerrno.greg.o \
o/$(MODE)/libc/fmt/strerrdoc.greg.o \ o/$(MODE)/libc/fmt/strerrdoc.greg.o \
o/$(MODE)/libc/fmt/strerror_wr.greg.o: private \ o/$(MODE)/libc/fmt/strerror_wr.greg.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fpie \ -fpie \
-ffreestanding \ -ffreestanding \
$(NO_MAGIC) $(NO_MAGIC)

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_INTRIN_AARCH64_ASMDEFS_H_ #ifndef COSMOPOLITAN_LIBC_INTRIN_AARCH64_ASMDEFS_H_
#define COSMOPOLITAN_LIBC_INTRIN_AARCH64_ASMDEFS_H_ #define COSMOPOLITAN_LIBC_INTRIN_AARCH64_ASMDEFS_H_
#include "libc/macros.internal.h"
#ifdef __ASSEMBLER__ #ifdef __ASSEMBLER__
// clang-format off // clang-format off
@ -44,7 +45,9 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
.global name; \ .global name; \
.type name,%function; \ .type name,%function; \
.align alignment; \ .align alignment; \
.ftrace1; \
name: \ name: \
.ftrace2; \
.cfi_startproc; \ .cfi_startproc; \
BTI_C; BTI_C;

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __memchr_aarch64 memchr #define __memchr_aarch64 memchr

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __memcmp_aarch64 memcmp #define __memcmp_aarch64 memcmp

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __memcpy_aarch64_simd memcpy #define __memcpy_aarch64_simd memcpy
#define __memmove_aarch64_simd memmove #define __memmove_aarch64_simd memmove

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __memrchr_aarch64 memrchr #define __memrchr_aarch64 memrchr

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __memset_aarch64 memset #define __memset_aarch64 memset

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __stpcpy_aarch64 stpcpy #define __stpcpy_aarch64 stpcpy

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strchr_aarch64 strchr #define __strchr_aarch64 strchr

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strchrnul_aarch64 strchrnul #define __strchrnul_aarch64 strchrnul

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strcmp_aarch64 strcmp #define __strcmp_aarch64 strcmp

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strcpy_aarch64 strcpy #define __strcpy_aarch64 strcpy

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strlen_aarch64 strlen #define __strlen_aarch64 strlen

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strncmp_aarch64 strncmp #define __strncmp_aarch64 strncmp

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strnlen_aarch64 strnlen #define __strnlen_aarch64 strnlen

View file

@ -25,7 +25,7 @@
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/intrin/aarch64/asmdefs.h" #include "libc/intrin/aarch64/asmdefs.internal.h"
#define __strrchr_aarch64 strrchr #define __strrchr_aarch64 strrchr

View file

@ -26,6 +26,7 @@
#include "libc/intrin/weaken.h" #include "libc/intrin/weaken.h"
#include "libc/log/backtrace.internal.h" #include "libc/log/backtrace.internal.h"
#include "libc/log/internal.h" #include "libc/log/internal.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h" #include "libc/runtime/symbols.internal.h"
#include "libc/thread/thread.h" #include "libc/thread/thread.h"
@ -38,7 +39,7 @@ relegated void __assert_fail(const char *expr, const char *file, int line) {
strace_enabled(-1); strace_enabled(-1);
ftrace_enabled(-1); ftrace_enabled(-1);
owner = 0; owner = 0;
me = __tls_enabled ? __get_tls()->tib_tid : sys_gettid(); me = __tls_enabled ? __get_tls()->tib_tid : __pid;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
kprintf("%s:%d: assert(%s) failed (tid %d) %m\n", file, line, expr, me); kprintf("%s:%d: assert(%s) failed (tid %d) %m\n", file, line, expr, me);
if (__vforked || if (__vforked ||

View file

@ -33,9 +33,10 @@
// @param rsi:rdi is 128-bit unsigned 𝑥 value // @param rsi:rdi is 128-bit unsigned 𝑥 value
// @return eax number in range [0,128) or undef if 𝑥 is 0 // @return eax number in range [0,128) or undef if 𝑥 is 0
// @see also treasure trove of nearly identical functions // @see also treasure trove of nearly identical functions
.ftrace1
_bsr128: _bsr128:
.ftrace2
.leafprologue .leafprologue
.profilable
bsr %rsi,%rax bsr %rsi,%rax
jnz 2f jnz 2f
bsr %rdi,%rax bsr %rdi,%rax

View file

@ -26,7 +26,7 @@
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1))); typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
typedef long long xmm_a __attribute__((__vector_size__(16), __aligned__(16))); typedef long long xmm_a __attribute__((__vector_size__(16), __aligned__(16)));
static void bzero_sse(char *p, size_t n) { static void bzero128(char *p, size_t n) {
xmm_t v = {0}; xmm_t v = {0};
if (IsAsan()) __asan_verify(p, n); if (IsAsan()) __asan_verify(p, n);
if (n <= 32) { if (n <= 32) {
@ -162,6 +162,6 @@ void bzero(void *p, size_t n) {
bzero_avx(b, n); bzero_avx(b, n);
#endif #endif
} else { } else {
bzero_sse(b, n); bzero128(b, n);
} }
} }

View file

@ -16,6 +16,7 @@ LIBC_INTRIN_A_CHECKS = $(LIBC_INTRIN_A).pkg
ifeq ($(ARCH), aarch64) ifeq ($(ARCH), aarch64)
LIBC_INTRIN_A_SRCS_S += $(wildcard libc/intrin/aarch64/*.S) LIBC_INTRIN_A_SRCS_S += $(wildcard libc/intrin/aarch64/*.S)
LIBC_INTRIN_A_HDRS += libc/intrin/aarch64/asmdefs.internal.h
endif endif
LIBC_INTRIN_A_OBJS = \ LIBC_INTRIN_A_OBJS = \
@ -49,39 +50,39 @@ $(LIBC_INTRIN_A).pkg: \
# we can't use asan because: # we can't use asan because:
# __strace_init() calls this before asan is initialized # __strace_init() calls this before asan is initialized
o/$(MODE)/libc/intrin/strace_enabled.o: private \ o/$(MODE)/libc/intrin/strace_enabled.o: private \
OVERRIDE_COPTS += \ COPTS += \
-fno-sanitize=address -fno-sanitize=address
# we can't use asan because: # we can't use asan because:
# asan guard pages haven't been allocated yet # asan guard pages haven't been allocated yet
o/$(MODE)/libc/intrin/directmap.o \ o/$(MODE)/libc/intrin/directmap.o \
o/$(MODE)/libc/intrin/directmap-nt.o: private \ o/$(MODE)/libc/intrin/directmap-nt.o: private \
OVERRIDE_COPTS += \ COPTS += \
-ffreestanding \ -ffreestanding \
-fno-sanitize=address -fno-sanitize=address
# we want small code size because: # we want small code size because:
# to keep .text.head under 4096 bytes # to keep .text.head under 4096 bytes
o/$(MODE)/libc/intrin/mman.greg.o: private \ o/$(MODE)/libc/intrin/mman.greg.o: private \
OVERRIDE_COPTS += \ COPTS += \
-Os -Os
# we can't use asan and ubsan because: # we can't use asan and ubsan because:
# this is asan and ubsan # this is asan and ubsan
o/$(MODE)/libc/intrin/asan.o \ o/$(MODE)/libc/intrin/asan.o \
o/$(MODE)/libc/intrin/ubsan.o: private \ o/$(MODE)/libc/intrin/ubsan.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fno-sanitize=all \ -fno-sanitize=all \
-fno-stack-protector -fno-stack-protector
o/$(MODE)/libc/intrin/asan.o: private \ o/$(MODE)/libc/intrin/asan.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-O2 \ -O2 \
-finline \ -finline \
-finline-functions -finline-functions
o/$(MODE)/libc/intrin/asanthunk.o: private \ o/$(MODE)/libc/intrin/asanthunk.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-x-no-pg \ -x-no-pg \
$(MNO_FENTRY) \ $(MNO_FENTRY) \
-ffreestanding \ -ffreestanding \
@ -95,7 +96,7 @@ o/$(MODE)/libc/intrin/strerrno.greg.o \
o/$(MODE)/libc/intrin/strerrdoc.greg.o \ o/$(MODE)/libc/intrin/strerrdoc.greg.o \
o/$(MODE)/libc/intrin/strerror_wr.greg.o \ o/$(MODE)/libc/intrin/strerror_wr.greg.o \
o/$(MODE)/libc/intrin/kprintf.greg.o: private \ o/$(MODE)/libc/intrin/kprintf.greg.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fpie \ -fpie \
-fwrapv \ -fwrapv \
-x-no-pg \ -x-no-pg \
@ -109,10 +110,9 @@ o/$(MODE)/libc/intrin/kprintf.greg.o: private \
o/$(MODE)/libc/intrin/futex_wait.o \ o/$(MODE)/libc/intrin/futex_wait.o \
o/$(MODE)/libc/intrin/futex_wake.o \ o/$(MODE)/libc/intrin/futex_wake.o \
o/$(MODE)/libc/intrin/gettid.greg.o \ o/$(MODE)/libc/intrin/gettid.greg.o \
o/$(MODE)/libc/intrin/sys_gettid.greg.o \
o/$(MODE)/libc/intrin/_trylock_debug_4.o \ o/$(MODE)/libc/intrin/_trylock_debug_4.o \
o/$(MODE)/libc/intrin/_spinlock_debug_4.o: private \ o/$(MODE)/libc/intrin/_spinlock_debug_4.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fwrapv \ -fwrapv \
-x-no-pg \ -x-no-pg \
$(MNO_FENTRY) \ $(MNO_FENTRY) \
@ -125,13 +125,13 @@ o/$(MODE)/libc/intrin/_spinlock_debug_4.o: private \
# global gone could be raised # global gone could be raised
o/$(MODE)/libc/intrin/exit.o \ o/$(MODE)/libc/intrin/exit.o \
o/$(MODE)/libc/intrin/restorewintty.o: private \ o/$(MODE)/libc/intrin/restorewintty.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fno-sanitize=all -fno-sanitize=all
# we can't use -ftrapv because: # we can't use -ftrapv because:
# this file implements it # this file implements it
o/$(MODE)/libc/intrin/ftrapv.o: private \ o/$(MODE)/libc/intrin/ftrapv.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-ffunction-sections \ -ffunction-sections \
-ffreestanding \ -ffreestanding \
-fwrapv -fwrapv
@ -142,7 +142,7 @@ o/$(MODE)/libc/intrin/describeflags.o \
o/$(MODE)/libc/intrin/describeframe.o \ o/$(MODE)/libc/intrin/describeframe.o \
o/$(MODE)/libc/intrin/describemapflags.o \ o/$(MODE)/libc/intrin/describemapflags.o \
o/$(MODE)/libc/intrin/describeprotflags.o: private \ o/$(MODE)/libc/intrin/describeprotflags.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fno-sanitize=address -fno-sanitize=address
o/$(MODE)/libc/intrin/exit1.greg.o \ o/$(MODE)/libc/intrin/exit1.greg.o \
@ -180,7 +180,7 @@ o/$(MODE)/libc/intrin/createfilemappingnuma.o \
o/$(MODE)/libc/intrin/waitformultipleobjects.o \ o/$(MODE)/libc/intrin/waitformultipleobjects.o \
o/$(MODE)/libc/intrin/generateconsolectrlevent.o \ o/$(MODE)/libc/intrin/generateconsolectrlevent.o \
o/$(MODE)/libc/intrin/wsawaitformultipleevents.o: private\ o/$(MODE)/libc/intrin/wsawaitformultipleevents.o: private\
OVERRIDE_CFLAGS += \ CFLAGS += \
-Os \ -Os \
-fwrapv \ -fwrapv \
-ffreestanding \ -ffreestanding \
@ -188,20 +188,20 @@ o/$(MODE)/libc/intrin/wsawaitformultipleevents.o: private\
-fno-sanitize=all -fno-sanitize=all
o//libc/intrin/memmove.o: private \ o//libc/intrin/memmove.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fno-toplevel-reorder -fno-toplevel-reorder
o//libc/intrin/bzero.o \ o//libc/intrin/bzero.o \
o//libc/intrin/memcmp.o \ o//libc/intrin/memcmp.o \
o//libc/intrin/memset.o \ o//libc/intrin/memset.o \
o//libc/intrin/memmove.o: private \ o//libc/intrin/memmove.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-O2 -finline -O2 -finline
o/$(MODE)/libc/intrin/bzero.o \ o/$(MODE)/libc/intrin/bzero.o \
o/$(MODE)/libc/intrin/memcmp.o \ o/$(MODE)/libc/intrin/memcmp.o \
o/$(MODE)/libc/intrin/memmove.o: private \ o/$(MODE)/libc/intrin/memmove.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fpie -fpie
# these assembly files are safe to build on aarch64 # these assembly files are safe to build on aarch64

View file

@ -382,7 +382,7 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
if (tib) { if (tib) {
x = atomic_load_explicit(&tib->tib_tid, memory_order_relaxed); x = atomic_load_explicit(&tib->tib_tid, memory_order_relaxed);
} else { } else {
x = sys_gettid(); x = __pid;
} }
if (!__nocolor && p + 7 <= e) { if (!__nocolor && p + 7 <= e) {
*p++ = '\e'; *p++ = '\e';

View file

@ -19,13 +19,14 @@
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/sysv/consts/nr.h" #include "libc/sysv/consts/nr.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.privileged
// Relinquishes scheduled quantum. // Relinquishes scheduled quantum.
// //
// @return 0 on success, or -1 w/ errno // @return 0 on success, or -1 w/ errno
// @norestart // @norestart
.ftrace1
sched_yield: sched_yield:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp

View file

@ -19,6 +19,7 @@
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/intrin/asan.internal.h" #include "libc/intrin/asan.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#ifndef __aarch64__
/** /**
* Compares NUL-terminated strings. * Compares NUL-terminated strings.
@ -28,7 +29,7 @@
* @return is <0, 0, or >0 based on uint8_t comparison * @return is <0, 0, or >0 based on uint8_t comparison
* @asyncsignalsafe * @asyncsignalsafe
*/ */
noasan int strcmp(const char *a, const char *b) { int strcmp(const char *a, const char *b) {
int c; int c;
size_t i = 0; size_t i = 0;
uint64_t v, w, d; uint64_t v, w, d;
@ -58,3 +59,5 @@ noasan int strcmp(const char *a, const char *b) {
} }
return (a[i] & 255) - (b[i] & 255); return (a[i] & 255) - (b[i] & 255);
} }
#endif /* __aarch64__ */

View file

@ -24,7 +24,7 @@
__msabi extern typeof(GetCurrentThreadId) *const __imp_GetCurrentThreadId; __msabi extern typeof(GetCurrentThreadId) *const __imp_GetCurrentThreadId;
privileged int sys_gettid(void) { int sys_gettid(void) {
#ifdef __x86_64__ #ifdef __x86_64__
int tid; int tid;
int64_t wut; int64_t wut;

View file

@ -23,8 +23,9 @@
// @param edi is int to encode // @param edi is int to encode
// @return rax is word-encoded byte buffer // @return rax is word-encoded byte buffer
// @note invented on a napkin in a new jersey diner // @note invented on a napkin in a new jersey diner
_tpenc: .leafprologue .ftrace1
.profilable _tpenc: .ftrace2
.leafprologue
mov %edi,%edi mov %edi,%edi
xor %eax,%eax xor %eax,%eax
cmp $127,%edi cmp $127,%edi
@ -47,20 +48,20 @@ _tpenc: .leafprologue
.rodata .rodata
.balign 4 .balign 4
.underrun .underrun
kTpenc: .rept 4 # MSB10 (0x7FF) kTpenc: .rept 4 // MSB10 (0x7FF)
.byte 1,0b11000000 # len,mark .byte 1,0b11000000 // len,mark
.endr .endr
.rept 5 # MSB15 (0xFFFF) .rept 5 // MSB15 (0xFFFF)
.byte 2,0b11100000 # len,mark .byte 2,0b11100000 // len,mark
.endr .endr
.rept 5 # MSB20 (0x1FFFFF) .rept 5 // MSB20 (0x1FFFFF)
.byte 3,0b11110000 # len,mark .byte 3,0b11110000 // len,mark
.endr .endr
.rept 5 # MSB25 (0x3FFFFFF) .rept 5 // MSB25 (0x3FFFFFF)
.byte 4,0b11111000 # len,mark .byte 4,0b11111000 // len,mark
.endr .endr
.rept 6 # MSB31 (0xffffffff) .rept 6 // MSB31 (0xffffffff)
.byte 5,0b11111100 # len,mark .byte 5,0b11111100 // len,mark
.endr .endr
.zero 2 .zero 2
.endobj kTpenc .endobj kTpenc

View file

@ -58,15 +58,15 @@ $(LIBC_LOG_A).pkg: \
o/$(MODE)/libc/log/backtrace2.o \ o/$(MODE)/libc/log/backtrace2.o \
o/$(MODE)/libc/log/backtrace3.o: private \ o/$(MODE)/libc/log/backtrace3.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-fno-sanitize=all -fno-sanitize=all
o/$(MODE)/libc/log/checkfail.o: private \ o/$(MODE)/libc/log/checkfail.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-mgeneral-regs-only -mgeneral-regs-only
o/$(MODE)/libc/log/watch.o: private \ o/$(MODE)/libc/log/watch.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
-ffreestanding -ffreestanding
o/$(MODE)/libc/log/watch.o \ o/$(MODE)/libc/log/watch.o \
@ -82,7 +82,7 @@ o/$(MODE)/libc/log/startfatal.o \
o/$(MODE)/libc/log/startfatal_ndebug.o \ o/$(MODE)/libc/log/startfatal_ndebug.o \
o/$(MODE)/libc/log/ubsan.o \ o/$(MODE)/libc/log/ubsan.o \
o/$(MODE)/libc/log/die.o: private \ o/$(MODE)/libc/log/die.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
$(NO_MAGIC) $(NO_MAGIC)
LIBC_LOG_LIBS = $(foreach x,$(LIBC_LOG_ARTIFACTS),$($(x))) LIBC_LOG_LIBS = $(foreach x,$(LIBC_LOG_ARTIFACTS),$($(x)))

View file

@ -213,6 +213,36 @@
.org 1347b+\fieldsize,0x00 .org 1347b+\fieldsize,0x00
.endm .endm
// Inserts --ftrace pre-prologue.
// This goes immediately before the function symbol.
// @see .ftrace2
.macro .ftrace1
#ifdef FTRACE
#ifdef __x86_64__
.rept 9
nop
.endr
#elif defined(__aarch64__)
.rept 6
nop
.endr
#endif /* __x86_64__ */
#endif /* FTRACE */
.endm
// Inserts --ftrace prologue.
// This goes immediately after the function symbol.
// @see .ftrace1
.macro .ftrace2
#ifdef FTRACE
#ifdef __x86_64__
xchg %ax,%ax
#elif defined(__aarch64__)
nop
#endif /* __x86_64__ */
#endif /* FTRACE */
.endm
#ifdef __x86_64__ #ifdef __x86_64__
#if __MNO_VZEROUPPER__ + 0 #if __MNO_VZEROUPPER__ + 0
@ -346,7 +376,7 @@
// Pads function prologue unconditionally for runtime hooking. // Pads function prologue unconditionally for runtime hooking.
// @cost ≥0.3 cycles, 5 bytes // @cost ≥0.3 cycles, 5 bytes
// @see .profilable // @see .ftrace1
.macro .hookable .macro .hookable
.byte 0x0f .byte 0x0f
.byte 0x1f .byte 0x1f
@ -473,31 +503,6 @@
#endif #endif
.endm .endm
// Inserts profiling hook in prologue if cc wants it.
//
// Cosmopolitan does this in a slightly different way from normal
// GNU toolchains. We always use the -mnop-mcount behavior, since
// the runtime is able to morph the binary at runtime. It is good
// since we can put hooks for profiling and function tracing into
// most builds, without any impact on performance.
//
// @cost ≥0.3 cycles, 5 bytes
// @see build/compile
.macro .profilable
#ifdef __PG__
1382:
#if defined(__MFENTRY__)
call __fentry__
#elif defined(__PIC__) || defined(__PIE__)
// nopw 0x00(%rax,%rax,1)
.byte 0x66,0x0f,0x1f,0x44,0x00,0x00
#else
// nopl 0x00(%rax,%rax,1)
.byte 0x0f,0x1f,0x44,0x00,0x00
#endif
#endif
.endm
// Pushes RVA on stack of linktime mergeable string literal. // Pushes RVA on stack of linktime mergeable string literal.
// @see popstr // @see popstr
.macro pushstr text .macro pushstr text

View file

@ -30,11 +30,12 @@
// @see examples/ctrlc.c // @see examples/ctrlc.c
// @threadsafe // @threadsafe
// @noreturn // @noreturn
.ftrace1
_gclongjmp: _gclongjmp:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %fs:0,%r12 # __get_tls() mov %fs:0,%r12 # __get_tls()
mov 0x18(%r12),%r12 # Tls::garbages mov 0x18(%r12),%r12 # Tls::garbages
test %r12,%r12 test %r12,%r12

View file

@ -25,7 +25,9 @@
// @noreturn // @noreturn
// @see _gclongjmp() // @see _gclongjmp()
// @see siglongjmp() // @see siglongjmp()
.ftrace1
longjmp: longjmp:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
mov %esi,%eax mov %esi,%eax
test %eax,%eax test %eax,%eax

View file

@ -32,10 +32,11 @@
// @param rdx is right hand side which must have 4 quadwords // @param rdx is right hand side which must have 4 quadwords
// @note words are host endian while array is little endian // @note words are host endian while array is little endian
// @mayalias // @mayalias
.ftrace1
Mul4x4Adx: Mul4x4Adx:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
sub $56,%rsp sub $56,%rsp
mov %r15,-8(%rbp) mov %r15,-8(%rbp)
mov %r14,-16(%rbp) mov %r14,-16(%rbp)

View file

@ -32,10 +32,11 @@
// @param rdx is right hand side which must have 4 quadwords // @param rdx is right hand side which must have 4 quadwords
// @note words are host endian while array is little endian // @note words are host endian while array is little endian
// @mayalias // @mayalias
.ftrace1
Mul6x6Adx: Mul6x6Adx:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
sub $64,%rsp sub $64,%rsp
mov %r15,-8(%rbp) mov %r15,-8(%rbp)
mov %r14,-16(%rbp) mov %r14,-16(%rbp)

View file

@ -32,10 +32,11 @@
// @param rdx is right hand side which must have 8 quadwords // @param rdx is right hand side which must have 8 quadwords
// @note words are host endian while array is little endian // @note words are host endian while array is little endian
// @mayalias // @mayalias
.ftrace1
Mul8x8Adx: Mul8x8Adx:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
sub $104,%rsp sub $104,%rsp
mov %r15,-8(%rbp) mov %r15,-8(%rbp)
mov %r14,-16(%rbp) mov %r14,-16(%rbp)

View file

@ -56,7 +56,7 @@ o/$(MODE)/libc/nexgen32e/ktoupper.o \
o/$(MODE)/libc/nexgen32e/pid.o \ o/$(MODE)/libc/nexgen32e/pid.o \
o/$(MODE)/libc/nexgen32e/program_invocation_name2.o \ o/$(MODE)/libc/nexgen32e/program_invocation_name2.o \
o/$(MODE)/libc/nexgen32e/threaded.o: private \ o/$(MODE)/libc/nexgen32e/threaded.o: private \
OVERRIDE_CFLAGS += \ CFLAGS += \
$(NO_MAGIC) $(NO_MAGIC)
# these assembly files are safe to build on aarch64 # these assembly files are safe to build on aarch64

View file

@ -29,12 +29,13 @@
// @return %rax,%xmm0 // @return %rax,%xmm0
// @note slower than __sysv2nt // @note slower than __sysv2nt
// @see NT2SYSV() macro // @see NT2SYSV() macro
.ftrace1
__nt2sysv: __nt2sysv:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
// TODO(jart): We should probably find some way to use our own // TODO(jart): We should probably find some way to use our own
// stack when Windows delivers signals ;_; // stack when Windows delivers signals ;_;
.profilable
sub $0x100,%rsp sub $0x100,%rsp
push %rbx push %rbx
push %rdi push %rdi

View file

@ -24,9 +24,10 @@
// @param di points to output buffer // @param di points to output buffer
// @param si points to uint8_t {len₁,byte₁}, ..., {0,0} // @param si points to uint8_t {len₁,byte₁}, ..., {0,0}
// @mode long,legacy,real // @mode long,legacy,real
.ftrace1
rldecode: rldecode:
.ftrace2
.leafprologue .leafprologue
.profilable
xor %ecx,%ecx xor %ecx,%ecx
0: lodsb 0: lodsb
xchg %al,%cl xchg %al,%cl

View file

@ -26,7 +26,8 @@
// @assume system five nexgen32e abi conformant // @assume system five nexgen32e abi conformant
// @note code built w/ microsoft abi compiler can't call this // @note code built w/ microsoft abi compiler can't call this
// @see longjmp(), _gclongjmp() // @see longjmp(), _gclongjmp()
setjmp: .ftrace1
setjmp: .ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
lea 8(%rsp),%rax lea 8(%rsp),%rax
mov %rax,(%rdi) mov %rax,(%rdi)

View file

@ -613,10 +613,11 @@ BSWAP_SHUFB_CTL:
// @param %rsi points to input data // @param %rsi points to input data
// @param %rdx is number of 64-byte blocks to process // @param %rdx is number of 64-byte blocks to process
// @see X86_HAVE(SHA) // @see X86_HAVE(SHA)
.ftrace1
sha1_transform_avx2: sha1_transform_avx2:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
push %rbx push %rbx
push %r12 push %r12
push %r13 push %r13

View file

@ -77,10 +77,11 @@ Tim Chen <tim.c.chen@linux.intel.com>\n"
// @param %rsi points to input data // @param %rsi points to input data
// @param %rdx is number of 64-byte blocks to process // @param %rdx is number of 64-byte blocks to process
// @see X86_HAVE(SHA) // @see X86_HAVE(SHA)
.ftrace1
sha1_transform_ni: sha1_transform_ni:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
sub $FRAME_SIZE,%rsp sub $FRAME_SIZE,%rsp
shl $6,NUM_BLKS # convert to bytes shl $6,NUM_BLKS # convert to bytes
jz .Ldone_hash jz .Ldone_hash

View file

@ -530,10 +530,11 @@ STACK_SIZE = _RSP + _RSP_SIZE
######################################################################## ########################################################################
.text .text
.balign 32 .balign 32
.ftrace1
sha256_transform_rorx: sha256_transform_rorx:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
pushq %rbx pushq %rbx
pushq %r12 pushq %r12
pushq %r13 pushq %r13

View file

@ -80,9 +80,10 @@ Tim Chen <tim.c.chen@linux.intel.com>\n"
// @param %rsi points to input data // @param %rsi points to input data
// @param %rdx is number of blocks to process // @param %rdx is number of blocks to process
// @see X86_HAVE(SHA) // @see X86_HAVE(SHA)
.ftrace1
sha256_transform_ni: sha256_transform_ni:
.ftrace2
.leafprologue .leafprologue
.profilable
shl $6,NUM_BLKS # convert to bytes shl $6,NUM_BLKS # convert to bytes
jz .Ldone_hash jz .Ldone_hash
add DATA_PTR,NUM_BLKS # pointer to end of data add DATA_PTR,NUM_BLKS # pointer to end of data

View file

@ -571,10 +571,11 @@ frame_size = frame_GPRSAVE + GPRSAVE_SIZE
# of SHA512 message blocks. # of SHA512 message blocks.
# "blocks" is the message length in SHA512 blocks # "blocks" is the message length in SHA512 blocks
######################################################################## ########################################################################
.ftrace1
sha512_transform_rorx: sha512_transform_rorx:
.ftrace2
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
# Allocate Stack Space # Allocate Stack Space
mov %rsp, %rax mov %rsp, %rax
sub $frame_size, %rsp sub $frame_size, %rsp

View file

@ -23,9 +23,10 @@
// @param RDI is wchar_t *s // @param RDI is wchar_t *s
// @param EAX is unsigned length // @param EAX is unsigned length
// @see libc/nexgen32e/strsak32.S // @see libc/nexgen32e/strsak32.S
.ftrace1
tinywcslen: tinywcslen:
.ftrace2
.leafprologue .leafprologue
.profilable
xor %eax,%eax xor %eax,%eax
1: cmpl $0,(%rdi,%rax,4) 1: cmpl $0,(%rdi,%rax,4)
jz 2f jz 2f

View file

@ -24,9 +24,10 @@
// @param RSI is size_t n // @param RSI is size_t n
// @param EAX is unsigned length // @param EAX is unsigned length
// @see libc/nexgen32e/strsak32.S // @see libc/nexgen32e/strsak32.S
.ftrace1
tinywcsnlen: tinywcsnlen:
.ftrace2
.leafprologue .leafprologue
.profilable
xor %eax,%eax xor %eax,%eax
1: cmp %esi,%eax 1: cmp %esi,%eax
jae 2f jae 2f

View file

@ -2,11 +2,12 @@
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WaitOnAddress,WaitOnAddress,111 .imp API-MS-Win-Core-Synch-l1-2-0,__imp_WaitOnAddress,WaitOnAddress,111
.text.windows .text.windows
.ftrace1
WaitOnAddress: WaitOnAddress:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_WaitOnAddress(%rip),%rax mov __imp_WaitOnAddress(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressAll,WakeByAddressAll,113 .imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressAll,WakeByAddressAll,113
.text.windows .text.windows
.ftrace1
WakeByAddressAll: WakeByAddressAll:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_WakeByAddressAll(%rip) call *__imp_WakeByAddressAll(%rip)

View file

@ -2,11 +2,12 @@
.imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressSingle,WakeByAddressSingle,116 .imp API-MS-Win-Core-Synch-l1-2-0,__imp_WakeByAddressSingle,WakeByAddressSingle,116
.text.windows .text.windows
.ftrace1
WakeByAddressSingle: WakeByAddressSingle:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_WakeByAddressSingle(%rip) call *__imp_WakeByAddressSingle(%rip)

View file

@ -2,11 +2,12 @@
.imp MsWSock,__imp_AcceptEx,AcceptEx,0 .imp MsWSock,__imp_AcceptEx,AcceptEx,0
.text.windows .text.windows
.ftrace1
AcceptEx: AcceptEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_AcceptEx(%rip),%rax mov __imp_AcceptEx(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp MsWSock,__imp_DisconnectEx,DisconnectEx,0 .imp MsWSock,__imp_DisconnectEx,DisconnectEx,0
.text.windows .text.windows
.ftrace1
DisconnectEx: DisconnectEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_DisconnectEx(%rip),%rax mov __imp_DisconnectEx(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp MsWSock,__imp_GetAcceptExSockaddrs,GetAcceptExSockaddrs,0 .imp MsWSock,__imp_GetAcceptExSockaddrs,GetAcceptExSockaddrs,0
.text.windows .text.windows
.ftrace1
GetAcceptExSockaddrs: GetAcceptExSockaddrs:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_GetAcceptExSockaddrs(%rip),%rax mov __imp_GetAcceptExSockaddrs(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp MsWSock,__imp_TransmitFile,TransmitFile,0 .imp MsWSock,__imp_TransmitFile,TransmitFile,0
.text.windows .text.windows
.ftrace1
TransmitFile: TransmitFile:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_TransmitFile(%rip),%rax mov __imp_TransmitFile(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp MsWSock,__imp_WSARecvEx,WSARecvEx,0 .imp MsWSock,__imp_WSARecvEx,WSARecvEx,0
.text.windows .text.windows
.ftrace1
WSARecvEx: WSARecvEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_WSARecvEx(%rip),%rax mov __imp_WSARecvEx(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp PowrProf,__imp_SetSuspendState,SetSuspendState,0 .imp PowrProf,__imp_SetSuspendState,SetSuspendState,0
.text.windows .text.windows
.ftrace1
SetSuspendState: SetSuspendState:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_SetSuspendState(%rip),%rax mov __imp_SetSuspendState(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_AccessCheck,AccessCheck,0 .imp advapi32,__imp_AccessCheck,AccessCheck,0
.text.windows .text.windows
.ftrace1
AccessCheck: AccessCheck:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_AccessCheck(%rip),%rax mov __imp_AccessCheck(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_AdjustTokenPrivileges,AdjustTokenPrivileges,0 .imp advapi32,__imp_AdjustTokenPrivileges,AdjustTokenPrivileges,0
.text.windows .text.windows
.ftrace1
AdjustTokenPrivileges: AdjustTokenPrivileges:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_AdjustTokenPrivileges(%rip),%rax mov __imp_AdjustTokenPrivileges(%rip),%rax
jmp __sysv2nt6 jmp __sysv2nt6
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_CreateProcessAsUserW,CreateProcessAsUserW,0 .imp advapi32,__imp_CreateProcessAsUserW,CreateProcessAsUserW,0
.text.windows .text.windows
.ftrace1
CreateProcessAsUser: CreateProcessAsUser:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_CreateProcessAsUserW(%rip),%rax mov __imp_CreateProcessAsUserW(%rip),%rax
jmp __sysv2nt12 jmp __sysv2nt12
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_DeregisterEventSource,DeregisterEventSource,1239 .imp advapi32,__imp_DeregisterEventSource,DeregisterEventSource,1239
.text.windows .text.windows
.ftrace1
DeregisterEventSource: DeregisterEventSource:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_DeregisterEventSource(%rip) call *__imp_DeregisterEventSource(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_DuplicateToken,DuplicateToken,0 .imp advapi32,__imp_DuplicateToken,DuplicateToken,0
.text.windows .text.windows
.ftrace1
DuplicateToken: DuplicateToken:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_DuplicateToken(%rip),%rax mov __imp_DuplicateToken(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_DuplicateTokenEx,DuplicateTokenEx,0 .imp advapi32,__imp_DuplicateTokenEx,DuplicateTokenEx,0
.text.windows .text.windows
.ftrace1
DuplicateTokenEx: DuplicateTokenEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_DuplicateTokenEx(%rip),%rax mov __imp_DuplicateTokenEx(%rip),%rax
jmp __sysv2nt6 jmp __sysv2nt6
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_GetFileSecurityW,GetFileSecurityW,0 .imp advapi32,__imp_GetFileSecurityW,GetFileSecurityW,0
.text.windows .text.windows
.ftrace1
GetFileSecurity: GetFileSecurity:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_GetFileSecurityW(%rip),%rax mov __imp_GetFileSecurityW(%rip),%rax
jmp __sysv2nt6 jmp __sysv2nt6
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_GetUserNameW,GetUserNameW,1381 .imp advapi32,__imp_GetUserNameW,GetUserNameW,1381
.text.windows .text.windows
.ftrace1
GetUserName: GetUserName:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_GetUserNameW(%rip),%rax mov __imp_GetUserNameW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_ImpersonateSelf,ImpersonateSelf,0 .imp advapi32,__imp_ImpersonateSelf,ImpersonateSelf,0
.text.windows .text.windows
.ftrace1
ImpersonateSelf: ImpersonateSelf:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_ImpersonateSelf(%rip) call *__imp_ImpersonateSelf(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_InitiateShutdownW,InitiateShutdownW,1403 .imp advapi32,__imp_InitiateShutdownW,InitiateShutdownW,1403
.text.windows .text.windows
.ftrace1
InitiateShutdown: InitiateShutdown:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_InitiateShutdownW(%rip),%rax mov __imp_InitiateShutdownW(%rip),%rax
jmp __sysv2nt6 jmp __sysv2nt6
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_LookupPrivilegeValueW,LookupPrivilegeValueW,1432 .imp advapi32,__imp_LookupPrivilegeValueW,LookupPrivilegeValueW,1432
.text.windows .text.windows
.ftrace1
LookupPrivilegeValue: LookupPrivilegeValue:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_LookupPrivilegeValueW(%rip),%rax mov __imp_LookupPrivilegeValueW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_MapGenericMask,MapGenericMask,0 .imp advapi32,__imp_MapGenericMask,MapGenericMask,0
.text.windows .text.windows
.ftrace1
MapGenericMask: MapGenericMask:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_MapGenericMask(%rip),%rax mov __imp_MapGenericMask(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_OpenProcessToken,OpenProcessToken,0 .imp advapi32,__imp_OpenProcessToken,OpenProcessToken,0
.text.windows .text.windows
.ftrace1
OpenProcessToken: OpenProcessToken:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_OpenProcessToken(%rip),%rax mov __imp_OpenProcessToken(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_OpenThreadToken,OpenThreadToken,0 .imp advapi32,__imp_OpenThreadToken,OpenThreadToken,0
.text.windows .text.windows
.ftrace1
OpenThreadToken: OpenThreadToken:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_OpenThreadToken(%rip),%rax mov __imp_OpenThreadToken(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegCloseKey,RegCloseKey,0 .imp advapi32,__imp_RegCloseKey,RegCloseKey,0
.text.windows .text.windows
.ftrace1
RegCloseKey: RegCloseKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_RegCloseKey(%rip) call *__imp_RegCloseKey(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegConnectRegistryW,RegConnectRegistryW,1608 .imp advapi32,__imp_RegConnectRegistryW,RegConnectRegistryW,1608
.text.windows .text.windows
.ftrace1
RegConnectRegistry: RegConnectRegistry:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegConnectRegistryW(%rip),%rax mov __imp_RegConnectRegistryW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegCreateKeyExW,RegCreateKeyExW,0 .imp advapi32,__imp_RegCreateKeyExW,RegCreateKeyExW,0
.text.windows .text.windows
.ftrace1
RegCreateKeyEx: RegCreateKeyEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegCreateKeyExW(%rip),%rax mov __imp_RegCreateKeyExW(%rip),%rax
jmp __sysv2nt10 jmp __sysv2nt10
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegCreateKeyW,RegCreateKeyW,1616 .imp advapi32,__imp_RegCreateKeyW,RegCreateKeyW,1616
.text.windows .text.windows
.ftrace1
RegCreateKey: RegCreateKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegCreateKeyW(%rip),%rax mov __imp_RegCreateKeyW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegDeleteKeyExW,RegDeleteKeyExW,0 .imp advapi32,__imp_RegDeleteKeyExW,RegDeleteKeyExW,0
.text.windows .text.windows
.ftrace1
RegDeleteKeyEx: RegDeleteKeyEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegDeleteKeyExW(%rip),%rax mov __imp_RegDeleteKeyExW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegDeleteKeyW,RegDeleteKeyW,1624 .imp advapi32,__imp_RegDeleteKeyW,RegDeleteKeyW,1624
.text.windows .text.windows
.ftrace1
RegDeleteKey: RegDeleteKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegDeleteKeyW(%rip),%rax mov __imp_RegDeleteKeyW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegDeleteTreeW,RegDeleteTreeW,0 .imp advapi32,__imp_RegDeleteTreeW,RegDeleteTreeW,0
.text.windows .text.windows
.ftrace1
RegDeleteTree: RegDeleteTree:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegDeleteTreeW(%rip),%rax mov __imp_RegDeleteTreeW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegDeleteValueW,RegDeleteValueW,0 .imp advapi32,__imp_RegDeleteValueW,RegDeleteValueW,0
.text.windows .text.windows
.ftrace1
RegDeleteValue: RegDeleteValue:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegDeleteValueW(%rip),%rax mov __imp_RegDeleteValueW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegDisablePredefinedCache,RegDisablePredefinedCache,1629 .imp advapi32,__imp_RegDisablePredefinedCache,RegDisablePredefinedCache,1629
.text.windows .text.windows
.ftrace1
RegDisablePredefinedCache: RegDisablePredefinedCache:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_RegDisablePredefinedCache(%rip) call *__imp_RegDisablePredefinedCache(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegDisableReflectionKey,RegDisableReflectionKey,1631 .imp advapi32,__imp_RegDisableReflectionKey,RegDisableReflectionKey,1631
.text.windows .text.windows
.ftrace1
RegDisableReflectionKey: RegDisableReflectionKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_RegDisableReflectionKey(%rip) call *__imp_RegDisableReflectionKey(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegEnableReflectionKey,RegEnableReflectionKey,1632 .imp advapi32,__imp_RegEnableReflectionKey,RegEnableReflectionKey,1632
.text.windows .text.windows
.ftrace1
RegEnableReflectionKey: RegEnableReflectionKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_RegEnableReflectionKey(%rip) call *__imp_RegEnableReflectionKey(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegEnumKeyExW,RegEnumKeyExW,0 .imp advapi32,__imp_RegEnumKeyExW,RegEnumKeyExW,0
.text.windows .text.windows
.ftrace1
RegEnumKeyEx: RegEnumKeyEx:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegEnumKeyExW(%rip),%rax mov __imp_RegEnumKeyExW(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegEnumKeyW,RegEnumKeyW,1636 .imp advapi32,__imp_RegEnumKeyW,RegEnumKeyW,1636
.text.windows .text.windows
.ftrace1
RegEnumKey: RegEnumKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegEnumKeyW(%rip),%rax mov __imp_RegEnumKeyW(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegEnumValueW,RegEnumValueW,0 .imp advapi32,__imp_RegEnumValueW,RegEnumValueW,0
.text.windows .text.windows
.ftrace1
RegEnumValue: RegEnumValue:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegEnumValueW(%rip),%rax mov __imp_RegEnumValueW(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegFlushKey,RegFlushKey,0 .imp advapi32,__imp_RegFlushKey,RegFlushKey,0
.text.windows .text.windows
.ftrace1
RegFlushKey: RegFlushKey:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov %rdi,%rcx mov %rdi,%rcx
sub $32,%rsp sub $32,%rsp
call *__imp_RegFlushKey(%rip) call *__imp_RegFlushKey(%rip)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegGetKeySecurity,RegGetKeySecurity,0 .imp advapi32,__imp_RegGetKeySecurity,RegGetKeySecurity,0
.text.windows .text.windows
.ftrace1
RegGetKeySecurity: RegGetKeySecurity:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegGetKeySecurity(%rip),%rax mov __imp_RegGetKeySecurity(%rip),%rax
jmp __sysv2nt jmp __sysv2nt
#elif defined(__aarch64__) #elif defined(__aarch64__)

View file

@ -2,11 +2,12 @@
.imp advapi32,__imp_RegGetValueW,RegGetValueW,0 .imp advapi32,__imp_RegGetValueW,RegGetValueW,0
.text.windows .text.windows
.ftrace1
RegGetValue: RegGetValue:
.ftrace2
#ifdef __x86_64__ #ifdef __x86_64__
push %rbp push %rbp
mov %rsp,%rbp mov %rsp,%rbp
.profilable
mov __imp_RegGetValueW(%rip),%rax mov __imp_RegGetValueW(%rip),%rax
jmp __sysv2nt8 jmp __sysv2nt8
#elif defined(__aarch64__) #elif defined(__aarch64__)

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