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
```
You now have a portable program! Your APE binary will assimilate itself
as conventional residents of your platform after the first run, so it
can be fast and efficient for subsequent executions.
You now have a portable program. Please note that your APE binary will
assimilate itself as a conventional resident of your platform after the
first run, so it can be fast and efficient for subsequent executions.
```sh
./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

View file

@ -1,7 +1,7 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
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
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
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.source __FILE__
#include "libc/nexgen32e/nexgen32e.h"
// Global variable for last error.
//
// The system call wrappers update this with WIN32 error codes.
// Unlike traditional libraries, Cosmopolitan error codes are
// defined as variables. By convention, system calls and other
// functions do not update this variable when nothing's broken.
//
// @see libc/sysv/consts.sh
// @see libc/sysv/errfuns.h
// @see __errno_location() stable abi
.bss
.align 4
errno: .long 0
.endobj errno,globl
yoink __errno_location
STATIC_YOINK("__errno_location"); /* needed by gdb */
/**
* Global variable for last error.
*
* The system call wrappers update this with WIN32 error codes.
* Unlike traditional libraries, Cosmopolitan error codes are
* defined as variables. By convention, system calls and other
* functions do not update this variable when nothing's broken.
*
* @see libc/sysv/consts.sh
* @see libc/sysv/errfuns.h
* @see __errno_location() stable abi
*/
int errno;