mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
parent
95f54eeb40
commit
c1d99676c4
1421 changed files with 5556 additions and 2198 deletions
|
@ -1,5 +1,10 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_FMT_PFLINK_H_
|
||||
#define COSMOPOLITAN_LIBC_FMT_PFLINK_H_
|
||||
#include "libc/dce.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
#ifndef __STRICT_ANSI__
|
||||
|
||||
|
@ -18,8 +23,8 @@
|
|||
if (___PFLINK(FMT, strpbrk, "faAeg")) STATIC_YOINK("__fmt_dtoa"); \
|
||||
if (___PFLINK(FMT, strpbrk, "cmrqs")) { \
|
||||
if (___PFLINK(FMT, strstr, "%m")) STATIC_YOINK("strerror"); \
|
||||
if (___PFLINK(FMT, strstr, "%*") || \
|
||||
___PFLINK(FMT, strpbrk, "0123456789")) { \
|
||||
if (!IsTiny() && (___PFLINK(FMT, strstr, "%*") || \
|
||||
___PFLINK(FMT, strpbrk, "0123456789"))) { \
|
||||
STATIC_YOINK("strnwidth"); \
|
||||
STATIC_YOINK("strnwidth16"); \
|
||||
STATIC_YOINK("wcsnwidth"); \
|
||||
|
@ -58,8 +63,36 @@
|
|||
* 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
|
||||
#ifdef __GNUC__
|
||||
__asm__(".section .yoink\n\t"
|
||||
"nopl\t__fmt_dtoa(%rip)\n\t"
|
||||
"nopl\tkCp437(%rip)\n\t"
|
||||
"nopl\tstrerror(%rip)\n\t"
|
||||
"nopl\tstrnwidth(%rip)\n\t"
|
||||
"nopl\tstrnwidth16(%rip)\n\t"
|
||||
"nopl\twcsnwidth(%rip)\n\t"
|
||||
"nopl\tmalloc(%rip)\n\t"
|
||||
"nopl\tcalloc(%rip)\n\t"
|
||||
"nopl\t__grow(%rip)\n\t"
|
||||
".previous");
|
||||
#else
|
||||
static long __pflink(long x) {
|
||||
x |= kCp437[0];
|
||||
x |= __fmt_dtoa(0, 0, 0, 0, 0, 0);
|
||||
x |= strnwidth(0, 0, 0);
|
||||
x |= strnwidth16(0, 0, 0);
|
||||
x |= wcsnwidth(0, 0, 0);
|
||||
x |= malloc(0);
|
||||
x |= __grow(0, 0, 0, 0);
|
||||
x |= (intptr_t)strerror(0);
|
||||
x |= (intptr_t)calloc(0, 0);
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STRICT_ANSI__ */
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_FMT_PFLINK_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue