1 /* Check LD_AUDIT for aarch64 specific ABI.
2 Copyright (C) 2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
24 #include "tst-audit26mod.h"
26 #define TEST_NAME "tst-audit26"
28 #define AUDIT26_COOKIE 0
31 la_version (unsigned int v
)
37 la_objopen (struct link_map
*map
, Lmid_t lmid
, uintptr_t *cookie
)
39 const char *p
= strrchr (map
->l_name
, '/');
40 const char *l_name
= p
== NULL
? map
->l_name
: p
+ 1;
42 if (strncmp (l_name
, TEST_NAME
, strlen (TEST_NAME
)) == 0)
45 printf ("objopen: %ld, %s [cookie=%ld]\n", lmid
, l_name
, ck
);
46 return ck
== -1 ? 0 : LA_FLG_BINDFROM
| LA_FLG_BINDTO
;
50 la_aarch64_gnu_pltenter (ElfW(Sym
) *sym
__attribute__ ((unused
)),
51 unsigned int ndx
__attribute__ ((unused
)),
52 uintptr_t *refcook
, uintptr_t *defcook
,
53 La_aarch64_regs
*regs
, unsigned int *flags
,
54 const char *symname
, long int *framesizep
)
56 printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
57 symname
, (long int) sym
->st_value
, ndx
, *flags
);
59 if (strcmp (symname
, "tst_audit26_func") == 0)
61 assert (regs
->lr_xreg
[0] == ARG1
);
62 assert (regs
->lr_xreg
[1] == ARG2
);
63 assert (regs
->lr_xreg
[2] == ARG3
);
68 assert (regs
->lr_vpcs
== 0);
71 asm volatile ("mov x8, -1" : : : "x8");
79 la_aarch64_gnu_pltexit (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
81 const struct La_aarch64_regs
*inregs
,
82 struct La_aarch64_retval
*outregs
, const char *symname
)
84 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u\n",
85 symname
, (long int) sym
->st_value
, ndx
);
87 if (strcmp (symname
, "tst_audit26_func") == 0)
89 assert (inregs
->lr_xreg
[0] == ARG1
);
90 assert (inregs
->lr_xreg
[1] == ARG2
);
91 assert (inregs
->lr_xreg
[2] == ARG3
);
96 assert (inregs
->lr_vpcs
== 0);
97 assert (outregs
->lrv_vpcs
== 0);
100 asm volatile ("mov x8, -1" : : : "x8");