Perform some minor code cleanup

This commit is contained in:
Justine Tunney 2021-03-04 13:22:32 -08:00
parent b9f73e6a4d
commit 5141d00992
4 changed files with 23 additions and 24 deletions

View file

@ -32,13 +32,13 @@ gcc -g -Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \
objcopy -S -O binary hello.com.dbg hello.com objcopy -S -O binary hello.com.dbg hello.com
``` ```
You now have a portable program! Your APE binary will assimilate itself You now have a portable program. Please note that your APE binary will
as conventional residents of your platform after the first run, so it assimilate itself as a conventional resident of your platform after the
can be fast and efficient for subsequent executions. first run, so it can be fast and efficient for subsequent executions.
```sh ```sh
./hello.com ./hello.com
bash -c './hello.com' # zsh/fish workaround: we upstream a patch! bash -c './hello.com' # zsh/fish workaround (we upstreamed a patch)
``` ```
So if you intend to copy the binary to Windows or Mac then please do So if you intend to copy the binary to Windows or Mac then please do

View file

@ -1,7 +1,7 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney Copyright 2021 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the any purpose with or without fee is hereby granted, provided that the
@ -16,21 +16,20 @@
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/macros.internal.h" #include "libc/nexgen32e/nexgen32e.h"
.source __FILE__
// Global variable for last error. STATIC_YOINK("__errno_location"); /* needed by gdb */
//
// The system call wrappers update this with WIN32 error codes. /**
// Unlike traditional libraries, Cosmopolitan error codes are * Global variable for last error.
// defined as variables. By convention, system calls and other *
// functions do not update this variable when nothing's broken. * The system call wrappers update this with WIN32 error codes.
// * Unlike traditional libraries, Cosmopolitan error codes are
// @see libc/sysv/consts.sh * defined as variables. By convention, system calls and other
// @see libc/sysv/errfuns.h * functions do not update this variable when nothing's broken.
// @see __errno_location() stable abi *
.bss * @see libc/sysv/consts.sh
.align 4 * @see libc/sysv/errfuns.h
errno: .long 0 * @see __errno_location() stable abi
.endobj errno,globl */
yoink __errno_location int errno;