hjl / source-git / glibc

Forked from source-git/glibc 4 years ago
Clone

Blame nptl/tst-audit-threads.h

Packit 9dbfad
/* Helper header for test-audit-threads.
Packit 9dbfad
Packit 9dbfad
   Copyright (C) 2018 Free Software Foundation, Inc.
Packit 9dbfad
   This file is part of the GNU C Library.
Packit 9dbfad
Packit 9dbfad
   The GNU C Library is free software; you can redistribute it and/or
Packit 9dbfad
   modify it under the terms of the GNU Lesser General Public
Packit 9dbfad
   License as published by the Free Software Foundation; either
Packit 9dbfad
   version 2.1 of the License, or (at your option) any later version.
Packit 9dbfad
Packit 9dbfad
   The GNU C Library is distributed in the hope that it will be useful,
Packit 9dbfad
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 9dbfad
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 9dbfad
   Lesser General Public License for more details.
Packit 9dbfad
Packit 9dbfad
   You should have received a copy of the GNU Lesser General Public
Packit 9dbfad
   License along with the GNU C Library; if not, see
Packit 9dbfad
   <http://www.gnu.org/licenses/>.  */
Packit 9dbfad
Packit 9dbfad
/* We use this helper to create a large number of functions, all of
Packit 9dbfad
   which will be resolved lazily and thus have their PLT updated.
Packit 9dbfad
   This is done to provide enough functions that we can statistically
Packit 9dbfad
   observe a thread vs. PLT resolution failure if one exists.  */
Packit 9dbfad
Packit 9dbfad
#define CONCAT(a, b) a ## b
Packit 9dbfad
#define NUM(x, y) CONCAT (x, y)
Packit 9dbfad
Packit 9dbfad
#define FUNC10(x)	\
Packit 9dbfad
  FUNC (NUM (x, 0));	\
Packit 9dbfad
  FUNC (NUM (x, 1));	\
Packit 9dbfad
  FUNC (NUM (x, 2));	\
Packit 9dbfad
  FUNC (NUM (x, 3));	\
Packit 9dbfad
  FUNC (NUM (x, 4));	\
Packit 9dbfad
  FUNC (NUM (x, 5));	\
Packit 9dbfad
  FUNC (NUM (x, 6));	\
Packit 9dbfad
  FUNC (NUM (x, 7));	\
Packit 9dbfad
  FUNC (NUM (x, 8));	\
Packit 9dbfad
  FUNC (NUM (x, 9))
Packit 9dbfad
Packit 9dbfad
#define FUNC100(x)	\
Packit 9dbfad
  FUNC10 (NUM (x, 0));	\
Packit 9dbfad
  FUNC10 (NUM (x, 1));	\
Packit 9dbfad
  FUNC10 (NUM (x, 2));	\
Packit 9dbfad
  FUNC10 (NUM (x, 3));	\
Packit 9dbfad
  FUNC10 (NUM (x, 4));	\
Packit 9dbfad
  FUNC10 (NUM (x, 5));	\
Packit 9dbfad
  FUNC10 (NUM (x, 6));	\
Packit 9dbfad
  FUNC10 (NUM (x, 7));	\
Packit 9dbfad
  FUNC10 (NUM (x, 8));	\
Packit 9dbfad
  FUNC10 (NUM (x, 9))
Packit 9dbfad
Packit 9dbfad
#define FUNC1000(x)		\
Packit 9dbfad
  FUNC100 (NUM (x, 0));		\
Packit 9dbfad
  FUNC100 (NUM (x, 1));		\
Packit 9dbfad
  FUNC100 (NUM (x, 2));		\
Packit 9dbfad
  FUNC100 (NUM (x, 3));		\
Packit 9dbfad
  FUNC100 (NUM (x, 4));		\
Packit 9dbfad
  FUNC100 (NUM (x, 5));		\
Packit 9dbfad
  FUNC100 (NUM (x, 6));		\
Packit 9dbfad
  FUNC100 (NUM (x, 7));		\
Packit 9dbfad
  FUNC100 (NUM (x, 8));		\
Packit 9dbfad
  FUNC100 (NUM (x, 9))
Packit 9dbfad
Packit 9dbfad
#define FUNC7000()	\
Packit 9dbfad
  FUNC1000 (1);		\
Packit 9dbfad
  FUNC1000 (2);		\
Packit 9dbfad
  FUNC1000 (3);		\
Packit 9dbfad
  FUNC1000 (4);		\
Packit 9dbfad
  FUNC1000 (5);		\
Packit 9dbfad
  FUNC1000 (6);		\
Packit 9dbfad
  FUNC1000 (7);
Packit 9dbfad
Packit 9dbfad
#ifdef FUNC
Packit 9dbfad
# undef FUNC
Packit 9dbfad
#endif
Packit 9dbfad
Packit 9dbfad
#ifdef externnum
Packit 9dbfad
# define FUNC(x) extern int CONCAT (retNum, x) (void)
Packit 9dbfad
#endif
Packit 9dbfad
Packit 9dbfad
#ifdef definenum
Packit 9dbfad
# define FUNC(x) int CONCAT (retNum, x) (void) { return x; }
Packit 9dbfad
#endif
Packit 9dbfad
Packit 9dbfad
#ifdef callnum
Packit 9dbfad
# define FUNC(x) CONCAT (retNum, x) (); sync_all (x)
Packit 9dbfad
#endif
Packit 9dbfad
Packit 9dbfad
/* A value of 7000 functions is chosen as an arbitrarily large
Packit 9dbfad
   number of functions that will allow us enough attempts to
Packit 9dbfad
   verify lazy resolution operation.  */
Packit 9dbfad
FUNC7000 ();