Clarify APE self-modifying behavior in README

See #102
This commit is contained in:
Justine Tunney 2021-03-04 07:54:41 -08:00
parent 43b2475aaa
commit b9f73e6a4d
2 changed files with 13 additions and 20 deletions

View file

@ -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)

View file

@ -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}
drr*/
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))));