Use correct includes in benchtests

Currently the benchtests are run with internal GLIBC headers, which is incorrect.
Defining _ISOMAC in the makefile ensures the internal headers are bypassed.
Fix all tests which were relying on internal defines or includes.

	* benchtests/Makefile: Define _ISOMAC.
	* benchtests/bench-strcoll.c: Add missing sys/stat.h include.
	* benchtests/bench-string.h: Define inhibit_loop_to_libcall macro.
	* benchtests/bench-strstr.c: Define empty libc_hidden_builtin_def.
	* benchtests/bench-strtok.c (oldstrtok): Use rawmemchr.
	* benchtests/bench-timing.h: Define attribute_hidden.
This commit is contained in:
Wilco Dijkstra 2018-03-15 15:44:58 +00:00
parent b47c3e7637
commit f1c8185d34
7 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2018-03-15 Wilco Dijkstra <wdijkstr@arm.com>
* benchtests/Makefile: Define _ISOMAC.
* benchtests/bench-strcoll.c: Add missing sys/stat.h include.
* benchtests/bench-string.h: Define inhibit_loop_to_libcall macro.
* benchtests/bench-strstr.c: Define empty libc_hidden_builtin_def.
* benchtests/bench-strtok.c (oldstrtok): Use rawmemchr.
* benchtests/bench-timing.h: Define attribute_hidden.
2018-03-15 Siddhesh Poyarekar <siddhesh@sourceware.org>
* sysdeps/aarch64/strncmp.S (strncmp): Use lsr instead of

View File

@ -125,7 +125,7 @@ ifndef BENCH_DURATION
BENCH_DURATION := 10
endif
CPPFLAGS-nonlib += -DDURATION=$(BENCH_DURATION)
CPPFLAGS-nonlib += -DDURATION=$(BENCH_DURATION) -D_ISOMAC
# Use clock_gettime to measure performance of functions. The default is to use
# HP_TIMING if it is available.

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <locale.h>
#include <unistd.h>
#include <sys/stat.h>
#include "json-lib.h"
#include "bench-timing.h"
#include <string.h>

View File

@ -19,6 +19,16 @@
#include <getopt.h>
#include <sys/cdefs.h>
/* We are compiled under _ISOMAC, so libc-symbols.h does not do this
for us. */
#include "config.h"
#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
# define inhibit_loop_to_libcall \
__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
#else
# define inhibit_loop_to_libcall
#endif
typedef struct
{
const char *name;

View File

@ -22,6 +22,7 @@
#define STRSTR simple_strstr
#define libc_hidden_builtin_def(X)
#include "../string/strstr.c"

View File

@ -42,7 +42,7 @@ oldstrtok (char *s, const char *delim)
s = strpbrk (token, delim);
if (s == NULL)
/* This token finishes the string. */
olds = __rawmemchr (token, '\0');
olds = rawmemchr (token, '\0');
else
{
/* Terminate the token and make OLDS point past it. */

View File

@ -16,6 +16,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#define attribute_hidden
#include <hp-timing.h>
#include <stdint.h>