mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Write tests for new APE loader and fix bugs
- Add FreeBSD-specific mmap() flags - Reduce size of the APE loader from 8kb to 4kb - Work towards fixing the Makefile build on WSL - Automate testing of APE no-modify-self behaviors - Make the ape.S shell script code cleaner and tinier - Improve the APE sanity check to test behavior better - Fixed issue with ShowCrashReports() sigaltstack() on BSDs - Delete symbols for S_MODE magnums which wasted compile time If you checked out yesterday's APE commit, please run: rm -f /usr/bin/ape o/tmp/ape /tmp/ape "${TMPDIR:-/tmp}/ape" Because this change fixes certain aspects of the new ABI. We don't have automated migrations for APE loader versions yet. Thanks! You can also download prebuilt binaries here: - https://justine.lol/ape.elf (Linux/FreeBSD/NetBSD/OpenBSD) - https://justine.lol/ape.macho (Apple) Install the appropriate one as `/usr/bin/ape`.
This commit is contained in:
parent
056dc5f554
commit
4e9662cbc7
75 changed files with 759 additions and 443 deletions
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon compat,MAP_32BIT,0x40,0,0x080000,0,0,0
|
||||
.syscon compat,MAP_32BIT,0x00000040,0,0x00080000,0,0,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon compat,MAP_ANON,0x20,0x1000,0x0001000,0x1000,0x1000,0x20
|
||||
.syscon compat,MAP_ANON,0x00000020,0x00001000,0x00001000,0x00001000,0x00001000,0x00000020
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon compat,MAP_DENYWRITE,0x0800,0,0,0,0,0
|
||||
.syscon compat,MAP_DENYWRITE,0x00000800,0,0,0,0,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon compat,MAP_EXECUTABLE,0x1000,0,0,0,0,0
|
||||
.syscon compat,MAP_EXECUTABLE,0x00001000,0,0,0,0,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon compat,MAP_FILE,0,0,0,0,0,0
|
||||
.syscon mmap,MAP_FILE,0,0,0,0,0,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_FIXED_NOREPLACE,0x08000000,0x08000000,0x08000000,0x08000000,0x08000000,0x08000000
|
||||
.syscon mmap,MAP_FIXED_NOREPLACE,0x08000000,0x00004010,0x08000000,0x08000000,0x08000000,0x08000000
|
||||
|
|
2
libc/sysv/consts/MAP_HASSEMAPHORE.S
Normal file
2
libc/sysv/consts/MAP_HASSEMAPHORE.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_HASSEMAPHORE,0,0x00000200,0x00000200,0,0x00000200,0
|
2
libc/sysv/consts/MAP_INHERIT.S
Normal file
2
libc/sysv/consts/MAP_INHERIT.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_INHERIT,-1,-1,-1,-1,0x00000080,-1
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon compat,MAP_NOCORE,0,0,0x0020000,0x8000,0x8000,0
|
||||
.syscon compat,MAP_NOCORE,0,0,0x00020000,0x00008000,0x00008000,0
|
||||
|
|
2
libc/sysv/consts/MAP_NOSYNC.S
Normal file
2
libc/sysv/consts/MAP_NOSYNC.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_NOSYNC,0,0,0x00000800,0,0,0
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon mmap,MAP_POPULATE,0x00008000,0,0,0,0,0
|
||||
.syscon mmap,MAP_POPULATE,0x00008000,0,0x00040000,0,0,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon misc,MINSIGSTKSZ,0x0800,0x8000,0x0800,0x3000,0x2000,0
|
||||
.syscon ss,MINSIGSTKSZ,2048,32768,2048,12288,8192,2048
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon ss,SIGSTKSZ,0x2000,0x020000,0x8800,0x7000,0x7000,0x2000
|
||||
.syscon ss,SIGSTKSZ,8192,131072,34816,28672,28672,8192
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon statvfs,ST_MANDLOCK,0x40,0,0,0,0,0
|
||||
.syscon statvfs,ST_MANDLOCK,0x0040,0,0,0,0,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon statvfs,ST_SYNCHRONOUS,0x10,0,0,0,2,0
|
||||
.syscon statvfs,ST_SYNCHRONOUS,16,0,0,0,2,0
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon statvfs,ST_WRITE,0x80,0,0,0,0,0
|
||||
.syscon statvfs,ST_WRITE,0x0080,0,0,0,0,0
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IEXEC,0000100,0000100,0000100,0000100,0000100,0000100
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFBLK,0060000,0060000,0060000,0060000,0060000,0060000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFCHR,0020000,0020000,0020000,0020000,0020000,0020000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFDIR,0040000,0040000,0040000,0040000,0040000,0040000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFIFO,0010000,0010000,0010000,0010000,0010000,0010000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFLNK,0120000,0120000,0120000,0120000,0120000,0120000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFMT,0170000,0170000,0170000,0170000,0170000,0170000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFREG,0100000,0100000,0100000,0100000,0100000,0100000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IFSOCK,0140000,0140000,0140000,0140000,0140000,0140000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IREAD,0000400,0000400,0000400,0000400,0000400,0000400
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IRGRP,0000040,0000040,0000040,0000040,0000040,0000040
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IROTH,0000004,0000004,0000004,0000004,0000004,0000004
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IRUSR,0000400,0000400,0000400,0000400,0000400,0000400
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IRWXG,0000070,0000070,0000070,0000070,0000070,0000070
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IRWXO,0000007,0000007,0000007,0000007,0000007,0000007
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IRWXU,0000700,0000700,0000700,0000700,0000700,0000700
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_ISGID,0002000,0002000,0002000,0002000,0002000,0002000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_ISUID,0004000,0004000,0004000,0004000,0004000,0004000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_ISVTX,0001000,0001000,0001000,0001000,0001000,0001000
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IWGRP,0000020,0000020,0000020,0000020,0000020,0000020
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IWOTH,0000002,0000002,0000002,0000002,0000002,0000002
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IWRITE,0000200,0000200,0000200,0000200,0000200,0000200
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IWUSR,0000200,0000200,0000200,0000200,0000200,0000200
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IXGRP,0000010,0000010,0000010,0000010,0000010,0000010
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IXOTH,0000001,0000001,0000001,0000001,0000001,0000001
|
|
@ -1,2 +0,0 @@
|
|||
#include "libc/sysv/consts/syscon.internal.h"
|
||||
.syscon stat,S_IXUSR,0000100,0000100,0000100,0000100,0000100,0000100
|
|
@ -12,13 +12,17 @@ extern const long MAP_DENYWRITE;
|
|||
extern const long MAP_EXECUTABLE;
|
||||
extern const long MAP_FILE;
|
||||
extern const long MAP_FIXED;
|
||||
extern const long MAP_FIXED_NOREPLACE;
|
||||
extern const long MAP_GROWSDOWN;
|
||||
extern const long MAP_HASSEMAPHORE;
|
||||
extern const long MAP_HUGETLB;
|
||||
extern const long MAP_HUGE_MASK;
|
||||
extern const long MAP_HUGE_SHIFT;
|
||||
extern const long MAP_INHERIT;
|
||||
extern const long MAP_LOCKED;
|
||||
extern const long MAP_NONBLOCK;
|
||||
extern const long MAP_NORESERVE;
|
||||
extern const long MAP_NOSYNC;
|
||||
extern const long MAP_POPULATE;
|
||||
extern const long MAP_PRIVATE;
|
||||
extern const long MAP_SHARED;
|
||||
|
@ -26,28 +30,30 @@ extern const long MAP_SHARED;
|
|||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
||||
#define MAP_FILE 0
|
||||
#define MAP_SHARED 1
|
||||
#define MAP_PRIVATE 2
|
||||
#define MAP_STACK 6
|
||||
#define MAP_TYPE 15
|
||||
#define MAP_FIXED 16
|
||||
#define MAP_FIXED_NOREPLACE 0x8000000
|
||||
#define MAP_FILE 0
|
||||
#define MAP_SHARED 1
|
||||
#define MAP_PRIVATE 2
|
||||
#define MAP_STACK 6
|
||||
#define MAP_TYPE 15
|
||||
#define MAP_FIXED 16
|
||||
|
||||
#define MAP_32BIT SYMBOLIC(MAP_32BIT)
|
||||
#define MAP_ANONYMOUS SYMBOLIC(MAP_ANONYMOUS)
|
||||
#define MAP_CONCEAL SYMBOLIC(MAP_CONCEAL)
|
||||
#define MAP_CONCEAL SYMBOLIC(MAP_CONCEAL)
|
||||
#define MAP_DENYWRITE SYMBOLIC(MAP_DENYWRITE)
|
||||
#define MAP_EXECUTABLE SYMBOLIC(MAP_EXECUTABLE)
|
||||
#define MAP_GROWSDOWN SYMBOLIC(MAP_GROWSDOWN)
|
||||
#define MAP_HUGETLB SYMBOLIC(MAP_HUGETLB)
|
||||
#define MAP_HUGE_MASK SYMBOLIC(MAP_HUGE_MASK)
|
||||
#define MAP_HUGE_SHIFT SYMBOLIC(MAP_HUGE_SHIFT)
|
||||
#define MAP_LOCKED SYMBOLIC(MAP_LOCKED)
|
||||
#define MAP_NONBLOCK SYMBOLIC(MAP_NONBLOCK)
|
||||
#define MAP_NORESERVE SYMBOLIC(MAP_NORESERVE)
|
||||
#define MAP_POPULATE SYMBOLIC(MAP_POPULATE)
|
||||
#define MAP_32BIT SYMBOLIC(MAP_32BIT)
|
||||
#define MAP_ANONYMOUS SYMBOLIC(MAP_ANONYMOUS)
|
||||
#define MAP_CONCEAL SYMBOLIC(MAP_CONCEAL)
|
||||
#define MAP_DENYWRITE SYMBOLIC(MAP_DENYWRITE)
|
||||
#define MAP_EXECUTABLE SYMBOLIC(MAP_EXECUTABLE)
|
||||
#define MAP_FIXED_NOREPLACE SYMBOLIC(MAP_FIXED_NOREPLACE)
|
||||
#define MAP_GROWSDOWN SYMBOLIC(MAP_GROWSDOWN)
|
||||
#define MAP_HASSEMAPHORE SYMBOLIC(MAP_HASSEMAPHORE)
|
||||
#define MAP_HUGETLB SYMBOLIC(MAP_HUGETLB)
|
||||
#define MAP_HUGE_MASK SYMBOLIC(MAP_HUGE_MASK)
|
||||
#define MAP_HUGE_SHIFT SYMBOLIC(MAP_HUGE_SHIFT)
|
||||
#define MAP_INHERIT SYMBOLIC(MAP_INHERIT)
|
||||
#define MAP_LOCKED SYMBOLIC(MAP_LOCKED)
|
||||
#define MAP_NONBLOCK SYMBOLIC(MAP_NONBLOCK)
|
||||
#define MAP_NORESERVE SYMBOLIC(MAP_NORESERVE)
|
||||
#define MAP_NOSYNC SYMBOLIC(MAP_NOSYNC)
|
||||
#define MAP_POPULATE SYMBOLIC(MAP_POPULATE)
|
||||
|
||||
#define MAP_ANON MAP_ANONYMOUS
|
||||
#define MAP_NOCORE MAP_CONCEAL
|
||||
|
|
|
@ -3,13 +3,16 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern const long SIGSTKSZ;
|
||||
extern const long MINSIGSTKSZ;
|
||||
extern const long SS_DISABLE;
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
||||
#define SIGSTKSZ STACKSIZE
|
||||
#define SS_ONSTACK 1
|
||||
#define SS_DISABLE SS_DISABLE
|
||||
#define SIGSTKSZ STACKSIZE
|
||||
#define MINSIGSTKSZ 32768
|
||||
#define SS_ONSTACK 1
|
||||
#define SS_DISABLE SS_DISABLE
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_SS_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue