Fix bugs and make improvements

- Get clone() working on FreeBSD
- Increase some Python build quotas
- Add more atomic builtins to chibicc
- Fix ASAN poisoning of alloca() memory
- Make MODE= mandatory link path tinier
- Improve the examples folder a little bit
- Start working on some more resource limits
- Make the linenoise auto-complete UI as good as GNU readline
- Update compile.com, avoiding AVX codegen on non-AVX systems
- Make sure empty path to syscalls like opendir raises ENOENT
- Correctly polyfill ENOENT vs. ENOTDIR on the New Technology
- Port bestline's paredit features to //third_party/linenoise
- Remove workarounds for RHEL 5.0 bugs that were fixed in 5.1
This commit is contained in:
Justine Tunney 2022-04-20 09:56:53 -07:00
parent c3fb624647
commit ae638c0850
181 changed files with 2994 additions and 1367 deletions

View file

@ -4,8 +4,8 @@
#define kNtMovefileReplaceExisting 1
#define kNtMovefileCopyAllowed 2
#define kNtMovefileDelayUntilReboot 4
#define kNtMovefileWriteThrough 8
#define kNtMovefileCreateHardlink 16
#define kNtMovefileFailIfNotTrackable 32
#define kNtMovefileWriteThrough 8
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_MOVEFILEEXFLAGS_H_ */

View file

@ -0,0 +1,7 @@
#ifndef COSMOPOLITAN_LIBC_NT_ENUM_SYMBOLICLINK_H_
#define COSMOPOLITAN_LIBC_NT_ENUM_SYMBOLICLINK_H_
#define kNtSymbolicLinkFlagDirectory 1
#define kNtSymbolicLinkFlagAllowUnprivilegedCreate 2
#endif /* COSMOPOLITAN_LIBC_NT_ENUM_SYMBOLICLINK_H_ */

View file

@ -44,8 +44,6 @@
#define kNtDuplicateCloseSource 1
#define kNtDuplicateSameAccess 2
#define kNtSymbolicLinkFlagDirectory 1
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_CreateSymbolicLinkW,CreateSymbolicLinkW,0
.text.windows
CreateSymbolicLink:
__CreateSymbolicLink:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_CreateSymbolicLinkW(%rip),%rax
jmp __sysv2nt
.endfn CreateSymbolicLink,globl
.endfn __CreateSymbolicLink,globl
.previous

View file

@ -2,11 +2,11 @@
.imp kernel32,__imp_MoveFileExW,MoveFileExW,0
.text.windows
MoveFileEx:
__MoveFileEx:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_MoveFileExW(%rip),%rax
jmp __sysv2nt
.endfn MoveFileEx,globl
.endfn __MoveFileEx,globl
.previous

View file

@ -1,2 +1,14 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_TlsAlloc,TlsAlloc,0
.text.windows
__TlsAlloc:
push %rbp
mov %rsp,%rbp
.profilable
sub $32,%rsp
call *__imp_TlsAlloc(%rip)
leave
ret
.endfn __TlsAlloc,globl
.previous

View file

@ -1,2 +1,15 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_TlsFree,TlsFree,0
.text.windows
__TlsFree:
push %rbp
mov %rsp,%rbp
.profilable
mov %rdi,%rcx
sub $32,%rsp
call *__imp_TlsFree(%rip)
leave
ret
.endfn __TlsFree,globl
.previous

View file

@ -1,2 +1,15 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_TlsGetValue,TlsGetValue,0
.text.windows
__TlsGetValue:
push %rbp
mov %rsp,%rbp
.profilable
mov %rdi,%rcx
sub $32,%rsp
call *__imp_TlsGetValue(%rip)
leave
ret
.endfn __TlsGetValue,globl
.previous

View file

@ -1,2 +1,12 @@
.include "o/libc/nt/codegen.inc"
.imp kernel32,__imp_TlsSetValue,TlsSetValue,0
.text.windows
__TlsSetValue:
push %rbp
mov %rsp,%rbp
.profilable
mov __imp_TlsSetValue(%rip),%rax
jmp __sysv2nt
.endfn __TlsSetValue,globl
.previous

View file

@ -196,7 +196,6 @@ imp 'CreateSemaphore' CreateSemaphoreW kernel32 0
imp 'CreateSemaphoreA' CreateSemaphoreA kernel32 232
imp 'CreateSemaphoreEx' CreateSemaphoreExW kernel32 0
imp 'CreateSemaphoreExA' CreateSemaphoreExA kernel32 233
imp 'CreateSymbolicLink' CreateSymbolicLinkW kernel32 0 3
imp 'CreateSymbolicLinkA' CreateSymbolicLinkA kernel32 0 3
imp 'CreateSymbolicLinkTransacted' CreateSymbolicLinkTransactedW kernel32 238
imp 'CreateSymbolicLinkTransactedA' CreateSymbolicLinkTransactedA kernel32 237
@ -884,7 +883,6 @@ imp 'Module32First' Module32FirstW kernel32 992
imp 'Module32Next' Module32NextW kernel32 994
imp 'MoveFile' MoveFileW kernel32 1000 2
imp 'MoveFileA' MoveFileA kernel32 995 2
imp 'MoveFileEx' MoveFileExW kernel32 0 3
imp 'MoveFileExA' MoveFileExA kernel32 996 3
imp 'MoveFileTransacted' MoveFileTransactedW kernel32 999
imp 'MoveFileTransactedA' MoveFileTransactedA kernel32 998
@ -1228,10 +1226,6 @@ imp 'TermsrvSetValueKey' TermsrvSetValueKey kernel32 1441
imp 'TermsrvSyncUserIniFileExt' TermsrvSyncUserIniFileExt kernel32 1442
imp 'Thread32First' Thread32First kernel32 1443
imp 'Thread32Next' Thread32Next kernel32 1444
imp 'TlsAlloc' TlsAlloc kernel32 0
imp 'TlsFree' TlsFree kernel32 0
imp 'TlsGetValue' TlsGetValue kernel32 0
imp 'TlsSetValue' TlsSetValue kernel32 0
imp 'Toolhelp32ReadProcessMemory' Toolhelp32ReadProcessMemory kernel32 1449
imp 'TransactNamedPipe' TransactNamedPipe kernel32 0 7
imp 'TransmitCommChar' TransmitCommChar kernel32 0
@ -1353,6 +1347,7 @@ imp '__CreateFileMappingNuma' CreateFileMappingNumaW kernel32 0 7
imp '__CreateNamedPipe' CreateNamedPipeW kernel32 0 8
imp '__CreatePipe' CreatePipe kernel32 0 4
imp '__CreateProcess' CreateProcessW kernel32 0 10
imp '__CreateSymbolicLink' CreateSymbolicLinkW kernel32 0 3
imp '__CreateThread' CreateThread kernel32 0 6
imp '__DeleteFile' DeleteFileW kernel32 0 1
imp '__DeviceIoControl' DeviceIoControl kernel32 0 8
@ -1365,11 +1360,16 @@ imp '__GenerateConsoleCtrlEvent' GenerateConsoleCtrlEvent kernel32 0 2
imp '__GetFileAttributes' GetFileAttributesW kernel32 0 1
imp '__MapViewOfFileEx' MapViewOfFileEx kernel32 0 6
imp '__MapViewOfFileExNuma' MapViewOfFileExNuma kernel32 0 7
imp '__MoveFileEx' MoveFileExW kernel32 0 3
imp '__OpenProcess' OpenProcess kernel32 0 3
imp '__ReOpenFile' ReOpenFile kernel32 0 4 # TODO(jart): 6.2 and higher
imp '__RemoveDirectory' RemoveDirectoryW kernel32 0 1
imp '__SetCurrentDirectory' SetCurrentDirectoryW kernel32 0 1
imp '__TerminateProcess' TerminateProcess kernel32 0 2
imp '__TlsAlloc' TlsAlloc kernel32 0 0
imp '__TlsFree' TlsFree kernel32 0 1
imp '__TlsGetValue' TlsGetValue kernel32 0 1
imp '__TlsSetValue' TlsSetValue kernel32 0 2
imp '__UnmapViewOfFile' UnmapViewOfFile kernel32 0 1
imp '__VirtualProtect' VirtualProtect kernel32 0 4

View file

@ -21,7 +21,7 @@
#define _NtGetFib() gs((void **)(0x20))
#define _NtGetEnv() gs((char16_t **)(0x38))
#define _NtGetRpc() gs((void **)(0x50))
#define _NtGetTls() gs((void **)(0x58))
#define _NtGetTls() gs((void **)(0x58)) /* cf. gs((long *)0x1480 + i0..64) */
#endif /* __GNUC__ && !__STRICT_ANSI__ */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */