From b9f73e6a4dc6cfbea4e0f8dd906a4a95bf7f86e7 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 4 Mar 2021 07:54:41 -0800 Subject: [PATCH] Clarify APE self-modifying behavior in README See #102 --- README.md | 15 +++++++++++++-- test/libc/tinymath/sinl_test.c | 18 ------------------ 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 89dda1dc7..aad80553b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ libc](https://justine.lol/cosmopolitan/index.html) website. We also have ## Getting Started If you're doing your development work on Linux or BSD then you need just -five files to get started: +five files to get started. Here's what you do on Linux: ```sh wget https://justine.lol/cosmopolitan/cosmopolitan.zip @@ -30,9 +30,20 @@ gcc -g -Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \ -o hello.com.dbg hello.c -fuse-ld=bfd -Wl,-T,ape.lds \ -include cosmopolitan.h crt.o ape.o cosmopolitan.a objcopy -S -O binary hello.com.dbg hello.com -./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. + +```sh +./hello.com +bash -c './hello.com' # zsh/fish workaround: we upstream a patch! +``` + +So if you intend to copy the binary to Windows or Mac then please do +that before you run it, not after. + If you're developing on Windows or MacOS then you need to download an x86_64-pc-linux-gnu toolchain beforehand. See the [Compiling on Windows](https://justine.lol/cosmopolitan/windows-compiling.html) diff --git a/test/libc/tinymath/sinl_test.c b/test/libc/tinymath/sinl_test.c index 60bdf198f..bfa67bf1f 100644 --- a/test/libc/tinymath/sinl_test.c +++ b/test/libc/tinymath/sinl_test.c @@ -26,24 +26,6 @@ #define sin(x) sin(VEIL("x", (double)(x))) #define sinf(x) sinf(VEIL("x", (float)(x))) -void SetUp(void) { - /* 8087 FPU Control Word - IM: Invalid Operation ───────────────┐ - DM: Denormal Operand ───────────────┐│ - ZM: Zero Divide ───────────────────┐││ - OM: Overflow ─────────────────────┐│││ - UM: Underflow ───────────────────┐││││ - PM: Precision ──────────────────┐│││││ - PC: Precision Control ────────┐ ││││││ - {float,∅,double,long double} │ ││││││ - RC: Rounding Control ───────┐ │ ││││││ - {even, →-∞, →+∞, →0} │┌┤ ││││││ - ┌┤││ ││││││ - d││││rr││││││*/ - int x87cw = 0b0000000000000000001101100001; - asm volatile("fldcw\t%0" : /* no outputs */ : "m"(x87cw)); -} - TEST(sinl, test) { EXPECT_STREQ("NAN", gc(xdtoal(sinl(NAN)))); EXPECT_STREQ("-NAN", gc(xdtoal(sinl(+INFINITY))));