@@ -22,7 +22,8 @@ Apple Silicon, and Raspberry Pi using your operating system's toolchain.
2222$ build/bootstrap/make.com -j8 o//blink/blink
2323
2424# for apple m1 arm silicon
25- $ build/bootstrap/blink-darwin-arm64 build/bootstrap/make.com -j8 o//blink/blink
25+ # don't use the ancient version of gnu make that comes with xcode
26+ $ make -j8 o//blink/blink
2627
2728# for linux raspberry pi
2829$ build/bootstrap/blink-linux-aarch64 build/bootstrap/make.com -j8 o//blink/blink
@@ -49,7 +50,7 @@ You can run our test executables to check your local platform build:
4950$ build/bootstrap/make.com -j8 check
5051```
5152
52- For maximum performance, use ` MODE=release ` or ` MODE=opt ` .
53+ For maximum performance, use ` MODE=rel ` or ` MODE=opt ` .
5354
5455``` sh
5556$ build/bootstrap/make.com MODE=opt -j8 check
@@ -63,6 +64,9 @@ $ strip o/tiny/blink/blink
6364$ ls -hal o/tiny/blink/blink
6465```
6566
67+ You can sanitize using ` MODE=asan ` , ` MODE=ubsan ` , ` MODE=tsan ` , and
68+ ` MODE=msan ` .
69+
6670If you're building your code on an x86-64 Linux machine, then the
6771following command will cross-compile blink for i386, arm, m68k, riscv,
6872mips, s390x. Then it'll launch all the cross-compiled binaries in qemu
@@ -93,3 +97,111 @@ Blink supports 32-bit and 16-bit BIOS programs, plus just enough ring0
9397instructions to test an operating system bootloader. Plus IBM PC Serial
9498UART, CGA, and MDA. However these legacy features might get sprung into
9599a sister project sometime soon.
100+
101+ ## Flakes
102+
103+ ![ Blink Flakes: The Original and Best Unexplained Errors] ( test/flakes.png )
104+
105+ Mutex lock tests sometimes flake:
106+
107+ ```
108+ // this happens on aarch64 and mips (probably s390x too?)
109+ error:test/libc/intrin/pthread_mutex_lock2_test.c:95: pthread_mutex_lock_contention(pthread_mutex_lock_recursive) on blink.local pid 22952 tid 22952
110+ EXPECT_EQ(THREADS, started)
111+ need 16 (or 0x10 or '►') =
112+ got 15 (or 0xf or '☼')
113+ EUNKNOWN/0/No error information
114+ third_party/cosmo/pthread_mutex_lock2_test.com @ blink.local
115+ 1 / 284 tests failed
116+ make: *** [test/test.mk:90: o//mips64/third_party/cosmo/pthread_mutex_lock2_test.com.emulates] Error 1
117+
118+ // instructions in question
119+ 40d1fe: f0 83 05 8e c2 06 00 01 lock addl $0x1,0x6c28e(%rip) # 479494 <started>
120+ ...
121+ 40d3c2: 4c 63 25 cb c0 06 00 movslq 0x6c0cb(%rip),%r12 # 479494 <started>
122+
123+ ```
124+
125+ * NSYNC unit tests sometimes flake:
126+
127+ ```
128+ I2022-11-21T00:43:58.774807:blink/throw.c:59: 262144: SEGMENTATION FAULT AT ADDRESS 8
129+ PC 41b77f mov %rsi,8(%rcx)
130+ AX 00001000802985e8 CX 0000000000000000 DX 00001000802985e8 BX 0000100080252fe0
131+ SP 000010008007fcf0 BP 000010008007fcf0 SI 00001000802985e8 DI 0000000000486820
132+ R8 0000000000433ca0 R9 0000000000000004 R10 0000000000000000 R11 0000000000000000
133+ R12 00001000802985e0 R13 0000000000000004 R14 0000100080252fe8 R15 000000000000001d
134+ FS 0000100080040240 GS 0000000000000000 OPS 5555954 JIT 0
135+ third_party/cosmo/wait_test.com
136+ 10008007fcf0 00000041b77f nsync_dll_make_last_in_list_+0x2f 0 bytes
137+ 10008007fd20 00000040d0c9 counter_enqueue+0x39 48 bytes
138+ 10008007fe90 00000040e289 nsync_wait_n+0x199 368 bytes
139+ 10008007ff20 00000040a9c3 test_wait_n+0x3d3 144 bytes
140+ 10008007ff50 00000040b1ad run_test+0x6d 48 bytes
141+ 10008007ff70 00000040adbb closure_f0_testing+0x1b 32 bytes
142+ 10008007ff80 00000040ab0b closure_run_body+0xb 16 bytes
143+ 10008007ffa0 00000040ac6a body+0x1a 32 bytes
144+ 10008007fff0 00000040c05c PosixThread+0xac 80 bytes
145+ 000000000000 00000042f7e3 sys_clone_linux+0x26
146+ I2022-11-21T00:43:58.774829:blink/syscall.c:195: 262144: halting machine from thread: -4
147+ make: *** [third_party/cosmo/cosmo.mk:20: o//third_party/cosmo/wait_test.com.ok] Error 252
148+
149+ I2022-11-21T01:28:26.296387:blink/throw.c:59: 262144: SEGMENTATION FAULT AT ADDRESS 3450
150+ PC 41b80e mov (%rdi),%rcx
151+ AX 000010008007fda8 CX 0000000000000000 DX 000010008007fda8 BX 000010008004bfe0
152+ SP 000010008007fcf0 BP 000010008007fcf0 SI 000010008007fda8 DI 0000000000003450
153+ R8 0000000000433c40 R9 0000000000000001 R10 0000000000465740 R11 0000000000000000
154+ R12 000010008007fda0 R13 0000000000000001 R14 000010008004bfe8 R15 0000000000000001
155+ FS 0000100080040240 GS 0000000000000000 OPS 532982 JIT 0
156+ third_party/cosmo/once_test.com
157+ 10008007fcf0 00000041b80e nsync_dll_make_last_in_list_+0x1e 0 bytes
158+ 10008007fd20 00000040cbe9 counter_enqueue+0x39 48 bytes
159+ 10008007fe90 00000040d7e9 nsync_wait_n+0x199 368 bytes
160+ 10008007fee0 00000040cdd1 nsync_counter_wait+0x41 80 bytes
161+ 10008007ff20 00000040a52c test_once_run+0xec 64 bytes
162+ 10008007ff50 00000040ad9d run_test+0x6d 48 bytes
163+ 10008007ff70 00000040a9ab closure_f0_testing+0x1b 32 bytes
164+ 10008007ff80 00000040a6fb closure_run_body+0xb 16 bytes
165+ 10008007ffa0 00000040a85a body+0x1a 32 bytes
166+ 10008007fff0 00000040bc4c PosixThread+0xac 80 bytes
167+ 000000000000 00000042f7e3 sys_clone_linux+0x26
168+ I2022-11-21T01:28:26.303859:blink/syscall.c:195: 262144: halting machine from thread: -4
169+ make: *** [third_party/cosmo/cosmo.mk:21: o/asan/third_party/cosmo/once_test.com.ok] Error 252
170+
171+ I2022-11-21T01:30:50.158305:blink/throw.c:59: 262144: SEGMENTATION FAULT AT ADDRESS 8
172+ PC 40e177 mov 8(%rax),%rdx
173+ AX 0000000000000000 CX 7fffffffffffffff DX 0000100080040140 BX 000010008004ef80
174+ SP 000010008007fd30 BP 000010008007fe90 SI 000010008007fd1c DI 0000000000000001
175+ R8 000000003b9ac9ff R9 000000000000000f R10 0000000000000000 R11 0000000000000000
176+ R12 0000000000000000 R13 7fffffffffffffff R14 000000000000000e R15 0000000000000000
177+ FS 0000100080040240 GS 0000000000000000 OPS 1993605 JIT 0
178+ third_party/cosmo/wait_test.com
179+ 10008007fe90 00000040e177 nsync_wait_n+0x87 352 bytes
180+ 10008007ff20 00000040a9c3 test_wait_n+0x3d3 144 bytes
181+ 10008007ff50 00000040b1ad run_test+0x6d 48 bytes
182+ 10008007ff70 00000040adbb closure_f0_testing+0x1b 32 bytes
183+ 10008007ff80 00000040ab0b closure_run_body+0xb 16 bytes
184+ 10008007ffa0 00000040ac6a body+0x1a 32 bytes
185+ 10008007fff0 00000040c05c PosixThread+0xac 80 bytes
186+ 000000000000 00000042f7e3 sys_clone_linux+0x26
187+ I2022-11-21T01:30:50.163956:blink/syscall.c:195: 262144: halting machine from thread: -4
188+ make: *** [third_party/cosmo/cosmo.mk:20: o/tsan/third_party/cosmo/wait_test.com.ok] Error 252
189+
190+ I2022-11-21T00:05:25.934780:blink/throw.c:59: 262144: SEGMENTATION FAULT AT ADDRESS 0
191+ PC 40e180 call (%rdx)
192+ AX 00001000803ebe30 CX 0000000000000000 DX 0000000000000000 BX 000010008022bc00
193+ SP 000010008007fd30 BP 000010008007fe90 SI 0000000000000000 DI 00001000803e84d0
194+ R8 000000003b9ac9ff R9 000000000000001e R10 0000000000000000 R11 0000000000000000
195+ R12 0000000000000002 R13 7fffffffffffffff R14 000000000000001d R15 0000000000000002
196+ FS 0000100080040240 GS 0000000000000000 OPS 2347174 JIT 0
197+ third_party/cosmo/wait_test.com
198+ 10008007fe90 00000040e180 nsync_wait_n+0x90 352 bytes
199+ 10008007ff20 00000040a9c3 test_wait_n+0x3d3 144 bytes
200+ 10008007ff50 00000040b1ad run_test+0x6d 48 bytes
201+ 10008007ff70 00000040adbb closure_f0_testing+0x1b 32 bytes
202+ 10008007ff80 00000040ab0b closure_run_body+0xb 16 bytes
203+ 10008007ffa0 00000040ac6a body+0x1a 32 bytes
204+ 10008007fff0 00000040c05c PosixThread+0xac 80 bytes
205+ 000000000000 00000042f7e3 sys_clone_linux+0x26
206+ I2022-11-21T00:05:25.934796:blink/syscall.c:195: 262144: halting machine from thread: -4
207+ ```
0 commit comments