sparc: refactor sparc64 __mpn_addmul_1 selector to C
[glibc.git] / elf / tst-auxv.c
blobbc571c5fa719fa41ef9a591371e0321d572b7e91
1 /* Copyright (C) 2013-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #include <elf.h>
19 #include <errno.h>
20 #include <link.h>
21 #include <string.h>
22 #include <stdio.h>
23 #include <unistd.h>
24 #include <misc/sys/auxv.h>
26 static int
27 do_test (int argc, char *argv[])
29 errno = 0;
30 const char *execfn = (const char *) getauxval (AT_NULL);
32 if (errno != ENOENT)
34 printf ("errno is %d rather than %d (ENOENT) on failure\n", errno,
35 ENOENT);
36 return 1;
39 if (execfn != NULL)
41 printf ("getauxval return value is nonzero on failure\n");
42 return 1;
45 errno = 0;
46 execfn = (const char *) getauxval (AT_EXECFN);
48 if (execfn == NULL)
50 printf ("No AT_EXECFN found, AT_EXECFN test skipped\n");
51 return 0;
54 if (errno != 0)
56 printf ("errno erroneously set to %d on success\n", errno);
57 return 1;
60 if (strcmp (argv[0], execfn) != 0)
62 printf ("Mismatch: argv[0]: %s vs. AT_EXECFN: %s\n", argv[0], execfn);
63 return 1;
66 return 0;
69 #define TEST_FUNCTION_ARGV do_test
70 #include <support/test-driver.c>