Merge "Correct libstdc++ version"
diff --git a/README.md b/README.md
index 0b3dcaa..0bf6c6d 100644
--- a/README.md
+++ b/README.md
@@ -220,19 +220,18 @@
The host tests require that you have `lunch`ed either an x86 or x86_64 target.
- $ mma
- $ mm bionic-unit-tests-run-on-host32
- $ mm bionic-unit-tests-run-on-host64 # For 64-bit *targets* only.
+ $ ./tests/run-on-host.sh 32
+ $ ./tests/run-on-host.sh 64 # For x86_64-bit *targets* only.
+
+You can supply gtest flags as extra arguments to this script.
### Against glibc
As a way to check that our tests do in fact test the correct behavior (and not
just the behavior we think is correct), it is possible to run the tests against
-the host's glibc. The executables are already in your path.
+the host's glibc.
- $ mma
- $ bionic-unit-tests-glibc32
- $ bionic-unit-tests-glibc64
+ $ ./tests/run-on-host.sh glibc
Gathering test coverage
diff --git a/libc/Android.bp b/libc/Android.bp
index 4905ec6..592c401 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -417,7 +417,6 @@
"upstream-openbsd/lib/libc/net/ntohs.c",
"upstream-openbsd/lib/libc/net/res_random.c",
"upstream-openbsd/lib/libc/stdio/asprintf.c",
- "upstream-openbsd/lib/libc/stdio/dprintf.c",
"upstream-openbsd/lib/libc/stdio/fflush.c",
"upstream-openbsd/lib/libc/stdio/fgetln.c",
"upstream-openbsd/lib/libc/stdio/fgets.c",
@@ -425,20 +424,14 @@
"upstream-openbsd/lib/libc/stdio/fgetws.c",
"upstream-openbsd/lib/libc/stdio/flags.c",
"upstream-openbsd/lib/libc/stdio/fmemopen.c",
- "upstream-openbsd/lib/libc/stdio/fprintf.c",
"upstream-openbsd/lib/libc/stdio/fpurge.c",
"upstream-openbsd/lib/libc/stdio/fputs.c",
"upstream-openbsd/lib/libc/stdio/fputwc.c",
"upstream-openbsd/lib/libc/stdio/fputws.c",
- "upstream-openbsd/lib/libc/stdio/fscanf.c",
"upstream-openbsd/lib/libc/stdio/fvwrite.c",
"upstream-openbsd/lib/libc/stdio/fwalk.c",
"upstream-openbsd/lib/libc/stdio/fwide.c",
- "upstream-openbsd/lib/libc/stdio/fwprintf.c",
"upstream-openbsd/lib/libc/stdio/fwrite.c",
- "upstream-openbsd/lib/libc/stdio/fwscanf.c",
- "upstream-openbsd/lib/libc/stdio/getc.c",
- "upstream-openbsd/lib/libc/stdio/getchar.c",
"upstream-openbsd/lib/libc/stdio/getdelim.c",
"upstream-openbsd/lib/libc/stdio/gets.c",
"upstream-openbsd/lib/libc/stdio/makebuf.c",
@@ -446,17 +439,11 @@
"upstream-openbsd/lib/libc/stdio/open_memstream.c",
"upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
"upstream-openbsd/lib/libc/stdio/perror.c",
- "upstream-openbsd/lib/libc/stdio/printf.c",
- "upstream-openbsd/lib/libc/stdio/putc.c",
- "upstream-openbsd/lib/libc/stdio/putchar.c",
"upstream-openbsd/lib/libc/stdio/puts.c",
"upstream-openbsd/lib/libc/stdio/remove.c",
"upstream-openbsd/lib/libc/stdio/rget.c",
- "upstream-openbsd/lib/libc/stdio/scanf.c",
"upstream-openbsd/lib/libc/stdio/setvbuf.c",
"upstream-openbsd/lib/libc/stdio/sscanf.c",
- "upstream-openbsd/lib/libc/stdio/swprintf.c",
- "upstream-openbsd/lib/libc/stdio/swscanf.c",
"upstream-openbsd/lib/libc/stdio/tempnam.c",
"upstream-openbsd/lib/libc/stdio/tmpnam.c",
"upstream-openbsd/lib/libc/stdio/ungetc.c",
@@ -473,8 +460,6 @@
"upstream-openbsd/lib/libc/stdio/vswprintf.c",
"upstream-openbsd/lib/libc/stdio/vswscanf.c",
"upstream-openbsd/lib/libc/stdio/wbuf.c",
- "upstream-openbsd/lib/libc/stdio/wprintf.c",
- "upstream-openbsd/lib/libc/stdio/wscanf.c",
"upstream-openbsd/lib/libc/stdio/wsetup.c",
"upstream-openbsd/lib/libc/stdlib/abs.c",
"upstream-openbsd/lib/libc/stdlib/atoi.c",
diff --git a/libc/arch-x86/atom/string/sse2-memset-atom.S b/libc/arch-x86/atom/string/sse2-memset-atom.S
index e03cd1a..4e211ca 100644
--- a/libc/arch-x86/atom/string/sse2-memset-atom.S
+++ b/libc/arch-x86/atom/string/sse2-memset-atom.S
@@ -40,41 +40,28 @@
# define ALIGN(n) .p2align n
#endif
-#ifndef cfi_rel_offset
-# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
-#endif
-
-#ifndef cfi_restore
-# define cfi_restore(reg) .cfi_restore reg
-#endif
-
-#ifndef cfi_adjust_cfa_offset
-# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
-#endif
-
#define CFI_PUSH(REG) \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (REG, 0)
+ .cfi_adjust_cfa_offset 4; \
+ .cfi_rel_offset REG, 0
#define CFI_POP(REG) \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (REG)
+ .cfi_adjust_cfa_offset -4; \
+ .cfi_restore REG
-#define PUSH(REG) pushl REG; CFI_PUSH (REG)
-#define POP(REG) popl REG; CFI_POP (REG)
+#define PUSH(REG) pushl REG; CFI_PUSH(REG)
+#define POP(REG) popl REG; CFI_POP(REG)
-#define DST PARMS
-#define CHR DST+4
-#define LEN CHR+4
+#define PARMS 8 /* Preserve EBX. */
+#define DST PARMS
+#define CHR (DST+4)
+#define LEN (CHR+4)
#define CHK_DST_LEN (LEN+4)
#define SETRTNVAL movl DST(%esp), %eax
-#if (defined SHARED || defined __PIC__)
-# define ENTRANCE PUSH (%ebx);
-# define RETURN_END POP (%ebx); ret
-# define RETURN RETURN_END; CFI_PUSH (%ebx)
-# define PARMS 8 /* Preserve EBX. */
-# define JMPTBL(I, B) I - B
+#define ENTRANCE PUSH(%ebx);
+#define RETURN_END POP(%ebx); ret
+#define RETURN RETURN_END; CFI_PUSH(%ebx)
+#define JMPTBL(I, B) I - B
/* Load an entry in a jump table into EBX and branch to it. TABLE is a
jump table with relative offsets. */
@@ -87,43 +74,32 @@
absolute address. */ \
add (%ebx,%ecx,4), %ebx; \
add %ecx, %edx; \
- /* We loaded the jump table and adjuested EDX. Go. */ \
+ /* We loaded the jump table and adjusted EDX. Go. */ \
jmp *%ebx
.section .gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax",@progbits
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
- ALIGN (4)
+ ALIGN(4)
.type __x86.get_pc_thunk.bx,@function
__x86.get_pc_thunk.bx:
movl (%esp), %ebx
ret
-#else
-# define ENTRANCE
-# define RETURN_END ret
-# define RETURN RETURN_END
-# define PARMS 4
-# define JMPTBL(I, B) I
-
-/* Branch to an entry in a jump table. TABLE is a jump table with
- absolute offsets. */
-# define BRANCH_TO_JMPTBL_ENTRY(TABLE) \
- add %ecx, %edx; \
- jmp *TABLE(,%ecx,4)
-#endif
ENTRY(__memset_chk)
ENTRANCE
movl LEN(%esp), %ecx
cmpl CHK_DST_LEN(%esp), %ecx
- ja __memset_chk_fail
- jmp L(memset_length_loaded)
+ jna L(memset_length_loaded)
+
+ POP(%ebx) // Undo ENTRANCE without returning.
+ jmp __memset_chk_fail
END(__memset_chk)
.section .text.sse2,"ax",@progbits
- ALIGN (4)
-ENTRY (memset)
+ ALIGN(4)
+ENTRY(memset)
ENTRANCE
movl LEN(%esp), %ecx
@@ -139,47 +115,47 @@
jae L(32bytesormore)
L(write_less32bytes):
- BRANCH_TO_JMPTBL_ENTRY (L(table_less_32bytes))
+ BRANCH_TO_JMPTBL_ENTRY(L(table_less_32bytes))
.pushsection .rodata.sse2,"a",@progbits
- ALIGN (2)
+ ALIGN(2)
L(table_less_32bytes):
- .int JMPTBL (L(write_0bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_1bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_2bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_3bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_4bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_5bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_6bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_7bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_8bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_9bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_10bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_11bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_12bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_13bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_14bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_15bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_16bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_17bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_18bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_19bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_20bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_21bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_22bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_23bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_24bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_25bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_26bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_27bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_28bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_29bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_30bytes), L(table_less_32bytes))
- .int JMPTBL (L(write_31bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_0bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_1bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_2bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_3bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_4bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_5bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_6bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_7bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_8bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_9bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_10bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_11bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_12bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_13bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_14bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_15bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_16bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_17bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_18bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_19bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_20bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_21bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_22bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_23bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_24bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_25bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_26bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_27bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_28bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_29bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_30bytes), L(table_less_32bytes))
+ .int JMPTBL(L(write_31bytes), L(table_less_32bytes))
.popsection
- ALIGN (4)
+ ALIGN(4)
L(write_28bytes):
movl %eax, -28(%edx)
L(write_24bytes):
@@ -198,7 +174,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(write_29bytes):
movl %eax, -29(%edx)
L(write_25bytes):
@@ -218,7 +194,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(write_30bytes):
movl %eax, -30(%edx)
L(write_26bytes):
@@ -238,7 +214,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(write_31bytes):
movl %eax, -31(%edx)
L(write_27bytes):
@@ -259,7 +235,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
/* ECX > 32 and EDX is 4 byte aligned. */
L(32bytesormore):
/* Fill xmm0 with the pattern. */
@@ -277,49 +253,25 @@
add %eax, %ecx
movd %xmm0, %eax
- ALIGN (4)
+ ALIGN(4)
L(aligned_16):
cmp $128, %ecx
jae L(128bytesormore)
L(aligned_16_less128bytes):
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
- ALIGN (4)
+ ALIGN(4)
L(128bytesormore):
-#ifdef SHARED_CACHE_SIZE
- PUSH (%ebx)
+ PUSH(%ebx)
mov $SHARED_CACHE_SIZE, %ebx
-#else
-# if (defined SHARED || defined __PIC__)
- call __x86.get_pc_thunk.bx
- add $_GLOBAL_OFFSET_TABLE_, %ebx
- mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx
-# else
- PUSH (%ebx)
- mov __x86_shared_cache_size, %ebx
-# endif
-#endif
cmp %ebx, %ecx
jae L(128bytesormore_nt_start)
-#ifdef DATA_CACHE_SIZE
- POP (%ebx)
-# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
+ POP(%ebx)
+# define RESTORE_EBX_STATE CFI_PUSH(%ebx)
cmp $DATA_CACHE_SIZE, %ecx
-#else
-# if (defined SHARED || defined __PIC__)
-# define RESTORE_EBX_STATE
- call __x86.get_pc_thunk.bx
- add $_GLOBAL_OFFSET_TABLE_, %ebx
- cmp __x86_data_cache_size@GOTOFF(%ebx), %ecx
-# else
- POP (%ebx)
-# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
- cmp __x86_data_cache_size, %ecx
-# endif
-#endif
jae L(128bytes_L2_normal)
subl $128, %ecx
@@ -351,9 +303,9 @@
L(128bytesless_normal):
add $128, %ecx
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
- ALIGN (4)
+ ALIGN(4)
L(128bytes_L2_normal):
prefetcht0 0x380(%edx)
prefetcht0 0x3c0(%edx)
@@ -371,7 +323,7 @@
jae L(128bytes_L2_normal)
L(128bytesless_L2_normal):
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
RESTORE_EBX_STATE
L(128bytesormore_nt_start):
@@ -380,7 +332,7 @@
and $0x7f, %eax
add %eax, %ecx
movd %xmm0, %eax
- ALIGN (4)
+ ALIGN(4)
L(128bytesormore_shared_cache_loop):
prefetcht0 0x3c0(%edx)
prefetcht0 0x380(%edx)
@@ -398,7 +350,7 @@
jae L(128bytesormore_shared_cache_loop)
cmp $0x80, %ecx
jb L(shared_cache_loop_end)
- ALIGN (4)
+ ALIGN(4)
L(128bytesormore_nt):
sub $0x80, %ecx
movntdq %xmm0, (%edx)
@@ -414,146 +366,144 @@
jae L(128bytesormore_nt)
sfence
L(shared_cache_loop_end):
-#if defined DATA_CACHE_SIZE || !(defined SHARED || defined __PIC__)
- POP (%ebx)
-#endif
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ POP(%ebx)
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
.pushsection .rodata.sse2,"a",@progbits
- ALIGN (2)
+ ALIGN(2)
L(table_16_128bytes):
- .int JMPTBL (L(aligned_16_0bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_1bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_2bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_3bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_4bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_5bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_6bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_7bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_8bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_9bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_10bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_11bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_12bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_13bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_14bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_15bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_16bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_17bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_18bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_19bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_20bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_21bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_22bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_23bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_24bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_25bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_26bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_27bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_28bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_29bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_30bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_31bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_32bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_33bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_34bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_35bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_36bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_37bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_38bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_39bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_40bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_41bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_42bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_43bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_44bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_45bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_46bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_47bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_48bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_49bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_50bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_51bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_52bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_53bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_54bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_55bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_56bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_57bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_58bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_59bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_60bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_61bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_62bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_63bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_64bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_65bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_66bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_67bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_68bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_69bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_70bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_71bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_72bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_73bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_74bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_75bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_76bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_77bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_78bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_79bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_80bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_81bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_82bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_83bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_84bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_85bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_86bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_87bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_88bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_89bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_90bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_91bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_92bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_93bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_94bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_95bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_96bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_97bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_98bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_99bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_100bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_101bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_102bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_103bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_104bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_105bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_106bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_107bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_108bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_109bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_110bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_111bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_112bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_113bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_114bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_115bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_116bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_117bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_118bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_119bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_120bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_121bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_122bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_123bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_124bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_125bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_126bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_127bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_0bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_1bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_2bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_3bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_4bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_5bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_6bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_7bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_8bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_9bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_10bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_11bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_12bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_13bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_14bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_15bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_16bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_17bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_18bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_19bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_20bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_21bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_22bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_23bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_24bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_25bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_26bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_27bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_28bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_29bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_30bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_31bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_32bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_33bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_34bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_35bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_36bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_37bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_38bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_39bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_40bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_41bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_42bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_43bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_44bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_45bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_46bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_47bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_48bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_49bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_50bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_51bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_52bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_53bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_54bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_55bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_56bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_57bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_58bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_59bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_60bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_61bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_62bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_63bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_64bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_65bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_66bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_67bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_68bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_69bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_70bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_71bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_72bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_73bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_74bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_75bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_76bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_77bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_78bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_79bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_80bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_81bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_82bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_83bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_84bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_85bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_86bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_87bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_88bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_89bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_90bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_91bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_92bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_93bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_94bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_95bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_96bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_97bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_98bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_99bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_100bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_101bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_102bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_103bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_104bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_105bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_106bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_107bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_108bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_109bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_110bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_111bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_112bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_113bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_114bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_115bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_116bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_117bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_118bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_119bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_120bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_121bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_122bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_123bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_124bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_125bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_126bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_127bytes), L(table_16_128bytes))
.popsection
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_112bytes):
movdqa %xmm0, -112(%edx)
L(aligned_16_96bytes):
@@ -572,7 +522,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_113bytes):
movdqa %xmm0, -113(%edx)
L(aligned_16_97bytes):
@@ -592,7 +542,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_114bytes):
movdqa %xmm0, -114(%edx)
L(aligned_16_98bytes):
@@ -612,7 +562,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_115bytes):
movdqa %xmm0, -115(%edx)
L(aligned_16_99bytes):
@@ -633,7 +583,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_116bytes):
movdqa %xmm0, -116(%edx)
L(aligned_16_100bytes):
@@ -653,7 +603,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_117bytes):
movdqa %xmm0, -117(%edx)
L(aligned_16_101bytes):
@@ -674,7 +624,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_118bytes):
movdqa %xmm0, -118(%edx)
L(aligned_16_102bytes):
@@ -695,7 +645,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_119bytes):
movdqa %xmm0, -119(%edx)
L(aligned_16_103bytes):
@@ -717,7 +667,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_120bytes):
movdqa %xmm0, -120(%edx)
L(aligned_16_104bytes):
@@ -737,7 +687,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_121bytes):
movdqa %xmm0, -121(%edx)
L(aligned_16_105bytes):
@@ -758,7 +708,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_122bytes):
movdqa %xmm0, -122(%edx)
L(aligned_16_106bytes):
@@ -779,7 +729,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_123bytes):
movdqa %xmm0, -123(%edx)
L(aligned_16_107bytes):
@@ -801,7 +751,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_124bytes):
movdqa %xmm0, -124(%edx)
L(aligned_16_108bytes):
@@ -822,7 +772,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_125bytes):
movdqa %xmm0, -125(%edx)
L(aligned_16_109bytes):
@@ -844,7 +794,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_126bytes):
movdqa %xmm0, -126(%edx)
L(aligned_16_110bytes):
@@ -866,7 +816,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_127bytes):
movdqa %xmm0, -127(%edx)
L(aligned_16_111bytes):
@@ -889,4 +839,4 @@
SETRTNVAL
RETURN_END
-END (memset)
+END(memset)
diff --git a/libc/arch-x86/silvermont/string/sse2-memset-slm.S b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
index f5182ba..03a552d 100644
--- a/libc/arch-x86/silvermont/string/sse2-memset-slm.S
+++ b/libc/arch-x86/silvermont/string/sse2-memset-slm.S
@@ -40,40 +40,27 @@
# define ALIGN(n) .p2align n
#endif
-#ifndef cfi_rel_offset
-# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
-#endif
-
-#ifndef cfi_restore
-# define cfi_restore(reg) .cfi_restore reg
-#endif
-
-#ifndef cfi_adjust_cfa_offset
-# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
-#endif
-
#define CFI_PUSH(REG) \
- cfi_adjust_cfa_offset (4); \
- cfi_rel_offset (REG, 0)
+ .cfi_adjust_cfa_offset 4; \
+ .cfi_rel_offset REG, 0
#define CFI_POP(REG) \
- cfi_adjust_cfa_offset (-4); \
- cfi_restore (REG)
+ .cfi_adjust_cfa_offset -4; \
+ .cfi_restore REG
-#define PUSH(REG) pushl REG; CFI_PUSH (REG)
-#define POP(REG) popl REG; CFI_POP (REG)
+#define PUSH(REG) pushl REG; CFI_PUSH(REG)
+#define POP(REG) popl REG; CFI_POP(REG)
-#define DST PARMS
-#define CHR DST+4
-#define LEN CHR+4
+#define PARMS 8 /* Preserve EBX. */
+#define DST PARMS
+#define CHR (DST+4)
+#define LEN (CHR+4)
#define CHK_DST_LEN (LEN+4)
#define SETRTNVAL movl DST(%esp), %eax
-#if (defined SHARED || defined __PIC__)
-# define ENTRANCE PUSH (%ebx);
-# define RETURN_END POP (%ebx); ret
-# define RETURN RETURN_END; CFI_PUSH (%ebx)
-# define PARMS 8 /* Preserve EBX. */
+# define ENTRANCE PUSH(%ebx);
+# define RETURN_END POP(%ebx); ret
+# define RETURN RETURN_END; CFI_PUSH(%ebx)
# define JMPTBL(I, B) I - B
/* Load an entry in a jump table into EBX and branch to it. TABLE is a
@@ -87,42 +74,31 @@
absolute address. */ \
add (%ebx,%ecx,4), %ebx; \
add %ecx, %edx; \
- /* We loaded the jump table and adjuested EDX. Go. */ \
+ /* We loaded the jump table and adjusted EDX. Go. */ \
jmp *%ebx
.section .gnu.linkonce.t.__x86.get_pc_thunk.bx,"ax",@progbits
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
- ALIGN (4)
+ ALIGN(4)
.type __x86.get_pc_thunk.bx,@function
__x86.get_pc_thunk.bx:
movl (%esp), %ebx
ret
-#else
-# define ENTRANCE
-# define RETURN_END ret
-# define RETURN RETURN_END
-# define PARMS 4
-# define JMPTBL(I, B) I
-
-/* Branch to an entry in a jump table. TABLE is a jump table with
- absolute offsets. */
-# define BRANCH_TO_JMPTBL_ENTRY(TABLE) \
- add %ecx, %edx; \
- jmp *TABLE(,%ecx,4)
-#endif
ENTRY(__memset_chk)
ENTRANCE
movl LEN(%esp), %ecx
cmpl CHK_DST_LEN(%esp), %ecx
- ja __memset_chk_fail
- jmp L(memset_length_loaded)
+ jna L(memset_length_loaded)
+
+ POP(%ebx) // Undo ENTRANCE without returning.
+ jmp __memset_chk_fail
END(__memset_chk)
.section .text.sse2,"ax",@progbits
- ALIGN (4)
+ ALIGN(4)
ENTRY(memset)
ENTRANCE
@@ -169,7 +145,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(16bytesormore):
movd %eax, %xmm0
pshufd $0, %xmm0, %xmm0
@@ -198,47 +174,25 @@
add %eax, %ecx
movd %xmm0, %eax
- ALIGN (4)
+ ALIGN(4)
L(aligned_16):
cmp $128, %ecx
jae L(128bytesormore)
L(aligned_16_less128bytes):
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
- ALIGN (4)
+ ALIGN(4)
L(128bytesormore):
-#ifdef SHARED_CACHE_SIZE
- PUSH (%ebx)
+ PUSH(%ebx)
mov $SHARED_CACHE_SIZE, %ebx
-#else
-# if (defined SHARED || defined __PIC__)
- call __x86.get_pc_thunk.bx
- add $_GLOBAL_OFFSET_TABLE_, %ebx
- mov $__x86_shared_cache_size@GOTOFF(%ebx), %ebx
-# else
- PUSH (%ebx)
- mov $__x86_shared_cache_size, %ebx
-# endif
-#endif
cmp %ebx, %ecx
jae L(128bytesormore_nt_start)
- POP (%ebx)
+ POP(%ebx)
-#ifdef DATA_CACHE_SIZE
- PUSH (%ebx)
+ PUSH(%ebx)
mov $DATA_CACHE_SIZE, %ebx
-#else
-# if (defined SHARED || defined __PIC__)
- call __x86.get_pc_thunk.bx
- add $_GLOBAL_OFFSET_TABLE_, %ebx
- mov $__x86_data_cache_size@GOTOFF(%ebx), %ebx
-# else
- PUSH (%ebx)
- mov $__x86_data_cache_size, %ebx
-# endif
-#endif
cmp %ebx, %ecx
jae L(128bytes_L2_normal)
@@ -271,12 +225,10 @@
L(128bytesless_normal):
lea 128(%ecx), %ecx
-#if defined DATA_CACHE_SIZE || !(defined SHARED || defined __PIC__)
- POP (%ebx)
-#endif
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ POP(%ebx)
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
- ALIGN (4)
+ ALIGN(4)
L(128bytes_L2_normal):
prefetchnta 0x380(%edx)
prefetchnta 0x3c0(%edx)
@@ -294,14 +246,12 @@
jae L(128bytes_L2_normal)
L(128bytesless_L2_normal):
-#if defined DATA_CACHE_SIZE || !(defined SHARED || defined __PIC__)
- POP (%ebx)
-#endif
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ POP(%ebx)
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
L(128bytesormore_nt_start):
sub %ebx, %ecx
- ALIGN (4)
+ ALIGN(4)
L(128bytesormore_shared_cache_loop):
prefetchnta 0x3c0(%edx)
prefetchnta 0x380(%edx)
@@ -319,7 +269,7 @@
jae L(128bytesormore_shared_cache_loop)
cmp $0x80, %ecx
jb L(shared_cache_loop_end)
- ALIGN (4)
+ ALIGN(4)
L(128bytesormore_nt):
sub $0x80, %ecx
movntdq %xmm0, (%edx)
@@ -335,146 +285,144 @@
jae L(128bytesormore_nt)
sfence
L(shared_cache_loop_end):
-#if defined SHARED_CACHE_SIZE || !(defined SHARED || defined __PIC__)
- POP (%ebx)
-#endif
- BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
+ POP(%ebx)
+ BRANCH_TO_JMPTBL_ENTRY(L(table_16_128bytes))
.pushsection .rodata.sse2,"a",@progbits
- ALIGN (2)
+ ALIGN(2)
L(table_16_128bytes):
- .int JMPTBL (L(aligned_16_0bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_1bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_2bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_3bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_4bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_5bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_6bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_7bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_8bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_9bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_10bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_11bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_12bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_13bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_14bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_15bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_16bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_17bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_18bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_19bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_20bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_21bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_22bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_23bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_24bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_25bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_26bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_27bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_28bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_29bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_30bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_31bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_32bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_33bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_34bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_35bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_36bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_37bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_38bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_39bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_40bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_41bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_42bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_43bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_44bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_45bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_46bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_47bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_48bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_49bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_50bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_51bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_52bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_53bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_54bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_55bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_56bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_57bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_58bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_59bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_60bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_61bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_62bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_63bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_64bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_65bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_66bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_67bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_68bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_69bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_70bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_71bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_72bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_73bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_74bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_75bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_76bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_77bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_78bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_79bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_80bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_81bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_82bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_83bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_84bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_85bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_86bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_87bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_88bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_89bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_90bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_91bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_92bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_93bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_94bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_95bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_96bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_97bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_98bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_99bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_100bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_101bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_102bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_103bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_104bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_105bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_106bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_107bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_108bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_109bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_110bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_111bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_112bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_113bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_114bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_115bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_116bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_117bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_118bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_119bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_120bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_121bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_122bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_123bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_124bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_125bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_126bytes), L(table_16_128bytes))
- .int JMPTBL (L(aligned_16_127bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_0bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_1bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_2bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_3bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_4bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_5bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_6bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_7bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_8bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_9bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_10bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_11bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_12bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_13bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_14bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_15bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_16bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_17bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_18bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_19bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_20bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_21bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_22bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_23bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_24bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_25bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_26bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_27bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_28bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_29bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_30bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_31bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_32bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_33bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_34bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_35bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_36bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_37bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_38bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_39bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_40bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_41bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_42bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_43bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_44bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_45bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_46bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_47bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_48bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_49bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_50bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_51bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_52bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_53bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_54bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_55bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_56bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_57bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_58bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_59bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_60bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_61bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_62bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_63bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_64bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_65bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_66bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_67bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_68bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_69bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_70bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_71bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_72bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_73bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_74bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_75bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_76bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_77bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_78bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_79bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_80bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_81bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_82bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_83bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_84bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_85bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_86bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_87bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_88bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_89bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_90bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_91bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_92bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_93bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_94bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_95bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_96bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_97bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_98bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_99bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_100bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_101bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_102bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_103bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_104bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_105bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_106bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_107bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_108bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_109bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_110bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_111bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_112bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_113bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_114bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_115bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_116bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_117bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_118bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_119bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_120bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_121bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_122bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_123bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_124bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_125bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_126bytes), L(table_16_128bytes))
+ .int JMPTBL(L(aligned_16_127bytes), L(table_16_128bytes))
.popsection
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_112bytes):
movdqa %xmm0, -112(%edx)
L(aligned_16_96bytes):
@@ -493,7 +441,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_113bytes):
movdqa %xmm0, -113(%edx)
L(aligned_16_97bytes):
@@ -513,7 +461,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_114bytes):
movdqa %xmm0, -114(%edx)
L(aligned_16_98bytes):
@@ -533,7 +481,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_115bytes):
movdqa %xmm0, -115(%edx)
L(aligned_16_99bytes):
@@ -554,7 +502,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_116bytes):
movdqa %xmm0, -116(%edx)
L(aligned_16_100bytes):
@@ -574,7 +522,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_117bytes):
movdqa %xmm0, -117(%edx)
L(aligned_16_101bytes):
@@ -595,7 +543,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_118bytes):
movdqa %xmm0, -118(%edx)
L(aligned_16_102bytes):
@@ -616,7 +564,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_119bytes):
movdqa %xmm0, -119(%edx)
L(aligned_16_103bytes):
@@ -638,7 +586,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_120bytes):
movdqa %xmm0, -120(%edx)
L(aligned_16_104bytes):
@@ -658,7 +606,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_121bytes):
movdqa %xmm0, -121(%edx)
L(aligned_16_105bytes):
@@ -679,7 +627,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_122bytes):
movdqa %xmm0, -122(%edx)
L(aligned_16_106bytes):
@@ -700,7 +648,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_123bytes):
movdqa %xmm0, -123(%edx)
L(aligned_16_107bytes):
@@ -722,7 +670,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_124bytes):
movdqa %xmm0, -124(%edx)
L(aligned_16_108bytes):
@@ -743,7 +691,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_125bytes):
movdqa %xmm0, -125(%edx)
L(aligned_16_109bytes):
@@ -765,7 +713,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_126bytes):
movdqa %xmm0, -126(%edx)
L(aligned_16_110bytes):
@@ -787,7 +735,7 @@
SETRTNVAL
RETURN
- ALIGN (4)
+ ALIGN(4)
L(aligned_16_127bytes):
movdqa %xmm0, -127(%edx)
L(aligned_16_111bytes):
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index f25e902..7be5a7c 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -246,19 +246,9 @@
#define NO_PRINTF_PERCENT_N
/* OpenBSD exposes these in <stdio.h>, but we only want them exposed to the implementation. */
-#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
-#if !defined(__cplusplus)
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
-static __inline int __sputc(int _c, FILE* _p) {
- if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) {
- return (*_p->_p++ = _c);
- } else {
- return (__swbuf(_c, _p));
- }
-}
-#endif
/* OpenBSD declares these in fvwrite.h but we want to ensure they're hidden. */
struct __suio;
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index d218ee6..53b3fae 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -53,6 +53,13 @@
#define NDYNAMIC 10 /* add ten more whenever necessary */
+#define PRINTF_IMPL(expr) \
+ va_list ap; \
+ va_start(ap, fmt); \
+ int result = (expr); \
+ va_end(ap); \
+ return result;
+
#define std(flags, file) \
{0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,nullptr,__swrite, \
{(unsigned char *)(__sFext+file), 0},nullptr,0,{0},{0},{0,0},0,0}
@@ -412,7 +419,7 @@
}
int feof_unlocked(FILE* fp) {
- return __sfeof(fp);
+ return ((fp->_flags & __SEOF) != 0);
}
int feof(FILE* fp) {
@@ -640,6 +647,14 @@
return s ? strcpy(s, _PATH_TTY) : const_cast<char*>(_PATH_TTY);
}
+int dprintf(int fd, const char* fmt, ...) {
+ PRINTF_IMPL(vdprintf(fd, fmt, ap));
+}
+
+int fprintf(FILE* fp, const char* fmt, ...) {
+ PRINTF_IMPL(vfprintf(fp, fmt, ap));
+}
+
int fgetc(FILE* fp) {
return getc(fp);
}
@@ -648,6 +663,35 @@
return putc(c, fp);
}
+int fscanf(FILE* fp, const char* fmt, ...) {
+ PRINTF_IMPL(vfscanf(fp, fmt, ap));
+}
+
+int fwprintf(FILE* fp, const wchar_t* fmt, ...) {
+ PRINTF_IMPL(vfwprintf(fp, fmt, ap));
+}
+
+int fwscanf(FILE* fp, const wchar_t* fmt, ...) {
+ PRINTF_IMPL(vfwscanf(fp, fmt, ap));
+}
+
+int getc(FILE* fp) {
+ ScopedFileLock sfl(fp);
+ return getc_unlocked(fp);
+}
+
+int getc_unlocked(FILE* fp) {
+ return __sgetc(fp);
+}
+
+int getchar_unlocked() {
+ return getc_unlocked(stdin);
+}
+
+int getchar() {
+ return getc(stdin);
+}
+
ssize_t getline(char** buf, size_t* len, FILE* fp) {
return getdelim(buf, len, '\n', fp);
}
@@ -660,6 +704,35 @@
return fgetwc(stdin);
}
+int printf(const char* fmt, ...) {
+ PRINTF_IMPL(vfprintf(stdout, fmt, ap));
+}
+
+int putc(int c, FILE* fp) {
+ ScopedFileLock sfl(fp);
+ return putc_unlocked(c, fp);
+}
+
+int putc_unlocked(int c, FILE* fp) {
+ if (cantwrite(fp)) {
+ errno = EBADF;
+ return EOF;
+ }
+ _SET_ORIENTATION(fp, -1);
+ if (--fp->_w >= 0 || (fp->_w >= fp->_lbfsize && c != '\n')) {
+ return (*fp->_p++ = c);
+ }
+ return (__swbuf(c, fp));
+}
+
+int putchar(int c) {
+ return putc(c, stdout);
+}
+
+int putchar_unlocked(int c) {
+ return putc_unlocked(c, stdout);
+}
+
wint_t putwc(wchar_t wc, FILE* fp) {
return fputwc(wc, fp);
}
@@ -674,6 +747,10 @@
clearerr_unlocked(fp);
}
+int scanf(const char* fmt, ...) {
+ PRINTF_IMPL(vfscanf(stdin, fmt, ap));
+}
+
void setbuf(FILE* fp, char* buf) {
setbuffer(fp, buf, BUFSIZ);
}
@@ -686,6 +763,14 @@
return setvbuf(fp, nullptr, _IOLBF, 0);
}
+int swprintf(wchar_t* s, size_t n, const wchar_t* fmt, ...) {
+ PRINTF_IMPL(vswprintf(s, n, fmt, ap));
+}
+
+int swscanf(const wchar_t* s, const wchar_t* fmt, ...) {
+ PRINTF_IMPL(vswscanf(s, fmt, ap));
+}
+
int vprintf(const char* fmt, va_list ap) {
return vfprintf(stdout, fmt, ap);
}
@@ -701,3 +786,11 @@
int vwscanf(const wchar_t* fmt, va_list ap) {
return vfwscanf(stdin, fmt, ap);
}
+
+int wprintf(const wchar_t* fmt, ...) {
+ PRINTF_IMPL(vfwprintf(stdout, fmt, ap));
+}
+
+int wscanf(const wchar_t* fmt, ...) {
+ PRINTF_IMPL(vfwscanf(stdin, fmt, ap));
+}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/dprintf.c b/libc/upstream-openbsd/lib/libc/stdio/dprintf.c
deleted file mode 100644
index dbf7d34..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/dprintf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: dprintf.c,v 1.1 2013/01/30 00:08:13 brad Exp $ */
-/* $FreeBSD: src/lib/libc/stdio/dprintf.c,v 1.2 2012/11/17 01:49:39 svnexp Exp $ */
-
-/*-
- * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
- * All rights reserved.
- *
- * Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
- * Portions of this software were developed by David Chisnall
- * under sponsorship from the FreeBSD Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-
-int
-dprintf(int fd, const char * __restrict fmt, ...)
-{
- va_list ap;
- int ret;
-
- va_start(ap, fmt);
- ret = vdprintf(fd, fmt, ap);
- va_end(ap);
- return ret;
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fprintf.c b/libc/upstream-openbsd/lib/libc/stdio/fprintf.c
deleted file mode 100644
index a391142..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/fprintf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: fprintf.c,v 1.7 2011/05/30 18:48:33 martynas Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-
-/* PRINTFLIKE2 */
-int
-fprintf(FILE *fp, const char *fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfprintf(fp, fmt, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fscanf.c b/libc/upstream-openbsd/lib/libc/stdio/fscanf.c
deleted file mode 100644
index 5fd10d4..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/fscanf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: fscanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-
-/* SCANFLIKE2 */
-int
-fscanf(FILE *fp, const char *fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfscanf(fp, fmt, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fwprintf.c b/libc/upstream-openbsd/lib/libc/stdio/fwprintf.c
deleted file mode 100644
index 4474e8b..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/fwprintf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: fwprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <wchar.h>
-
-int
-fwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfwprintf(fp, fmt, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/fwscanf.c b/libc/upstream-openbsd/lib/libc/stdio/fwscanf.c
deleted file mode 100644
index b716cbf..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/fwscanf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: fwscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */
-
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
-{
- va_list ap;
- int r;
-
- va_start(ap, fmt);
- r = vfwscanf(fp, fmt, ap);
- va_end(ap);
-
- return (r);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/getc.c b/libc/upstream-openbsd/lib/libc/stdio/getc.c
deleted file mode 100644
index 6879cbb..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/getc.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: getc.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include "local.h"
-
-/*
- * A subroutine version of the macro getc_unlocked.
- */
-#undef getc_unlocked
-
-int
-getc_unlocked(FILE *fp)
-{
- return (__sgetc(fp));
-}
-
-/*
- * A subroutine version of the macro getc.
- */
-#undef getc
-
-int
-getc(FILE *fp)
-{
- int c;
-
- FLOCKFILE(fp);
- c = __sgetc(fp);
- FUNLOCKFILE(fp);
- return (c);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/getchar.c b/libc/upstream-openbsd/lib/libc/stdio/getchar.c
deleted file mode 100644
index 550817d..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/getchar.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: getchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-
-/*
- * A subroutine version of the macro getchar_unlocked.
- */
-#undef getchar_unlocked
-
-int
-getchar_unlocked(void)
-{
- return (getc_unlocked(stdin));
-}
-
-
-/*
- * A subroutine version of the macro getchar.
- */
-
-#undef getchar
-
-int
-getchar(void)
-{
- return (getc(stdin));
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/printf.c b/libc/upstream-openbsd/lib/libc/stdio/printf.c
deleted file mode 100644
index 09bb3d7..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/printf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: printf.c,v 1.8 2011/05/30 18:48:33 martynas Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-
-/* PRINTFLIKE1 */
-int
-printf(const char *fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfprintf(stdout, fmt, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/putc.c b/libc/upstream-openbsd/lib/libc/stdio/putc.c
deleted file mode 100644
index 762fecb..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/putc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: putc.c,v 1.12 2009/11/21 10:11:54 guenther Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include "local.h"
-
-/*
- * A subroutine version of the macro putc_unlocked.
- */
-#undef putc_unlocked
-
-int
-putc_unlocked(int c, FILE *fp)
-{
- if (cantwrite(fp)) {
- errno = EBADF;
- return (EOF);
- }
- _SET_ORIENTATION(fp, -1);
- return (__sputc(c, fp));
-}
-
-/*
- * A subroutine version of the macro putc.
- */
-#undef putc
-
-int
-putc(int c, FILE *fp)
-{
- int ret;
-
- FLOCKFILE(fp);
- ret = putc_unlocked(c, fp);
- FUNLOCKFILE(fp);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/putchar.c b/libc/upstream-openbsd/lib/libc/stdio/putchar.c
deleted file mode 100644
index 233cdfd..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/putchar.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: putchar.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-
-#undef putchar_unlocked
-/*
- * A subrouting version of the macro putchar_unlocked
- */
-int
-putchar_unlocked(int c)
-{
- FILE *so = stdout;
-
- return (putc_unlocked(c,so));
-}
-
-#undef putchar
-
-/*
- * A subroutine version of the macro putchar
- */
-int
-putchar(int c)
-{
- FILE *so = stdout;
-
- return (putc(c, so));
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/scanf.c b/libc/upstream-openbsd/lib/libc/stdio/scanf.c
deleted file mode 100644
index 90cf12a..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/scanf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: scanf.c,v 1.10 2011/05/30 18:48:33 martynas Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-
-/* SCANFLIKE1 */
-int
-scanf(const char *fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfscanf(stdin, fmt, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/swprintf.c b/libc/upstream-openbsd/lib/libc/stdio/swprintf.c
deleted file mode 100644
index 8928aea..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/swprintf.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: swprintf.c,v 1.5 2012/12/05 23:20:01 deraadt Exp $ */
-/* $NetBSD: swprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp $ */
-
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-swprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vswprintf(s, n, fmt, ap);
- va_end(ap);
-
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/swscanf.c b/libc/upstream-openbsd/lib/libc/stdio/swscanf.c
deleted file mode 100644
index a85e9ee..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/swscanf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: swscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */
-
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-swscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, ...)
-{
- va_list ap;
- int r;
-
- va_start(ap, fmt);
- r = vswscanf(str, fmt, ap);
- va_end(ap);
-
- return (r);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/wprintf.c b/libc/upstream-openbsd/lib/libc/stdio/wprintf.c
deleted file mode 100644
index 9f7abb6..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/wprintf.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: wprintf.c,v 1.3 2011/04/28 17:38:46 stsp Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <wchar.h>
-
-int
-wprintf(const wchar_t * __restrict fmt, ...)
-{
- int ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vfwprintf(stdout, fmt, ap);
- va_end(ap);
- return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/wscanf.c b/libc/upstream-openbsd/lib/libc/stdio/wscanf.c
deleted file mode 100644
index 06c0829..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/wscanf.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: wscanf.c,v 1.2 2012/12/05 23:20:01 deraadt Exp $ */
-
-/*-
- * Copyright (c) 2002 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <wchar.h>
-
-int
-wscanf(const wchar_t * __restrict fmt, ...)
-{
- va_list ap;
- int r;
-
- va_start(ap, fmt);
- r = vfwscanf(stdin, fmt, ap);
- va_end(ap);
-
- return (r);
-}
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 4db1f72..636b504 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -37,6 +37,24 @@
#define STDIO_TEST stdio
#endif
+static void AssertFileIs(FILE* fp, const char* expected, bool is_fmemopen = false) {
+ rewind(fp);
+
+ char line[1024];
+ ASSERT_EQ(line, fgets(line, sizeof(line), fp));
+ ASSERT_STREQ(expected, line);
+
+ if (is_fmemopen) {
+ // fmemopen appends a trailing NUL byte, which probably shouldn't show up as an
+ // extra empty line, but does on every C library I tested...
+ ASSERT_EQ(line, fgets(line, sizeof(line), fp));
+ ASSERT_STREQ("", line);
+ }
+
+ // Make sure there isn't anything else in the file.
+ ASSERT_EQ(nullptr, fgets(line, sizeof(line), fp)) << "junk at end of file: " << line;
+}
+
TEST(STDIO_TEST, flockfile_18208568_stderr) {
// Check that we have a _recursive_ mutex for flockfile.
flockfile(stderr);
@@ -69,13 +87,7 @@
rc = fprintf(fp, "hello\n");
ASSERT_EQ(rc, 6);
- rewind(fp);
-
- char buf[16];
- char* s = fgets(buf, sizeof(buf), fp);
- ASSERT_TRUE(s != NULL);
- ASSERT_STREQ("hello\n", s);
-
+ AssertFileIs(fp, "hello\n");
fclose(fp);
}
@@ -95,11 +107,7 @@
FILE* tfile = fdopen(tf.fd, "r");
ASSERT_TRUE(tfile != NULL);
- char buf[7];
- ASSERT_EQ(buf, fgets(buf, sizeof(buf), tfile));
- ASSERT_STREQ("hello\n", buf);
- // Make sure there isn't anything else in the file.
- ASSERT_EQ(NULL, fgets(buf, sizeof(buf), tfile));
+ AssertFileIs(tfile, "hello\n");
fclose(tfile);
}
@@ -568,6 +576,17 @@
ASSERT_EQ(ENOMEM, errno);
}
+TEST(STDIO_TEST, fprintf) {
+ TemporaryFile tf;
+
+ FILE* tfile = fdopen(tf.fd, "r+");
+ ASSERT_TRUE(tfile != nullptr);
+
+ ASSERT_EQ(7, fprintf(tfile, "%d %s", 123, "abc"));
+ AssertFileIs(tfile, "123 abc");
+ fclose(tfile);
+}
+
TEST(STDIO_TEST, fprintf_failures_7229520) {
// http://b/7229520
FILE* fp;
@@ -806,13 +825,7 @@
ASSERT_STREQ("<abc>\n", buf);
- rewind(fp);
-
- char line[16];
- char* s = fgets(line, sizeof(line), fp);
- ASSERT_TRUE(s != NULL);
- ASSERT_STREQ("<abc>\n", s);
-
+ AssertFileIs(fp, "<abc>\n", true);
fclose(fp);
}
@@ -820,13 +833,7 @@
FILE* fp = fmemopen(nullptr, 128, "r+");
ASSERT_NE(EOF, fputs("xyz\n", fp));
- rewind(fp);
-
- char line[16];
- char* s = fgets(line, sizeof(line), fp);
- ASSERT_TRUE(s != NULL);
- ASSERT_STREQ("xyz\n", s);
-
+ AssertFileIs(fp, "xyz\n", true);
fclose(fp);
}
@@ -1196,15 +1203,10 @@
}
for (size_t i = 0; i < 256; ++i) {
- rewind(fps[i]);
-
- char buf[BUFSIZ];
- ASSERT_TRUE(fgets(buf, sizeof(buf), fps[i]) != nullptr);
-
char expected[BUFSIZ];
snprintf(expected, sizeof(expected), "hello %zu!\n", i);
- ASSERT_STREQ(expected, buf);
+ AssertFileIs(fps[i], expected);
fclose(fps[i]);
delete tfs[i];
}