]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/tst-glibc-hwcaps-cache.c
elf: Rework exception handling in the dynamic loader [BZ #25486]
[thirdparty/glibc.git] / elf / tst-glibc-hwcaps-cache.c
CommitLineData
600d9e0c 1/* Wrapper to invoke tst-glibc-hwcaps in a container, to test ld.so.cache.
581c785b 2 Copyright (C) 2020-2022 Free Software Foundation, Inc.
600d9e0c
FW
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19/* This program is just a wrapper that runs ldconfig followed by
20 tst-glibc-hwcaps. The actual test is provided via an
21 implementation in a sysdeps subdirectory. */
22
23#include <stdio.h>
24#include <stdlib.h>
25#include <support/support.h>
26#include <unistd.h>
27
28int
29main (int argc, char **argv)
30{
31 /* Run ldconfig to populate the cache. */
32 {
33 char *command = xasprintf ("%s/ldconfig", support_install_rootsbindir);
34 if (system (command) != 0)
35 return 1;
36 free (command);
37 }
38
39 /* Reuse tst-glibc-hwcaps. Since this code is running in a
40 container, we can launch it directly. */
41 char *path = xasprintf ("%s/elf/tst-glibc-hwcaps", support_objdir_root);
42 execv (path, argv);
43 printf ("error: execv of %s failed: %m\n", path);
44 return 1;
45}