mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-10 05:59:39 +08:00
Compare commits
31
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59c0f6ff86 | ||
|
|
94dc51ad84 | ||
|
|
50d2d4bb0e | ||
|
|
3a6219d3ec | ||
|
|
f5eb5f9c91 | ||
|
|
3b7f56026c | ||
|
|
daf161ce63 | ||
|
|
87efefb037 | ||
|
|
65c7020d26 | ||
|
|
9f95ec0adb | ||
|
|
1885fe873e | ||
|
|
16d0a0ce76 | ||
|
|
014eaa2207 | ||
|
|
965630aefa | ||
|
|
51e762570e | ||
|
|
163437ec37 | ||
|
|
f676ce661c | ||
|
|
907cc11c57 | ||
|
|
dbcaca73cb | ||
|
|
26f36461f6 | ||
|
|
e04da210f7 | ||
|
|
e871e19b5f | ||
|
|
f2cdbadd8a | ||
|
|
978908245b | ||
|
|
8a4e5cc657 | ||
|
|
fe7b1136e5 | ||
|
|
d679497db2 | ||
|
|
01b07c70ad | ||
|
|
75adf430d2 | ||
|
|
c66e8b9e58 | ||
|
|
004c993bdd |
@@ -1,2 +1 @@
|
||||
ChangeLog merge=merge-changelog
|
||||
timezone/* -whitespace
|
||||
|
||||
@@ -43,4 +43,3 @@ core
|
||||
/linuxthreads
|
||||
/linuxthreads_db
|
||||
/rtkaio
|
||||
*.pyc
|
||||
|
||||
+1
-1
@@ -1017,7 +1017,7 @@
|
||||
* elf/dl-error.c (_dl_signal_error): Allocate memory for objname
|
||||
as well. Reported by Alexander V. Lukyanov <lav@yars.free.net>.
|
||||
|
||||
* iconvdata/gconv-modules: Add aliases for Windows charsets.
|
||||
* iconvdata/gconv-modules: Add aliases for Winblowz charsets.
|
||||
Patch by Joseph S. Myers <jsm28@cam.ac.uk>.
|
||||
|
||||
2000-10-13 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
+1
-1
@@ -525,7 +525,7 @@
|
||||
|
||||
1998-07-29 12:58 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* sysdeps/generic/glob.c: Windows compatibility stuff.
|
||||
* sysdeps/generic/glob.c: Winblowz compatibility stuff.
|
||||
Patch received from Paul D. Smith <psmith@BayNetworks.COM>.
|
||||
|
||||
1998-07-29 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||
|
||||
@@ -116,36 +116,20 @@ will be used, and CFLAGS sets optimization options for the compiler.
|
||||
program linked statically with the NSS libraries cannot be
|
||||
dynamically reconfigured to use a different name database.
|
||||
|
||||
'--without-tls'
|
||||
By default the C library is built with support for thread-local
|
||||
storage if the used tools support it. By using '--without-tls'
|
||||
this can be prevented though there generally is no reason since it
|
||||
creates compatibility problems.
|
||||
|
||||
'--enable-hardcoded-path-in-tests'
|
||||
By default, dynamic tests are linked to run with the installed C
|
||||
library. This option hardcodes the newly built C library path in
|
||||
dynamic tests so that they can be invoked directly.
|
||||
|
||||
'--disable-timezone-tools'
|
||||
By default, timezone related utilities ('zic', 'zdump', and
|
||||
'tzselect') are installed with the GNU C Library. If you are
|
||||
building these independently (e.g. by using the 'tzcode' package),
|
||||
then this option will allow disabling the install of these.
|
||||
|
||||
Note that you need to make sure the external tools are kept in sync
|
||||
with the versions that the GNU C Library expects as the data
|
||||
formats may change over time. Consult the 'timezone' subdirectory
|
||||
for more details.
|
||||
|
||||
'--enable-lock-elision=yes'
|
||||
Enable lock elision for pthread mutexes by default.
|
||||
|
||||
'--enable-stack-protector'
|
||||
'--enable-stack-protector=strong'
|
||||
'--enable-stack-protector=all'
|
||||
Compile the C library and all other parts of the glibc package
|
||||
(including the threading and math libraries, NSS modules, and
|
||||
transliteration modules) using the GCC '-fstack-protector',
|
||||
'-fstack-protector-strong' or '-fstack-protector-all' options to
|
||||
detect stack overruns. Only the dynamic linker and a small number
|
||||
of routines called directly from assembler are excluded from this
|
||||
protection.
|
||||
|
||||
'--enable-pt_chown'
|
||||
The file 'pt_chown' is a helper binary for 'grantpt' (*note
|
||||
Pseudo-Terminals: Allocation.) that is installed setuid root to fix
|
||||
@@ -165,31 +149,6 @@ will be used, and CFLAGS sets optimization options for the compiler.
|
||||
with, so new warnings cause the build with '-Werror' to fail), you
|
||||
can configure with '--disable-werror'.
|
||||
|
||||
'--disable-mathvec'
|
||||
By default for x86_64, the GNU C Library is built with the vector
|
||||
math library. Use this option to disable the vector math library.
|
||||
|
||||
'--enable-tunables'
|
||||
Tunables support allows additional library parameters to be
|
||||
customized at runtime. This is an experimental feature and affects
|
||||
startup time and is thus disabled by default. This option can take
|
||||
the following values:
|
||||
|
||||
'no'
|
||||
This is the default if the option is not passed to configure.
|
||||
This disables tunables.
|
||||
|
||||
'yes'
|
||||
This is the default if the option is passed to configure.
|
||||
This enables tunables and selects the default frontend
|
||||
(currently 'valstring').
|
||||
|
||||
'valstring'
|
||||
This enables tunables and selects the 'valstring' frontend for
|
||||
tunables. This frontend allows users to specify tunables as a
|
||||
colon-separated list in a single environment variable
|
||||
'GLIBC_TUNABLES'.
|
||||
|
||||
'--build=BUILD-SYSTEM'
|
||||
'--host=HOST-SYSTEM'
|
||||
These options are for cross-compiling. If you specify both options
|
||||
@@ -225,8 +184,8 @@ will be used, and CFLAGS sets optimization options for the compiler.
|
||||
|
||||
To build the library and related programs, type 'make'. This will
|
||||
produce a lot of output, some of which may look like errors from 'make'
|
||||
but aren't. Look for error messages from 'make' containing '***'.
|
||||
Those indicate that something is seriously wrong.
|
||||
but isn't. Look for error messages from 'make' containing '***'. Those
|
||||
indicate that something is seriously wrong.
|
||||
|
||||
The compilation process can take a long time, depending on the
|
||||
configuration and the speed of your machine. Some complex modules may
|
||||
@@ -256,33 +215,6 @@ You can specify 'stop-on-test-failure=y' when running 'make check' to
|
||||
make the test run stop and exit with an error status immediately when a
|
||||
failure occurs.
|
||||
|
||||
The GNU C Library pretty printers come with their own set of scripts
|
||||
for testing, which run together with the rest of the testsuite through
|
||||
'make check'. These scripts require the following tools to run
|
||||
successfully:
|
||||
|
||||
* Python 2.7.6/3.4.3 or later
|
||||
|
||||
Python is required for running the printers' test scripts.
|
||||
|
||||
* PExpect 4.0
|
||||
|
||||
The printer tests drive GDB through test programs and compare its
|
||||
output to the printers'. PExpect is used to capture the output of
|
||||
GDB, and should be compatible with the Python version in your
|
||||
system.
|
||||
|
||||
* GDB 7.8 or later with support for Python 2.7.6/3.4.3 or later
|
||||
|
||||
GDB itself needs to be configured with Python support in order to
|
||||
use the pretty printers. Notice that your system having Python
|
||||
available doesn't imply that GDB supports it, nor that your
|
||||
system's Python and GDB's have the same version.
|
||||
|
||||
If these tools are absent, the printer tests will report themselves as
|
||||
'UNSUPPORTED'. Notice that some of the printer tests require the GNU C
|
||||
Library to be compiled with debugging symbols.
|
||||
|
||||
To format the 'GNU C Library Reference Manual' for printing, type
|
||||
'make dvi'. You need a working TeX installation to do this. The
|
||||
distribution builds the on-line formatted version of the manual, as Info
|
||||
@@ -322,12 +254,7 @@ program that runs a newly built program with environment variable
|
||||
assignments in effect, those assignments being specified as 'VAR=VALUE'
|
||||
before the name of the program to be run. If multiple assignments to
|
||||
the same variable are specified, the last assignment specified must take
|
||||
precedence. Similarly, if 'TEST-WRAPPER env -i' will not work to run a
|
||||
program with an environment completely empty of variables except those
|
||||
directly assigned, then 'test-wrapper-env-only' must be set; its use has
|
||||
the same syntax as 'test-wrapper-env', the only difference in its
|
||||
semantics being starting with an empty set of environment variables
|
||||
rather than the ambient set.
|
||||
precedence.
|
||||
|
||||
Installing the C Library
|
||||
========================
|
||||
@@ -359,13 +286,11 @@ headers from libraries other than the GNU C Library yourself after
|
||||
installing the library.
|
||||
|
||||
You can install the GNU C Library somewhere other than where you
|
||||
configured it to go by setting the 'DESTDIR' GNU standard make variable
|
||||
on the command line for 'make install'. The value of this variable is
|
||||
configured it to go by setting the 'install_root' variable on the
|
||||
command line for 'make install'. The value of this variable is
|
||||
prepended to all the paths for installation. This is useful when
|
||||
setting up a chroot environment or preparing a binary distribution. The
|
||||
directory should be specified with an absolute file name. Installing
|
||||
with the 'prefix' and 'exec_prefix' GNU standard make variables set is
|
||||
not supported.
|
||||
directory should be specified with an absolute file name.
|
||||
|
||||
The GNU C Library includes a daemon called 'nscd', which you may or
|
||||
may not want to run. 'nscd' caches name service lookups; it can
|
||||
@@ -410,23 +335,14 @@ build the GNU C Library:
|
||||
recommend GNU 'make' version 3.79. All earlier versions have
|
||||
severe bugs or lack features.
|
||||
|
||||
* GCC 4.7 or newer
|
||||
* GCC 4.6 or newer
|
||||
|
||||
GCC 4.7 or higher is required. In general it is recommended to use
|
||||
GCC 4.6 or higher is required. In general it is recommended to use
|
||||
the newest version of the compiler that is known to work for
|
||||
building the GNU C Library, as newer compilers usually produce
|
||||
better code. As of release time, GCC 6.3 is the newest compiler
|
||||
better code. As of release time, GCC 4.9.2 is the newest compiler
|
||||
verified to work to build the GNU C Library.
|
||||
|
||||
For multi-arch support it is recommended to use a GCC which has
|
||||
been built with support for GNU indirect functions. This ensures
|
||||
that correct debugging information is generated for functions
|
||||
selected by IFUNC resolvers. This support can either be enabled by
|
||||
configuring GCC with '--enable-gnu-indirect-function', or by
|
||||
enabling it by default by setting 'default_gnu_indirect_function'
|
||||
variable for a particular architecture in the GCC source file
|
||||
'gcc/config.gcc'.
|
||||
|
||||
You can use whatever compiler you like to compile programs that use
|
||||
the GNU C Library.
|
||||
|
||||
@@ -446,16 +362,14 @@ build the GNU C Library:
|
||||
need this version of the 'texinfo' package. Earlier versions do
|
||||
not understand all the tags used in the document, and the
|
||||
installation mechanism for the info files is not present or works
|
||||
differently. As of release time, 'texinfo' 6.0 is the newest
|
||||
differently. As of release time, 'texinfo' 5.2 is the newest
|
||||
verified to work to build the GNU C Library.
|
||||
|
||||
* GNU 'awk' 3.1.2, or higher
|
||||
|
||||
'awk' is used in several places to generate files. Some 'gawk'
|
||||
extensions are used, including the 'asorti' function, which was
|
||||
introduced in version 3.1.2 of 'gawk'. As of release time, 'gawk'
|
||||
version 4.1.3 is the newest verified to work to build the GNU C
|
||||
Library.
|
||||
introduced in version 3.1.2 of 'gawk'.
|
||||
|
||||
* Perl 5
|
||||
|
||||
@@ -465,8 +379,11 @@ build the GNU C Library:
|
||||
* GNU 'sed' 3.02 or newer
|
||||
|
||||
'Sed' is used in several places to generate files. Most scripts
|
||||
work with any version of 'sed'. As of release time, 'sed' version
|
||||
4.2.2 is the newest verified to work to build the GNU C Library.
|
||||
work with any version of 'sed'. The known exception is the script
|
||||
'po2test.sed' in the 'intl' subdirectory which is used to generate
|
||||
'msgs.h' for the test suite. This script works correctly only with
|
||||
GNU 'sed' 3.02. If you like to run the test suite, you should
|
||||
definitely upgrade 'sed'.
|
||||
|
||||
If you change any of the 'configure.ac' files you will also need
|
||||
|
||||
@@ -488,7 +405,7 @@ Specific advice for GNU/Linux systems
|
||||
=====================================
|
||||
|
||||
If you are installing the GNU C Library on GNU/Linux systems, you need
|
||||
to have the header files from a 3.2 or newer kernel around for
|
||||
to have the header files from a 2.6.32 or newer kernel around for
|
||||
reference. These headers must be installed using 'make
|
||||
headers_install'; the headers present in the kernel source directory are
|
||||
not suitable for direct use by the GNU C Library. You do not need to
|
||||
|
||||
+65
-174
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -50,7 +50,7 @@ export sysdep_dir := $(sysdep_dir)
|
||||
include $(common-objpfx)config.make
|
||||
|
||||
# What flags to give to sources which call user provided callbacks
|
||||
uses-callbacks = -fexceptions
|
||||
uses-callbacks = $(exceptions)
|
||||
|
||||
# What flags to give to tests which test stack alignment
|
||||
stack-align-test-flags =
|
||||
@@ -190,19 +190,18 @@ zonedir = $(datadir)/zoneinfo
|
||||
endif
|
||||
inst_zonedir = $(install_root)$(zonedir)
|
||||
|
||||
# Where to install the compiled binary locale archive and compiled
|
||||
# binary locale files.
|
||||
ifndef complocaledir
|
||||
complocaledir = $(libdir)/locale
|
||||
# Where to install the locale files.
|
||||
ifndef localedir
|
||||
localedir = $(libdir)/locale
|
||||
endif
|
||||
inst_complocaledir = $(install_root)$(complocaledir)
|
||||
inst_localedir = $(install_root)$(localedir)
|
||||
|
||||
# Where to install the message catalog data files (which are
|
||||
# machine-independent).
|
||||
ifndef localedir
|
||||
localedir = $(datadir)/locale
|
||||
ifndef msgcatdir
|
||||
msgcatdir = $(datadir)/locale
|
||||
endif
|
||||
inst_localedir = $(install_root)$(localedir)
|
||||
inst_msgcatdir = $(install_root)$(msgcatdir)
|
||||
|
||||
# Where to install the locale charmap source files.
|
||||
ifndef i18ndir
|
||||
@@ -346,7 +345,9 @@ endif
|
||||
endif
|
||||
|
||||
# Flags to pass the C compiler when assembling preprocessed assembly code
|
||||
# (`.S' files).
|
||||
# (`.S' files). On some systems the assembler doesn't understand the `#' line
|
||||
# directives the preprocessor produces. If you have troubling compiling
|
||||
# assembly code, try using -P here to suppress these directives.
|
||||
ifndef asm-CPPFLAGS
|
||||
asm-CPPFLAGS =
|
||||
endif
|
||||
@@ -386,17 +387,6 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
|
||||
LDFLAGS-rtld += $(hashstyle-LDFLAGS)
|
||||
endif
|
||||
|
||||
# Command to run after every final link (executable or shared object).
|
||||
# This is invoked with $(call after-link,...), so it should operate on
|
||||
# the file $1. This can be set to do some sort of post-processing on
|
||||
# binaries, or to perform some sort of static sanity check.
|
||||
ifndef after-link
|
||||
after-link =
|
||||
endif
|
||||
|
||||
# Additional libraries to link into every test.
|
||||
link-extra-libs-tests = $(libsupport)
|
||||
|
||||
# Command for linking PIE programs with the C library.
|
||||
ifndef +link-pie
|
||||
+link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \
|
||||
@@ -410,20 +400,10 @@ ifndef +link-pie
|
||||
$(common-objpfx)libc% $(+postinit),$^) \
|
||||
$(link-extra-libs)
|
||||
+link-pie-after-libc = $(+postctorS) $(+postinit)
|
||||
define +link-pie
|
||||
$(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-libc) $(+link-pie-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
define +link-pie-tests
|
||||
$(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
||||
$(+link-pie-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
define +link-pie-printers-tests
|
||||
$(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
|
||||
$(+link-pie-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
+link-pie = $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-libc) \
|
||||
$(+link-pie-after-libc)
|
||||
+link-pie-tests = $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) \
|
||||
$(link-libc-tests) $(+link-pie-after-libc)
|
||||
endif
|
||||
# Command for statically linking programs with the C library.
|
||||
ifndef +link-static
|
||||
@@ -437,24 +417,14 @@ ifndef +link-static
|
||||
$(common-objpfx)libc% $(+postinit),$^) \
|
||||
$(link-extra-libs-static)
|
||||
+link-static-after-libc = $(+postctorT) $(+postinit)
|
||||
define +link-static
|
||||
$(+link-static-before-libc) $(link-libc-static) $(+link-static-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
define +link-static-tests
|
||||
$(+link-static-before-libc) $(link-libc-static-tests) $(+link-static-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
+link-static = $(+link-static-before-libc) $(link-libc-static) \
|
||||
$(+link-static-after-libc)
|
||||
+link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
|
||||
$(+link-static-after-libc)
|
||||
endif
|
||||
# Commands for linking programs with the C library.
|
||||
ifndef +link
|
||||
ifeq (yes,$(build-shared))
|
||||
ifeq (yes,$(build-pie-default))
|
||||
no-pie-ldflag = -no-pie
|
||||
+link = $(+link-pie)
|
||||
+link-tests = $(+link-pie-tests)
|
||||
+link-printers-tests = $(+link-pie-printers-tests)
|
||||
else # not build-pie-default
|
||||
+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \
|
||||
$(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||||
$(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
|
||||
@@ -466,96 +436,54 @@ else # not build-pie-default
|
||||
$(common-objpfx)libc% $(+postinit),$^) \
|
||||
$(link-extra-libs)
|
||||
+link-after-libc = $(+postctor) $(+postinit)
|
||||
define +link
|
||||
$(+link-before-libc) $(rtld-LDFLAGS) $(link-libc) $(+link-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
define +link-tests
|
||||
$(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \
|
||||
$(+link-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
define +link-printers-tests
|
||||
$(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \
|
||||
$(+link-after-libc)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
endif # build-pie-default
|
||||
else # build-static
|
||||
+link = $(+link-before-libc) $(rtld-LDFLAGS) $(link-libc) \
|
||||
$(+link-after-libc)
|
||||
+link-tests = $(+link-before-libc) $(rtld-tests-LDFLAGS) \
|
||||
$(link-libc-tests) $(+link-after-libc)
|
||||
else
|
||||
+link = $(+link-static)
|
||||
+link-tests = $(+link-static-tests)
|
||||
+link-printers-tests = $(+link-static-tests)
|
||||
endif # build-shared
|
||||
endif # +link
|
||||
|
||||
# The pretty printer test programs need to be compiled without optimizations
|
||||
# so they won't confuse gdb. We could use either the 'GCC optimize' pragma
|
||||
# or the 'optimize' function attribute to achieve this; however, at least on
|
||||
# ARM, gcc always produces different debugging symbols when invoked with
|
||||
# a -O greater than 0 than when invoked with -O0, regardless of anything else
|
||||
# we're using to suppress optimizations. Therefore, we need to explicitly pass
|
||||
# -O0 to it through CFLAGS.
|
||||
# Additionally, the build system will try to -include $(common-objpfx)/config.h
|
||||
# when compiling the tests, which will throw an error if some special macros
|
||||
# (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we
|
||||
# tell gcc to define IS_IN_build.
|
||||
CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
# These indicate whether to link using the built ld.so or the installed one.
|
||||
installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
|
||||
built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
|
||||
|
||||
ifndef rtld-LDFLAGS
|
||||
rtld-LDFLAGS = $(installed-rtld-LDFLAGS)
|
||||
endif
|
||||
|
||||
endif
|
||||
ifeq (yes,$(build-shared))
|
||||
ifndef rtld-LDFLAGS
|
||||
rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name)
|
||||
endif
|
||||
ifndef rtld-tests-LDFLAGS
|
||||
ifeq (yes,$(build-hardcoded-path-in-tests))
|
||||
rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS)
|
||||
rtld-tests-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so
|
||||
else
|
||||
rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS)
|
||||
endif # build-hardcoded-path-in-tests
|
||||
endif # rtld-tests-LDFLAGS
|
||||
|
||||
endif # build-shared
|
||||
|
||||
rtld-tests-LDFLAGS = $(rtld-LDFLAGS)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifndef link-libc
|
||||
ifeq (yes,$(build-shared))
|
||||
# We need the versioned name of libc.so in the deps of $(others) et al
|
||||
# so that the symlink to libc.so is created before anything tries to
|
||||
# run the linked programs.
|
||||
link-libc-rpath = -Wl,-rpath=$(rpath-link)
|
||||
link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link)
|
||||
|
||||
ifeq (yes,$(build-hardcoded-path-in-tests))
|
||||
link-libc-tests-rpath-link = $(link-libc-rpath)
|
||||
link-libc-tests-rpath-link = -Wl,-rpath=$(rpath-link)
|
||||
else
|
||||
link-libc-tests-rpath-link = $(link-libc-rpath-link)
|
||||
endif # build-hardcoded-path-in-tests
|
||||
|
||||
endif
|
||||
link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \
|
||||
$(common-objpfx)$(patsubst %,$(libtype.oS),c) \
|
||||
$(as-needed) $(elf-objpfx)ld.so \
|
||||
$(no-as-needed)
|
||||
link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib)
|
||||
|
||||
link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests)
|
||||
link-libc-tests = $(link-libc-tests-rpath-link) \
|
||||
$(link-libc-tests-after-rpath-link)
|
||||
# Pretty printer test programs always require rpath instead of rpath-link.
|
||||
link-libc-printers-tests = $(link-libc-rpath) \
|
||||
$(link-libc-tests-after-rpath-link)
|
||||
|
||||
$(link-libc-before-gnulib) $(gnulib-tests)
|
||||
# This is how to find at build-time things that will be installed there.
|
||||
rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec support
|
||||
rpath-dirs = math elf dlfcn nss nis rt resolv crypt
|
||||
rpath-link = \
|
||||
$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
|
||||
else # build-static
|
||||
else
|
||||
link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
|
||||
link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests)
|
||||
endif # build-shared
|
||||
endif # link-libc
|
||||
endif
|
||||
endif
|
||||
|
||||
# Differences in the linkers on the various platforms.
|
||||
LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
|
||||
@@ -646,6 +574,7 @@ endif
|
||||
# Variants of the two previous definitions for statically linking programs.
|
||||
+prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
|
||||
+postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
|
||||
+interp = $(addprefix $(elf-objpfx),interp.os)
|
||||
csu-objpfx = $(common-objpfx)csu/
|
||||
elf-objpfx = $(common-objpfx)elf/
|
||||
|
||||
@@ -660,11 +589,6 @@ endif
|
||||
ifndef test-wrapper-env
|
||||
test-wrapper-env = $(test-wrapper) env
|
||||
endif
|
||||
# Likewise, but the program's environment will be empty except for any
|
||||
# explicit <variable>=<value> assignments preceding the program name.
|
||||
ifndef test-wrapper-env-only
|
||||
test-wrapper-env-only = $(test-wrapper) env -i
|
||||
endif
|
||||
|
||||
# Whether to run test programs built for the library's host system.
|
||||
ifndef run-built-tests
|
||||
@@ -788,15 +712,15 @@ endif
|
||||
|
||||
# Extra flags to pass to GCC.
|
||||
ifeq ($(all-warnings),yes)
|
||||
+gccwarn := -Wall -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
|
||||
+gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
|
||||
else
|
||||
+gccwarn := -Wall -Wwrite-strings
|
||||
+gccwarn := -Wall -Wwrite-strings -Winline
|
||||
endif
|
||||
+gccwarn += -Wundef
|
||||
ifeq ($(enable-werror),yes)
|
||||
+gccwarn += -Werror
|
||||
+gccwarn += -Werror -Wno-error=undef
|
||||
endif
|
||||
+gccwarn-c = -Wstrict-prototypes -Wold-style-definition
|
||||
+gccwarn-c = -Wstrict-prototypes
|
||||
|
||||
# We do not depend on the address of constants in different files to be
|
||||
# actually different, so allow the compiler to merge them all.
|
||||
@@ -807,11 +731,6 @@ endif
|
||||
# disable any optimization that assume default rounding mode.
|
||||
+math-flags = -frounding-math
|
||||
|
||||
# We might want to compile with some stack-protection flag.
|
||||
ifneq ($(stack-protector),)
|
||||
+stack-protector=$(stack-protector)
|
||||
endif
|
||||
|
||||
# This is the program that generates makefile dependencies from C source files.
|
||||
# The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy
|
||||
# targets for headers so that removed headers don't break the build.
|
||||
@@ -871,8 +790,7 @@ ifeq "$(strip $(+cflags))" ""
|
||||
+cflags := $(default_cflags)
|
||||
endif # $(+cflags) == ""
|
||||
|
||||
+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \
|
||||
$(+stack-protector)
|
||||
+cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags)
|
||||
+gcc-nowarn := -w
|
||||
|
||||
# Don't duplicate options if we inherited variables from the parent.
|
||||
@@ -901,26 +819,26 @@ libio-include = -I$(..)libio
|
||||
# List of non-library modules that we build.
|
||||
built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
|
||||
libSegFault libpcprofile librpcsvc locale-programs \
|
||||
memusagestat nonlib nscd extramodules libnldbl libsupport
|
||||
memusagestat nonlib nscd extramodules libnldbl
|
||||
|
||||
# We don't include libc-modules.h when these targets are being built. These
|
||||
# targets don't (and will likely never need to) use the IS_IN facility. In
|
||||
# fact, shlib-versions should not use it because that will create a circular
|
||||
# dependency as libc-modules.h is generated from shlib-versions.
|
||||
skip-module-cppflags = shlib-versions.v.i Versions.v.i
|
||||
|
||||
in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
|
||||
$(libof-$(<F)) \
|
||||
$(libof-$(@F)) \
|
||||
libc))
|
||||
|
||||
# Build ld.so, libc.so and libpthread.so with -ftls-model=initial-exec
|
||||
tls-model = $(if $(filter libpthread rtld \
|
||||
libc,$(in-module)),-ftls-model=initial-exec,)
|
||||
|
||||
module-cppflags-real = -include $(common-objpfx)libc-modules.h \
|
||||
-DMODULE_NAME=$(in-module)
|
||||
|
||||
# We don't need libc-modules.h and the MODULE_NAME definition for .v.i
|
||||
# files. These targets don't (and will likely never need to) use the IS_IN
|
||||
# facility. In fact, shlib-versions should not use it because that will
|
||||
# create a circular dependency as libc-modules.h is generated from
|
||||
# shlib-versions.
|
||||
module-cppflags = $(if $(filter %.v.i,$(@F)),,$(module-cppflags-real))
|
||||
# We don't need libc-modules.h and the MODULE_NAME definition for
|
||||
# shlib-version.v.i.
|
||||
module-cppflags = $(if $(filter $(@F),$(skip-module-cppflags)), \
|
||||
,$(module-cppflags-real))
|
||||
|
||||
# These are the variables that the implicit compilation rules use.
|
||||
# Note that we can't use -std=* in CPPFLAGS, because it overrides
|
||||
@@ -934,19 +852,13 @@ CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \
|
||||
$(foreach lib,$(libof-$(basename $(@F))) \
|
||||
$(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
|
||||
$(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
|
||||
|
||||
ifneq (no,$(have-tunables))
|
||||
CPPFLAGS += -DTOP_NAMESPACE=glibc
|
||||
endif
|
||||
|
||||
override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
|
||||
override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) $(config-extra-cflags) \
|
||||
$(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
|
||||
$(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
|
||||
$(CFLAGS-$(@F)) $(tls-model) \
|
||||
$(CFLAGS-$(@F)) \
|
||||
$(foreach lib,$(libof-$(basename $(@F))) \
|
||||
$(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
|
||||
# Use our copies of cstdlib and cmath.
|
||||
override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \
|
||||
override CXXFLAGS = $(c++-sysincludes) \
|
||||
$(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
|
||||
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
|
||||
|
||||
@@ -961,8 +873,7 @@ endif
|
||||
# The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
|
||||
# to pass different flags for each flavor.
|
||||
libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
|
||||
# .op may be added to all-object-suffixes below.
|
||||
all-object-suffixes := .o .os .oS
|
||||
all-object-suffixes := .o .os .op .og .oS
|
||||
object-suffixes :=
|
||||
CPPFLAGS-.o = $(pic-default)
|
||||
CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
|
||||
@@ -987,7 +898,6 @@ PIE-ccflag = -fPIE
|
||||
ifeq (yes,$(build-profile))
|
||||
# Under --enable-profile, we will build a static library of profiled objects.
|
||||
# The profiled object files are named foo.op.
|
||||
all-object-suffixes += .op
|
||||
object-suffixes += .op
|
||||
CPPFLAGS-.op = -DPROF $(pic-default)
|
||||
CFLAGS-.op = -pg
|
||||
@@ -1016,7 +926,7 @@ endif
|
||||
ifndef ASFLAGS
|
||||
ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS))
|
||||
endif
|
||||
ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu)
|
||||
ASFLAGS += $(ASFLAGS-config) $(asflags-cpu)
|
||||
|
||||
ifndef BUILD_CC
|
||||
BUILD_CC = $(CC)
|
||||
@@ -1113,17 +1023,6 @@ $(common-objpfx)libc-modules.stmp: $(..)scripts/gen-libc-modules.awk \
|
||||
|
||||
endif
|
||||
|
||||
# Build the tunables list header early since it could be used by any module in
|
||||
# glibc.
|
||||
ifneq (no,$(have-tunables))
|
||||
before-compile += $(common-objpfx)dl-tunable-list.h
|
||||
|
||||
$(common-objpfx)dl-tunable-list.h: $(..)scripts/gen-tunables.awk \
|
||||
$(..)elf/dl-tunables.list
|
||||
$(AWK) -f $^ > $@.tmp
|
||||
mv $@.tmp $@
|
||||
endif
|
||||
|
||||
common-generated += libc-modules.h libc-modules.stmp
|
||||
|
||||
# The name under which the run-time dynamic linker is installed.
|
||||
@@ -1152,16 +1051,8 @@ endif
|
||||
|
||||
ifeq ($(build-shared),yes)
|
||||
libm = $(common-objpfx)math/libm.so$(libm.so-version)
|
||||
libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version)
|
||||
else
|
||||
libm = $(common-objpfx)math/libm.a
|
||||
libmvec = $(common-objpfx)mathvec/libmvec.a
|
||||
endif
|
||||
|
||||
ifeq ($(build-shared),yes)
|
||||
libsupport = $(common-objpfx)support/libsupport_nonshared.a
|
||||
else
|
||||
libsupport = $(common-objpfx)support/libsupport.a
|
||||
endif
|
||||
|
||||
# These are the subdirectories containing the library source. The order
|
||||
@@ -1171,7 +1062,7 @@ all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
|
||||
stdlib stdio-common libio malloc string wcsmbs time dirent \
|
||||
grp pwd posix io termios resource misc socket sysvipc gmon \
|
||||
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
|
||||
crypt localedata timezone rt conform debug mathvec support \
|
||||
crypt localedata timezone rt conform debug \
|
||||
$(add-on-subdirs) dlfcn elf
|
||||
|
||||
ifndef avoid-generated
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -53,15 +53,13 @@ endif # $(AUTOCONF) = no
|
||||
subdir_clean subdir_distclean subdir_realclean \
|
||||
tests xtests \
|
||||
subdir_update-abi subdir_check-abi \
|
||||
subdir_update-all-abi \
|
||||
subdir_echo-headers \
|
||||
subdir_install \
|
||||
subdir_objs subdir_stubs subdir_testclean \
|
||||
$(addprefix install-, no-libc.a bin lib data headers others)
|
||||
|
||||
headers := limits.h values.h features.h gnu-versions.h \
|
||||
bits/xopen_lim.h gnu/libc-version.h stdc-predef.h \
|
||||
bits/libc-header-start.h
|
||||
headers := limits.h values.h features.h gnu-versions.h bits/libc-lock.h \
|
||||
bits/xopen_lim.h gnu/libc-version.h stdc-predef.h
|
||||
|
||||
echo-headers: subdir_echo-headers
|
||||
|
||||
@@ -252,19 +250,19 @@ mostlyclean: parent-mostlyclean
|
||||
tests-clean:
|
||||
@$(MAKE) subdir_testclean no_deps=t
|
||||
|
||||
ifneq (,$(CXX))
|
||||
tests-special += $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out
|
||||
ifneq ($(CXX),no)
|
||||
|
||||
vpath c++-types.data $(+sysdep_dirs)
|
||||
|
||||
tests-special += $(objpfx)c++-types-check.out
|
||||
$(objpfx)c++-types-check.out: c++-types.data scripts/check-c++-types.sh
|
||||
scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu11 $(+gccwarn-c),$(CFLAGS)) $(CPPFLAGS) > $@; \
|
||||
scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@; \
|
||||
$(evaluate-test)
|
||||
endif
|
||||
|
||||
tests-special += $(objpfx)check-local-headers.out
|
||||
$(objpfx)check-local-headers.out: scripts/check-local-headers.sh
|
||||
AWK='$(AWK)' scripts/check-local-headers.sh \
|
||||
"$(includedir)" "$(objpfx)" < /dev/null > $@; \
|
||||
"$(includedir)" "$(objpfx)" > $@; \
|
||||
$(evaluate-test)
|
||||
|
||||
ifneq ($(PERL),no)
|
||||
@@ -318,36 +316,6 @@ $(objpfx)begin-end-check.out: scripts/begin-end-check.pl
|
||||
$(evaluate-test)
|
||||
endif
|
||||
|
||||
ifneq "$(headers)" ""
|
||||
# Special test of all the installed headers in this directory.
|
||||
tests-special += $(objpfx)check-installed-headers-c.out
|
||||
libof-check-installed-headers-c := nonlib
|
||||
$(objpfx)check-installed-headers-c.out: \
|
||||
scripts/check-installed-headers.sh $(headers)
|
||||
$(SHELL) $(..)scripts/check-installed-headers.sh c \
|
||||
"$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
|
||||
$(headers) > $@; \
|
||||
$(evaluate-test)
|
||||
|
||||
ifneq "$(CXX)" ""
|
||||
tests-special += $(objpfx)check-installed-headers-cxx.out
|
||||
libof-check-installed-headers-cxx := nonlib
|
||||
$(objpfx)check-installed-headers-cxx.out: \
|
||||
scripts/check-installed-headers.sh $(headers)
|
||||
$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
|
||||
"$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
|
||||
$(headers) > $@; \
|
||||
$(evaluate-test)
|
||||
endif
|
||||
endif
|
||||
|
||||
define summarize-tests
|
||||
@egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
|
||||
@echo "Summary of test results$2:"
|
||||
@sed 's/:.*//' < $(objpfx)$1 | sort | uniq -c
|
||||
@! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
|
||||
endef
|
||||
|
||||
tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
|
||||
tests: $(tests-special)
|
||||
$(..)scripts/merge-test-results.sh -s $(objpfx) "" \
|
||||
@@ -356,12 +324,22 @@ tests: $(tests-special)
|
||||
$(..)scripts/merge-test-results.sh -t $(objpfx) subdir-tests.sum \
|
||||
$(sort $(subdirs) .) \
|
||||
> $(objpfx)tests.sum
|
||||
$(call summarize-tests,tests.sum)
|
||||
@grep '^ERROR:' $(objpfx)tests.sum || true
|
||||
@grep '^FAIL:' $(objpfx)tests.sum || true
|
||||
@echo "Summary of test results:"
|
||||
@sed 's/:.*//' < $(objpfx)tests.sum | sort | uniq -c
|
||||
@if grep -q '^ERROR:' $(objpfx)tests.sum; then exit 1; fi
|
||||
@if grep -q '^FAIL:' $(objpfx)tests.sum; then exit 1; fi
|
||||
xtests:
|
||||
$(..)scripts/merge-test-results.sh -t $(objpfx) subdir-xtests.sum \
|
||||
$(sort $(subdirs)) \
|
||||
> $(objpfx)xtests.sum
|
||||
$(call summarize-tests,xtests.sum, for extra tests)
|
||||
@grep '^ERROR:' $(objpfx)xtests.sum || true
|
||||
@grep '^FAIL:' $(objpfx)xtests.sum || true
|
||||
@echo "Summary of test results for extra tests:"
|
||||
@sed 's/:.*//' < $(objpfx)xtests.sum | sort | uniq -c
|
||||
@if grep -q '^ERROR:' $(objpfx)xtests.sum; then exit 1; fi
|
||||
@if grep -q '^FAIL:' $(objpfx)xtests.sum; then exit 1; fi
|
||||
|
||||
# The realclean target is just like distclean for the parent, but we want
|
||||
# the subdirs to know the difference in case they care.
|
||||
@@ -443,3 +421,30 @@ FORCE:
|
||||
|
||||
iconvdata/% localedata/% po/%: FORCE
|
||||
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
||||
|
||||
# glibc 2.0 contains some header files which aren't used with glibc 2.1
|
||||
# anymore.
|
||||
# These rules should remove those headers
|
||||
ifeq (,$(install_root))
|
||||
ifeq ($(old-glibc-headers),yes)
|
||||
install: remove-old-headers
|
||||
endif
|
||||
endif
|
||||
|
||||
headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
|
||||
errnos.h fcntlbits.h huge_val.h ioctl-types.h \
|
||||
ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
|
||||
mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
|
||||
posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
|
||||
selectbits.h semaphorebits.h sigaction.h sigcontext.h \
|
||||
signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
|
||||
statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
|
||||
syscall-list.h termbits.h timebits.h ustatbits.h \
|
||||
utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
|
||||
xopen_lim.h gnu/types.h sys/ipc_buf.h \
|
||||
sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
|
||||
sys/shm_buf.h sys/socketcall.h sigstack.h
|
||||
|
||||
.PHONY: remove-old-headers
|
||||
remove-old-headers:
|
||||
rm -f $(addprefix $(inst_includedir)/, $(headers2_0))
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ install:
|
||||
LC_ALL=C; export LC_ALL; \
|
||||
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
|
||||
|
||||
bench bench-clean bench-build:
|
||||
bench bench-clean:
|
||||
$(MAKE) -C $(srcdir)/benchtests $(PARALLELMFLAGS) objdir=`pwd` $@
|
||||
|
||||
# Convenience target to rebuild ULPs for all math tests.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -109,26 +109,6 @@ endif # avoid-generated
|
||||
endif # $(build-shared) = yes
|
||||
|
||||
ifndef avoid-generated
|
||||
ifneq (,$(CXX))
|
||||
# If C++ headers <cstdlib> or <cmath> are used, GCC 6 will include
|
||||
# /usr/include/stdlib.h or /usr/include/math.h from "#include_next"
|
||||
# (instead of stdlib/stdlib.h or math/math.h in the glibc source
|
||||
# directory), and this turns up as a make dependency. An implicit
|
||||
# rule will kick in and make will try to install stdlib/stdlib.h or
|
||||
# math/math.h as /usr/include/stdlib.h or /usr/include/math.h because
|
||||
# the target is out of date. We make a copy of <cstdlib> and <cmath>
|
||||
# in the glibc build directory so that stdlib/stdlib.h and math/math.h
|
||||
# will be used instead of /usr/include/stdlib.h and /usr/include/math.h.
|
||||
before-compile := $(common-objpfx)cstdlib $(common-objpfx)cmath \
|
||||
$(before-compile)
|
||||
$(common-objpfx)cstdlib: $(c++-cstdlib-header)
|
||||
$(INSTALL_DATA) $< $@T
|
||||
$(move-if-change) $@T $@
|
||||
$(common-objpfx)cmath: $(c++-cmath-header)
|
||||
$(INSTALL_DATA) $< $@T
|
||||
$(move-if-change) $@T $@
|
||||
endif
|
||||
|
||||
before-compile := $(common-objpfx)libc-abis.h $(before-compile)
|
||||
$(common-objpfx)libc-abis.h: $(common-objpfx)libc-abis.stamp; @:
|
||||
$(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \
|
||||
@@ -143,16 +123,6 @@ $(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \
|
||||
common-generated += $(common-objpfx)libc-abis.h
|
||||
endif # avoid-generated
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
$(common-objpfx)runtime-linker.h: $(common-objpfx)runtime-linker.stamp; @:
|
||||
$(common-objpfx)runtime-linker.stamp: $(common-objpfx)config.make
|
||||
$(make-target-directory)
|
||||
echo '#define RUNTIME_LINKER "$(rtlddir)/$(rtld-installed-name)"' \
|
||||
> ${@:stamp=T}
|
||||
$(move-if-change) ${@:stamp=T} ${@:stamp=h}
|
||||
touch $@
|
||||
endif
|
||||
|
||||
# Make sure the subdirectory for object files gets created.
|
||||
ifdef objpfx
|
||||
ifeq (,$(wildcard $(objpfx).))
|
||||
@@ -210,52 +180,6 @@ sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' \
|
||||
-e 's@^\([^ \/$$][^ \]*\)@$$(..)\1@g'
|
||||
endif
|
||||
|
||||
ifdef gen-py-const-headers
|
||||
# We'll use a static pattern rule to match .pysym files with their
|
||||
# corresponding generated .py files.
|
||||
# The generated .py files go in the submodule's dir in the glibc build dir.
|
||||
py-const-files := $(patsubst %.pysym,%.py,$(gen-py-const-headers))
|
||||
py-const-dir := $(objpfx)
|
||||
py-const := $(addprefix $(py-const-dir),$(py-const-files))
|
||||
py-const-script := $(..)scripts/gen-py-const.awk
|
||||
|
||||
# This is a hack we use to generate .py files with constants for Python
|
||||
# pretty printers. It works the same way as gen-as-const.
|
||||
# See scripts/gen-py-const.awk for details on how the awk | gcc mechanism
|
||||
# works.
|
||||
#
|
||||
# $@.tmp and $@.tmp2 are temporary files we use to store the partial contents
|
||||
# of the target file. We do this instead of just writing on $@ because, if the
|
||||
# build process terminates prematurely, re-running Make wouldn't run this rule
|
||||
# since Make would see that the target file already exists (despite it being
|
||||
# incomplete).
|
||||
#
|
||||
# The sed line replaces "@name@SOME_NAME@value@SOME_VALUE@" strings from the
|
||||
# output of 'gcc -S' with "SOME_NAME = SOME_VALUE" strings.
|
||||
# The '-n' option, combined with the '/p' command, makes sed output only the
|
||||
# modified lines instead of the whole input file. The output is redirected
|
||||
# to a .py file; we'll import it in the pretty printers file to read
|
||||
# the constants generated by gen-py-const.awk.
|
||||
# The regex has two capturing groups, for SOME_NAME and SOME_VALUE
|
||||
# respectively. Notice SOME_VALUE may be prepended by a special character,
|
||||
# depending on the assembly syntax (e.g. immediates are prefixed by a '$'
|
||||
# in AT&T x86, and by a '#' in ARM). We discard it using a complemented set
|
||||
# before the second capturing group.
|
||||
$(py-const): $(py-const-dir)%.py: %.pysym $(py-const-script) \
|
||||
$(common-before-compile)
|
||||
$(make-target-directory)
|
||||
$(AWK) -f $(py-const-script) $< \
|
||||
| $(CC) -S -o $@.tmp $(CFLAGS) $(CPPFLAGS) -x c -
|
||||
echo '# GENERATED FILE\n' > $@.tmp2
|
||||
echo '# Constant definitions for pretty printers.' >> $@.tmp2
|
||||
echo '# See gen-py-const.awk for details.\n' >> $@.tmp2
|
||||
sed -n -r 's/^.*@name@([^@]+)@value@[^[:xdigit:]Xx-]*([[:xdigit:]Xx-]+)@.*/\1 = \2/p' \
|
||||
$@.tmp >> $@.tmp2
|
||||
mv -f $@.tmp2 $@
|
||||
rm -f $@.tmp
|
||||
|
||||
generated += $(py-const)
|
||||
endif # gen-py-const-headers
|
||||
|
||||
ifdef gen-as-const-headers
|
||||
# Generating headers for assembly constants.
|
||||
@@ -539,6 +463,7 @@ elide-routines.os += $(static-only-routines)
|
||||
# static libraries.
|
||||
elide-routines.o += $(shared-only-routines)
|
||||
elide-routines.op += $(shared-only-routines)
|
||||
elide-routines.og += $(shared-only-routines)
|
||||
|
||||
# Shared library building.
|
||||
|
||||
@@ -580,10 +505,9 @@ link-libc-deps = $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so \
|
||||
# to be as similar as possible to a default link with an installed libc.
|
||||
lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(link-libc-deps)
|
||||
$(build-shlib) $(link-libc-args)
|
||||
$(call after-link,$@)
|
||||
|
||||
define build-shlib-helper
|
||||
$(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
|
||||
$(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
|
||||
$(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) $(rtld-LDFLAGS) \
|
||||
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
|
||||
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
|
||||
@@ -627,9 +551,6 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
|
||||
PROVIDE(__start___libc_thread_subfreeres = .);\
|
||||
__libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
|
||||
PROVIDE(__stop___libc_thread_subfreeres = .);\
|
||||
PROVIDE(__start___libc_IO_vtables = .);\
|
||||
__libc_IO_vtables : { *(__libc_IO_vtables) }\
|
||||
PROVIDE(__stop___libc_IO_vtables = .);\
|
||||
/DISCARD/ : { *(.gnu.glibc-stub.*) }@'
|
||||
test -s $@T
|
||||
mv -f $@T $@
|
||||
@@ -645,7 +566,7 @@ $(build-shlib-helper) -o $@ $(shlib-lds-flags) \
|
||||
endef
|
||||
|
||||
define build-module-helper
|
||||
$(LINK.o) -shared -static-libgcc $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
|
||||
$(LINK.o) -shared $(static-libgcc) $(sysdep-LDFLAGS) $(rtld-LDFLAGS) \
|
||||
$(if $($(@F)-no-z-defs)$(no-z-defs),,-Wl,-z,defs) \
|
||||
-B$(csu-objpfx) $(load-map-file) \
|
||||
$(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
|
||||
@@ -659,14 +580,12 @@ endef
|
||||
define build-module
|
||||
$(build-module-helper) -o $@ $(shlib-lds-flags) \
|
||||
$(csu-objpfx)abi-note.o $(build-module-objlist) $(link-libc-args)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
define build-module-asneeded
|
||||
$(build-module-helper) -o $@ $(shlib-lds-flags) \
|
||||
$(csu-objpfx)abi-note.o \
|
||||
-Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed \
|
||||
$(link-libc-args)
|
||||
$(call after-link,$@)
|
||||
endef
|
||||
|
||||
build-module-helper-objlist = \
|
||||
@@ -747,7 +666,6 @@ $(common-objpfx)libc.so: $(elf-objpfx)soinit.os \
|
||||
$(elf-objpfx)ld.so \
|
||||
$(shlib-lds)
|
||||
$(build-shlib)
|
||||
$(call after-link,$@)
|
||||
|
||||
$(common-objpfx)linkobj/libc.so: $(elf-objpfx)soinit.os \
|
||||
$(common-objpfx)linkobj/libc_pic.a \
|
||||
@@ -756,7 +674,6 @@ $(common-objpfx)linkobj/libc.so: $(elf-objpfx)soinit.os \
|
||||
$(elf-objpfx)ld.so \
|
||||
$(shlib-lds)
|
||||
$(build-shlib)
|
||||
$(call after-link,$@)
|
||||
|
||||
ifeq ($(build-shared),yes)
|
||||
$(common-objpfx)libc.so: $(common-objpfx)libc.map
|
||||
@@ -984,26 +901,6 @@ endef
|
||||
installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
|
||||
$(inst_libdir)/$(patsubst %,$(libtype$o),\
|
||||
$(libprefix)$(libc-name)))
|
||||
|
||||
.PHONY: check-install-supported
|
||||
check-install-supported:
|
||||
|
||||
# Check to see if the prefix or exec_prefix GNU standard variable
|
||||
# has been overridden on the command line and, if so, fail with
|
||||
# an error message since doing so is not supported (set DESTDIR
|
||||
# instead).
|
||||
ifeq ($(origin prefix),command line)
|
||||
check-install-supported:
|
||||
$(error Overriding prefix is not supported. Set DESTDIR instead.)
|
||||
endif
|
||||
|
||||
ifeq ($(origin exec_prefix),command line)
|
||||
check-install-supported:
|
||||
$(error Overriding exec_prefix is not supported. Set DESTDIR instead.)
|
||||
endif
|
||||
|
||||
install: check-install-supported
|
||||
|
||||
install: $(installed-libcs)
|
||||
$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
|
||||
$(make-target-directory)
|
||||
@@ -1200,8 +1097,7 @@ endif
|
||||
|
||||
define do-install-so
|
||||
$(do-install-program)
|
||||
$(patsubst %,$(LN_S) -f $(@F) \
|
||||
$(@D)/$(patsubst %$*.so,%,$(<F))$(libprefix)$*.so,\
|
||||
$(patsubst %,ln -s -f $(@F) $(@D)/$(patsubst %$*.so,%,$(<F))$(libprefix)$*.so,\
|
||||
$(filter-out %.so,$@))
|
||||
endef
|
||||
|
||||
@@ -1237,7 +1133,6 @@ $(addprefix $(inst_sbindir)/,$(install-sbin)): \
|
||||
endif
|
||||
ifdef install-lib
|
||||
install-lib.a := $(filter lib%.a,$(install-lib))
|
||||
install-lib.a := $(filter-out $(install-lib-ldscripts),$(install-lib.a))
|
||||
install-lib-non.a := $(filter-out lib%.a,$(install-lib))
|
||||
ifdef install-lib-non.a
|
||||
$(addprefix $(inst_libdir)/$(libprefix),$(install-lib-non.a)): \
|
||||
@@ -1416,54 +1311,25 @@ define update-abi
|
||||
fi
|
||||
endef
|
||||
|
||||
# Patch all .abilist files for one DSO. The find command locates
|
||||
# abilist files for all architectures. The regular expression in the
|
||||
# find invocation is needed to separate libc.abilist and
|
||||
# libcrypt.abilist, for example. It assumes that abilist-pattern, if
|
||||
# set, is of the form "%-SUFFIX", and not "%SUFFIX", that is, there is
|
||||
# a non-alphanumeric seperator between the pattern and the suffix
|
||||
# added. The abilist files in /generic/ are filtered out because
|
||||
# these are expected to remain empty.
|
||||
define update-all-abi
|
||||
$(SHELL) $(..)scripts/update-abilist.sh $^ \
|
||||
$$(find $(..)sysdeps \
|
||||
-regextype posix-egrep -regex '.*/$*([^a-z0-9].*)?\.abilist$$' \
|
||||
\! -regex '.*/generic/.*')
|
||||
endef
|
||||
ifdef abilist-pattern
|
||||
update-all-abi-%: $(abilist-pattern) $(objpfx)%.symlist
|
||||
$(update-all-abi)
|
||||
update-all-abi-%: $(abilist-pattern) $(common-objpfx)%.symlist
|
||||
$(update-all-abi)
|
||||
endif
|
||||
update-all-abi-%: %.abilist $(objpfx)%.symlist
|
||||
$(update-all-abi)
|
||||
update-all-abi-%: %.abilist $(common-objpfx)%.symlist
|
||||
$(update-all-abi)
|
||||
|
||||
.PHONY: update-abi update-all-abi check-abi
|
||||
.PHONY: update-abi check-abi
|
||||
update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned))
|
||||
update-all-abi: $(patsubst %.so,update-all-abi-%,$(install-lib.so-versioned))
|
||||
check-abi-list = $(patsubst %.so,$(objpfx)check-abi-%.out, \
|
||||
$(install-lib.so-versioned))
|
||||
check-abi: $(check-abi-list)
|
||||
ifdef subdir
|
||||
subdir_check-abi: check-abi
|
||||
subdir_update-abi: update-abi
|
||||
subdir_update-all-abi: update-all-abi
|
||||
else
|
||||
check-abi: subdir_check-abi
|
||||
if grep -q '^FAIL:' $(objpfx)*/check-abi*.test-result; then \
|
||||
cat $(objpfx)*/check-abi*.out && exit 1; fi
|
||||
update-abi: subdir_update-abi
|
||||
update-all-abi: subdir_update-all-abi
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),elf)
|
||||
check-abi: $(objpfx)check-abi-libc.out
|
||||
tests-special += $(objpfx)check-abi-libc.out
|
||||
update-abi: update-abi-libc
|
||||
update-all-abi: update-all-abi-libc
|
||||
common-generated += libc.symlist
|
||||
endif
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
Open jobs for finishing GNU libc:
|
||||
---------------------------------
|
||||
Status: October 2004
|
||||
|
||||
If you have time and talent to take over any of the jobs below please
|
||||
contact <bug-glibc@gnu.org>.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
[ 1] Port to new platforms or test current version on formerly supported
|
||||
platforms.
|
||||
|
||||
**** See http://www.gnu.org/software/libc/porting.html for more details.
|
||||
|
||||
|
||||
[ 2] Test compliance with standards. If you have access to recent
|
||||
standards (IEEE, ISO, ANSI, X/Open, ...) and/or test suites you
|
||||
could do some checks as the goal is to be compliant with all
|
||||
standards if they do not contradict each other.
|
||||
|
||||
|
||||
[ 3] The IMHO opinion most important task is to write a more complete
|
||||
test suite. We cannot get too many people working on this. It is
|
||||
not difficult to write a test, find a definition of the function
|
||||
which I normally can provide, if necessary, and start writing tests
|
||||
to test for compliance. Beside this, take a look at the sources
|
||||
and write tests which in total test as many paths of execution as
|
||||
possible.
|
||||
|
||||
|
||||
[ 4] Write translations for the GNU libc message for the so far
|
||||
unsupported languages. GNU libc is fully internationalized and
|
||||
users can immediately benefit from this.
|
||||
|
||||
Take a look at the matrix in
|
||||
ftp://ftp.gnu.org/pub/gnu/ABOUT-NLS
|
||||
for the current status (of course better use a mirror of ftp.gnu.org).
|
||||
|
||||
|
||||
[ 8] If you enjoy assembler programming (as I do --drepper :-) you might
|
||||
be interested in writing optimized versions for some functions.
|
||||
Especially the string handling functions can be optimized a lot.
|
||||
|
||||
Take a look at
|
||||
|
||||
Faster String Functions
|
||||
Henry Spencer, University of Toronto
|
||||
Usenix Winter '92, pp. 419--428
|
||||
|
||||
or just ask. Currently mostly i?86 and Alpha optimized versions
|
||||
exist. Please ask before working on this to avoid duplicate
|
||||
work.
|
||||
|
||||
|
||||
[11] Write access function for netmasks, bootparams, and automount
|
||||
databases for nss_files, nss_nis, and nss_nisplus modules.
|
||||
The functions should be embedded in the nss scheme. This is not
|
||||
hard and not all services must be supported at once.
|
||||
|
||||
|
||||
[15] Cleaning up the header files. Ideally, each header style should
|
||||
follow the "good examples". Each variable and function should have
|
||||
a short description of the function and its parameters. The prototypes
|
||||
should always contain variable names which can help to identify their
|
||||
meaning; better than
|
||||
|
||||
int foo (int, int, int, int);
|
||||
|
||||
Blargh!
|
||||
|
||||
*** The conformtest.pl tool helps cleaning the namespace. As far as
|
||||
known the prototypes all contain parameter names. But maybe some
|
||||
comments can be improved.
|
||||
|
||||
|
||||
[18] Based on the sprof program we need tools to analyze the output. The
|
||||
result should be a link map which specifies in which order the .o
|
||||
files are placed in the shared object. This should help to improve
|
||||
code locality and result in a smaller footprint (in code and data
|
||||
memory) since less pages are only used in small parts.
|
||||
|
||||
|
||||
[19] A user-level STREAMS implementation should be available if the
|
||||
kernel does not provide the support.
|
||||
|
||||
*** This is a much lower priority job now that STREAMS are optional in
|
||||
XPG.
|
||||
|
||||
|
||||
[20] More conversion modules for iconv(3). Existing modules should be
|
||||
extended to do things like transliteration if this is wanted.
|
||||
For often used conversion a direct conversion function should be
|
||||
available.
|
||||
|
||||
|
||||
[23] The `strptime' function needs to be completed. This includes among
|
||||
other things that it must get teached about timezones. The solution
|
||||
envisioned is to extract the timezones from the ADO timezone
|
||||
specifications. Special care must be given names which are used
|
||||
multiple times. Here the precedence should (probably) be according
|
||||
to the geograhical distance. E.g., the timezone EST should be
|
||||
treated as the `Eastern Australia Time' instead of the US `Eastern
|
||||
Standard Time' if the current TZ variable is set to, say,
|
||||
Australia/Canberra or if the current locale is en_AU.
|
||||
|
||||
|
||||
[27] ...deleted...
|
||||
@@ -17,9 +17,7 @@ GNU/Hurd support requires out-of-tree patches that will eventually be
|
||||
incorporated into an official GNU C Library release.
|
||||
|
||||
When working with Linux kernels, this version of the GNU C Library
|
||||
requires Linux kernel version 3.2 or later on all architectures except
|
||||
i[4567]86 and x86_64, where Linux kernel version 2.6.32 or later
|
||||
suffices.
|
||||
requires Linux kernel version 2.6.32 or later.
|
||||
|
||||
Also note that the shared version of the libgcc_s library must be
|
||||
installed for the pthread library to work correctly.
|
||||
@@ -71,6 +69,6 @@ This web page gives detailed information on how to report bugs properly.
|
||||
The GNU C Library is free software. See the file COPYING.LIB for copying
|
||||
conditions, and LICENSES for notices about a few contributions that require
|
||||
these additional notices to be distributed. License copyright years may be
|
||||
listed using range notation, e.g., 1996-2015, indicating that every year in
|
||||
listed using range notation, e.g., 2000-2013, indicating that every year in
|
||||
the range, inclusive, is a copyrightable year that would otherwise be listed
|
||||
individually.
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
README for the glibc Python pretty printers
|
||||
===========================================
|
||||
|
||||
Pretty printers are gdb extensions that allow it to print useful, human-readable
|
||||
information about a program's variables. For example, for a pthread_mutex_t
|
||||
gdb would usually output something like this:
|
||||
|
||||
(gdb) print mutex
|
||||
$1 = {
|
||||
__data = {
|
||||
__lock = 22020096,
|
||||
__count = 0,
|
||||
__owner = 0,
|
||||
__nusers = 0,
|
||||
__kind = 576,
|
||||
__spins = 0,
|
||||
__elision = 0,
|
||||
__list = {
|
||||
__prev = 0x0,
|
||||
__next = 0x0
|
||||
}
|
||||
},
|
||||
__size = "\000\000P\001", '\000' <repeats 12 times>, "@\002", '\000' <repeats 21 times>,
|
||||
__align = 22020096
|
||||
}
|
||||
|
||||
However, with a pretty printer gdb will output something like this:
|
||||
|
||||
(gdb) print mutex
|
||||
$1 = pthread_mutex_t = {
|
||||
Type = Normal,
|
||||
Status = Not acquired,
|
||||
Robust = No,
|
||||
Shared = No,
|
||||
Protocol = Priority protect,
|
||||
Priority ceiling = 42
|
||||
}
|
||||
|
||||
Before printing a value, gdb will first check if there's a pretty printer
|
||||
registered for it. If there is, it'll use it, otherwise it'll print the value
|
||||
as usual. Pretty printers can be registered in various ways; for our purposes
|
||||
we register them for the current objfile by calling
|
||||
gdb.printing.register_pretty_printer().
|
||||
|
||||
Currently our printers are based on gdb.RegexpCollectionPrettyPrinter, which
|
||||
means they'll be triggered if the type of the variable we're printing matches
|
||||
a given regular expression. For example, MutexPrinter will be triggered if
|
||||
our variable's type matches the regexp '^pthread_mutex_t$'.
|
||||
|
||||
Besides the printers themselves, each module may have a constants file which the
|
||||
printers will import. These constants are generated from C headers during the
|
||||
build process, and need to be in the Python search path when loading the
|
||||
printers.
|
||||
|
||||
|
||||
Installing and loading
|
||||
----------------------
|
||||
|
||||
The pretty printers and their constant files may be installed in different paths
|
||||
for each distro, though gdb should be able to automatically load them by itself.
|
||||
When in doubt, you can use the 'info pretty-printer' gdb command to list the
|
||||
loaded pretty printers.
|
||||
|
||||
If the printers aren't automatically loaded for some reason, you should add the
|
||||
following to your .gdbinit:
|
||||
|
||||
python
|
||||
import sys
|
||||
sys.path.insert(0, '/path/to/constants/file/directory')
|
||||
end
|
||||
|
||||
source /path/to/printers.py
|
||||
|
||||
If you're building glibc manually, '/path/to/constants/file/directory' should be
|
||||
'/path/to/glibc-build/submodule', where 'submodule' is e.g. nptl.
|
||||
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
The pretty printers come with a small test suite based on PExpect, which is a
|
||||
Python module with Expect-like features for spawning and controlling interactive
|
||||
programs. Each printer has a corresponding C program and a Python script
|
||||
that uses PExpect to drive gdb through the program and compare its output to
|
||||
the expected printer's.
|
||||
|
||||
The tests run on the glibc host, which is assumed to have both gdb and PExpect;
|
||||
if any of those is absent the tests will fail with code 77 (UNSUPPORTED).
|
||||
Native builds can be tested simply by doing 'make check'; cross builds must use
|
||||
cross-test-ssh.sh as test-wrapper, like this:
|
||||
|
||||
make test-wrapper='/path/to/scripts/cross-test-ssh.sh user@host' check
|
||||
|
||||
(Remember to share the build system's filesystem with the glibc host's through
|
||||
NFS or something similar).
|
||||
|
||||
Running 'make check' on a cross build will only compile the test programs,
|
||||
without running the scripts.
|
||||
|
||||
|
||||
Adding new pretty printers
|
||||
--------------------------
|
||||
|
||||
Adding new pretty printers to glibc requires following these steps:
|
||||
|
||||
1. Identify which constants must be generated from C headers, and write the
|
||||
corresponding .pysym file. See scripts/gen-py-const.awk for more information
|
||||
on how this works. The name of the .pysym file must be added to the
|
||||
'gen-py-const-headers' variable in your submodule's Makefile (without the .pysym
|
||||
extension).
|
||||
|
||||
2. Write the pretty printer code itself. For this you can follow the gdb
|
||||
Python API documentation, and use the existing printers as examples. The printer
|
||||
code must import the generated constants file (which will have the same name
|
||||
as your .pysym file). The names of the pretty printer files must be added
|
||||
to the 'pretty-printers' variable in your submodule's Makefile (without the .py
|
||||
extension).
|
||||
|
||||
3. Write the unit tests for your pretty printers. The build system calls each
|
||||
test script passing it the paths to the test program source, the test program
|
||||
binary, and the printer files you added to 'pretty-printers' in the previous
|
||||
step. The test scripts, in turn, must import scripts/test_printers_common
|
||||
and call the init_test function passing it, among other things, the name of the
|
||||
set of pretty printers to enable (as seen by running 'info pretty-printer').
|
||||
You can use the existing unit tests as examples.
|
||||
|
||||
4. Add the names of the pretty printer tests to the 'tests-printers' variable
|
||||
in your submodule's Makefile (without extensions). In addition, for each test
|
||||
program you must define a corresponding CFLAGS-* and CPPFLAGS-* variable and
|
||||
set it to $(CFLAGS-printers-tests) to ensure they're compiled correctly. For
|
||||
example, test-foo-printer.c requires the following:
|
||||
|
||||
CFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests)
|
||||
CPPFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests)
|
||||
|
||||
Finally, if your programs need to be linked with a specific library, you can add
|
||||
its name to the 'tests-printers-libs' variable in your submodule's Makefile.
|
||||
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
* Pretty printers are inherently coupled to the code they're targetting, thus
|
||||
any changes to the target code must also update the corresponding printers.
|
||||
On the plus side, the printer code itself may serve as a kind of documentation
|
||||
for the target code.
|
||||
|
||||
* There's no guarantee that the information the pretty printers provide is
|
||||
complete, i.e. some details might be left off. For example, the pthread_mutex_t
|
||||
printers won't report whether a thread is spin-waiting in an attempt to acquire
|
||||
the mutex.
|
||||
|
||||
* Older versions of the gdb Python API have a bug where
|
||||
gdb.RegexpCollectionPrettyPrinter would not be able to get a value's real type
|
||||
if it was typedef'd. This would cause gdb to ignore the pretty printers for
|
||||
types like pthread_mutex_t, which is defined as:
|
||||
|
||||
typedef union
|
||||
{
|
||||
...
|
||||
} pthread_mutex_t;
|
||||
|
||||
This was fixed in commit 1b588015839caafc608a6944a78aea170f5fb2f6, and released
|
||||
as part of gdb 7.8. However, typedef'ing an already typedef'd type may cause
|
||||
a similar issue, e.g.:
|
||||
|
||||
typedef pthread_mutex_t mutex;
|
||||
mutex a_mutex;
|
||||
|
||||
Here, trying to print a_mutex won't trigger the pthread_mutex_t printer.
|
||||
|
||||
* The test programs must be compiled without optimizations. This is necessary
|
||||
because the test scripts rely on the C code structure being preserved when
|
||||
stepping through the programs. Things like aggressive instruction reordering
|
||||
or optimizing variables out may make this kind of testing impossible.
|
||||
@@ -1,85 +0,0 @@
|
||||
TUNABLE FRAMEWORK
|
||||
=================
|
||||
|
||||
Tunables is a feature in the GNU C Library that allows application authors and
|
||||
distribution maintainers to alter the runtime library behaviour to match their
|
||||
workload.
|
||||
|
||||
The tunable framework allows modules within glibc to register variables that
|
||||
may be tweaked through an environment variable. It aims to enforce a strict
|
||||
namespace rule to bring consistency to naming of these tunable environment
|
||||
variables across the project. This document is a guide for glibc developers to
|
||||
add tunables to the framework.
|
||||
|
||||
ADDING A NEW TUNABLE
|
||||
--------------------
|
||||
|
||||
The TOP_NAMESPACE macro is defined by default as 'glibc'. If distributions
|
||||
intend to add their own tunables, they should do so in a different top
|
||||
namespace by overriding the TOP_NAMESPACE macro for that tunable. Downstream
|
||||
implementations are discouraged from using the 'glibc' top namespace for
|
||||
tunables they don't already have consensus to push upstream.
|
||||
|
||||
There are two steps to adding a tunable:
|
||||
|
||||
1. Add a tunable ID:
|
||||
|
||||
Modules that wish to use the tunables interface must define the
|
||||
TUNABLE_NAMESPACE macro. Following this, for each tunable you want to
|
||||
add, make an entry in elf/dl-tunables.list. The format of the file is as
|
||||
follows:
|
||||
|
||||
TOP_NAMESPACE {
|
||||
NAMESPACE1 {
|
||||
TUNABLE1 {
|
||||
# tunable attributes, one per line
|
||||
}
|
||||
# A tunable with default attributes, i.e. string variable.
|
||||
TUNABLE2
|
||||
TUNABLE3 {
|
||||
# its attributes
|
||||
}
|
||||
}
|
||||
NAMESPACE2 {
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
The list of allowed attributes are:
|
||||
|
||||
- type: Data type. Defaults to STRING. Allowed types are:
|
||||
INT_32, SIZE_T and STRING.
|
||||
|
||||
- minval: Optional minimum acceptable value. For a string type
|
||||
this is the minimum length of the value.
|
||||
|
||||
- maxval: Optional maximum acceptable value. For a string type
|
||||
this is the maximum length of the value.
|
||||
|
||||
- env_alias: An alias environment variable
|
||||
|
||||
- is_secure: Specify whether the tunable should be read for setuid
|
||||
binaries. True allows the tunable to be read for
|
||||
setuid binaries while false disables it. Note that
|
||||
even if this is set as true and the value is read, it
|
||||
may not be used if it does not validate against the
|
||||
acceptable values or is not considered safe by the
|
||||
module.
|
||||
|
||||
2. Call either the TUNABLE_SET_VALUE and pass into it the tunable name and a
|
||||
pointer to the variable that should be set with the tunable value.
|
||||
If additional work needs to be done after setting the value, use the
|
||||
TUNABLE_SET_VALUE_WITH_CALLBACK instead and additionally pass a pointer to
|
||||
the function that should be called if the tunable value has been set.
|
||||
|
||||
FUTURE WORK
|
||||
-----------
|
||||
|
||||
The framework currently only allows a one-time initialization of variables
|
||||
through environment variables and in some cases, modification of variables via
|
||||
an API call. A future goals for this project include:
|
||||
|
||||
- Setting system-wide and user-wide defaults for tunables through some
|
||||
mechanism like a configuration file.
|
||||
|
||||
- Allow tweaking of some tunables at runtime
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -80,74 +80,29 @@ $(common-objpfx)dummy.c:
|
||||
(echo 'extern void __dummy__ (void);'; \
|
||||
echo 'void __dummy__ (void) { }') > $@
|
||||
common-generated += dummy.o dummy.c
|
||||
|
||||
ifneq "$(headers)" ""
|
||||
# Special test of all the installed headers in this directory.
|
||||
tests-special += $(objpfx)check-installed-headers-c.out
|
||||
libof-check-installed-headers-c := nonlib
|
||||
$(objpfx)check-installed-headers-c.out: \
|
||||
$(..)scripts/check-installed-headers.sh $(headers)
|
||||
$(SHELL) $(..)scripts/check-installed-headers.sh c \
|
||||
"$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
|
||||
$(headers) > $@; \
|
||||
$(evaluate-test)
|
||||
|
||||
ifneq "$(CXX)" ""
|
||||
tests-special += $(objpfx)check-installed-headers-cxx.out
|
||||
libof-check-installed-headers-cxx := nonlib
|
||||
$(objpfx)check-installed-headers-cxx.out: \
|
||||
$(..)scripts/check-installed-headers.sh $(headers)
|
||||
$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
|
||||
"$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
|
||||
$(headers) > $@; \
|
||||
$(evaluate-test)
|
||||
endif
|
||||
endif
|
||||
|
||||
# This makes all the auxiliary and test programs.
|
||||
|
||||
.PHONY: others tests bench bench-build
|
||||
|
||||
# Test programs for the pretty printers.
|
||||
tests-printers-programs := $(addprefix $(objpfx),$(tests-printers))
|
||||
|
||||
# .out files with the output of running the pretty printer tests.
|
||||
tests-printers-out := $(patsubst %,$(objpfx)%.out,$(tests-printers))
|
||||
|
||||
ifndef PYTHON
|
||||
# Mark tests-printers tests as unsupported if we don't have PYTHON.
|
||||
tests-unsupported += $(tests-printers)
|
||||
endif
|
||||
.PHONY: others tests bench
|
||||
|
||||
ifeq ($(build-programs),yes)
|
||||
others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
|
||||
else
|
||||
others: $(addprefix $(objpfx),$(extra-objs))
|
||||
endif
|
||||
|
||||
# Generate constant files for Python pretty printers if required.
|
||||
others: $(py-const)
|
||||
|
||||
ifeq ($(run-built-tests),no)
|
||||
tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests)) \
|
||||
$(test-srcs)) $(tests-special) \
|
||||
$(tests-printers-programs)
|
||||
tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-special)
|
||||
xtests: tests $(xtests-special)
|
||||
else
|
||||
tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out)
|
||||
tests: $(tests:%=$(objpfx)%.out) $(tests-special)
|
||||
xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
|
||||
endif
|
||||
|
||||
tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
|
||||
xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special))
|
||||
ifeq ($(run-built-tests),no)
|
||||
tests-expected =
|
||||
else
|
||||
tests-expected = $(tests) $(tests-printers)
|
||||
endif
|
||||
tests:
|
||||
$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
|
||||
$(sort $(tests-expected) $(tests-special-notdir:.out=)) \
|
||||
$(sort $(tests) $(tests-special-notdir:.out=)) \
|
||||
> $(objpfx)subdir-tests.sum
|
||||
xtests:
|
||||
$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
|
||||
@@ -194,7 +149,6 @@ endif
|
||||
|
||||
ifneq "$(strip $(binaries-shared-tests))" ""
|
||||
$(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \
|
||||
$(link-extra-libs-tests) \
|
||||
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link-tests)
|
||||
@@ -202,7 +156,6 @@ endif
|
||||
|
||||
ifneq "$(strip $(binaries-pie-tests))" ""
|
||||
$(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \
|
||||
$(link-extra-libs-tests) \
|
||||
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link-pie-tests)
|
||||
@@ -224,7 +177,6 @@ endif
|
||||
|
||||
ifneq "$(strip $(binaries-static-tests))" ""
|
||||
$(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \
|
||||
$(link-extra-libs-tests) \
|
||||
$(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link-static-tests)
|
||||
@@ -234,11 +186,9 @@ ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
|
||||
# These are the implicit rules for making test outputs
|
||||
# from the test programs and whatever input files are present.
|
||||
|
||||
define make-test-out
|
||||
$(if $($*-ENV-only),$(test-wrapper-env-only) $($*-ENV-only),\
|
||||
$(test-wrapper-env) $(run-program-env) $($*-ENV)) \
|
||||
$(host-test-program-cmd) $($*-ARGS)
|
||||
endef
|
||||
make-test-out = $(test-wrapper-env) \
|
||||
$(run-program-env) \
|
||||
$($*-ENV) $(host-test-program-cmd) $($*-ARGS)
|
||||
$(objpfx)%.out: %.input $(objpfx)%
|
||||
$(make-test-out) > $@ < $(word 1,$^); \
|
||||
$(evaluate-test)
|
||||
@@ -246,45 +196,8 @@ $(objpfx)%.out: /dev/null $(objpfx)% # Make it 2nd arg for canned sequence.
|
||||
$(make-test-out) > $@; \
|
||||
$(evaluate-test)
|
||||
|
||||
# tests-unsupported lists tests that we will not try to build at all in
|
||||
# this configuration. Note this runs every time because it does not
|
||||
# actually create its target. The dependency on Makefile is meant to
|
||||
# ensure that it runs after a Makefile change to add a test to the list
|
||||
# when it previously ran and produced a .out file (probably for a failure).
|
||||
ifneq "$(strip $(tests-unsupported))" ""
|
||||
$(tests-unsupported:%=$(objpfx)%.out): $(objpfx)%.out: Makefile
|
||||
@rm -f $@
|
||||
$(..)scripts/evaluate-test.sh $(patsubst $(common-objpfx)%.out,%,$@) \
|
||||
77 false false > $(@:.out=.test-result)
|
||||
endif
|
||||
|
||||
endif # tests
|
||||
|
||||
ifdef PYTHON
|
||||
ifneq "$(strip $(tests-printers))" ""
|
||||
|
||||
# Static pattern rule for building the test programs for the pretty printers.
|
||||
$(tests-printers-programs): %: %.o $(tests-printers-libs) \
|
||||
$(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link-printers-tests)
|
||||
|
||||
# Add the paths to the generated constants file and test_common_printers.py
|
||||
# to PYTHONPATH so the test scripts can find them.
|
||||
py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH}
|
||||
|
||||
# Static pattern rule that matches the test-* targets to their .c and .py
|
||||
# prerequisites. It'll run the corresponding test script for each test program
|
||||
# we compiled and place its output in the corresponding .out file.
|
||||
# The pretty printer files and test_common_printers.py must be present for all.
|
||||
$(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \
|
||||
$(..)scripts/test_printers_common.py
|
||||
$(test-wrapper-env) $(py-env) \
|
||||
$(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
|
||||
$(evaluate-test)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: distclean realclean subdir_distclean subdir_realclean \
|
||||
subdir_clean subdir_mostlyclean subdir_testclean
|
||||
|
||||
@@ -28,7 +28,5 @@
|
||||
|
||||
.*-.*-syllable.* 5 2.0.0 # just an arbitrary value
|
||||
|
||||
.*-.*-nacl.* 6 42.0.0 # earliest compatible Chromium version
|
||||
|
||||
# There is no catch-all default here because every supported OS that uses
|
||||
# ELF must have its own unique ABI tag.
|
||||
|
||||
Vendored
+4
-4
@@ -141,7 +141,7 @@ int _start (void) { return 0; }
|
||||
int __start (void) { return 0; }
|
||||
$1
|
||||
EOF
|
||||
AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
|
||||
AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
|
||||
conftest.c -static -nostartfiles -nostdlib
|
||||
1>&AS_MESSAGE_LOG_FD])],
|
||||
[$2], [$3])
|
||||
@@ -226,7 +226,7 @@ if test x"$gnu_ld" = x"yes"; then
|
||||
cat > conftest.c <<EOF
|
||||
int _start (void) { return 42; }
|
||||
EOF
|
||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
|
||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||
$2 -nostdlib -nostartfiles
|
||||
-fPIC -shared -o conftest.so conftest.c
|
||||
1>&AS_MESSAGE_LOG_FD])
|
||||
@@ -268,7 +268,7 @@ libc_compiler_builtin_inlined=no
|
||||
cat > conftest.c <<EOF
|
||||
int _start (void) { $2 return 0; }
|
||||
EOF
|
||||
if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
|
||||
if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||
$3 -nostdlib -nostartfiles
|
||||
-S conftest.c -o - | fgrep "$1"
|
||||
1>&AS_MESSAGE_LOG_FD])
|
||||
@@ -296,7 +296,7 @@ case "$prefix" in
|
||||
if test "$libdir" = '${exec_prefix}/lib'; then
|
||||
libdir='${exec_prefix}/$1';
|
||||
# Locale data can be shared between 32-bit and 64-bit libraries.
|
||||
libc_cv_complocaledir='${exec_prefix}/lib/locale'
|
||||
libc_cv_localedir='${exec_prefix}/lib/locale'
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
|
||||
Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Default definition for ARGP_ERR_EXIT_STATUS
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Word-wrapping and line-truncating streams
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -100,11 +100,7 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
|
||||
__argp_fmtstream_update (fs);
|
||||
if (fs->p > fs->buf)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
__fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
|
||||
#else
|
||||
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
|
||||
#endif
|
||||
}
|
||||
free (fs->buf);
|
||||
free (fs);
|
||||
|
||||
+16
-5
@@ -1,5 +1,5 @@
|
||||
/* Word-wrapping and line-truncating streams.
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -29,6 +29,21 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
|
||||
defined __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
|
||||
defined __STRICT_ANSI__
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
|
||||
/* line_wrap_stream is available, so use that. */
|
||||
#define ARGP_FMTSTREAM_USE_LINEWRAP
|
||||
@@ -96,8 +111,6 @@ struct argp_fmtstream
|
||||
|
||||
typedef struct argp_fmtstream *argp_fmtstream_t;
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
|
||||
written on it with LMARGIN spaces and limits them to RMARGIN columns
|
||||
total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
|
||||
@@ -284,8 +297,6 @@ __argp_fmtstream_point (argp_fmtstream_t __fs)
|
||||
|
||||
#endif /* __OPTIMIZE__ */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
|
||||
|
||||
#endif /* argp-fmtstream.h */
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Real definitions for extern inline functions in argp-fmtstream.h
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Hierarchial argument parsing help output
|
||||
Copyright (C) 1995-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Name frobnication for compiling argp outside of glibc
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Hierarchial argument parsing, layered over getopt
|
||||
Copyright (C) 1995-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Default definition for ARGP_PROGRAM_VERSION.
|
||||
Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
|
||||
Copyright (C) 1996-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Test program for argp argument parser
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/* Real definitions for extern inline functions in argp.h
|
||||
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
|
||||
+43
-5
@@ -1,5 +1,5 @@
|
||||
/* Hierarchial argument parsing, layered over getopt.
|
||||
Copyright (C) 1995-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Written by Miles Bader <miles@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -28,12 +28,48 @@
|
||||
#define __need_error_t
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef __THROW
|
||||
# define __THROW
|
||||
#endif
|
||||
#ifndef __NTH
|
||||
# define __NTH(fct) fct __THROW
|
||||
#endif
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
|
||||
defined __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
|
||||
defined __STRICT_ANSI__
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||
"restrict", and "configure" may have defined "restrict". */
|
||||
#ifndef __restrict
|
||||
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
|
||||
# if defined restrict || 199901L <= __STDC_VERSION__
|
||||
# define __restrict restrict
|
||||
# else
|
||||
# define __restrict
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __error_t_defined
|
||||
typedef int error_t;
|
||||
# define __error_t_defined
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* A description of a particular option. A pointer to an array of
|
||||
these is passed in the OPTIONS field of an argp structure. Each option
|
||||
@@ -511,7 +547,7 @@ extern void *__argp_input (const struct argp *__restrict __argp,
|
||||
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
|
||||
# if !(defined _LIBC && _LIBC)
|
||||
# if !_LIBC
|
||||
# define __argp_usage argp_usage
|
||||
# define __argp_state_help argp_state_help
|
||||
# define __option_is_short _option_is_short
|
||||
@@ -546,7 +582,7 @@ __NTH (__option_is_end (const struct argp_option *__opt))
|
||||
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
|
||||
}
|
||||
|
||||
# if !(defined _LIBC && _LIBC)
|
||||
# if !_LIBC
|
||||
# undef __argp_usage
|
||||
# undef __argp_state_help
|
||||
# undef __option_is_short
|
||||
@@ -554,6 +590,8 @@ __NTH (__option_is_end (const struct argp_option *__opt))
|
||||
# endif
|
||||
#endif /* Use extern inlines. */
|
||||
|
||||
__END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* argp.h */
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Jakub Jelinek <jakub@redhat.com>, 2007.
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2000-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
+6
-18
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -82,23 +82,10 @@ extern void __assert (const char *__assertion, const char *__file, int __line)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/* When possible, define assert so that it does not add extra
|
||||
parentheses around EXPR. Otherwise, those added parentheses would
|
||||
suppress warnings we'd expect to be detected by gcc's -Wparentheses. */
|
||||
# if !defined __GNUC__ || defined __STRICT_ANSI__
|
||||
# define assert(expr) \
|
||||
((expr) \
|
||||
? __ASSERT_VOID_CAST (0) \
|
||||
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
|
||||
# else
|
||||
# define assert(expr) \
|
||||
({ \
|
||||
if (expr) \
|
||||
; /* empty */ \
|
||||
else \
|
||||
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
|
||||
})
|
||||
# endif
|
||||
# define assert(expr) \
|
||||
((expr) \
|
||||
? __ASSERT_VOID_CAST (0) \
|
||||
: __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION))
|
||||
|
||||
# ifdef __USE_GNU
|
||||
# define assert_perror(errnum) \
|
||||
@@ -126,6 +113,7 @@ __END_DECLS
|
||||
|
||||
|
||||
#if defined __USE_ISOC11 && !defined __cplusplus
|
||||
/* Static assertion. Requires support in the compiler. */
|
||||
# undef static_assert
|
||||
# define static_assert _Static_assert
|
||||
#endif
|
||||
|
||||
+19
-74
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -15,72 +15,38 @@
|
||||
# License along with the GNU C Library; if not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
# Makefile for benchmark tests. The only useful target here is `bench`.
|
||||
# Add benchmark functions in alphabetical order.
|
||||
|
||||
subdir := benchtests
|
||||
|
||||
include ../Makeconfig
|
||||
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \
|
||||
modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \
|
||||
fmaxf
|
||||
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 ffs ffsll \
|
||||
log log2 modf pow rint sin sincos sinh sqrt tan tanh
|
||||
|
||||
bench-pthread := pthread_once
|
||||
|
||||
bench-string := ffs ffsll
|
||||
|
||||
bench := $(bench-math) $(bench-pthread) $(bench-string)
|
||||
bench := $(bench-math) $(bench-pthread)
|
||||
|
||||
# String function benchmarks.
|
||||
string-benchset := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
||||
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
||||
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
||||
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
||||
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok \
|
||||
strcoll memcpy-large memmove-large memset-large
|
||||
string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
||||
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
||||
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
||||
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
||||
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok
|
||||
string-bench-all := $(string-bench)
|
||||
|
||||
# Build and run locale-dependent benchmarks only if we're building natively.
|
||||
ifeq (no,$(cross-compiling))
|
||||
wcsmbs-benchset := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat \
|
||||
wcscmp wcsncmp wcschr wcschrnul wcsrchr wcsspn wcspbrk wcscspn \
|
||||
wmemchr wmemset wmemcmp
|
||||
else
|
||||
wcsmbs-benchset :=
|
||||
endif
|
||||
stdlib-bench := strtod
|
||||
|
||||
string-benchset-all := $(string-benchset) ${wcsmbs-benchset}
|
||||
|
||||
ifeq (no,$(cross-compiling))
|
||||
# We have to generate locales
|
||||
LOCALES := en_US.UTF-8 tr_TR.UTF-8 cs_CZ.UTF-8 fa_IR.UTF-8 fr_FR.UTF-8 \
|
||||
ja_JP.UTF-8 si_LK.UTF-8 en_GB.UTF-8 vi_VN.UTF-8 ar_SA.UTF-8 \
|
||||
da_DK.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 el_GR.UTF-8 ru_RU.UTF-8 \
|
||||
he_IL.UTF-8 is_IS.UTF-8 es_ES.UTF-8 hi_IN.UTF-8 sv_SE.UTF-8 \
|
||||
hu_HU.UTF-8 it_IT.UTF-8 sr_RS.UTF-8 zh_CN.UTF-8
|
||||
include ../gen-locales.mk
|
||||
endif
|
||||
|
||||
stdlib-benchset := strtod
|
||||
|
||||
stdio-common-benchset := sprintf
|
||||
|
||||
math-benchset := math-inlines
|
||||
|
||||
benchset := $(string-benchset-all) $(stdlib-benchset) $(stdio-common-benchset) \
|
||||
$(math-benchset)
|
||||
benchset := $(string-bench-all) $(stdlib-bench)
|
||||
|
||||
CFLAGS-bench-ffs.c += -fno-builtin
|
||||
CFLAGS-bench-ffsll.c += -fno-builtin
|
||||
CFLAGS-bench-sqrt.c += -fno-builtin
|
||||
CFLAGS-bench-fmin.c += -fno-builtin
|
||||
CFLAGS-bench-fminf.c += -fno-builtin
|
||||
CFLAGS-bench-fmax.c += -fno-builtin
|
||||
CFLAGS-bench-fmaxf.c += -fno-builtin
|
||||
|
||||
bench-malloc := malloc-thread
|
||||
|
||||
$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
|
||||
$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
|
||||
$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
|
||||
$(objpfx)bench-malloc-thread: $(shared-thread-library)
|
||||
|
||||
@@ -125,15 +91,13 @@ cpp-srcs-left := $(binaries-benchset:=.c) $(binaries-bench:=.c) \
|
||||
lib := nonlib
|
||||
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
|
||||
|
||||
bench-extra-objs = json-lib.o
|
||||
|
||||
extra-objs += $(bench-extra-objs)
|
||||
extra-objs += json-lib.o
|
||||
|
||||
bench-deps := bench-skeleton.c bench-timing.h Makefile
|
||||
|
||||
run-bench = $(test-wrapper-env) \
|
||||
$(run-program-env) \
|
||||
$($*-ENV) $(test-via-rtld-prefix) $${run}
|
||||
$($*-ENV) $(rtld-prefix) $${run}
|
||||
|
||||
timing-type := $(objpfx)bench-timing-type
|
||||
|
||||
@@ -142,26 +106,8 @@ bench-clean:
|
||||
rm -f $(binaries-benchset) $(addsuffix .o,$(binaries-benchset))
|
||||
rm -f $(binaries-bench-malloc) $(addsuffix .o,$(binaries-bench-malloc))
|
||||
rm -f $(timing-type) $(addsuffix .o,$(timing-type))
|
||||
rm -f $(addprefix $(objpfx),$(bench-extra-objs))
|
||||
|
||||
# Define the bench target only if the target has a usable python installation.
|
||||
ifdef PYTHON
|
||||
bench: bench-build bench-set bench-func bench-malloc
|
||||
else
|
||||
bench:
|
||||
@echo "The bench target needs python to run."
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
# Target to only build the benchmark without running it. We generate locales
|
||||
# only if we're building natively.
|
||||
ifeq (no,$(cross-compiling))
|
||||
bench-build: $(gen-locales) $(timing-type) $(binaries-bench) \
|
||||
$(binaries-benchset) $(binaries-bench-malloc)
|
||||
else
|
||||
bench-build: $(timing-type) $(binaries-bench) $(binaries-benchset) \
|
||||
$(binaries-bench-malloc)
|
||||
endif
|
||||
bench: $(timing-type) bench-set bench-func bench-malloc
|
||||
|
||||
bench-set: $(binaries-benchset)
|
||||
for run in $^; do \
|
||||
@@ -198,19 +144,18 @@ bench-func: $(binaries-bench)
|
||||
mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
|
||||
fi; \
|
||||
mv -f $(objpfx)bench.out-tmp $(objpfx)bench.out
|
||||
$(PYTHON) scripts/validate_benchout.py $(objpfx)bench.out \
|
||||
scripts/validate_benchout.py $(objpfx)bench.out \
|
||||
scripts/benchout.schema.json
|
||||
|
||||
$(timing-type) $(binaries-bench) $(binaries-benchset) \
|
||||
$(binaries-bench-malloc): %: %.o $(objpfx)json-lib.o \
|
||||
$(link-extra-libs-tests) \
|
||||
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link-tests)
|
||||
$(+link)
|
||||
|
||||
$(objpfx)bench-%.c: %-inputs $(bench-deps)
|
||||
{ if [ -n "$($*-INCLUDE)" ]; then \
|
||||
cat $($*-INCLUDE); \
|
||||
fi; \
|
||||
$(PYTHON) scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp
|
||||
scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp
|
||||
mv -f $@-tmp $@
|
||||
|
||||
@@ -34,25 +34,6 @@ the benchmark to use clock_gettime by invoking make as follows:
|
||||
|
||||
Again, one must run `make bench-clean' before changing the measurement method.
|
||||
|
||||
Running benchmarks on another target:
|
||||
====================================
|
||||
|
||||
If the target where you want to run benchmarks is not capable of building the
|
||||
code or you're cross-building, you could build and execute the benchmark in
|
||||
separate steps. On the build system run:
|
||||
|
||||
$ make bench-build
|
||||
|
||||
and then copy the source and build directories to the target and run the
|
||||
benchmarks from the build directory as usual:
|
||||
|
||||
$ make bench
|
||||
|
||||
make sure the copy preserves timestamps by using either rsync or scp -p
|
||||
otherwise the above command may try to build the benchmark again. Benchmarks
|
||||
that require generated code to be executed during the build are skipped when
|
||||
cross-building.
|
||||
|
||||
Adding a function to benchtests:
|
||||
===============================
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure bcopy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure bzero functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Benchmark malloc and free functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,285 +0,0 @@
|
||||
/* Measure math inline functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define SIZE 1024
|
||||
#define TEST_MAIN
|
||||
#define TEST_NAME "math-inlines"
|
||||
#define TEST_FUNCTION test_main ()
|
||||
#include "bench-timing.h"
|
||||
#include "json-lib.h"
|
||||
#include "bench-util.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define BOOLTEST(func) \
|
||||
static int __attribute__((noinline)) \
|
||||
func ## _f (double d, int i) \
|
||||
{ \
|
||||
if (func (d)) \
|
||||
return (int) d + i; \
|
||||
else \
|
||||
return 5; \
|
||||
} \
|
||||
static int \
|
||||
func ## _t (volatile double *p, size_t n, size_t iters) \
|
||||
{ \
|
||||
int i, j; \
|
||||
int res = 0; \
|
||||
for (j = 0; j < iters; j++) \
|
||||
for (i = 0; i < n; i++) \
|
||||
if (func ## _f (p[i] * 2.0, i) != 0) \
|
||||
res += 5; \
|
||||
return res; \
|
||||
}
|
||||
|
||||
#define VALUETEST(func) \
|
||||
static int __attribute__((noinline)) \
|
||||
func ## _f (double d) \
|
||||
{ \
|
||||
return func (d); \
|
||||
} \
|
||||
static int \
|
||||
func ## _t (volatile double *p, size_t n, size_t iters) \
|
||||
{ \
|
||||
int i, j; \
|
||||
int res = 0; \
|
||||
for (j = 0; j < iters; j++) \
|
||||
for (i = 0; i < n; i++) \
|
||||
res += func ## _f (p[i] * 2.0); \
|
||||
return res; \
|
||||
}
|
||||
|
||||
typedef union
|
||||
{
|
||||
double value;
|
||||
uint64_t word;
|
||||
} ieee_double_shape_type;
|
||||
|
||||
#define EXTRACT_WORDS64(i,d) \
|
||||
do { \
|
||||
ieee_double_shape_type gh_u; \
|
||||
gh_u.value = (d); \
|
||||
(i) = gh_u.word; \
|
||||
} while (0)
|
||||
|
||||
/* Inlines similar to existing math_private.h versions. */
|
||||
|
||||
static __always_inline int
|
||||
__isnan_inl (double d)
|
||||
{
|
||||
uint64_t di;
|
||||
EXTRACT_WORDS64 (di, d);
|
||||
return (di & 0x7fffffffffffffffull) > 0x7ff0000000000000ull;
|
||||
}
|
||||
|
||||
static __always_inline int
|
||||
__isinf_ns2 (double d)
|
||||
{
|
||||
uint64_t di;
|
||||
EXTRACT_WORDS64 (di, d);
|
||||
return (di & 0x7fffffffffffffffull) == 0x7ff0000000000000ull;
|
||||
}
|
||||
|
||||
static __always_inline int
|
||||
__finite_inl (double d)
|
||||
{
|
||||
uint64_t di;
|
||||
EXTRACT_WORDS64 (di, d);
|
||||
return (di & 0x7fffffffffffffffull) < 0x7ff0000000000000ull;
|
||||
}
|
||||
|
||||
#define __isnormal_inl(X) (__fpclassify (X) == FP_NORMAL)
|
||||
|
||||
/* Inlines for the builtin functions. */
|
||||
|
||||
#define __isnan_builtin(X) __builtin_isnan (X)
|
||||
#define __isinf_ns_builtin(X) __builtin_isinf (X)
|
||||
#define __isinf_builtin(X) __builtin_isinf_sign (X)
|
||||
#define __isfinite_builtin(X) __builtin_isfinite (X)
|
||||
#define __isnormal_builtin(X) __builtin_isnormal (X)
|
||||
#define __fpclassify_builtin(X) __builtin_fpclassify (FP_NAN, FP_INFINITE, \
|
||||
FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (X))
|
||||
|
||||
static double __attribute ((noinline))
|
||||
kernel_standard (double x, double y, int z)
|
||||
{
|
||||
return x * y + z;
|
||||
}
|
||||
|
||||
volatile double rem1 = 2.5;
|
||||
|
||||
static __always_inline double
|
||||
remainder_test1 (double x)
|
||||
{
|
||||
double y = rem1;
|
||||
if (((__builtin_expect (y == 0.0, 0) && !__isnan_inl (x))
|
||||
|| (__builtin_expect (__isinf_ns2 (x), 0) && !__isnan_inl (y))))
|
||||
return kernel_standard (x, y, 10);
|
||||
|
||||
return remainder (x, y);
|
||||
}
|
||||
|
||||
static __always_inline double
|
||||
remainder_test2 (double x)
|
||||
{
|
||||
double y = rem1;
|
||||
if (((__builtin_expect (y == 0.0, 0) && !__builtin_isnan (x))
|
||||
|| (__builtin_expect (__builtin_isinf (x), 0) && !__builtin_isnan (y))))
|
||||
return kernel_standard (x, y, 10);
|
||||
|
||||
return remainder (x, y);
|
||||
}
|
||||
|
||||
/* Create test functions for each possibility. */
|
||||
|
||||
BOOLTEST (__isnan)
|
||||
BOOLTEST (__isnan_inl)
|
||||
BOOLTEST (__isnan_builtin)
|
||||
BOOLTEST (isnan)
|
||||
|
||||
BOOLTEST (__isinf)
|
||||
BOOLTEST (__isinf_builtin)
|
||||
BOOLTEST (__isinf_ns2)
|
||||
BOOLTEST (__isinf_ns_builtin)
|
||||
BOOLTEST (isinf)
|
||||
|
||||
BOOLTEST (__finite)
|
||||
BOOLTEST (__finite_inl)
|
||||
BOOLTEST (__isfinite_builtin)
|
||||
BOOLTEST (isfinite)
|
||||
|
||||
BOOLTEST (__isnormal_inl)
|
||||
BOOLTEST (__isnormal_builtin)
|
||||
BOOLTEST (isnormal)
|
||||
|
||||
VALUETEST (__fpclassify)
|
||||
VALUETEST (__fpclassify_builtin)
|
||||
VALUETEST (fpclassify)
|
||||
|
||||
VALUETEST (remainder_test1)
|
||||
VALUETEST (remainder_test2)
|
||||
|
||||
typedef int (*proto_t) (volatile double *p, size_t n, size_t iters);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
proto_t fn;
|
||||
} impl_t;
|
||||
|
||||
#define IMPL(name) { #name, name ## _t }
|
||||
|
||||
static impl_t test_list[] =
|
||||
{
|
||||
IMPL (__isnan),
|
||||
IMPL (__isnan_inl),
|
||||
IMPL (__isnan_builtin),
|
||||
IMPL (isnan),
|
||||
|
||||
IMPL (__isinf),
|
||||
IMPL (__isinf_ns2),
|
||||
IMPL (__isinf_ns_builtin),
|
||||
IMPL (__isinf_builtin),
|
||||
IMPL (isinf),
|
||||
|
||||
IMPL (__finite),
|
||||
IMPL (__finite_inl),
|
||||
IMPL (__isfinite_builtin),
|
||||
IMPL (isfinite),
|
||||
|
||||
IMPL (__isnormal_inl),
|
||||
IMPL (__isnormal_builtin),
|
||||
IMPL (isnormal),
|
||||
|
||||
IMPL (__fpclassify),
|
||||
IMPL (__fpclassify_builtin),
|
||||
IMPL (fpclassify),
|
||||
|
||||
IMPL (remainder_test1),
|
||||
IMPL (remainder_test2)
|
||||
};
|
||||
|
||||
static void
|
||||
do_one_test (json_ctx_t *json_ctx, proto_t test_fn, volatile double *arr,
|
||||
size_t len, const char *testname)
|
||||
{
|
||||
size_t iters = 500;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
json_attr_object_begin (json_ctx, testname);
|
||||
|
||||
TIMING_NOW (start);
|
||||
test_fn (arr, len, iters);
|
||||
TIMING_NOW (stop);
|
||||
TIMING_DIFF (cur, start, stop);
|
||||
|
||||
json_attr_double (json_ctx, "duration", cur);
|
||||
json_attr_double (json_ctx, "iterations", iters);
|
||||
json_attr_double (json_ctx, "mean", cur / iters);
|
||||
json_attr_object_end (json_ctx);
|
||||
}
|
||||
|
||||
static volatile double arr1[SIZE];
|
||||
static volatile double arr2[SIZE];
|
||||
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
json_ctx_t json_ctx;
|
||||
size_t i;
|
||||
|
||||
bench_start ();
|
||||
|
||||
json_init (&json_ctx, 2, stdout);
|
||||
json_attr_object_begin (&json_ctx, TEST_NAME);
|
||||
|
||||
/* Create 2 test arrays, one with 10% zeroes, 10% negative values,
|
||||
79% positive values and 1% infinity/NaN. The other contains
|
||||
50% inf, 50% NaN. This relies on rand behaving correctly. */
|
||||
|
||||
for (i = 0; i < SIZE; i++)
|
||||
{
|
||||
int x = rand () & 255;
|
||||
arr1[i] = (x < 25) ? 0.0 : ((x < 50) ? -1 : 100);
|
||||
if (x == 255) arr1[i] = __builtin_inf ();
|
||||
if (x == 254) arr1[i] = __builtin_nan ("0");
|
||||
arr2[i] = (x < 128) ? __builtin_inf () : __builtin_nan ("0");
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof (test_list) / sizeof (test_list[0]); i++)
|
||||
{
|
||||
json_attr_object_begin (&json_ctx, test_list[i].name);
|
||||
do_one_test (&json_ctx, test_list[i].fn, arr2, SIZE, "inf/nan");
|
||||
json_attr_object_end (&json_ctx);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof (test_list) / sizeof (test_list[0]); i++)
|
||||
{
|
||||
json_attr_object_begin (&json_ctx, test_list[i].name);
|
||||
do_one_test (&json_ctx, test_list[i].fn, arr1, SIZE, "normal");
|
||||
json_attr_object_end (&json_ctx);
|
||||
}
|
||||
|
||||
json_attr_object_end (&json_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "bench-util.c"
|
||||
#include "../test-skeleton.c"
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memccpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -160,4 +160,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+25
-48
@@ -1,5 +1,5 @@
|
||||
/* Measure memchr functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -16,52 +16,31 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef WIDE
|
||||
# define CHAR char
|
||||
# define SMALL_CHAR 127
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define CHAR wchar_t
|
||||
# define SMALL_CHAR 1273
|
||||
#endif /* WIDE */
|
||||
|
||||
#ifndef USE_AS_MEMRCHR
|
||||
# define TEST_MAIN
|
||||
# ifndef WIDE
|
||||
# define TEST_NAME "memchr"
|
||||
# else
|
||||
# define TEST_NAME "wmemchr"
|
||||
# endif /* WIDE */
|
||||
# define TEST_NAME "memchr"
|
||||
# include "bench-string.h"
|
||||
|
||||
# ifndef WIDE
|
||||
# define MEMCHR memchr
|
||||
# define SIMPLE_MEMCHR simple_memchr
|
||||
# else
|
||||
# define MEMCHR wmemchr
|
||||
# define SIMPLE_MEMCHR simple_wmemchr
|
||||
# endif /* WIDE */
|
||||
typedef char *(*proto_t) (const char *, int, size_t);
|
||||
char *simple_memchr (const char *, int, size_t);
|
||||
|
||||
typedef CHAR *(*proto_t) (const CHAR *, int, size_t);
|
||||
CHAR *SIMPLE_MEMCHR (const CHAR *, int, size_t);
|
||||
IMPL (simple_memchr, 0)
|
||||
IMPL (memchr, 1)
|
||||
|
||||
IMPL (SIMPLE_MEMCHR, 0)
|
||||
IMPL (MEMCHR, 1)
|
||||
|
||||
CHAR *
|
||||
SIMPLE_MEMCHR (const CHAR *s, int c, size_t n)
|
||||
char *
|
||||
simple_memchr (const char *s, int c, size_t n)
|
||||
{
|
||||
while (n--)
|
||||
if (*s++ == (CHAR) c)
|
||||
return (CHAR *) s - 1;
|
||||
if (*s++ == (char) c)
|
||||
return (char *) s - 1;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !USE_AS_MEMRCHR */
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, int c, size_t n, CHAR *exp_res)
|
||||
do_one_test (impl_t *impl, const char *s, int c, size_t n, char *exp_res)
|
||||
{
|
||||
CHAR *res = CALL (impl, s, c, n);
|
||||
char *res = CALL (impl, s, c, n);
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
@@ -89,38 +68,36 @@ static void
|
||||
do_test (size_t align, size_t pos, size_t len, int seek_char)
|
||||
{
|
||||
size_t i;
|
||||
CHAR *result;
|
||||
char *result;
|
||||
|
||||
align &= 7;
|
||||
if ((align + len) * sizeof (CHAR) >= page_size)
|
||||
if (align + len >= page_size)
|
||||
return;
|
||||
|
||||
CHAR *buf = (CHAR *) (buf1);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
buf[align + i] = 1 + 23 * i % SMALL_CHAR;
|
||||
if (buf[align + i] == seek_char)
|
||||
buf[align + i] = seek_char + 1;
|
||||
buf1[align + i] = 1 + 23 * i % 127;
|
||||
if (buf1[align + i] == seek_char)
|
||||
buf1[align + i] = seek_char + 1;
|
||||
}
|
||||
buf[align + len] = 0;
|
||||
buf1[align + len] = 0;
|
||||
|
||||
if (pos < len)
|
||||
{
|
||||
buf[align + pos] = seek_char;
|
||||
buf[align + len] = -seek_char;
|
||||
result = (CHAR *) (buf + align + pos);
|
||||
buf1[align + pos] = seek_char;
|
||||
buf1[align + len] = -seek_char;
|
||||
result = (char *) (buf1 + align + pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = NULL;
|
||||
buf[align + len] = seek_char;
|
||||
buf1[align + len] = seek_char;
|
||||
}
|
||||
|
||||
printf ("Length %4zd, alignment %2zd:", pos, align);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, (CHAR *) (buf + align), seek_char, len, result);
|
||||
do_one_test (impl, (char *) (buf1 + align), seek_char, len, result);
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
@@ -153,4 +130,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memcmp functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -174,5 +174,4 @@ test_main (void)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/* Measure memcpy functions with large data sizes.
|
||||
Copyright (C) 2016-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef MEMCPY_RESULT
|
||||
# define MEMCPY_RESULT(dst, len) dst
|
||||
# define START_SIZE (64 * 1024)
|
||||
# define MIN_PAGE_SIZE (getpagesize () + 32 * 1024 * 1024)
|
||||
# define TEST_MAIN
|
||||
# define TEST_NAME "memcpy"
|
||||
# define TIMEOUT (20 * 60)
|
||||
# include "bench-string.h"
|
||||
|
||||
IMPL (memcpy, 1)
|
||||
#endif
|
||||
|
||||
typedef char *(*proto_t) (char *, const char *, size_t);
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, char *dst, const char *src,
|
||||
size_t len)
|
||||
{
|
||||
size_t i, iters = 16;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
/* Must clear the destination buffer updated by the previous run. */
|
||||
for (i = 0; i < len; i++)
|
||||
dst[i] = 0;
|
||||
|
||||
if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s %p %p", impl->name,
|
||||
CALL (impl, dst, src, len), MEMCPY_RESULT (dst, len));
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (memcmp (dst, src, len) != 0)
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
|
||||
impl->name, dst, src);
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
TIMING_NOW (start);
|
||||
for (i = 0; i < iters; ++i)
|
||||
{
|
||||
CALL (impl, dst, src, len);
|
||||
}
|
||||
TIMING_NOW (stop);
|
||||
|
||||
TIMING_DIFF (cur, start, stop);
|
||||
|
||||
TIMING_PRINT_MEAN ((double) cur, (double) iters);
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (size_t align1, size_t align2, size_t len)
|
||||
{
|
||||
size_t i, j;
|
||||
char *s1, *s2;
|
||||
|
||||
align1 &= 63;
|
||||
if (align1 + len >= page_size)
|
||||
return;
|
||||
|
||||
align2 &= 63;
|
||||
if (align2 + len >= page_size)
|
||||
return;
|
||||
|
||||
s1 = (char *) (buf1 + align1);
|
||||
s2 = (char *) (buf2 + align2);
|
||||
|
||||
for (i = 0, j = 1; i < len; i++, j += 23)
|
||||
s1[i] = j;
|
||||
|
||||
printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, s2, s1, len);
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
test_init ();
|
||||
|
||||
printf ("%23s", "");
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
printf ("\t%s", impl->name);
|
||||
putchar ('\n');
|
||||
|
||||
for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
{
|
||||
do_test (0, 0, i + 7);
|
||||
do_test (0, 3, i + 15);
|
||||
do_test (3, 0, i + 31);
|
||||
do_test (3, 5, i + 63);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memcpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -55,10 +55,6 @@ do_one_test (impl_t *impl, char *dst, const char *src,
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
/* Must clear the destination buffer set by the previous run. */
|
||||
for (i = 0; i < len; i++)
|
||||
dst[i] = 0;
|
||||
|
||||
if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s %p %p", impl->name,
|
||||
@@ -153,17 +149,9 @@ test_main (void)
|
||||
do_test (i, i, 16 * i);
|
||||
}
|
||||
|
||||
for (i = 32; i < 64; ++i)
|
||||
{
|
||||
do_test (0, 0, 32 * i);
|
||||
do_test (i, 0, 32 * i);
|
||||
do_test (0, i, 32 * i);
|
||||
do_test (i, i, 32 * i);
|
||||
}
|
||||
|
||||
do_test (0, 0, getpagesize ());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memmem functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -161,4 +161,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
/* Measure memmove functions with large data sizes.
|
||||
Copyright (C) 2016-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define BASE_PAGE_SIZE (1024 * 1024)
|
||||
#define START_SIZE (4 * 1024)
|
||||
#define MIN_PAGE_SIZE (getpagesize () + 16 * 1024 * 1024)
|
||||
#define TEST_MAIN
|
||||
#define TEST_NAME "memmove"
|
||||
#define TIMEOUT (20 * 60)
|
||||
#include "bench-string.h"
|
||||
|
||||
IMPL (memmove, 1)
|
||||
|
||||
typedef char *(*proto_t) (char *, const char *, size_t);
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
|
||||
size_t len)
|
||||
{
|
||||
size_t i, iters = 16;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
/* This also clears the destination buffer updated by the previous
|
||||
run. */
|
||||
memcpy (src, orig_src, len);
|
||||
|
||||
char *res = CALL (impl, dst, src, len);
|
||||
if (res != dst)
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s %p %p", impl->name,
|
||||
res, dst);
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (memcmp (dst, orig_src, len) != 0)
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
|
||||
impl->name, dst, src);
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
TIMING_NOW (start);
|
||||
for (i = 0; i < iters; ++i)
|
||||
{
|
||||
CALL (impl, dst, src, len);
|
||||
}
|
||||
TIMING_NOW (stop);
|
||||
|
||||
TIMING_DIFF (cur, start, stop);
|
||||
|
||||
TIMING_PRINT_MEAN ((double) cur, (double) iters);
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (size_t align1, size_t align2, size_t len)
|
||||
{
|
||||
size_t i, j;
|
||||
char *s1, *s2;
|
||||
|
||||
align1 &= 127;
|
||||
if (align1 + len >= page_size)
|
||||
return;
|
||||
|
||||
align2 &= 127;
|
||||
if (align2 + len >= page_size)
|
||||
return;
|
||||
|
||||
s1 = (char *) (buf1 + align1);
|
||||
s2 = (char *) (buf2 + align2);
|
||||
|
||||
for (i = 0, j = 1; i < len; i++, j += 23)
|
||||
s1[i] = j;
|
||||
|
||||
printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, s2, (char *) (buf2 + align1), s1, len);
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
test_init ();
|
||||
|
||||
printf ("%23s", "");
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
printf ("\t%s", impl->name);
|
||||
putchar ('\n');
|
||||
|
||||
for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
{
|
||||
do_test (0, 64, i + 7);
|
||||
do_test (0, 3, i + 15);
|
||||
do_test (3, 0, i + 31);
|
||||
do_test (3, 7, i + 63);
|
||||
do_test (9, 5, i + 127);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memmove functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -70,7 +70,6 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
/* This also clears the destination buffer set by the previous run. */
|
||||
memcpy (src, orig_src, len);
|
||||
#ifdef TEST_BCOPY
|
||||
CALL (impl, src, dst, len);
|
||||
@@ -139,7 +138,7 @@ do_test (size_t align1, size_t align2, size_t len)
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
size_t i;
|
||||
@@ -177,15 +176,7 @@ test_main (void)
|
||||
do_test (i, 0, 16 * i);
|
||||
}
|
||||
|
||||
for (i = 32; i < 64; ++i)
|
||||
{
|
||||
do_test (0, 0, 32 * i);
|
||||
do_test (i, 0, 32 * i);
|
||||
do_test (0, i, 32 * i);
|
||||
do_test (i, i, 32 * i);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure mempcpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memrchr functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/* Measure memset functions with large data sizes.
|
||||
Copyright (C) 2016-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "memset"
|
||||
#else
|
||||
# define TEST_NAME "wmemset"
|
||||
#endif /* WIDE */
|
||||
#define START_SIZE (128 * 1024)
|
||||
#define MIN_PAGE_SIZE (getpagesize () + 64 * 1024 * 1024)
|
||||
#define TIMEOUT (20 * 60)
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define MEMSET memset
|
||||
# define CHAR char
|
||||
# define SIMPLE_MEMSET simple_memset
|
||||
# define MEMCMP memcmp
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define MEMSET wmemset
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_MEMSET simple_wmemset
|
||||
# define MEMCMP wmemcmp
|
||||
#endif /* WIDE */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
IMPL (MEMSET, 1)
|
||||
|
||||
typedef CHAR *(*proto_t) (CHAR *, int, size_t);
|
||||
|
||||
CHAR *
|
||||
inhibit_loop_to_libcall
|
||||
SIMPLE_MEMSET (CHAR *s, int c, size_t n)
|
||||
{
|
||||
CHAR *r = s, *end = s + n;
|
||||
while (r < end)
|
||||
*r++ = c;
|
||||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
|
||||
{
|
||||
size_t i, iters = 16;
|
||||
timing_t start, stop, cur;
|
||||
CHAR *tstbuf = malloc (n * sizeof (*s));
|
||||
assert (tstbuf != NULL);
|
||||
|
||||
/* Must clear the destination buffer updated by the previous run. */
|
||||
for (i = 0; i < n; i++)
|
||||
s[i] = 0;
|
||||
|
||||
CHAR *res = CALL (impl, s, c, n);
|
||||
if (res != s
|
||||
|| SIMPLE_MEMSET (tstbuf, c, n) != tstbuf
|
||||
|| MEMCMP (s, tstbuf, n) != 0)
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s", impl->name);
|
||||
ret = 1;
|
||||
free (tstbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
TIMING_NOW (start);
|
||||
for (i = 0; i < iters; ++i)
|
||||
{
|
||||
CALL (impl, s, c, n);
|
||||
}
|
||||
TIMING_NOW (stop);
|
||||
|
||||
TIMING_DIFF (cur, start, stop);
|
||||
|
||||
TIMING_PRINT_MEAN ((double) cur, (double) iters);
|
||||
|
||||
free (tstbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
do_test (size_t align, int c, size_t len)
|
||||
{
|
||||
align &= 63;
|
||||
if ((align + len) * sizeof (CHAR) > page_size)
|
||||
return;
|
||||
|
||||
printf ("Length %4zd, alignment %2zd, c %2d:", len, align, c);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, (CHAR *) (buf1) + align, c, len);
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
size_t i;
|
||||
int c;
|
||||
|
||||
test_init ();
|
||||
|
||||
printf ("%24s", "");
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
printf ("\t%s", impl->name);
|
||||
putchar ('\n');
|
||||
|
||||
c = 65;
|
||||
for (i = START_SIZE; i <= MIN_PAGE_SIZE; i <<= 1)
|
||||
{
|
||||
do_test (0, c, i);
|
||||
do_test (3, c, i);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
+25
-51
@@ -1,5 +1,5 @@
|
||||
/* Measure memset functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -20,29 +20,12 @@
|
||||
#ifdef TEST_BZERO
|
||||
# define TEST_NAME "bzero"
|
||||
#else
|
||||
# ifndef WIDE
|
||||
# define TEST_NAME "memset"
|
||||
# else
|
||||
# define TEST_NAME "wmemset"
|
||||
# endif /* WIDE */
|
||||
#endif /* !TEST_BZERO */
|
||||
# define TEST_NAME "memset"
|
||||
#endif
|
||||
#define MIN_PAGE_SIZE 131072
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define MEMSET memset
|
||||
# define CHAR char
|
||||
# define SIMPLE_MEMSET simple_memset
|
||||
# define MEMCMP memcmp
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define MEMSET wmemset
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_MEMSET simple_wmemset
|
||||
# define MEMCMP wmemcmp
|
||||
#endif /* WIDE */
|
||||
|
||||
CHAR *SIMPLE_MEMSET (CHAR *, int, size_t);
|
||||
char *simple_memset (char *, int, size_t);
|
||||
|
||||
#ifdef TEST_BZERO
|
||||
typedef void (*proto_t) (char *, size_t);
|
||||
@@ -56,7 +39,7 @@ IMPL (bzero, 1)
|
||||
void
|
||||
simple_bzero (char *s, size_t n)
|
||||
{
|
||||
SIMPLE_MEMSET (s, 0, n);
|
||||
simple_memset (s, 0, n);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -65,50 +48,46 @@ builtin_bzero (char *s, size_t n)
|
||||
__builtin_bzero (s, n);
|
||||
}
|
||||
#else
|
||||
typedef CHAR *(*proto_t) (CHAR *, int, size_t);
|
||||
|
||||
IMPL (SIMPLE_MEMSET, 0)
|
||||
# ifndef WIDE
|
||||
typedef char *(*proto_t) (char *, int, size_t);
|
||||
char *builtin_memset (char *, int, size_t);
|
||||
IMPL (builtin_memset, 0)
|
||||
# endif /* !WIDE */
|
||||
IMPL (MEMSET, 1)
|
||||
|
||||
# ifndef WIDE
|
||||
IMPL (simple_memset, 0)
|
||||
IMPL (builtin_memset, 0)
|
||||
IMPL (memset, 1)
|
||||
|
||||
char *
|
||||
builtin_memset (char *s, int c, size_t n)
|
||||
{
|
||||
return __builtin_memset (s, c, n);
|
||||
}
|
||||
# endif /* !WIDE */
|
||||
#endif /* !TEST_BZERO */
|
||||
#endif
|
||||
|
||||
CHAR *
|
||||
char *
|
||||
inhibit_loop_to_libcall
|
||||
SIMPLE_MEMSET (CHAR *s, int c, size_t n)
|
||||
simple_memset (char *s, int c, size_t n)
|
||||
{
|
||||
CHAR *r = s, *end = s + n;
|
||||
char *r = s, *end = s + n;
|
||||
while (r < end)
|
||||
*r++ = c;
|
||||
return s;
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
|
||||
do_one_test (impl_t *impl, char *s, int c __attribute ((unused)), size_t n)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
CHAR tstbuf[n];
|
||||
char tstbuf[n];
|
||||
#ifdef TEST_BZERO
|
||||
simple_bzero (tstbuf, n);
|
||||
CALL (impl, s, n);
|
||||
if (memcmp (s, tstbuf, n) != 0)
|
||||
#else
|
||||
CHAR *res = CALL (impl, s, c, n);
|
||||
char *res = CALL (impl, s, c, n);
|
||||
if (res != s
|
||||
|| SIMPLE_MEMSET (tstbuf, c, n) != tstbuf
|
||||
|| MEMCMP (s, tstbuf, n) != 0)
|
||||
#endif /* !TEST_BZERO */
|
||||
|| simple_memset (tstbuf, c, n) != tstbuf
|
||||
|| memcmp (s, tstbuf, n) != 0)
|
||||
#endif
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s", impl->name);
|
||||
ret = 1;
|
||||
@@ -122,7 +101,7 @@ do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
|
||||
CALL (impl, s, n);
|
||||
#else
|
||||
CALL (impl, s, c, n);
|
||||
#endif /* !TEST_BZERO */
|
||||
#endif
|
||||
}
|
||||
TIMING_NOW (stop);
|
||||
|
||||
@@ -134,14 +113,14 @@ do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
|
||||
static void
|
||||
do_test (size_t align, int c, size_t len)
|
||||
{
|
||||
align &= 63;
|
||||
if ((align + len) * sizeof (CHAR) > page_size)
|
||||
align &= 7;
|
||||
if (align + len > page_size)
|
||||
return;
|
||||
|
||||
printf ("Length %4zd, alignment %2zd, c %2d:", len, align, c);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, (CHAR *) (buf1) + align, c, len);
|
||||
do_one_test (impl, (char *) buf1 + align, c, len);
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
@@ -181,13 +160,8 @@ test_main (void)
|
||||
do_test (4, c, 64);
|
||||
do_test (2, c, 25);
|
||||
}
|
||||
for (i = 33; i <= 256; i += 4)
|
||||
{
|
||||
do_test (0, c, 32 * i);
|
||||
do_test (i, c, 32 * i);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure memchr functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -123,4 +123,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Skeleton for benchmark programs.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -24,9 +24,21 @@
|
||||
#include <inttypes.h>
|
||||
#include "bench-timing.h"
|
||||
#include "json-lib.h"
|
||||
#include "bench-util.h"
|
||||
|
||||
#include "bench-util.c"
|
||||
volatile unsigned int dontoptimize = 0;
|
||||
|
||||
void
|
||||
startup (void)
|
||||
{
|
||||
/* This loop should cause CPU to switch to maximal freqency.
|
||||
This makes subsequent measurement more accurate. We need a side effect
|
||||
to prevent the loop being deleted by compiler.
|
||||
This should be enough to cause CPU to speed up and it is simpler than
|
||||
running loop for constant time. This is used when user does not have root
|
||||
access to set a constant freqency. */
|
||||
for (int k = 0; k < 10000000; k++)
|
||||
dontoptimize += 23 * dontoptimize + 2;
|
||||
}
|
||||
|
||||
#define TIMESPEC_AFTER(a, b) \
|
||||
(((a).tv_sec == (b).tv_sec) ? \
|
||||
@@ -44,7 +56,7 @@ main (int argc, char **argv)
|
||||
if (argc == 2 && !strcmp (argv[1], "-d"))
|
||||
detailed = true;
|
||||
|
||||
bench_start ();
|
||||
startup();
|
||||
|
||||
memset (&runtime, 0, sizeof (runtime));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure stpcpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -18,34 +18,19 @@
|
||||
|
||||
#define STRCPY_RESULT(dst, len) ((dst) + (len))
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "stpcpy"
|
||||
#else
|
||||
# define TEST_NAME "wcpcpy"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "stpcpy"
|
||||
#include "bench-string.h"
|
||||
#ifndef WIDE
|
||||
# define CHAR char
|
||||
# define SIMPLE_STPCPY simple_stpcpy
|
||||
# define STPCPY stpcpy
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_STPCPY simple_wcpcpy
|
||||
# define STPCPY wcpcpy
|
||||
#endif /* WIDE */
|
||||
|
||||
CHAR *SIMPLE_STPCPY (CHAR *, const CHAR *);
|
||||
char *simple_stpcpy (char *, const char *);
|
||||
|
||||
IMPL (SIMPLE_STPCPY, 0)
|
||||
IMPL (STPCPY, 1)
|
||||
IMPL (simple_stpcpy, 0)
|
||||
IMPL (stpcpy, 1)
|
||||
|
||||
CHAR *
|
||||
SIMPLE_STPCPY (CHAR *dst, const CHAR *src)
|
||||
char *
|
||||
simple_stpcpy (char *dst, const char *src)
|
||||
{
|
||||
while ((*dst++ = *src++) != '\0');
|
||||
return dst - 1;
|
||||
}
|
||||
|
||||
#undef CHAR
|
||||
#include "bench-strcpy.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure stpcpy checking functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
+12
-31
@@ -1,5 +1,5 @@
|
||||
/* Measure stpncpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -18,36 +18,18 @@
|
||||
|
||||
#define STRNCPY_RESULT(dst, len, n) ((dst) + ((len) > (n) ? (n) : (len)))
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "stpncpy"
|
||||
#else
|
||||
# define TEST_NAME "wcpncpy"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "stpncpy"
|
||||
#include "bench-string.h"
|
||||
#ifndef WIDE
|
||||
# define CHAR char
|
||||
# define SIMPLE_STPNCPY simple_stpncpy
|
||||
# define STUPID_STPNCPY stupid_stpncpy
|
||||
# define STPNCPY stpncpy
|
||||
# define STRNLEN strnlen
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_STPNCPY simple_wcpncpy
|
||||
# define STUPID_STPNCPY stupid_wcpncpy
|
||||
# define STPNCPY wcpncpy
|
||||
# define STRNLEN wcsnlen
|
||||
#endif /* WIDE */
|
||||
|
||||
CHAR *SIMPLE_STPNCPY (CHAR *, const CHAR *, size_t);
|
||||
CHAR *STUPID_STPNCPY (CHAR *, const CHAR *, size_t);
|
||||
char *simple_stpncpy (char *, const char *, size_t);
|
||||
char *stupid_stpncpy (char *, const char *, size_t);
|
||||
|
||||
IMPL (STUPID_STPNCPY, 0)
|
||||
IMPL (SIMPLE_STPNCPY, 0)
|
||||
IMPL (STPNCPY, 1)
|
||||
IMPL (stupid_stpncpy, 0)
|
||||
IMPL (simple_stpncpy, 0)
|
||||
IMPL (stpncpy, 1)
|
||||
|
||||
CHAR *
|
||||
SIMPLE_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
char *
|
||||
simple_stpncpy (char *dst, const char *src, size_t n)
|
||||
{
|
||||
while (n--)
|
||||
if ((*dst++ = *src++) == '\0')
|
||||
@@ -61,10 +43,10 @@ SIMPLE_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CHAR *
|
||||
STUPID_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
char *
|
||||
stupid_stpncpy (char *dst, const char *src, size_t n)
|
||||
{
|
||||
size_t nc = STRNLEN (src, n);
|
||||
size_t nc = strnlen (src, n);
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nc; ++i)
|
||||
@@ -74,5 +56,4 @@ STUPID_STPNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
return dst + nc;
|
||||
}
|
||||
|
||||
#undef CHAR
|
||||
#include "bench-strncpy.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strcasecmp functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -173,4 +173,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strcasestr functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -177,4 +177,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+31
-57
@@ -1,5 +1,5 @@
|
||||
/* Measure strcat functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -17,45 +17,19 @@
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "strcat"
|
||||
#else
|
||||
# define TEST_NAME "wcscat"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "strcat"
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define STRCAT strcat
|
||||
# define CHAR char
|
||||
# define sfmt "s"
|
||||
# define SIMPLE_STRCAT simple_strcat
|
||||
# define STRLEN strlen
|
||||
# define STRCMP strcmp
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
# define SMALL_CHAR 127
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define STRCAT wcscat
|
||||
# define CHAR wchar_t
|
||||
# define sfmt "ls"
|
||||
# define SIMPLE_STRCAT simple_wcscat
|
||||
# define STRLEN wcslen
|
||||
# define STRCMP wcscmp
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define SMALL_CHAR 1273
|
||||
#endif /* WIDE */
|
||||
typedef char *(*proto_t) (char *, const char *);
|
||||
char *simple_strcat (char *, const char *);
|
||||
|
||||
IMPL (simple_strcat, 0)
|
||||
IMPL (strcat, 1)
|
||||
|
||||
typedef CHAR *(*proto_t) (CHAR *, const CHAR *);
|
||||
CHAR *SIMPLE_STRCAT (CHAR *, const CHAR *);
|
||||
|
||||
IMPL (SIMPLE_STRCAT, 0)
|
||||
IMPL (STRCAT, 1)
|
||||
|
||||
CHAR *
|
||||
SIMPLE_STRCAT (CHAR *dst, const CHAR *src)
|
||||
char *
|
||||
simple_strcat (char *dst, const char *src)
|
||||
{
|
||||
CHAR *ret = dst;
|
||||
char *ret = dst;
|
||||
while (*dst++ != '\0');
|
||||
--dst;
|
||||
while ((*dst++ = *src++) != '\0');
|
||||
@@ -63,9 +37,9 @@ SIMPLE_STRCAT (CHAR *dst, const CHAR *src)
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, CHAR *dst, const CHAR *src)
|
||||
do_one_test (impl_t *impl, char *dst, const char *src)
|
||||
{
|
||||
size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS;
|
||||
size_t k = strlen (dst), i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
if (CALL (impl, dst, src) != dst)
|
||||
@@ -76,9 +50,9 @@ do_one_test (impl_t *impl, CHAR *dst, const CHAR *src)
|
||||
return;
|
||||
}
|
||||
|
||||
if (STRCMP (dst + k, src) != 0)
|
||||
if (strcmp (dst + k, src) != 0)
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s dst \"%" sfmt "\" src \"%" sfmt "\"",
|
||||
error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
|
||||
impl->name, dst, src);
|
||||
ret = 1;
|
||||
return;
|
||||
@@ -101,18 +75,18 @@ static void
|
||||
do_test (size_t align1, size_t align2, size_t len1, size_t len2, int max_char)
|
||||
{
|
||||
size_t i;
|
||||
CHAR *s1, *s2;
|
||||
char *s1, *s2;
|
||||
|
||||
align1 &= 7;
|
||||
if ((align1 + len1) * sizeof (CHAR) >= page_size)
|
||||
if (align1 + len1 >= page_size)
|
||||
return;
|
||||
|
||||
align2 &= 7;
|
||||
if ((align2 + len1 + len2) * sizeof (CHAR) >= page_size)
|
||||
if (align2 + len1 + len2 >= page_size)
|
||||
return;
|
||||
|
||||
s1 = (CHAR *) (buf1) + align1;
|
||||
s2 = (CHAR *) (buf2) + align2;
|
||||
s1 = (char *) (buf1 + align1);
|
||||
s2 = (char *) (buf2 + align2);
|
||||
|
||||
for (i = 0; i < len1; ++i)
|
||||
s1[i] = 32 + 23 * i % (max_char - 32);
|
||||
@@ -146,29 +120,29 @@ test_main (void)
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
do_test (0, 0, i, i, SMALL_CHAR);
|
||||
do_test (0, 0, i, i, BIG_CHAR);
|
||||
do_test (0, i, i, i, SMALL_CHAR);
|
||||
do_test (i, 0, i, i, BIG_CHAR);
|
||||
do_test (0, 0, i, i, 127);
|
||||
do_test (0, 0, i, i, 255);
|
||||
do_test (0, i, i, i, 127);
|
||||
do_test (i, 0, i, i, 255);
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (0, 0, 8 << i, 8 << i, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 8 << i, 8 << i, SMALL_CHAR);
|
||||
do_test (0, 0, 8 << i, 2 << i, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 8 << i, 2 << i, SMALL_CHAR);
|
||||
do_test (0, 0, 8 << i, 8 << i, 127);
|
||||
do_test (8 - i, 2 * i, 8 << i, 8 << i, 127);
|
||||
do_test (0, 0, 8 << i, 2 << i, 127);
|
||||
do_test (8 - i, 2 * i, 8 << i, 2 << i, 127);
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (i, 2 * i, 8 << i, 1, SMALL_CHAR);
|
||||
do_test (2 * i, i, 8 << i, 1, BIG_CHAR);
|
||||
do_test (i, i, 8 << i, 10, SMALL_CHAR);
|
||||
do_test (i, i, 8 << i, 10, BIG_CHAR);
|
||||
do_test (i, 2 * i, 8 << i, 1, 127);
|
||||
do_test (2 * i, i, 8 << i, 1, 255);
|
||||
do_test (i, i, 8 << i, 10, 127);
|
||||
do_test (i, i, 8 << i, 10, 255);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure STRCHR functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -22,14 +22,10 @@
|
||||
# define TEST_NAME "strchrnul"
|
||||
# else
|
||||
# define TEST_NAME "strchr"
|
||||
# endif /* !USE_FOR_STRCHRNUL */
|
||||
# endif
|
||||
#else
|
||||
# ifdef USE_FOR_STRCHRNUL
|
||||
# define TEST_NAME "wcschrnul"
|
||||
# else
|
||||
# define TEST_NAME "wcschr"
|
||||
# endif /* !USE_FOR_STRCHRNUL */
|
||||
#endif /* WIDE */
|
||||
# define TEST_NAME "wcschr"
|
||||
#endif
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
@@ -39,7 +35,7 @@
|
||||
# define simple_STRCHR simple_STRCHRNUL
|
||||
# else
|
||||
# define STRCHR strchr
|
||||
# endif /* !USE_FOR_STRCHRNUL */
|
||||
# endif
|
||||
# define STRLEN strlen
|
||||
# define CHAR char
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
@@ -48,26 +44,20 @@
|
||||
# define UCHAR unsigned char
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# ifdef USE_FOR_STRCHRNUL
|
||||
# define STRCHR wcschrnul
|
||||
# define stupid_STRCHR stupid_WCSCHRNUL
|
||||
# define simple_STRCHR simple_WCSCHRNUL
|
||||
# else
|
||||
# define STRCHR wcschr
|
||||
# endif /* !USE_FOR_STRCHRNUL */
|
||||
# define STRCHR wcschr
|
||||
# define STRLEN wcslen
|
||||
# define CHAR wchar_t
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define MIDDLE_CHAR 1121
|
||||
# define SMALL_CHAR 851
|
||||
# define UCHAR wchar_t
|
||||
#endif /* WIDE */
|
||||
#endif
|
||||
|
||||
#ifdef USE_FOR_STRCHRNUL
|
||||
# define NULLRET(endptr) endptr
|
||||
#else
|
||||
# define NULLRET(endptr) NULL
|
||||
#endif /* !USE_FOR_STRCHRNUL */
|
||||
#endif
|
||||
|
||||
|
||||
typedef CHAR *(*proto_t) (const CHAR *, int);
|
||||
@@ -207,4 +197,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strchrnul function.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strcmp and wcscmp functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -238,4 +238,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,275 +0,0 @@
|
||||
/* Measure strcoll execution time in different locales.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
#include "json-lib.h"
|
||||
#include "bench-timing.h"
|
||||
#include <string.h>
|
||||
|
||||
/* Many thanks to http://generator.lorem-ipsum.info/ */
|
||||
#define INPUT_PREFIX "strcoll-inputs/"
|
||||
|
||||
static const char *const input_files[] = {
|
||||
"filelist#C",
|
||||
"filelist#en_US.UTF-8",
|
||||
"lorem_ipsum#vi_VN.UTF-8",
|
||||
"lorem_ipsum#ar_SA.UTF-8",
|
||||
"lorem_ipsum#en_US.UTF-8",
|
||||
"lorem_ipsum#zh_CN.UTF-8",
|
||||
"lorem_ipsum#cs_CZ.UTF-8",
|
||||
"lorem_ipsum#en_GB.UTF-8",
|
||||
"lorem_ipsum#da_DK.UTF-8",
|
||||
"lorem_ipsum#pl_PL.UTF-8",
|
||||
"lorem_ipsum#fr_FR.UTF-8",
|
||||
"lorem_ipsum#pt_PT.UTF-8",
|
||||
"lorem_ipsum#el_GR.UTF-8",
|
||||
"lorem_ipsum#ru_RU.UTF-8",
|
||||
"lorem_ipsum#he_IL.UTF-8",
|
||||
"lorem_ipsum#es_ES.UTF-8",
|
||||
"lorem_ipsum#hi_IN.UTF-8",
|
||||
"lorem_ipsum#sv_SE.UTF-8",
|
||||
"lorem_ipsum#hu_HU.UTF-8",
|
||||
"lorem_ipsum#tr_TR.UTF-8",
|
||||
"lorem_ipsum#is_IS.UTF-8",
|
||||
"lorem_ipsum#it_IT.UTF-8",
|
||||
"lorem_ipsum#sr_RS.UTF-8",
|
||||
"lorem_ipsum#ja_JP.UTF-8"
|
||||
};
|
||||
|
||||
#define TEXTFILE_DELIMITER " \n\r\t.,?!"
|
||||
|
||||
static char *
|
||||
read_file (const char *filename)
|
||||
{
|
||||
struct stat stats;
|
||||
char *buffer = NULL;
|
||||
int fd = open (filename, O_CLOEXEC);
|
||||
|
||||
if (fd >= 0)
|
||||
{
|
||||
if (fstat (fd, &stats) == 0)
|
||||
{
|
||||
buffer = malloc (stats.st_size + 1);
|
||||
if (buffer)
|
||||
{
|
||||
if (read (fd, buffer, stats.st_size) == stats.st_size)
|
||||
buffer[stats.st_size] = '\0';
|
||||
else
|
||||
{
|
||||
free (buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
close (fd);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static size_t
|
||||
count_words (const char *text, const char *delim)
|
||||
{
|
||||
size_t wordcount = 0;
|
||||
char *tmp = strdup (text);
|
||||
|
||||
char *token = strtok (tmp, delim);
|
||||
while (token != NULL)
|
||||
{
|
||||
if (*token != '\0')
|
||||
wordcount++;
|
||||
token = strtok (NULL, delim);
|
||||
}
|
||||
|
||||
free (tmp);
|
||||
return wordcount;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t size;
|
||||
char **words;
|
||||
} word_list;
|
||||
|
||||
static word_list *
|
||||
new_word_list (size_t size)
|
||||
{
|
||||
word_list *list = malloc (sizeof (word_list));
|
||||
assert (list != NULL);
|
||||
list->size = size;
|
||||
list->words = malloc (size * sizeof (char *));
|
||||
assert (list->words != NULL);
|
||||
return list;
|
||||
}
|
||||
|
||||
static word_list *
|
||||
str_word_list (const char *str, const char *delim)
|
||||
{
|
||||
size_t n = 0;
|
||||
word_list *list = new_word_list (count_words (str, delim));
|
||||
|
||||
char *toks = strdup (str);
|
||||
char *word = strtok (toks, delim);
|
||||
while (word != NULL && n < list->size)
|
||||
{
|
||||
if (*word != '\0')
|
||||
list->words[n++] = strdup (word);
|
||||
word = strtok (NULL, delim);
|
||||
}
|
||||
|
||||
free (toks);
|
||||
return list;
|
||||
}
|
||||
|
||||
static word_list *
|
||||
copy_word_list (const word_list *list)
|
||||
{
|
||||
size_t i;
|
||||
word_list *copy = new_word_list (list->size);
|
||||
|
||||
for (i = 0; i < list->size; i++)
|
||||
copy->words[i] = strdup (list->words[i]);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
static void
|
||||
free_word_list (word_list *list)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < list->size; i++)
|
||||
free (list->words[i]);
|
||||
|
||||
free (list->words);
|
||||
free (list);
|
||||
}
|
||||
|
||||
static int
|
||||
compare_words (const void *a, const void *b)
|
||||
{
|
||||
const char *s1 = *(char **) a;
|
||||
const char *s2 = *(char **) b;
|
||||
return strcoll (s1, s2);
|
||||
}
|
||||
|
||||
#undef INNER_LOOP_ITERS
|
||||
#define INNER_LOOP_ITERS 16
|
||||
|
||||
static void
|
||||
bench_list (json_ctx_t *json_ctx, word_list *list)
|
||||
{
|
||||
size_t i;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
word_list **tests = malloc (INNER_LOOP_ITERS * sizeof (word_list *));
|
||||
assert (tests != NULL);
|
||||
for (i = 0; i < INNER_LOOP_ITERS; i++)
|
||||
tests[i] = copy_word_list (list);
|
||||
|
||||
TIMING_NOW (start);
|
||||
for (i = 0; i < INNER_LOOP_ITERS; i++)
|
||||
qsort (tests[i]->words, tests[i]->size, sizeof (char *), compare_words);
|
||||
TIMING_NOW (stop);
|
||||
|
||||
TIMING_DIFF (cur, start, stop);
|
||||
setlocale (LC_ALL, "en_US.UTF-8");
|
||||
json_attr_double (json_ctx, "duration", cur);
|
||||
json_attr_double (json_ctx, "iterations", i);
|
||||
json_attr_double (json_ctx, "mean", (double) cur / i);
|
||||
|
||||
for (i = 0; i < INNER_LOOP_ITERS; i++)
|
||||
free_word_list (tests[i]);
|
||||
free (tests);
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OK,
|
||||
ERROR_FILENAME,
|
||||
ERROR_LOCALE,
|
||||
ERROR_IO
|
||||
} result_t;
|
||||
|
||||
static result_t
|
||||
bench_file (json_ctx_t *json_ctx, const char *testname, const char *filename,
|
||||
const char *locale)
|
||||
{
|
||||
if (setlocale (LC_ALL, locale) == NULL)
|
||||
return ERROR_LOCALE;
|
||||
|
||||
char *text = read_file (filename);
|
||||
if (text == NULL)
|
||||
return ERROR_IO;
|
||||
|
||||
word_list *list = str_word_list (text, TEXTFILE_DELIMITER);
|
||||
|
||||
json_attr_object_begin (json_ctx, testname);
|
||||
bench_list (json_ctx, list);
|
||||
json_attr_object_end (json_ctx);
|
||||
|
||||
free_word_list (list);
|
||||
free (text);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
json_ctx_t *json_ctx = malloc (sizeof (json_ctx_t));
|
||||
assert (json_ctx != NULL);
|
||||
json_init (json_ctx, 2, stdout);
|
||||
json_attr_object_begin (json_ctx, "strcoll");
|
||||
|
||||
size_t i;
|
||||
result_t result = OK;
|
||||
for (i = 0; i < (sizeof (input_files) / sizeof (input_files[0])); i++)
|
||||
{
|
||||
char *locale = strchr (input_files[i], '#');
|
||||
if (locale == NULL)
|
||||
{
|
||||
printf ("Failed to get locale from filename %s, aborting!\n",
|
||||
input_files[i]);
|
||||
return ERROR_FILENAME;
|
||||
}
|
||||
|
||||
char *filename;
|
||||
asprintf (&filename, INPUT_PREFIX "%s", input_files[i]);
|
||||
result = bench_file (json_ctx, input_files[i], filename, locale + 1);
|
||||
|
||||
if (result != OK)
|
||||
{
|
||||
if (result == ERROR_LOCALE)
|
||||
printf ("Failed to set locale %s, aborting!\n", locale);
|
||||
else if (result == ERROR_IO)
|
||||
printf ("Failed to read file %s, aborting!\n", filename);
|
||||
free (filename);
|
||||
goto out;
|
||||
}
|
||||
free (filename);
|
||||
}
|
||||
|
||||
out:
|
||||
json_attr_object_end (json_ctx);
|
||||
free (json_ctx);
|
||||
return result;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strcpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -190,4 +190,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure __strcpy_chk functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -53,7 +53,8 @@ simple_strcpy_chk (char *dst, const char *src, size_t len)
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <support/support.h>
|
||||
static int test_main (void);
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
volatile int chk_fail_ok;
|
||||
jmp_buf chk_fail_buf;
|
||||
@@ -240,5 +241,3 @@ test_main (void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
|
||||
+13
-34
@@ -1,5 +1,5 @@
|
||||
/* Measure strcspn functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -19,41 +19,22 @@
|
||||
#define STRPBRK_RESULT(s, pos) (pos)
|
||||
#define RES_TYPE size_t
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "strcspn"
|
||||
#else
|
||||
# define TEST_NAME "wcscspn"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "strcspn"
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define STRCSPN strcspn
|
||||
# define CHAR char
|
||||
# define SIMPLE_STRCSPN simple_strcspn
|
||||
# define STUPID_STRCSPN stupid_strcspn
|
||||
# define STRLEN strlen
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define STRCSPN wcscspn
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_STRCSPN simple_wcscspn
|
||||
# define STUPID_STRCSPN stupid_wcscspn
|
||||
# define STRLEN wcslen
|
||||
#endif /* WIDE */
|
||||
typedef size_t (*proto_t) (const char *, const char *);
|
||||
size_t simple_strcspn (const char *, const char *);
|
||||
size_t stupid_strcspn (const char *, const char *);
|
||||
|
||||
typedef size_t (*proto_t) (const CHAR *, const CHAR *);
|
||||
size_t SIMPLE_STRCSPN (const CHAR *, const CHAR *);
|
||||
size_t STUPID_STRCSPN (const CHAR *, const CHAR *);
|
||||
|
||||
IMPL (STUPID_STRCSPN, 0)
|
||||
IMPL (SIMPLE_STRCSPN, 0)
|
||||
IMPL (STRCSPN, 1)
|
||||
IMPL (stupid_strcspn, 0)
|
||||
IMPL (simple_strcspn, 0)
|
||||
IMPL (strcspn, 1)
|
||||
|
||||
size_t
|
||||
SIMPLE_STRCSPN (const CHAR *s, const CHAR *rej)
|
||||
simple_strcspn (const char *s, const char *rej)
|
||||
{
|
||||
const CHAR *r, *str = s;
|
||||
CHAR c;
|
||||
const char *r, *str = s;
|
||||
char c;
|
||||
|
||||
while ((c = *s++) != '\0')
|
||||
for (r = rej; *r != '\0'; ++r)
|
||||
@@ -63,9 +44,9 @@ SIMPLE_STRCSPN (const CHAR *s, const CHAR *rej)
|
||||
}
|
||||
|
||||
size_t
|
||||
STUPID_STRCSPN (const CHAR *s, const CHAR *rej)
|
||||
stupid_strcspn (const char *s, const char *rej)
|
||||
{
|
||||
size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
||||
size_t ns = strlen (s), nrej = strlen (rej);
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < ns; ++i)
|
||||
@@ -75,6 +56,4 @@ STUPID_STRCSPN (const CHAR *s, const CHAR *rej)
|
||||
return i;
|
||||
}
|
||||
|
||||
#undef CHAR
|
||||
#undef STRLEN
|
||||
#include "bench-strpbrk.c"
|
||||
|
||||
+20
-30
@@ -1,5 +1,5 @@
|
||||
/* Measure string and memory functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -16,7 +16,6 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <getopt.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
typedef struct
|
||||
@@ -56,10 +55,8 @@ extern impl_t __start_impls[], __stop_impls[];
|
||||
# include "bench-timing.h"
|
||||
|
||||
|
||||
# define TEST_FUNCTION test_main
|
||||
# ifndef TIMEOUT
|
||||
# define TIMEOUT (4 * 60)
|
||||
# endif
|
||||
# define TEST_FUNCTION test_main ()
|
||||
# define TIMEOUT (4 * 60)
|
||||
# define OPT_ITERATIONS 10000
|
||||
# define OPT_RANDOM 10001
|
||||
# define OPT_SEED 10002
|
||||
@@ -88,31 +85,24 @@ size_t iterations = 100000;
|
||||
# define CMDLINE_OPTIONS ITERATIONS_OPTIONS \
|
||||
{ "random", no_argument, NULL, OPT_RANDOM }, \
|
||||
{ "seed", required_argument, NULL, OPT_SEED },
|
||||
|
||||
static void __attribute__ ((used))
|
||||
cmdline_process_function (int c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
ITERATIONS_PROCESS
|
||||
case OPT_RANDOM:
|
||||
{
|
||||
int fdr = open ("/dev/urandom", O_RDONLY);
|
||||
if (fdr < 0 || read (fdr, &seed, sizeof(seed)) != sizeof (seed))
|
||||
seed = time (NULL);
|
||||
if (fdr >= 0)
|
||||
close (fdr);
|
||||
do_srandom = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case OPT_SEED:
|
||||
seed = strtoul (optarg, NULL, 0);
|
||||
do_srandom = 1;
|
||||
# define CMDLINE_PROCESS ITERATIONS_PROCESS \
|
||||
case OPT_RANDOM: \
|
||||
{ \
|
||||
int fdr = open ("/dev/urandom", O_RDONLY); \
|
||||
\
|
||||
if (fdr < 0 || read (fdr, &seed, sizeof(seed)) != sizeof (seed)) \
|
||||
seed = time (NULL); \
|
||||
if (fdr >= 0) \
|
||||
close (fdr); \
|
||||
do_srandom = 1; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
case OPT_SEED: \
|
||||
seed = strtoul (optarg, NULL, 0); \
|
||||
do_srandom = 1; \
|
||||
break;
|
||||
}
|
||||
}
|
||||
# define CMDLINE_PROCESS cmdline_process_function
|
||||
|
||||
# define CALL(impl, ...) \
|
||||
(* (proto_t) (impl)->fn) (__VA_ARGS__)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure STRLEN functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -139,4 +139,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strncasecmp functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -204,4 +204,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+35
-60
@@ -1,5 +1,5 @@
|
||||
/* Measure strncat functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -17,58 +17,33 @@
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "strncat"
|
||||
#else
|
||||
# define TEST_NAME "wcsncat"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "strncat"
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define STRNCAT strncat
|
||||
# define CHAR char
|
||||
# define SIMPLE_STRNCAT simple_strncat
|
||||
# define STUPID_STRNCAT stupid_strncat
|
||||
# define STRLEN strlen
|
||||
# define MEMCMP memcmp
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
# define SMALL_CHAR 127
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define STRNCAT wcsncat
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_STRNCAT simple_wcsncat
|
||||
# define STUPID_STRNCAT stupid_wcsncat
|
||||
# define STRLEN wcslen
|
||||
# define MEMCMP wmemcmp
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define SMALL_CHAR 1273
|
||||
#endif /* WIDE */
|
||||
typedef char *(*proto_t) (char *, const char *, size_t);
|
||||
char *stupid_strncat (char *, const char *, size_t);
|
||||
char *simple_strncat (char *, const char *, size_t);
|
||||
|
||||
typedef CHAR *(*proto_t) (CHAR *, const CHAR *, size_t);
|
||||
CHAR *STUPID_STRNCAT (CHAR *, const CHAR *, size_t);
|
||||
CHAR *SIMPLE_STRNCAT (CHAR *, const CHAR *, size_t);
|
||||
IMPL (stupid_strncat, 0)
|
||||
IMPL (strncat, 2)
|
||||
|
||||
IMPL (STUPID_STRNCAT, 0)
|
||||
IMPL (STRNCAT, 2)
|
||||
|
||||
CHAR *
|
||||
STUPID_STRNCAT (CHAR *dst, const CHAR *src, size_t n)
|
||||
char *
|
||||
stupid_strncat (char *dst, const char *src, size_t n)
|
||||
{
|
||||
CHAR *ret = dst;
|
||||
char *ret = dst;
|
||||
while (*dst++ != '\0');
|
||||
--dst;
|
||||
while (n--)
|
||||
if ((*dst++ = *src++) == '\0')
|
||||
if ( (*dst++ = *src++) == '\0')
|
||||
return ret;
|
||||
*dst = '\0';
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
|
||||
do_one_test (impl_t *impl, char *dst, const char *src, size_t n)
|
||||
{
|
||||
size_t k = STRLEN (dst), i, iters = INNER_LOOP_ITERS;
|
||||
size_t k = strlen (dst), i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
|
||||
if (CALL (impl, dst, src, n) != dst)
|
||||
@@ -79,10 +54,10 @@ do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
|
||||
return;
|
||||
}
|
||||
|
||||
size_t len = STRLEN (src);
|
||||
if (MEMCMP (dst + k, src, len + 1 > n ? n : len + 1) != 0)
|
||||
size_t len = strlen (src);
|
||||
if (memcmp (dst + k, src, len + 1 > n ? n : len + 1) != 0)
|
||||
{
|
||||
error (0, 0, "Incorrect concatenation in function %s",
|
||||
error (0, 0, "Incorrect cancatination in function %s",
|
||||
impl->name);
|
||||
ret = 1;
|
||||
return;
|
||||
@@ -113,20 +88,20 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2,
|
||||
size_t n, int max_char)
|
||||
{
|
||||
size_t i;
|
||||
CHAR *s1, *s2;
|
||||
char *s1, *s2;
|
||||
|
||||
align1 &= 7;
|
||||
if ((align1 + len1) * sizeof (CHAR) >= page_size)
|
||||
if (align1 + len1 >= page_size)
|
||||
return;
|
||||
if ((align1 + n) * sizeof (CHAR) > page_size)
|
||||
if (align1 + n > page_size)
|
||||
return;
|
||||
align2 &= 7;
|
||||
if ((align2 + len1 + len2) * sizeof (CHAR) >= page_size)
|
||||
if (align2 + len1 + len2 >= page_size)
|
||||
return;
|
||||
if ((align2 + len1 + n) * sizeof (CHAR) > page_size)
|
||||
if (align2 + len1 + n > page_size)
|
||||
return;
|
||||
s1 = (CHAR *) (buf1) + align1;
|
||||
s2 = (CHAR *) (buf2) + align2;
|
||||
s1 = (char *) (buf1 + align1);
|
||||
s2 = (char *) (buf2 + align2);
|
||||
|
||||
for (i = 0; i < len1; ++i)
|
||||
s1[i] = 32 + 23 * i % (max_char - 32);
|
||||
@@ -161,25 +136,25 @@ main (void)
|
||||
|
||||
for (n = 2; n <= 2048; n*=4)
|
||||
{
|
||||
do_test (0, 2, 2, 2, n, SMALL_CHAR);
|
||||
do_test (0, 0, 4, 4, n, SMALL_CHAR);
|
||||
do_test (4, 0, 4, 4, n, BIG_CHAR);
|
||||
do_test (0, 0, 8, 8, n, SMALL_CHAR);
|
||||
do_test (0, 8, 8, 8, n, SMALL_CHAR);
|
||||
do_test (0, 2, 2, 2, n, 127);
|
||||
do_test (0, 0, 4, 4, n, 127);
|
||||
do_test (4, 0, 4, 4, n, 255);
|
||||
do_test (0, 0, 8, 8, n, 127);
|
||||
do_test (0, 8, 8, 8, n, 127);
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (0, 0, 8 << i, 8 << i, n, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 8 << i, 8 << i, n, SMALL_CHAR);
|
||||
do_test (0, 0, 8 << i, 2 << i, n, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 8 << i, 2 << i, n, SMALL_CHAR);
|
||||
do_test (0, 0, 8 << i, 8 << i, n, 127);
|
||||
do_test (8 - i, 2 * i, 8 << i, 8 << i, n, 127);
|
||||
do_test (0, 0, 8 << i, 2 << i, n, 127);
|
||||
do_test (8 - i, 2 * i, 8 << i, 2 << i, n, 127);
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (i, 2 * i, 8 << i, 1, n, SMALL_CHAR);
|
||||
do_test (2 * i, i, 8 << i, 1, n, BIG_CHAR);
|
||||
do_test (i, i, 8 << i, 10, n, SMALL_CHAR);
|
||||
do_test (i, 2 * i, 8 << i, 1, n, 127);
|
||||
do_test (2 * i, i, 8 << i, 1, n, 255);
|
||||
do_test (i, i, 8 << i, 10, n, 127);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-87
@@ -1,5 +1,5 @@
|
||||
/* Measure strncmp functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -17,68 +17,17 @@
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TEST_MAIN
|
||||
#ifdef WIDE
|
||||
# define TEST_NAME "wcsncmp"
|
||||
#else
|
||||
# define TEST_NAME "strncmp"
|
||||
#endif /* !WIDE */
|
||||
#define TEST_NAME "strncmp"
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifdef WIDE
|
||||
# include <wchar.h>
|
||||
typedef int (*proto_t) (const char *, const char *, size_t);
|
||||
int simple_strncmp (const char *, const char *, size_t);
|
||||
int stupid_strncmp (const char *, const char *, size_t);
|
||||
|
||||
# define L(str) L##str
|
||||
# define STRNCMP wcsncmp
|
||||
# define SIMPLE_STRNCMP simple_wcsncmp
|
||||
# define STUPID_STRNCMP stupid_wcsncmp
|
||||
# define CHAR wchar_t
|
||||
# define CHARBYTES 4
|
||||
IMPL (stupid_strncmp, 0)
|
||||
IMPL (simple_strncmp, 0)
|
||||
IMPL (strncmp, 1)
|
||||
|
||||
/* Wcsncmp uses signed semantics for comparison, not unsigned.
|
||||
Avoid using substraction since possible overflow. */
|
||||
int
|
||||
simple_wcsncmp (const CHAR *s1, const CHAR *s2, size_t n)
|
||||
{
|
||||
wchar_t c1, c2;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
if (c1 == L ('\0') || c1 != c2)
|
||||
return c1 > c2 ? 1 : (c1 < c2 ? -1 : 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
stupid_wcsncmp (const CHAR *s1, const CHAR *s2, size_t n)
|
||||
{
|
||||
wchar_t c1, c2;
|
||||
size_t ns1 = wcsnlen (s1, n) + 1, ns2 = wcsnlen (s2, n) + 1;
|
||||
|
||||
n = ns1 < n ? ns1 : n;
|
||||
n = ns2 < n ? ns2 : n;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
c1 = *s1++;
|
||||
c2 = *s2++;
|
||||
if (c1 != c2)
|
||||
return c1 > c2 ? 1 : -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
# define L(str) str
|
||||
# define STRNCMP strncmp
|
||||
# define SIMPLE_STRNCMP simple_strncmp
|
||||
# define STUPID_STRNCMP stupid_strncmp
|
||||
# define CHAR char
|
||||
# define CHARBYTES 1
|
||||
|
||||
/* Strncmp uses unsigned semantics for comparison. */
|
||||
int
|
||||
simple_strncmp (const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
@@ -97,21 +46,12 @@ stupid_strncmp (const char *s1, const char *s2, size_t n)
|
||||
|
||||
n = ns1 < n ? ns1 : n;
|
||||
n = ns2 < n ? ns2 : n;
|
||||
while (n-- && (ret = *(unsigned char *) s1++ - *(unsigned char *) s2++) == 0);
|
||||
while (n-- && (ret = *(unsigned char *) s1++ - * (unsigned char *) s2++) == 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !WIDE */
|
||||
|
||||
typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
|
||||
|
||||
IMPL (STUPID_STRNCMP, 0)
|
||||
IMPL (SIMPLE_STRNCMP, 0)
|
||||
IMPL (STRNCMP, 1)
|
||||
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t n,
|
||||
do_one_test (impl_t *impl, const char *s1, const char *s2, size_t n,
|
||||
int exp_result)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
@@ -134,12 +74,12 @@ do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char,
|
||||
int exp_result)
|
||||
{
|
||||
size_t i, align_n;
|
||||
CHAR *s1, *s2;
|
||||
char *s1, *s2;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
s1 = (CHAR *) (buf1 + page_size);
|
||||
s2 = (CHAR *) (buf2 + page_size);
|
||||
s1 = (char*)(buf1 + page_size);
|
||||
s2 = (char*)(buf2 + page_size);
|
||||
printf ("Length %4zd/%4zd:", len, n);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
@@ -152,16 +92,16 @@ do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char,
|
||||
|
||||
align1 &= 15;
|
||||
align2 &= 15;
|
||||
align_n = (page_size - n * CHARBYTES) & 15;
|
||||
align_n = (page_size - n) & 15;
|
||||
|
||||
s1 = (CHAR *) (buf1 + page_size - n * CHARBYTES);
|
||||
s2 = (CHAR *) (buf2 + page_size - n * CHARBYTES);
|
||||
s1 = (char*)(buf1 + page_size - n);
|
||||
s2 = (char*)(buf2 + page_size - n);
|
||||
|
||||
if (align1 < align_n)
|
||||
s1 = (CHAR *) ((char *) s1 - (align_n - align1));
|
||||
s1 -= (align_n - align1);
|
||||
|
||||
if (align2 < align_n)
|
||||
s2 = (CHAR *) ((char *) s2 - (align_n - align2));
|
||||
s2 -= (align_n - align2);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
s1[i] = s2[i] = 1 + 23 * i % max_char;
|
||||
@@ -189,24 +129,24 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
|
||||
int exp_result)
|
||||
{
|
||||
size_t i;
|
||||
CHAR *s1, *s2;
|
||||
char *s1, *s2;
|
||||
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
align1 &= 63;
|
||||
if (align1 + (n + 1) * CHARBYTES >= page_size)
|
||||
align1 &= 7;
|
||||
if (align1 + n + 1 >= page_size)
|
||||
return;
|
||||
|
||||
align2 &= 7;
|
||||
if (align2 + (n + 1) * CHARBYTES >= page_size)
|
||||
if (align2 + n + 1 >= page_size)
|
||||
return;
|
||||
|
||||
s1 = (CHAR *) (buf1 + align1);
|
||||
s2 = (CHAR *) (buf2 + align2);
|
||||
s1 = (char*)(buf1 + align1);
|
||||
s2 = (char*)(buf2 + align2);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % max_char;
|
||||
s1[i] = s2[i] = 1 + 23 * i % max_char;
|
||||
|
||||
s1[n] = 24 + exp_result;
|
||||
s2[n] = 23;
|
||||
@@ -222,7 +162,7 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
|
||||
printf ("Length %4zd/%4zd, alignment %2zd/%2zd:", len, n, align1, align2);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, s1, s2, n, exp_result);
|
||||
do_one_test (impl, (char*)s1, (char*)s2, n, exp_result);
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
@@ -296,4 +236,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+37
-73
@@ -1,5 +1,5 @@
|
||||
/* Measure strncpy functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -16,56 +16,23 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifdef WIDE
|
||||
# include <wchar.h>
|
||||
# define CHAR wchar_t
|
||||
# define UCHAR wchar_t
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define SMALL_CHAR 1273
|
||||
# define MEMCMP wmemcmp
|
||||
# define MEMSET wmemset
|
||||
# define STRNLEN wcsnlen
|
||||
#else
|
||||
# define CHAR char
|
||||
# define UCHAR unsigned char
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
# define SMALL_CHAR 127
|
||||
# define MEMCMP memcmp
|
||||
# define MEMSET memset
|
||||
# define STRNLEN strnlen
|
||||
#endif /* !WIDE */
|
||||
|
||||
|
||||
#ifndef STRNCPY_RESULT
|
||||
# define STRNCPY_RESULT(dst, len, n) dst
|
||||
# define TEST_MAIN
|
||||
# ifndef WIDE
|
||||
# define TEST_NAME "strncpy"
|
||||
# else
|
||||
# define TEST_NAME "wcsncpy"
|
||||
# endif /* WIDE */
|
||||
# define TEST_NAME "strncpy"
|
||||
# include "bench-string.h"
|
||||
# ifndef WIDE
|
||||
# define SIMPLE_STRNCPY simple_strncpy
|
||||
# define STUPID_STRNCPY stupid_strncpy
|
||||
# define STRNCPY strncpy
|
||||
# else
|
||||
# define SIMPLE_STRNCPY simple_wcsncpy
|
||||
# define STUPID_STRNCPY stupid_wcsncpy
|
||||
# define STRNCPY wcsncpy
|
||||
# endif /* WIDE */
|
||||
|
||||
CHAR *SIMPLE_STRNCPY (CHAR *, const CHAR *, size_t);
|
||||
CHAR *STUPID_STRNCPY (CHAR *, const CHAR *, size_t);
|
||||
char *simple_strncpy (char *, const char *, size_t);
|
||||
char *stupid_strncpy (char *, const char *, size_t);
|
||||
|
||||
IMPL (STUPID_STRNCPY, 0)
|
||||
IMPL (SIMPLE_STRNCPY, 0)
|
||||
IMPL (STRNCPY, 1)
|
||||
IMPL (stupid_strncpy, 0)
|
||||
IMPL (simple_strncpy, 0)
|
||||
IMPL (strncpy, 1)
|
||||
|
||||
CHAR *
|
||||
SIMPLE_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
char *
|
||||
simple_strncpy (char *dst, const char *src, size_t n)
|
||||
{
|
||||
CHAR *ret = dst;
|
||||
char *ret = dst;
|
||||
while (n--)
|
||||
if ((*dst++ = *src++) == '\0')
|
||||
{
|
||||
@@ -76,10 +43,10 @@ SIMPLE_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
return ret;
|
||||
}
|
||||
|
||||
CHAR *
|
||||
STUPID_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
char *
|
||||
stupid_strncpy (char *dst, const char *src, size_t n)
|
||||
{
|
||||
size_t nc = STRNLEN (src, n);
|
||||
size_t nc = strnlen (src, n);
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < nc; ++i)
|
||||
@@ -88,12 +55,12 @@ STUPID_STRNCPY (CHAR *dst, const CHAR *src, size_t n)
|
||||
dst[i] = '\0';
|
||||
return dst;
|
||||
}
|
||||
#endif /* !STRNCPY_RESULT */
|
||||
#endif
|
||||
|
||||
typedef CHAR *(*proto_t) (CHAR *, const CHAR *, size_t);
|
||||
typedef char *(*proto_t) (char *, const char *, size_t);
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t len, size_t n)
|
||||
do_one_test (impl_t *impl, char *dst, const char *src, size_t len, size_t n)
|
||||
{
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
@@ -106,7 +73,7 @@ do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t len, size_t n)
|
||||
return;
|
||||
}
|
||||
|
||||
if (memcmp (dst, src, (len > n ? n : len) * sizeof (CHAR)) != 0)
|
||||
if (memcmp (dst, src, len > n ? n : len) != 0)
|
||||
{
|
||||
error (0, 0, "Wrong result in function %s", impl->name);
|
||||
ret = 1;
|
||||
@@ -142,26 +109,23 @@ static void
|
||||
do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
|
||||
{
|
||||
size_t i;
|
||||
CHAR *s1, *s2;
|
||||
char *s1, *s2;
|
||||
|
||||
/* For wcsncpy: align1 and align2 here mean alignment not in bytes,
|
||||
but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t)). */
|
||||
align1 &= 7;
|
||||
if ((align1 + len) * sizeof (CHAR) >= page_size)
|
||||
if (align1 + len >= page_size)
|
||||
return;
|
||||
|
||||
align2 &= 7;
|
||||
if ((align2 + len) * sizeof (CHAR) >= page_size)
|
||||
if (align2 + len >= page_size)
|
||||
return;
|
||||
|
||||
s1 = (CHAR *) (buf1) + align1;
|
||||
s2 = (CHAR *) (buf2) + align2;
|
||||
s1 = (char *) (buf1 + align1);
|
||||
s2 = (char *) (buf2 + align2);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
s1[i] = 32 + 23 * i % (max_char - 32);
|
||||
s1[len] = 0;
|
||||
for (i = len + 1; (i + align1) * sizeof (CHAR) < page_size && i < len + 64;
|
||||
++i)
|
||||
for (i = len + 1; i + align1 < page_size && i < len + 64; ++i)
|
||||
s1[i] = 32 + 32 * i % (max_char - 32);
|
||||
|
||||
printf ("Length %4zd, n %4zd, alignment %2zd/%2zd:", len, n, align1, align2);
|
||||
@@ -172,7 +136,7 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
size_t i;
|
||||
@@ -186,25 +150,25 @@ test_main (void)
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (i, i, 16, 16, SMALL_CHAR);
|
||||
do_test (i, i, 16, 16, BIG_CHAR);
|
||||
do_test (i, 2 * i, 16, 16, SMALL_CHAR);
|
||||
do_test (2 * i, i, 16, 16, BIG_CHAR);
|
||||
do_test (8 - i, 2 * i, 1 << i, 2 << i, SMALL_CHAR);
|
||||
do_test (2 * i, 8 - i, 2 << i, 1 << i, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 1 << i, 2 << i, BIG_CHAR);
|
||||
do_test (2 * i, 8 - i, 2 << i, 1 << i, BIG_CHAR);
|
||||
do_test (i, i, 16, 16, 127);
|
||||
do_test (i, i, 16, 16, 255);
|
||||
do_test (i, 2 * i, 16, 16, 127);
|
||||
do_test (2 * i, i, 16, 16, 255);
|
||||
do_test (8 - i, 2 * i, 1 << i, 2 << i, 127);
|
||||
do_test (2 * i, 8 - i, 2 << i, 1 << i, 127);
|
||||
do_test (8 - i, 2 * i, 1 << i, 2 << i, 255);
|
||||
do_test (2 * i, 8 - i, 2 << i, 1 << i, 255);
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (0, 0, 4 << i, 8 << i, SMALL_CHAR);
|
||||
do_test (0, 0, 16 << i, 8 << i, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 4 << i, 8 << i, SMALL_CHAR);
|
||||
do_test (8 - i, 2 * i, 16 << i, 8 << i, SMALL_CHAR);
|
||||
do_test (0, 0, 4 << i, 8 << i, 127);
|
||||
do_test (0, 0, 16 << i, 8 << i, 127);
|
||||
do_test (8 - i, 2 * i, 4 << i, 8 << i, 127);
|
||||
do_test (8 - i, 2 * i, 16 << i, 8 << i, 127);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+26
-47
@@ -1,5 +1,5 @@
|
||||
/* Measure strlen functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -17,36 +17,17 @@
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "strnlen"
|
||||
#else
|
||||
# define TEST_NAME "wcsnlen"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "strnlen"
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define STRNLEN strnlen
|
||||
# define CHAR char
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
# define MIDDLE_CHAR 127
|
||||
# define SIMPLE_STRNLEN simple_strnlen
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define STRNLEN wcsnlen
|
||||
# define CHAR wchar_t
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define MIDDLE_CHAR 1121
|
||||
# define SIMPLE_STRNLEN simple_wcsnlen
|
||||
#endif /* WIDE */
|
||||
typedef size_t (*proto_t) (const char *, size_t);
|
||||
size_t simple_strnlen (const char *, size_t);
|
||||
|
||||
typedef size_t (*proto_t) (const CHAR *, size_t);
|
||||
size_t SIMPLE_STRNLEN (const CHAR *, size_t);
|
||||
|
||||
IMPL (SIMPLE_STRNLEN, 0)
|
||||
IMPL (STRNLEN, 1)
|
||||
IMPL (simple_strnlen, 0)
|
||||
IMPL (strnlen, 1)
|
||||
|
||||
size_t
|
||||
SIMPLE_STRNLEN (const CHAR *s, size_t maxlen)
|
||||
simple_strnlen (const char *s, size_t maxlen)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@@ -55,7 +36,7 @@ SIMPLE_STRNLEN (const CHAR *s, size_t maxlen)
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, size_t maxlen, size_t exp_len)
|
||||
do_one_test (impl_t *impl, const char *s, size_t maxlen, size_t exp_len)
|
||||
{
|
||||
size_t len = CALL (impl, s, maxlen), i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
@@ -85,20 +66,18 @@ do_test (size_t align, size_t len, size_t maxlen, int max_char)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
align &= 63;
|
||||
if ((align + len) * sizeof (CHAR) >= page_size)
|
||||
align &= 7;
|
||||
if (align + len >= page_size)
|
||||
return;
|
||||
|
||||
CHAR *buf = (CHAR *) (buf1);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
buf[align + i] = 1 + 7 * i % max_char;
|
||||
buf[align + len] = 0;
|
||||
buf1[align + i] = 1 + 7 * i % max_char;
|
||||
buf1[align + len] = 0;
|
||||
|
||||
printf ("Length %4zd, alignment %2zd:", len, align);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
do_one_test (impl, (CHAR *) (buf + align), maxlen, MIN (len, maxlen));
|
||||
do_one_test (impl, (char *) (buf1 + align), maxlen, MIN (len, maxlen));
|
||||
|
||||
putchar ('\n');
|
||||
}
|
||||
@@ -117,37 +96,37 @@ test_main (void)
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (0, i, i - 1, MIDDLE_CHAR);
|
||||
do_test (0, i, i, MIDDLE_CHAR);
|
||||
do_test (0, i, i + 1, MIDDLE_CHAR);
|
||||
do_test (0, i, i - 1, 127);
|
||||
do_test (0, i, i, 127);
|
||||
do_test (0, i, i + 1, 127);
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
{
|
||||
do_test (i, i, i - 1, MIDDLE_CHAR);
|
||||
do_test (i, i, i, MIDDLE_CHAR);
|
||||
do_test (i, i, i + 1, MIDDLE_CHAR);
|
||||
do_test (i, i, i - 1, 127);
|
||||
do_test (i, i, i, 127);
|
||||
do_test (i, i, i + 1, 127);
|
||||
}
|
||||
|
||||
for (i = 2; i <= 10; ++i)
|
||||
{
|
||||
do_test (0, 1 << i, 5000, MIDDLE_CHAR);
|
||||
do_test (1, 1 << i, 5000, MIDDLE_CHAR);
|
||||
do_test (0, 1 << i, 5000, 127);
|
||||
do_test (1, 1 << i, 5000, 127);
|
||||
}
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
do_test (0, i, 5000, BIG_CHAR);
|
||||
do_test (0, i, 5000, 255);
|
||||
|
||||
for (i = 1; i < 8; ++i)
|
||||
do_test (i, i, 5000, BIG_CHAR);
|
||||
do_test (i, i, 5000, 255);
|
||||
|
||||
for (i = 2; i <= 10; ++i)
|
||||
{
|
||||
do_test (0, 1 << i, 5000, BIG_CHAR);
|
||||
do_test (1, 1 << i, 5000, BIG_CHAR);
|
||||
do_test (0, 1 << i, 5000, 255);
|
||||
do_test (1, 1 << i, 5000, 255);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+35
-65
@@ -1,5 +1,5 @@
|
||||
/* Measure strpbrk functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -16,80 +16,50 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef WIDE
|
||||
# define CHAR char
|
||||
# define STRLEN strlen
|
||||
# define STRCHR strchr
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
# define SMALL_CHAR 127
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define CHAR wchar_t
|
||||
# define STRLEN wcslen
|
||||
# define STRCHR wcschr
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define SMALL_CHAR 1273
|
||||
#endif /* WIDE */
|
||||
|
||||
#ifndef STRPBRK_RESULT
|
||||
# define STRPBRK_RESULT(s, pos) ((s)[(pos)] ? (s) + (pos) : NULL)
|
||||
# define RES_TYPE CHAR *
|
||||
# define RES_TYPE char *
|
||||
# define TEST_MAIN
|
||||
# ifndef WIDE
|
||||
# define TEST_NAME "strpbrk"
|
||||
# else
|
||||
# define TEST_NAME "wcspbrk"
|
||||
# endif /* WIDE */
|
||||
# define TEST_NAME "strpbrk"
|
||||
# include "bench-string.h"
|
||||
|
||||
# ifndef WIDE
|
||||
# define STRPBRK strpbrk
|
||||
# define SIMPLE_STRPBRK simple_strpbrk
|
||||
# define STUPID_STRPBRK stupid_strpbrk
|
||||
# else
|
||||
# include <wchar.h>
|
||||
# define STRPBRK wcspbrk
|
||||
# define SIMPLE_STRPBRK simple_wcspbrk
|
||||
# define STUPID_STRPBRK stupid_wcspbrk
|
||||
# endif /* WIDE */
|
||||
typedef char *(*proto_t) (const char *, const char *);
|
||||
char *simple_strpbrk (const char *, const char *);
|
||||
char *stupid_strpbrk (const char *, const char *);
|
||||
|
||||
typedef CHAR *(*proto_t) (const CHAR *, const CHAR *);
|
||||
CHAR *SIMPLE_STRPBRK (const CHAR *, const CHAR *);
|
||||
CHAR *STUPID_STRPBRK (const CHAR *, const CHAR *);
|
||||
IMPL (stupid_strpbrk, 0)
|
||||
IMPL (simple_strpbrk, 0)
|
||||
IMPL (strpbrk, 1)
|
||||
|
||||
IMPL (STUPID_STRPBRK, 0)
|
||||
IMPL (SIMPLE_STRPBRK, 0)
|
||||
IMPL (STRPBRK, 1)
|
||||
|
||||
CHAR *
|
||||
SIMPLE_STRPBRK (const CHAR *s, const CHAR *rej)
|
||||
char *
|
||||
simple_strpbrk (const char *s, const char *rej)
|
||||
{
|
||||
const CHAR *r;
|
||||
CHAR c;
|
||||
const char *r;
|
||||
char c;
|
||||
|
||||
while ((c = *s++) != '\0')
|
||||
for (r = rej; *r != '\0'; ++r)
|
||||
if (*r == c)
|
||||
return (CHAR *) s - 1;
|
||||
return (char *) s - 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CHAR *
|
||||
STUPID_STRPBRK (const CHAR *s, const CHAR *rej)
|
||||
char *
|
||||
stupid_strpbrk (const char *s, const char *rej)
|
||||
{
|
||||
size_t ns = STRLEN (s), nrej = STRLEN (rej);
|
||||
size_t ns = strlen (s), nrej = strlen (rej);
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < ns; ++i)
|
||||
for (j = 0; j < nrej; ++j)
|
||||
if (s[i] == rej[j])
|
||||
return (CHAR *) s + i;
|
||||
return (char *) s + i;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* !STRPBRK_RESULT */
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, const CHAR *rej, RES_TYPE exp_res)
|
||||
do_one_test (impl_t *impl, const char *s, const char *rej, RES_TYPE exp_res)
|
||||
{
|
||||
RES_TYPE res = CALL (impl, s, rej);
|
||||
size_t i, iters = INNER_LOOP_ITERS;
|
||||
@@ -121,35 +91,35 @@ do_test (size_t align, size_t pos, size_t len)
|
||||
size_t i;
|
||||
int c;
|
||||
RES_TYPE result;
|
||||
CHAR *rej, *s;
|
||||
char *rej, *s;
|
||||
|
||||
align &= 7;
|
||||
if ((align + pos + 10) * sizeof (CHAR) >= page_size || len > 240)
|
||||
if (align + pos + 10 >= page_size || len > 240)
|
||||
return;
|
||||
|
||||
rej = (CHAR *) (buf2) + (random () & 255);
|
||||
s = (CHAR *) (buf1) + align;
|
||||
rej = (char *) (buf2 + (random () & 255));
|
||||
s = (char *) (buf1 + align);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
rej[i] = random () & BIG_CHAR;
|
||||
rej[i] = random () & 255;
|
||||
if (!rej[i])
|
||||
rej[i] = random () & BIG_CHAR;
|
||||
rej[i] = random () & 255;
|
||||
if (!rej[i])
|
||||
rej[i] = 1 + (random () & SMALL_CHAR);
|
||||
rej[i] = 1 + (random () & 127);
|
||||
}
|
||||
rej[len] = '\0';
|
||||
for (c = 1; c <= BIG_CHAR; ++c)
|
||||
if (STRCHR (rej, c) == NULL)
|
||||
for (c = 1; c <= 255; ++c)
|
||||
if (strchr (rej, c) == NULL)
|
||||
break;
|
||||
|
||||
for (i = 0; i < pos; ++i)
|
||||
{
|
||||
s[i] = random () & BIG_CHAR;
|
||||
if (STRCHR (rej, s[i]))
|
||||
s[i] = random () & 255;
|
||||
if (strchr (rej, s[i]))
|
||||
{
|
||||
s[i] = random () & BIG_CHAR;
|
||||
if (STRCHR (rej, s[i]))
|
||||
s[i] = random () & 255;
|
||||
if (strchr (rej, s[i]))
|
||||
s[i] = c;
|
||||
}
|
||||
}
|
||||
@@ -157,7 +127,7 @@ do_test (size_t align, size_t pos, size_t len)
|
||||
if (s[pos])
|
||||
{
|
||||
for (i = pos + 1; i < pos + 10; ++i)
|
||||
s[i] = random () & BIG_CHAR;
|
||||
s[i] = random () & 255;
|
||||
s[i] = '\0';
|
||||
}
|
||||
result = STRPBRK_RESULT (s, pos);
|
||||
@@ -203,4 +173,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure STRCHR functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -181,4 +181,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+23
-60
@@ -1,5 +1,5 @@
|
||||
/* Measure strsep functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -49,56 +49,10 @@ simple_strsep (char **s1, char *s2)
|
||||
return begin;
|
||||
}
|
||||
|
||||
char *
|
||||
oldstrsep (char **stringp, const char *delim)
|
||||
{
|
||||
char *begin, *end;
|
||||
|
||||
begin = *stringp;
|
||||
if (begin == NULL)
|
||||
return NULL;
|
||||
|
||||
/* A frequent case is when the delimiter string contains only one
|
||||
character. Here we don't need to call the expensive `strpbrk'
|
||||
function and instead work using `strchr'. */
|
||||
if (delim[0] == '\0' || delim[1] == '\0')
|
||||
{
|
||||
char ch = delim[0];
|
||||
|
||||
if (ch == '\0')
|
||||
end = NULL;
|
||||
else
|
||||
{
|
||||
if (*begin == ch)
|
||||
end = begin;
|
||||
else if (*begin == '\0')
|
||||
end = NULL;
|
||||
else
|
||||
end = strchr (begin + 1, ch);
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Find the end of the token. */
|
||||
end = strpbrk (begin, delim);
|
||||
|
||||
if (end)
|
||||
{
|
||||
/* Terminate the token and set *STRINGP past NUL character. */
|
||||
*end++ = '\0';
|
||||
*stringp = end;
|
||||
}
|
||||
else
|
||||
/* No more delimiters; this is the last token. */
|
||||
*stringp = NULL;
|
||||
|
||||
return begin;
|
||||
}
|
||||
|
||||
typedef char *(*proto_t) (const char **, const char *);
|
||||
|
||||
IMPL (simple_strsep, 0)
|
||||
IMPL (strsep, 1)
|
||||
IMPL (oldstrsep, 2)
|
||||
|
||||
static void
|
||||
do_one_test (impl_t * impl, const char *s1, const char *s2)
|
||||
@@ -109,10 +63,7 @@ do_one_test (impl_t * impl, const char *s1, const char *s2)
|
||||
TIMING_NOW (start);
|
||||
for (i = 0; i < iters; ++i)
|
||||
{
|
||||
const char *s1a = s1;
|
||||
CALL (impl, &s1a, s2);
|
||||
if (s1a != NULL)
|
||||
((char*)s1a)[-1] = '1';
|
||||
CALL (impl, &s1, s2);
|
||||
}
|
||||
TIMING_NOW (stop);
|
||||
|
||||
@@ -125,10 +76,7 @@ static void
|
||||
do_test (size_t align1, size_t align2, size_t len1, size_t len2, int fail)
|
||||
{
|
||||
char *s2 = (char *) (buf2 + align2);
|
||||
|
||||
/* Search for a delimiter in a string containing mostly '0', so don't
|
||||
use '0' as a delimiter. */
|
||||
static const char d[] = "123456789abcdefg";
|
||||
static const char d[] = "1234567890abcdef";
|
||||
#define dl (sizeof (d) - 1)
|
||||
char *ss2 = s2;
|
||||
for (size_t l = len2; l > 0; l = l > dl ? l - dl : 0)
|
||||
@@ -144,9 +92,24 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2, int fail)
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
{
|
||||
char *s1 = (char *) (buf1 + align1);
|
||||
memset (s1, '0', len1);
|
||||
if (!fail)
|
||||
s1[len1 / 2] = '1';
|
||||
if (fail)
|
||||
{
|
||||
char *ss1 = s1;
|
||||
for (size_t l = len1; l > 0; l = l > dl ? l - dl : 0)
|
||||
{
|
||||
size_t t = l > dl ? dl : l;
|
||||
memcpy (ss1, d, t);
|
||||
++ss1[len2 > 7 ? 7 : len2 - 1];
|
||||
ss1 += t;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset (s1, '0', len1);
|
||||
memcpy (s1 + (len1 - len2) - 2, s2, len2);
|
||||
if ((len1 / len2) > 4)
|
||||
memcpy (s1 + (len1 - len2) - (3 * len2), s2, len2);
|
||||
}
|
||||
s1[len1] = '\0';
|
||||
do_one_test (impl, s1, s2);
|
||||
}
|
||||
@@ -164,7 +127,7 @@ test_main (void)
|
||||
putchar ('\n');
|
||||
|
||||
for (size_t klen = 2; klen < 32; ++klen)
|
||||
for (size_t hlen = 4 * klen; hlen < 8 * klen; hlen += klen)
|
||||
for (size_t hlen = 2 * klen; hlen < 16 * klen; hlen += klen)
|
||||
{
|
||||
do_test (0, 0, hlen, klen, 0);
|
||||
do_test (0, 0, hlen, klen, 1);
|
||||
@@ -208,4 +171,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
+25
-50
@@ -1,5 +1,5 @@
|
||||
/* Measure strspn functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -17,47 +17,22 @@
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define TEST_MAIN
|
||||
#ifndef WIDE
|
||||
# define TEST_NAME "strspn"
|
||||
#else
|
||||
# define TEST_NAME "wcsspn"
|
||||
#endif /* WIDE */
|
||||
#define TEST_NAME "strspn"
|
||||
#include "bench-string.h"
|
||||
|
||||
#ifndef WIDE
|
||||
# define STRSPN strspn
|
||||
# define CHAR char
|
||||
# define SIMPLE_STRSPN simple_strspn
|
||||
# define STUPID_STRSPN stupid_strspn
|
||||
# define STRLEN strlen
|
||||
# define STRCHR strchr
|
||||
# define BIG_CHAR CHAR_MAX
|
||||
# define SMALL_CHAR 127
|
||||
#else
|
||||
# include <wchar.h>
|
||||
# define STRSPN wcsspn
|
||||
# define CHAR wchar_t
|
||||
# define SIMPLE_STRSPN simple_wcsspn
|
||||
# define STUPID_STRSPN stupid_wcsspn
|
||||
# define STRLEN wcslen
|
||||
# define STRCHR wcschr
|
||||
# define BIG_CHAR WCHAR_MAX
|
||||
# define SMALL_CHAR 1273
|
||||
#endif /* WIDE */
|
||||
typedef size_t (*proto_t) (const char *, const char *);
|
||||
size_t simple_strspn (const char *, const char *);
|
||||
size_t stupid_strspn (const char *, const char *);
|
||||
|
||||
typedef size_t (*proto_t) (const CHAR *, const CHAR *);
|
||||
size_t SIMPLE_STRSPN (const CHAR *, const CHAR *);
|
||||
size_t STUPID_STRSPN (const CHAR *, const CHAR *);
|
||||
|
||||
IMPL (STUPID_STRSPN, 0)
|
||||
IMPL (SIMPLE_STRSPN, 0)
|
||||
IMPL (STRSPN, 1)
|
||||
IMPL (stupid_strspn, 0)
|
||||
IMPL (simple_strspn, 0)
|
||||
IMPL (strspn, 1)
|
||||
|
||||
size_t
|
||||
SIMPLE_STRSPN (const CHAR *s, const CHAR *acc)
|
||||
simple_strspn (const char *s, const char *acc)
|
||||
{
|
||||
const CHAR *r, *str = s;
|
||||
CHAR c;
|
||||
const char *r, *str = s;
|
||||
char c;
|
||||
|
||||
while ((c = *s++) != '\0')
|
||||
{
|
||||
@@ -71,9 +46,9 @@ SIMPLE_STRSPN (const CHAR *s, const CHAR *acc)
|
||||
}
|
||||
|
||||
size_t
|
||||
STUPID_STRSPN (const CHAR *s, const CHAR *acc)
|
||||
stupid_strspn (const char *s, const char *acc)
|
||||
{
|
||||
size_t ns = STRLEN (s), nacc = STRLEN (acc);
|
||||
size_t ns = strlen (s), nacc = strlen (acc);
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < ns; ++i)
|
||||
@@ -88,7 +63,7 @@ STUPID_STRSPN (const CHAR *s, const CHAR *acc)
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, const CHAR *acc, size_t exp_res)
|
||||
do_one_test (impl_t *impl, const char *s, const char *acc, size_t exp_res)
|
||||
{
|
||||
size_t res = CALL (impl, s, acc), i, iters = INNER_LOOP_ITERS;
|
||||
timing_t start, stop, cur;
|
||||
@@ -117,34 +92,34 @@ static void
|
||||
do_test (size_t align, size_t pos, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
CHAR *acc, *s;
|
||||
char *acc, *s;
|
||||
|
||||
align &= 7;
|
||||
if ((align + pos + 10) * sizeof (CHAR) >= page_size || len > 240 || ! len)
|
||||
if (align + pos + 10 >= page_size || len > 240 || ! len)
|
||||
return;
|
||||
|
||||
acc = (CHAR *) (buf2) + (random () & 255);
|
||||
s = (CHAR *) (buf1) + align;
|
||||
acc = (char *) (buf2 + (random () & 255));
|
||||
s = (char *) (buf1 + align);
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
acc[i] = random () & BIG_CHAR;
|
||||
acc[i] = random () & 255;
|
||||
if (!acc[i])
|
||||
acc[i] = random () & BIG_CHAR;
|
||||
acc[i] = random () & 255;
|
||||
if (!acc[i])
|
||||
acc[i] = 1 + (random () & SMALL_CHAR);
|
||||
acc[i] = 1 + (random () & 127);
|
||||
}
|
||||
acc[len] = '\0';
|
||||
|
||||
for (i = 0; i < pos; ++i)
|
||||
s[i] = acc[random () % len];
|
||||
s[pos] = random () & BIG_CHAR;
|
||||
if (STRCHR (acc, s[pos]))
|
||||
s[pos] = random () & 255;
|
||||
if (strchr (acc, s[pos]))
|
||||
s[pos] = '\0';
|
||||
else
|
||||
{
|
||||
for (i = pos + 1; i < pos + 10; ++i)
|
||||
s[i] = random () & BIG_CHAR;
|
||||
s[i] = random () & 255;
|
||||
s[i] = '\0';
|
||||
}
|
||||
|
||||
@@ -189,4 +164,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strstr functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -174,4 +174,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strtod implementation.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Measure strtok functions.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -20,41 +20,13 @@
|
||||
#define TEST_NAME "strtok"
|
||||
#include "bench-string.h"
|
||||
|
||||
char *
|
||||
oldstrtok (char *s, const char *delim)
|
||||
{
|
||||
static char *olds;
|
||||
char *token;
|
||||
#define STRTOK strtok_string
|
||||
#include <string/strtok.c>
|
||||
|
||||
if (s == NULL)
|
||||
s = olds;
|
||||
|
||||
/* Scan leading delimiters. */
|
||||
s += strspn (s, delim);
|
||||
if (*s == '\0')
|
||||
{
|
||||
olds = s;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the end of the token. */
|
||||
token = s;
|
||||
s = strpbrk (token, delim);
|
||||
if (s == NULL)
|
||||
/* This token finishes the string. */
|
||||
olds = __rawmemchr (token, '\0');
|
||||
else
|
||||
{
|
||||
/* Terminate the token and make OLDS point past it. */
|
||||
*s = '\0';
|
||||
olds = s + 1;
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
typedef char *(*proto_t) (const char *, const char *);
|
||||
|
||||
IMPL (oldstrtok, 0)
|
||||
IMPL (strtok_string, 0)
|
||||
IMPL (strtok, 1)
|
||||
|
||||
static void
|
||||
@@ -177,4 +149,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include <support/test-driver.c>
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Print out the timing type used by the benchmark run.
|
||||
Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Define timing macros.
|
||||
Copyright (C) 2013-2017 Free Software Foundation, Inc.
|
||||
Copyright (C) 2013-2015 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/* Benchmark utility functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
static volatile unsigned int dontoptimize = 0;
|
||||
|
||||
void
|
||||
bench_start (void)
|
||||
{
|
||||
/* This loop should cause CPU to switch to maximal freqency.
|
||||
This makes subsequent measurement more accurate. We need a side effect
|
||||
to prevent the loop being deleted by compiler.
|
||||
This should be enough to cause CPU to speed up and it is simpler than
|
||||
running loop for constant time. This is used when user does not have root
|
||||
access to set a constant freqency. */
|
||||
|
||||
for (int k = 0; k < START_ITER; k++)
|
||||
dontoptimize += 23 * dontoptimize + 2;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/* Benchmark utility functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
#ifndef START_ITER
|
||||
# define START_ITER (100000000)
|
||||
#endif
|
||||
|
||||
/* bench_start reduces the random variations due to frequency scaling by
|
||||
executing a small loop with many memory accesses. START_ITER controls
|
||||
the number of iterations. */
|
||||
|
||||
void bench_start (void);
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcpcpy functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-stpcpy.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcpncpy functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-stpncpy.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcscat functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strcat.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcschr functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strchr.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcschrnul functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strchrnul.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcscmp functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strcmp.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcscpy functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strcpy.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcscspn functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strcspn.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcslen functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strlen.c"
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Measure wcsncat functions.
|
||||
Copyright (C) 2015-2017 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#define WIDE 1
|
||||
#include "bench-strncat.c"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user