Browse Source

Add glob and some finer tuning of documentation

main
Justine Tunney 1 year ago
parent
commit
d51409ccd9
  1. 5
      Makefile
  2. 13
      NOTICE
  3. 44
      README.md
  4. 33
      build/config.mk
  5. 1
      build/rules.mk
  6. 37
      examples/ntdll.c
  7. 33
      libc/alg/alg.h
  8. 1
      libc/calls/hefty/dirstream.c
  9. 4
      libc/calls/ioctl.h
  10. 4
      libc/calls/termios.h
  11. 2
      libc/calls/weirdtypes.h
  12. 2
      libc/crypto/rijndael.h
  13. 30
      libc/elf/elf.h
  14. 3
      libc/elf/getelfsectionbyaddress.c
  15. 21
      libc/escape/escape.h
  16. 6
      libc/escape/escapedos.c
  17. 264
      libc/fmt/kerrnonames.S
  18. 6
      libc/fmt/palandftoa.c
  19. 47
      libc/fmt/palandprintf.c
  20. 10
      libc/fmt/pflink.h
  21. 2
      libc/fmt/snprintf.c
  22. 6
      libc/fmt/sprintf.c
  23. 2
      libc/fmt/stoa.c
  24. 3
      libc/fmt/vcscanf.h
  25. 4
      libc/fmt/vsnprintf.c
  26. 6
      libc/fmt/vsprintf.c
  27. 2
      libc/fmt/vsscanf.c
  28. 5
      libc/integral/c.inc
  29. 3
      libc/runtime/runtime.h
  30. 2
      libc/stdio/fread.c
  31. 14
      libc/stdio/internal.h
  32. 1
      libc/stdio/printf.c
  33. 42
      libc/stdio/unlocked.h
  34. 8
      libc/stdio/unlocked/clearerr_unlocked.S
  35. 8
      libc/stdio/unlocked/feof_unlocked.S
  36. 8
      libc/stdio/unlocked/ferror_unlocked.S
  37. 8
      libc/stdio/unlocked/fflush_unlocked.S
  38. 8
      libc/stdio/unlocked/fgetc_unlocked.S
  39. 8
      libc/stdio/unlocked/fgets_unlocked.S
  40. 8
      libc/stdio/unlocked/fgetwc_unlocked.S
  41. 8
      libc/stdio/unlocked/fgetws_unlocked.S
  42. 8
      libc/stdio/unlocked/fileno_unlocked.S
  43. 8
      libc/stdio/unlocked/fputc_unlocked.S
  44. 8
      libc/stdio/unlocked/fputs_unlocked.S
  45. 8
      libc/stdio/unlocked/fputwc_unlocked.S
  46. 8
      libc/stdio/unlocked/fputws_unlocked.S
  47. 8
      libc/stdio/unlocked/fread_unlocked.S
  48. 8
      libc/stdio/unlocked/fwrite_unlocked.S
  49. 8
      libc/stdio/unlocked/getc_unlocked.S
  50. 8
      libc/stdio/unlocked/getchar_unlocked.S
  51. 8
      libc/stdio/unlocked/getwc_unlocked.S
  52. 8
      libc/stdio/unlocked/getwchar_unlocked.S
  53. 8
      libc/stdio/unlocked/putc_unlocked.S
  54. 8
      libc/stdio/unlocked/putchar_unlocked.S
  55. 8
      libc/stdio/unlocked/putwc_unlocked.S
  56. 8
      libc/stdio/unlocked/putwchar_unlocked.S
  57. 12
      libc/sysv/consts.sh
  58. 34
      libc/sysv/consts/glob.h
  59. 1
      libc/x/x.h
  60. 36
      libc/x/xstrndup.c
  61. 1
      test/libc/fmt/sprintf_s.inc
  62. 4
      test/libc/xed/x86ild_test.c
  63. 9
      third_party/avir/avir1.h
  64. 1
      third_party/avir/avir_float4_sse.h
  65. 368
      third_party/musl/fnmatch.c
  66. 20
      third_party/musl/fnmatch.h
  67. 320
      third_party/musl/glob.c
  68. 36
      third_party/musl/glob.h
  69. 2
      third_party/musl/musl.mk
  70. 294
      third_party/regex/glob.c.todo
  71. 2
      third_party/xed/x86ild.greg.c
  72. 22
      third_party/xed/x86tab.S
  73. 2
      third_party/xed/xed.mk
  74. 31
      tool/build/summy.c
  75. 12
      tool/build/zipobj.c
  76. 6
      tool/emacs/cosmo-asm-mode.el
  77. 2
      tool/scripts/install-emacs.sh

5
Makefile

@ -231,8 +231,9 @@ HTAGS: o/$(MODE)/hdrs.txt $(HDRS)
@rm -f $@
@ACTION=TAGS TARGET=$@ build/do build/htags -L $< -o $@
loc:; find -name \*.h -or -name \*.c -or -name \*.S | \
$(XARGS) wc -l | grep total | awk '{print $$1}' | summy
loc: o/$(MODE)/tool/build/summy.com
find -name \*.h -or -name \*.c -or -name \*.S | \
$(XARGS) wc -l | grep total | awk '{print $$1}' | $<
# UNSPECIFIED PREREQUISITES TUTORIAL
#

13
NOTICE

@ -1,16 +1,3 @@
Cosmopolitan is Free Software licensed under the GPLv2. The build config
**will embed all linked sources inside your binaries** so the compliance
is easy while facilitating trust and transparency similar to JavaScript.
You can audit your source filesystem using ZIP GUIs e.g. WIN10, InfoZip.
If you want to be able to distribute binaries in binary form only, then
please send $1,000 to jtunney@gmail.com on PayPal for a license lasting
1 year. Please be sure to provide your contact information, and details
on whether or not the license is for an individual or a corporation. If
you want your license to last 5 years, send $10,000 to the author above
who is Justine Tunney <jtunney@gmail.com>. Reach out, for more details.
────────────────────────────────────────────────────────────────────────
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

44
README.md

@ -18,17 +18,19 @@ Cosmopolitan provides a native development environment similar to those
currently being offered by RedHat, Google, Apple, Microsoft, etc. We're
different in two ways: (1) we're not a platform therefore we don't have
any commercial interest in making our tooling work better on one rather
than another; and (2) we're only focused on catering towards interfaces
all platforms agree upon. Goal is software that stands the test of time
than another; and (2) we cater primarily towards features having gained
cross-platform agreement. Goal is software that stands the test of time
without the costs and restrictions cross-platform distribution entails.
That makes Cosmopolitan an excellent fit for writing small CLI programs
that do things like heavyweight numerical computations as a subprocess.
that do things like matrix multiplication relu stdio as a subprocess or
perhaps a web server having the minimum surface area that you require.
## Getting Started
Just clone the repository and put your own folder in it. Please choose a
name that's based on a .com or .org domain name registration you control
which is scout's honor but might change to require TXT records in future
which is scout's honor but could change to verify TXT records in future.
We provide a script that makes it easy to start a new package:
@ -37,11 +39,11 @@ We provide a script that makes it easy to start a new package:
make o//com/github/user/project/program.com
o//com/github/user/project/program.com
Please note GNU make is awesome. Little known fact: make is a functional
Please note GNU Make is awesome. Little known fact: make is a functional
programming language. We improved upon it too! In [tool/build/package.c]
which performs strict dependency checking, to correct Google's published
mistakes c. 2006 which was when they switched from using a GNU Make repo
in favor of an inhouse derivative called Blaze which does strictness too
in favor of an inhouse derivative called Blaze which does graph checking
thereby allowing the repository to grow gracefully with any requirements
## Performance
@ -66,18 +68,20 @@ Furthermore Cosmopolitan provides you with Intel's official instruction
length decoder Xed ravaged down to 3kb in size using Tim Patterson code
stunts. So you can absolutely code high-performance lightweight fabless
x86 microprocessors using any hobbyist board without royalties, because
Xed tells us which parts of the encoding space now belong to the people
Xed tells us which parts of the encoding space now belong to the people.
Please see [third_party/xed/x86ild.greg.c] to learn more.
## Integrated Development Environment
Your Cosmopolitan IDE is based on Emacs. When used alongside `make tags`
it can automate certain toilsome problems such as adding an include line
by typing `C-c C-h` with the cursor over a symbol. Please install these:
Your Cosmopolitan IDE is based on whichever editor you love most. Emacs
configs are provided, showing how `make tags` can be used to automate
certain toil, such as adding include lines by typing `C-c C-h` over a
symbol. We recommend trying the following:
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt install gdb ragel ctags clang-format-10 # <-recommended
sudo apt install gdb ragel ctags clang-format-10
git clone git@github.com:jart/cosmopolitan.git && cd cosmopolitan
tool/scripts/install-emacs.sh # recommended over apt
tool/scripts/install-emacs.sh # Emacs 26.1 has a bug
tool/scripts/configure-emacs.sh # adds load statements
make tags # index all the symbol
emacs # for power and glory!
@ -95,10 +99,9 @@ should explain how easy it is to do pe+sh+elf+macho+bootloader overlays
enabling gnu ld.bfd to produce a simple portable 12kb .com program file
Please send feedback and concerns to <jtunney@gmail.com> since we would
love to do an even better job. Please also report GPL abuse the address
above as well. We believe this binary structure is novel, and therefore
easily recognizable. So if some goofball isn't bundling the source code
please let us know, so we can reach out and ask if they want a license.
love to do an even better job. Please also let us know if some goofball
is distributing without bundling their source code, so we can reach out
and ask if they would like to purchase a commercial license.
make -j10 -O MODE=tiny CPPFLAGS=-DIM_FEELING_NAUGHTY
o/tiny/tool/viz/bing.com <o/tiny/examples/life.com |
@ -244,6 +247,7 @@ Cosmopolitan is Free Software licensed under the GPLv2. The build config
**will embed all linked sources inside your binaries** so the compliance
is easy while facilitating trust and transparency similar to JavaScript.
You can audit your source filesystem using ZIP GUIs e.g. Win10, InfoZip.
That works easiest by changing the filename extension from .com to .zip.
### Commercial Support
@ -276,9 +280,9 @@ ideas, aside from taking care of low-level build system toil, so coding
can become more beautifully pleasant.
Cosmopolitan is maintained by Justine Tunney, who previously worked on
projects like TensorFlow, [Operation Rosehub], [Nomulus], and Google's
tape backups sre team. She's also helped radical activists by operating
the [Occupy Wall Street] website. Justine Tunney currently isn't on the
projects like [TensorFlow], [Operation Rosehub], [Nomulus], and Google's
tape backups SRE team. She's also helped activists by operating the
[Occupy Wall Street] website. Justine Tunney currently isn't on the
payroll of any company. She's been focusing on Cosmopolitan because she
wants to give back to Free Software which helped her be successful. See
her [LinkedIn] profile for further details on her professional history.
@ -288,6 +292,7 @@ her [LinkedIn] profile for further details on her professional history.
[Nomulus]: https://github.com/google/nomulus
[Occupy Wall Street]: https://www.newyorker.com/magazine/2011/11/28/pre-occupied
[Operation Rosehub]: https://opensource.googleblog.com/2017/03/operation-rosehub.html
[TensorFlow]: https://github.com/tensorflow/tensorflow
[ansitrinsics library]: libc/intrin
[ape/ape.lds]: ape/ape.lds
[dsp/scale/cdecimate2xuint8x8.c]: dsp/scale/cdecimate2xuint8x8.c
@ -297,6 +302,7 @@ her [LinkedIn] profile for further details on her professional history.
[libc/nexgen32e/x86feature.h]: libc/nexgen32e/x86feature.h
[libc/sysv/consts.sh]: libc/sysv/consts.sh
[libc/sysv/syscalls.sh]: libc/sysv/syscalls.sh
[third_party/xed/x86ild.greg.c]: third_party/xed/x86ild.greg.c
[tool/build/package.c]: tool/build/package.c
[tool/emacs/cosmo-stuff.el]: tool/emacs/cosmo-stuff.el
[tool/viz/lib/ycbcr2rgb3.c]: tool/viz/lib/ycbcr2rgb3.c

33
build/config.mk

@ -141,12 +141,37 @@ endif
# ANSI Mode
#
# Folks who want it deserve to get it, good and hard.
# These flags cause GCC to predefine __STRICT_ANSI__. Please be warned
# that Cosmopolitan headers are written to comply with that request if
# it's possible to do so. Consider the following example:
#
# make -j12 -O o//tool/viz/printvideo.i
# clang-format-10 -i o//tool/viz/printvideo.i
# less o//tool/viz/printvideo.i
#
# You'll notice functions like memcpy(), ioctl(), etc. get expanded into
# wild-eyed gnu-style performance hacks. You can turn it off as follows:
#
# make -j12 -O MODE=ansi o/ansi/tool/viz/printvideo.i
# clang-format-10 -i o/ansi/tool/viz/printvideo.i
# less o/ansi/tool/viz/printvideo.i
#
# Here it becomes clear that ANSI mode can help you decouple your source
# from Cosmopolitan, by turning it into plain ordinary textbook C code.
#
# Another potential use case is distributing code to folks using tools
# such as MSVC or XCode. You can run your binary objects through a tool
# like objconv to convert them to COFF or MachO. Then use ANSI mode to
# rollup one header file that'll enable linkage with minimal issues.
#
# Lastly note that in some cases, such as gc(), there simply isn't any
# ANSI workaround available. It's only in cases like that when we'll use
# the __asm__() header workaround, rather than simply removing it. We do
# however try to do that much less often than mainstream C libraries.
ifeq ($(MODE), ansi)
CONFIG_CCFLAGS += \
-std=c11 \
-Og
CONFIG_CFLAGS += -std=c11
CONFIG_CXXFLAGS += -std=c++11
endif

1
build/rules.mk

@ -96,4 +96,3 @@ build/bootstrap/%.c.gz: %.rl
%.svgz: %.rl
@$(RAGEL) -V -p $< | $(DOT) -Tsvg | $(GZ) $(ZFLAGS) >$@
$(LIBC__A_SRCS:%=o/$(MODE)/%.zip.o) \

37
examples/ntdll.c

@ -1,37 +0,0 @@
#if 0
/*─────────────────────────────────────────────────────────────────╗
To the extent possible under law, Justine Tunney has waived
all copyright and related or neighboring rights to this file,
as it is written in the following disclaimers:
http://unlicense.org/
http://creativecommons.org/publicdomain/zero/1.0/
*/
#endif
#include "libc/dce.h"
#include "libc/nt/dll.h"
#include "libc/nt/nt/process.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/sysv/consts/exit.h"
int main() {
if (IsWindows()) {
/*
* Cosmopolitan imports this automatically if it's referenced the
* normal way. But Microsoft wants us to use loose coupling when
* referencing their internal APIs. Don't think for a moment they
* won't break open source projects that fail to heed the warning.
*/
typeof(NtTerminateProcess) *NtTerminateProcess_ =
GetProcAddress(GetModuleHandle("ntdll.dll"), "NtTerminateProcess");
printf("%ld\n", GetModuleHandle("ntdll.dll"));
printf("%p\n", NtTerminateProcess_);
if (NtTerminateProcess_) {
fflush(stdout);
for (;;) NtTerminateProcess_(-1, 42);
}
} else {
fprintf(stderr, "error: intended for windows\n");
}
return EXIT_FAILURE;
}

33
libc/alg/alg.h

@ -13,17 +13,14 @@ void *bsearch_r(const void *, const void *, size_t, size_t,
int cmp(const void *, const void *, void *), void *)
paramsnonnull((1, 2, 5)) nothrow nosideeffect;
void djbsort(size_t n, int32_t[n]);
void qsort(void *items, size_t itemcount, size_t itemsize,
int cmp(const void *, const void *)) paramsnonnull();
void qsort_r(void *items, size_t itemcount, size_t itemsize,
void qsort(void *, size_t, size_t, int (*)(const void *, const void *))
paramsnonnull();
void qsort_r(void *, size_t, size_t,
int cmp(const void *, const void *, void *), void *arg)
paramsnonnull((1, 4));
int tarjan(uint32_t vertex_count, const uint32_t (*edges)[2],
uint32_t edge_count, uint32_t out_sorted[],
uint32_t out_opt_components[], uint32_t *out_opt_componentcount)
paramsnonnull((2, 4)) nocallback nothrow;
void heapsortcar(int32_t (*A)[2], unsigned n)
paramsnonnull() nocallback nothrow;
int tarjan(uint32_t, const uint32_t (*)[2], uint32_t, uint32_t[], uint32_t[],
uint32_t *) paramsnonnull((2, 4)) nocallback nothrow;
void heapsortcar(int32_t (*)[2], unsigned) paramsnonnull() nocallback nothrow;
void *memmem(const void *, size_t, const void *, size_t)
paramsnonnull() nothrow nocallback nosideeffect;
@ -56,16 +53,16 @@ struct critbit0 {
size_t count;
};
bool critbit0_contains(struct critbit0 *t, const char *u) nothrow nosideeffect
bool critbit0_contains(struct critbit0 *, const char *) nothrow nosideeffect
paramsnonnull();
bool critbit0_insert(struct critbit0 *t, const char *u) paramsnonnull();
bool critbit0_delete(struct critbit0 *t, const char *u) nothrow paramsnonnull();
void critbit0_clear(struct critbit0 *t) nothrow paramsnonnull();
char *critbit0_get(struct critbit0 *t, const char *u);
intptr_t critbit0_allprefixed(struct critbit0 *t, const char *prefix,
intptr_t (*callback)(const char *elem, void *arg),
void *arg) paramsnonnull((1, 2, 3)) nothrow;
bool critbit0_emplace(struct critbit0 *t, char *u, size_t ulen) paramsnonnull();
bool critbit0_insert(struct critbit0 *, const char *) paramsnonnull();
bool critbit0_delete(struct critbit0 *, const char *) nothrow paramsnonnull();
void critbit0_clear(struct critbit0 *) nothrow paramsnonnull();
char *critbit0_get(struct critbit0 *, const char *);
intptr_t critbit0_allprefixed(struct critbit0 *, const char *,
intptr_t (*)(const char *, void *), void *)
paramsnonnull((1, 2, 3)) nothrow;
bool critbit0_emplace(struct critbit0 *, char *, size_t) paramsnonnull();
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § algorithms » comparators

1
libc/calls/hefty/dirstream.c

@ -76,6 +76,7 @@ static textwindows noinline DIR *opendir$nt(const char *name) {
*
* @returns newly allocated DIR object, or NULL w/ errno
* @errors ENOENT, ENOTDIR, EACCES, EMFILE, ENFILE, ENOMEM
* @see glob()
*/
DIR *opendir(const char *name) {
if (!IsWindows() && !IsXnu()) {

4
libc/calls/ioctl.h

@ -12,7 +12,7 @@ int ioctl(int, uint64_t, void *);
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § system calls » input output control » undiamonding
*/
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#include "libc/macros.h"
#include "libc/sysv/consts/termios.h"
@ -46,7 +46,7 @@ forceinline int ioctl$dispatch(int fd, uint64_t request, void *memory) {
return ioctl$default(fd, request, memory);
}
#endif /* GNUC */
#endif /* GNUC && !ANSI */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_IOCTL_H_ */

4
libc/calls/termios.h

@ -28,8 +28,9 @@ int unlockpt(int);
int posix_openpt(int) nodiscard;
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § teletypewriter » optimizations
cosmopolitan § teletypewriter » undiamonding
*/
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
#define tcsetattr(FD, OPT, TIO) tcsetattr$dispatch(FD, OPT, TIO)
forceinline int tcsetattr$dispatch(int fd, int opt, const struct termios *tio) {
@ -44,6 +45,7 @@ forceinline int tcgetattr$dispatch(int fd, const struct termios *tio) {
return ioctl(fd, TCGETS, (void *)tio);
}
#endif /* GNUC && !ANSI */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_TERMIOS_H_ */

2
libc/calls/weirdtypes.h

@ -3,7 +3,7 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/**
* @fileoverview Types for scoundrels.
* @fileoverview Types we'd prefer hadn't been invented.
*/
#define blkcnt_t int64_t

2
libc/crypto/rijndael.h

@ -49,7 +49,7 @@ aes_block_t unrijndael(uint32_t, aes_block_t, const struct Rijndael *);
aligned(64) extern const uint8_t kAesSbox[256];
aligned(64) extern const uint8_t kAesSboxInverse[256];
aes_block_t InvMixColumns(aes_block_t x) hidden;
aes_block_t InvMixColumns(aes_block_t) hidden;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

30
libc/elf/elf.h

@ -18,12 +18,10 @@ COSMOPOLITAN_C_START_
struct MappedFile;
Elf64_Ehdr *mapelfread(const char *filename, struct MappedFile *mf);
char *getelfstringtable(const Elf64_Ehdr *elf, size_t mapsize);
Elf64_Sym *getelfsymboltable(const Elf64_Ehdr *elf, size_t mapsize,
Elf64_Xword *out_count);
Elf64_Shdr *getelfsectionbyaddress(const Elf64_Ehdr *elf, size_t mapsize,
void *addr);
Elf64_Ehdr *mapelfread(const char *, struct MappedFile *);
char *getelfstringtable(const Elf64_Ehdr *, size_t);
Elf64_Sym *getelfsymboltable(const Elf64_Ehdr *, size_t, Elf64_Xword *);
Elf64_Shdr *getelfsectionbyaddress(const Elf64_Ehdr *, size_t, void *);
forceinline void checkelfaddress(const Elf64_Ehdr *elf, size_t mapsize,
intptr_t addr, size_t addrsize) {
@ -66,8 +64,9 @@ static inline Elf64_Shdr *getelfsectionheaderaddress(const Elf64_Ehdr *elf,
static inline void *getelfsectionaddress(const Elf64_Ehdr *elf, size_t mapsize,
const Elf64_Shdr *shdr) {
intptr_t addr = (intptr_t)elf + (intptr_t)shdr->sh_offset;
intptr_t size = (intptr_t)shdr->sh_size;
intptr_t addr, size;
addr = (intptr_t)elf + (intptr_t)shdr->sh_offset;
size = (intptr_t)shdr->sh_size;
checkelfaddress(elf, mapsize, addr, size);
return (void *)addr;
}
@ -83,13 +82,16 @@ static inline void getelfvirtualaddressrange(const Elf64_Ehdr *elf,
size_t elfsize,
intptr_t *out_start,
intptr_t *out_end) {
intptr_t start = INTPTR_MAX;
intptr_t end = 0;
for (unsigned i = 0; i < elf->e_phnum; ++i) {
Elf64_Phdr *phdr = getelfsegmentheaderaddress(elf, elfsize, i);
unsigned i;
Elf64_Phdr *phdr;
intptr_t start, end, pstart, pend;
start = INTPTR_MAX;
end = 0;
for (i = 0; i < elf->e_phnum; ++i) {
phdr = getelfsegmentheaderaddress(elf, elfsize, i);
if (phdr->p_type != PT_LOAD) continue;
intptr_t pstart = phdr->p_vaddr;
intptr_t pend = phdr->p_vaddr + phdr->p_memsz;
pstart = phdr->p_vaddr;
pend = phdr->p_vaddr + phdr->p_memsz;
if (pstart < start) start = pstart;
if (pend > end) end = pend;
}

3
libc/elf/getelfsectionbyaddress.c

@ -23,9 +23,10 @@
Elf64_Shdr *getelfsectionbyaddress(const Elf64_Ehdr *elf, size_t mapsize,
void *addr) {
Elf64_Half i;
Elf64_Shdr *shdr;
if (elf) {
for (i = elf->e_shnum; i > 0; --i) {
Elf64_Shdr *shdr = getelfsectionheaderaddress(elf, mapsize, i - 1);
shdr = getelfsectionheaderaddress(elf, mapsize, i - 1);
if ((intptr_t)addr >= shdr->sh_addr &&
(intptr_t)addr < shdr->sh_addr + shdr->sh_size) {
return shdr;

21
libc/escape/escape.h

@ -7,20 +7,15 @@ COSMOPOLITAN_C_START_
cosmopolitan § escaping
*/
unsigned cescapec(int c);
int escapec(char *buf, unsigned size, const char *unescaped, unsigned length)
unsigned cescapec(int);
int escapec(char *, unsigned, const char *, unsigned)
paramsnonnull((3)) nothrow nocallback;
int escapesh(char *buf, unsigned size, const char *unescaped, unsigned length)
paramsnonnull((3));
bool escapedos(char16_t *buffer, unsigned buflen, const char16_t *unquoted,
unsigned len);
int aescapec(char **escaped, const char *unescaped, unsigned length)
paramsnonnull();
int aescapesh(char **escaped, const char *unescaped, unsigned length)
paramsnonnull();
int aescape(char **escaped, size_t size, const char *unescaped, unsigned length,
int impl(char *escaped, unsigned size, const char *unescaped,
unsigned length)) hidden;
int escapesh(char *, unsigned, const char *, unsigned) paramsnonnull((3));
bool escapedos(char16_t *, unsigned, const char16_t *, unsigned);
int aescapec(char **, const char *, unsigned) paramsnonnull();
int aescapesh(char **, const char *, unsigned) paramsnonnull();
int aescape(char **, size_t, const char *, unsigned,
int (*)(char *, unsigned, const char *, unsigned)) hidden;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

6
libc/escape/escapedos.c

@ -20,11 +20,6 @@
#include "libc/escape/escape.h"
#include "libc/str/str.h"
asm(".ident\t\"\\n\\n\
NSSM (Public Domain)\\n\
Credit: Iain Patterson\n\
http://iain.cx/\"");
static textwindows bool shouldescapedos(const char16_t c) {
if (c == u'"') return true;
if (c == u'&') return true;
@ -48,6 +43,7 @@ static textwindows bool shouldquotedos(const char16_t c) {
/**
* Escapes command so DOS can run it.
* @see Iain Patterson's NSSM for original code in public domain
*/
textwindows bool escapedos(char16_t *buffer, unsigned buflen,
const char16_t *unquoted, unsigned len) {

264
libc/fmt/kerrnonames.S

@ -170,138 +170,138 @@ kErrnoNames:
/ @assume linker invoked as LC_ALL=C ld ...
/ @see libc/sysv/systemfive.S
/ @see libc/sysv/consts/syscon.h
yoink E2BIG
yoink EACCES
yoink EADDRINUSE
yoink EADDRNOTAVAIL
yoink EADV
yoink EAFNOSUPPORT
yoink EAGAIN
yoink EALREADY
yoink EBADE
yoink EBADF
yoink EBADFD
yoink EBADMSG
yoink EBADR
yoink EBADRQC
yoink EBADSLT
yoink EBFONT
yoink EBUSY
yoink ECANCELED
yoink ECHILD
yoink ECHRNG
yoink ECOMM
yoink ECONNABORTED
yoink ECONNREFUSED
yoink ECONNRESET
yoink EDEADLK
yoink EDESTADDRREQ
yoink EDOM
yoink EDOTDOT
yoink EDQUOT
yoink EEXIST
yoink EFAULT
yoink EFBIG
yoink EHOSTDOWN
yoink EHOSTUNREACH
yoink EHWPOISON
yoink EIDRM
yoink EILSEQ
yoink EINPROGRESS
yoink EINTR
yoink EINVAL
yoink EIO
yoink EISCONN
yoink EISDIR
yoink EISNAM
yoink EKEYEXPIRED
yoink EKEYREJECTED
yoink EKEYREVOKED
yoink EL2HLT
yoink EL2NSYNC
yoink EL3HLT
yoink EL3RST
yoink ELIBACC
yoink ELIBBAD
yoink ELIBEXEC
yoink ELIBMAX
yoink ELIBSCN
yoink ELNRNG
yoink ELOOP
yoink EMEDIUMTYPE
yoink EMFILE
yoink EMLINK
yoink EMSGSIZE
yoink EMULTIHOP
yoink ENAMETOOLONG
yoink ENAVAIL
yoink ENETDOWN
yoink ENETRESET
yoink ENETUNREACH
yoink ENFILE
yoink ENOANO
yoink ENOBUFS
yoink ENOCSI
yoink ENODATA
yoink ENODEV
yoink ENOENT
yoink ENOEXEC
yoink ENOKEY
yoink ENOLCK
yoink ENOLINK
yoink ENOMEDIUM
yoink ENOMEM
yoink ENOMSG
yoink ENONET
yoink ENOPKG
yoink ENOPROTOOPT
yoink ENOSPC
yoink ENOSR
yoink ENOSTR
yoink ENOSYS
yoink ENOTBLK
yoink ENOTCONN
yoink ENOTDIR
yoink ENOTEMPTY
yoink ENOTNAM
yoink ENOTRECOVERABLE
yoink ENOTSOCK
yoink ENOTSUP
yoink ENOTTY
yoink ENOTUNIQ
yoink ENXIO
yoink EOPNOTSUPP
yoink EOVERFLOW
yoink EOWNERDEAD
yoink EPERM
yoink EPFNOSUPPORT
yoink EPIPE
yoink EPROTO
yoink EPROTONOSUPPORT
yoink EPROTOTYPE
yoink ERANGE
yoink EREMCHG
yoink EREMOTE
yoink EREMOTEIO
yoink ERESTART
yoink ERFKILL
yoink EROFS
yoink ESHUTDOWN
yoink ESOCKTNOSUPPORT
yoink ESPIPE
yoink ESRCH
yoink ESRMNT
yoink ESTALE
yoink ESTRPIPE
yoink ETIME
yoink ETIMEDOUT
yoink ETOOMANYREFS
yoink ETXTBSY
yoink EUCLEAN
yoink EUNATCH
yoink EUSERS
yoink EXDEV
yoink EXFULL
.yoink E2BIG
.yoink EACCES
.yoink EADDRINUSE
.yoink EADDRNOTAVAIL
.yoink EADV
.yoink EAFNOSUPPORT
.yoink EAGAIN
.yoink EALREADY
.yoink EBADE
.yoink EBADF
.yoink EBADFD
.yoink EBADMSG
.yoink EBADR
.yoink EBADRQC
.yoink EBADSLT
.yoink EBFONT
.yoink EBUSY
.yoink ECANCELED
.yoink ECHILD
.yoink ECHRNG
.yoink ECOMM
.yoink ECONNABORTED
.yoink ECONNREFUSED
.yoink ECONNRESET
.yoink EDEADLK
.yoink EDESTADDRREQ
.yoink EDOM
.yoink EDOTDOT
.yoink EDQUOT
.yoink EEXIST
.yoink EFAULT
.yoink EFBIG
.yoink EHOSTDOWN
.yoink EHOSTUNREACH
.yoink EHWPOISON
.yoink EIDRM
.yoink EILSEQ
.yoink EINPROGRESS
.yoink EINTR
.yoink EINVAL
.yoink EIO
.yoink EISCONN
.yoink EISDIR
.yoink EISNAM
.yoink EKEYEXPIRED
.yoink EKEYREJECTED
.yoink EKEYREVOKED
.yoink EL2HLT
.yoink EL2NSYNC
.yoink EL3HLT
.yoink EL3RST
.yoink ELIBACC
.yoink ELIBBAD
.yoink ELIBEXEC
.yoink ELIBMAX
.yoink ELIBSCN
.yoink ELNRNG
.yoink ELOOP
.yoink EMEDIUMTYPE
.yoink EMFILE
.yoink EMLINK
.yoink EMSGSIZE
.yoink EMULTIHOP
.yoink ENAMETOOLONG
.yoink ENAVAIL
.yoink ENETDOWN
.yoink ENETRESET
.yoink ENETUNREACH
.yoink ENFILE
.yoink ENOANO
.yoink ENOBUFS
.yoink ENOCSI
.yoink ENODATA
.yoink ENODEV
.yoink ENOENT
.yoink ENOEXEC
.yoink ENOKEY
.yoink ENOLCK
.yoink ENOLINK
.yoink ENOMEDIUM
.yoink ENOMEM
.yoink ENOMSG
.yoink ENONET
.yoink ENOPKG
.yoink ENOPROTOOPT
.yoink ENOSPC
.yoink ENOSR
.yoink ENOSTR
.yoink ENOSYS
.yoink ENOTBLK
.yoink ENOTCONN
.yoink ENOTDIR
.yoink ENOTEMPTY
.yoink ENOTNAM
.yoink ENOTRECOVERABLE
.yoink ENOTSOCK
.yoink ENOTSUP
.yoink ENOTTY
.yoink ENOTUNIQ
.yoink ENXIO
.yoink EOPNOTSUPP
.yoink EOVERFLOW
.yoink EOWNERDEAD
.yoink EPERM
.yoink EPFNOSUPPORT
.yoink EPIPE
.yoink EPROTO
.yoink EPROTONOSUPPORT
.yoink EPROTOTYPE
.yoink ERANGE
.yoink EREMCHG
.yoink EREMOTE
.yoink EREMOTEIO
.yoink ERESTART
.yoink ERFKILL
.yoink EROFS
.yoink ESHUTDOWN
.yoink ESOCKTNOSUPPORT
.yoink ESPIPE
.yoink ESRCH
.yoink ESRMNT
.yoink ESTALE
.yoink ESTRPIPE
.yoink ETIME
.yoink ETIMEDOUT
.yoink ETOOMANYREFS
.yoink ETXTBSY
.yoink EUCLEAN
.yoink EUNATCH
.yoink EUSERS
.yoink EXDEV
.yoink EXFULL
.type kErrnoStart,@object
.type kErrnoEnd,@object

6
libc/fmt/palandftoa.c

@ -37,6 +37,12 @@
static const int kPow10[] = {1, 10, 100, 1000, 10000,
100000, 1000000, 10000000, 100000000, 1000000000};
/**
* Formats floating point number.
*
* @see xdtoa() for higher precision at the cost of bloat
* @see palandprintf() which is intended caller
*/
int ftoa(int out(int, void *), void *arg, long double value, unsigned long prec,
unsigned long width, unsigned long flags) {
long whole, frac;

47
libc/fmt/palandprintf.c

@ -56,7 +56,52 @@ static unsigned ppatoi(const char **str) {
/**
* Implements {,v}{,s{,n},{,{,x}as},f,d}printf state machine.
* @see libc/stdio/printf.c for documentation
*
* Type Specifiers
*
* - `%s` char * (thompson-pike unicode)
* - `%ls` wchar_t * (32-bit unicode thompson-pike unicode)
* - `%hs` char16_t * (16-bit unicode thompson-pike unicode)
* - `%b` int (radix 2 binary)
* - `%o` int (radix 8 octal)
* - `%d` int (radix 10 decimal)
* - `%x` int (radix 16 hexadecimal)
* - `%X` int (radix 16 hexadecimal uppercase)
* - `%u` unsigned
* - `%f` double
* - `%Lf` long double
* - `%p` pointer (48-bit hexadecimal)
*
* Length Modifiers
*
* - `%hhd` char (8-bit)
* - `%hd` short (16-bit)
* - `%ld` long (64-bit)
* - `%lu` unsigned long (64-bit)
* - `%lx` unsigned long (64-bit hexadecimal)
* - `%jd` intmax_t (128-bit)
*
* Width Modifiers
*
* - `%08d` fixed columns w/ zero leftpadding
* - `%8d` fixed columns w/ space leftpadding
* - `%*s` variable column string (thompson-pike)
* - `%.*s` variable column data (ignore nul terminator)
*
* Formatting Modifiers
*
* - `%,d` thousands separators
* - `%'s` escaped c string literal
* - `%'c` escaped c character literal
* - `%`s` escaped double quoted c string literal
* - `%`c` escaped double quoted c character literal
* - `%+d` plus leftpad if positive (aligns w/ negatives)
* - `% d` space leftpad if positive (aligns w/ negatives)
* - `%#s` datum (radix 256 null-terminated ibm cp437)
* - `%#x` int (radix 16 hexadecimal w/ 0x prefix if not zero)
*
* @note implementation detail of printf(), snprintf(), etc.
* @see printf() for wordier documentation
*/
hidden int palandprintf(void *fn, void *arg, const char *format, va_list va) {
int (*out)(int, void *);

10
libc/fmt/pflink.h

@ -50,8 +50,18 @@
#endif
#if defined(__GNUC__) && __GNUC__ < 6
/*
* Compilers don't understand the features we've added to the format
* string DSL, such as c string escaping, therefore we can't use it.
* Ideally compilers should grant us more flexibility to define DSLs
*
* The recommended approach to turning this back on is `CFLAGS=-std=c11`
* which puts the compiler in __STRICT_ANSI__ mode, which Cosmopolitan
* respects by disabling all the esoteric tuning in headers like this.
*/
#pragma GCC diagnostic ignored "-Wformat-security"
#endif /* __GNUC__ + 0 < 6 */
#else
#define PFLINK(FMT) FMT
#define SFLINK(FMT) FMT

2
libc/fmt/snprintf.c

@ -25,7 +25,7 @@
* @return number of bytes written, excluding the NUL terminator; or,
* if the output buffer wasn't passed, or was too short, then the
* number of characters that *would* have been written is returned
* @see libc/fmt/fmt.h for documentation
* @see palandprintf() and printf() for detailed documentation
*/
int(snprintf)(char* buf, size_t count, const char* fmt, ...) {
int rc;

6
libc/fmt/sprintf.c

@ -20,6 +20,12 @@
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
/**
* Formats string to buffer that's hopefully large enough.
*
* @see palandprintf() and printf() for detailed documentation
* @see snprintf() for same w/ buf size param
*/
int(sprintf)(char *buf, const char *fmt, ...) {
int rc;
va_list va;

2
libc/fmt/stoa.c

@ -74,6 +74,8 @@ forceinline int emitquote(int out(int, void *), void *arg, unsigned flags,
* This function is used by palandprintf() to implement the %s and %c
* directives. The content outputted to the array is always UTF-8, but
* the input may be UTF-16 or UTF-32.
*
* @see palandprintf()
*/
int stoa(int out(int, void *), void *arg, void *data, unsigned long flags,
unsigned long precision, unsigned long width, unsigned char signbit,

3
libc/fmt/vcscanf.h

@ -34,6 +34,9 @@
* 8-bit through 128-bit integers (with validation), floating point
* numbers, etc. It can also be used to convert UTF-8 to UTF-16/32.
*
* - `%d` parses integer
* - `%ms` parses string allocating buffer assigning pointer
*
* @param callback supplies UTF-8 characters using -1 sentinel
* @param fmt is a computer program embedded inside a c string, written
* in a domain-specific programming language that, by design, lacks

4
libc/fmt/vsnprintf.c

@ -40,7 +40,7 @@ static int vsnprintfputchar(unsigned char c, struct SprintfStr *str) {
}
/**
* Formats string to buffer.
* Formats string to buffer w/ preexisting vararg state.
*
* @param buf stores output and a NUL-terminator is always written,
* provided buf!=NULL && size!=0
@ -50,7 +50,7 @@ static int vsnprintfputchar(unsigned char c, struct SprintfStr *str) {
* number of characters that *would* have been written is returned
* @throw EOVERFLOW when a formatted field exceeds its limit, which can
* be checked by setting errno to 0 before calling
* @see libc/fmt/fmt.h for further documentation
* @see palandprintf() and printf() for detailed documentation
*/
int(vsnprintf)(char *buf, size_t size, const char *fmt, va_list va) {
struct SprintfStr str = {buf, 0, size};

6
libc/fmt/vsprintf.c

@ -20,6 +20,12 @@
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
/**
* Formats string to buffer hopefully large enough w/ vararg state.
*
* @see palandprintf() and printf() for detailed documentation
* @see vsnprintf() for modern alternative w/ buf size param
*/
int(vsprintf)(char *buf, const char *fmt, va_list va) {
return (vsnprintf)(buf, INT_MAX, fmt, va);
}

2
libc/fmt/vsscanf.c

@ -21,7 +21,7 @@
#include "libc/fmt/vsscanf.h"
/**
* String decoder.
* Decodes string.
*
* @see libc/fmt/vcscanf.h (for docs and implementation)
* @note to offer the best performance, we assume small codebases

5
libc/integral/c.inc

@ -1015,8 +1015,9 @@ typedef uint64_t uintmax_t;
/**
* Pulls source of object being compiled into zip.
* @note automates compliance with gpl terms
* @see -DIM_FEELING_NAUGHTY
* @note automates most compliance with gpl terms
* @see libc/zipos/zipcentraldir.S
* @see ape/ape.lds
*/
#ifdef __BASE_FILE__
STATIC_YOINK_SOURCE(__BASE_FILE__);

3
libc/runtime/runtime.h

@ -50,8 +50,7 @@ void exit(int) noreturn;
void quick_exit(int) noreturn;
void _exit(int) libcesque noreturn;
void _Exit(int) libcesque noreturn;
void abort(void) noreturn noinstrument forcealignargpointer;
void abort_(void) asm("abort") noreturn noinstrument privileged;
void abort(void) noreturn noinstrument;
void panic(void) noreturn noinstrument privileged;
void triplf(void) noreturn noinstrument privileged;
int __cxa_atexit(void *, void *, void *) libcesque;

2
libc/stdio/fread.c

@ -44,7 +44,7 @@ size_t fread(void *buf, size_t stride, size_t count, FILE *f) {
if (i % stride != 0) abort(); /* todo(jart) */
return i / stride;
}
p[i] = (unsigned char)c;
p[i] = c & 0xff;
}
return count;
}

14
libc/stdio/internal.h

@ -12,13 +12,13 @@ extern unsigned char g_stderrbuf[BUFSIZ];
int fflushregister(FILE *) hidden;
void fflushunregister(FILE *) hidden;
int freadbuf(FILE *f) hidden;
int fwritebuf(FILE *f) hidden;
int fsreadbuf(FILE *f) hidden;
int fswritebuf(FILE *f) hidden;
long fseteof(FILE *f) hidden;
long fseterrno(FILE *f) hidden;
long fseterr(FILE *f, int err) hidden;
int freadbuf(FILE *) hidden;
int fwritebuf(FILE *) hidden;
int fsreadbuf(FILE *) hidden;
int fswritebuf(FILE *) hidden;
long fseteof(FILE *) hidden;
long fseterrno(FILE *) hidden;
long fseterr(FILE *, int) hidden;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

1
libc/stdio/printf.c

@ -59,6 +59,7 @@
* it implies the quoting modifier, wraps the value with {,u,L}['"]
* quotes, displays NULL as "NULL" rather than "(null)", etc.
*
* @see palandprintf() for intuitive reference documentation
* @see {,v}{,s{,n},{,{,x}as},f,d}printf
*/
int(printf)(const char* fmt, ...) {

42
libc/stdio/unlocked.h

@ -4,29 +4,29 @@
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int getc_unlocked(FILE *f) paramsnonnull();
int getc_unlocked(FILE *) paramsnonnull();
int getchar_unlocked(void);
int putc_unlocked(int c, FILE *f) paramsnonnull();
int putchar_unlocked(int c);
void clearerr_unlocked(FILE *f);
int feof_unlocked(FILE *f);
int ferror_unlocked(FILE *f);
int fileno_unlocked(FILE *f);
int fflush_unlocked(FILE *f);
int fgetc_unlocked(FILE *f);
int fputc_unlocked(int c, FILE *f);
size_t fread_unlocked(void *ptr, size_t size, size_t n, FILE *f);
size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *f);
char *fgets_unlocked(char *s, int n, FILE *f);
int fputs_unlocked(const char *s, FILE *f);
wint_t getwc_unlocked(FILE *f);
int putc_unlocked(int, FILE *) paramsnonnull();
int putchar_unlocked(int);
void clearerr_unlocked(FILE *);
int feof_unlocked(FILE *);
int ferror_unlocked(FILE *);
int fileno_unlocked(FILE *);
int fflush_unlocked(FILE *);
int fgetc_unlocked(FILE *);
int fputc_unlocked(int, FILE *);
size_t fread_unlocked(void *, size_t, size_t, FILE *);
size_t fwrite_unlocked(const void *, size_t, size_t, FILE *);
char *fgets_unlocked(char *, int, FILE *);
int fputs_unlocked(const char *, FILE *);
wint_t getwc_unlocked(FILE *);
wint_t getwchar_unlocked(void);
wint_t fgetwc_unlocked(FILE *f);
wint_t fputwc_unlocked(wchar_t wc, FILE *f);
wint_t putwc_unlocked(wchar_t wc, FILE *f);
wint_t putwchar_unlocked(wchar_t wc);
wchar_t *fgetws_unlocked(wchar_t *ws, int n, FILE *f);
int fputws_unlocked(const wchar_t *ws, FILE *f);
wint_t fgetwc_unlocked(FILE *);
wint_t fputwc_unlocked(wchar_t, FILE *);
wint_t putwc_unlocked(wchar_t, FILE *);
wint_t putwchar_unlocked(wchar_t);
wchar_t *fgetws_unlocked(wchar_t *, int, FILE *);
int fputws_unlocked(const wchar_t *, FILE *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */

8
libc/stdio/unlocked/clearerr_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
clearerr_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call clearerr
.leafepilogue
pop %rbp
ret
.endfn clearerr_unlocked,globl

8
libc/stdio/unlocked/feof_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
feof_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call feof
.leafepilogue
pop %rbp
ret
.endfn feof_unlocked,globl

8
libc/stdio/unlocked/ferror_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
ferror_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call ferror
.leafepilogue
pop %rbp
ret
.endfn ferror_unlocked,globl

8
libc/stdio/unlocked/fflush_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fflush_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fflush
.leafepilogue
pop %rbp
ret
.endfn fflush_unlocked,globl

8
libc/stdio/unlocked/fgetc_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fgetc_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fgetc
.leafepilogue
pop %rbp
ret
.endfn fgetc_unlocked,globl

8
libc/stdio/unlocked/fgets_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fgets_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fgets
.leafepilogue
pop %rbp
ret
.endfn fgets_unlocked,globl

8
libc/stdio/unlocked/fgetwc_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fgetwc_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fgetwc
.leafepilogue
pop %rbp
ret
.endfn fgetwc_unlocked,globl

8
libc/stdio/unlocked/fgetws_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fgetws_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fgetws
.leafepilogue
pop %rbp
ret
.endfn fgetws_unlocked,globl

8
libc/stdio/unlocked/fileno_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fileno_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fileno
.leafepilogue
pop %rbp
ret
.endfn fileno_unlocked,globl

8
libc/stdio/unlocked/fputc_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fputc_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fputc
.leafepilogue
pop %rbp
ret
.endfn fputc_unlocked,globl

8
libc/stdio/unlocked/fputs_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fputs_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fputs
.leafepilogue
pop %rbp
ret
.endfn fputs_unlocked,globl

8
libc/stdio/unlocked/fputwc_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fputwc_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fputwc
.leafepilogue
pop %rbp
ret
.endfn fputwc_unlocked,globl

8
libc/stdio/unlocked/fputws_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fputws_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fputws
.leafepilogue
pop %rbp
ret
.endfn fputws_unlocked,globl

8
libc/stdio/unlocked/fread_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fread_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fread
.leafepilogue
pop %rbp
ret
.endfn fread_unlocked,globl

8
libc/stdio/unlocked/fwrite_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
fwrite_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fwrite
.leafepilogue
pop %rbp
ret
.endfn fwrite_unlocked,globl

8
libc/stdio/unlocked/getc_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
getc_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call getc
.leafepilogue
pop %rbp
ret
.endfn getc_unlocked,globl

8
libc/stdio/unlocked/getchar_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
getchar_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call getchar
.leafepilogue
pop %rbp
ret
.endfn getchar_unlocked,globl

8
libc/stdio/unlocked/getwc_unlocked.S

@ -21,8 +21,10 @@
.source __FILE__
getwc_unlocked:
.leafprologue
.profilable # so we can fix code supporting this abomination
push %rbp
mov %rsp,%rbp
.profilable # note: no consensus for threads exists in abis
call fgetwc_unlocked
.leafepilogue
pop %rbp
ret
.endfn getwc_unlocked,globl

8
libc/stdio/unlocked/getwchar_unlocked.S

@ -21,8 +21,10 @@