Fix grouping and reuse other locales in various locales
[glibc.git] / elf / tst-auditmod3b.c
blob388ed6e49c90e59d8eb02d8a6bdd919242c30de3
1 /* Verify that changing xmm registers in audit library won't affect
2 function parameter passing/return. */
4 #include <dlfcn.h>
5 #include <stdint.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 #include <bits/wordsize.h>
11 #include <gnu/lib-names.h>
12 #include <emmintrin.h>
14 unsigned int
15 la_version (unsigned int v)
17 setlinebuf (stdout);
19 printf ("version: %u\n", v);
21 char buf[20];
22 sprintf (buf, "%u", v);
24 return v;
27 void
28 la_activity (uintptr_t *cookie, unsigned int flag)
30 if (flag == LA_ACT_CONSISTENT)
31 printf ("activity: consistent\n");
32 else if (flag == LA_ACT_ADD)
33 printf ("activity: add\n");
34 else if (flag == LA_ACT_DELETE)
35 printf ("activity: delete\n");
36 else
37 printf ("activity: unknown activity %u\n", flag);
40 char *
41 la_objsearch (const char *name, uintptr_t *cookie, unsigned int flag)
43 char buf[100];
44 const char *flagstr;
45 if (flag == LA_SER_ORIG)
46 flagstr = "LA_SET_ORIG";
47 else if (flag == LA_SER_LIBPATH)
48 flagstr = "LA_SER_LIBPATH";
49 else if (flag == LA_SER_RUNPATH)
50 flagstr = "LA_SER_RUNPATH";
51 else if (flag == LA_SER_CONFIG)
52 flagstr = "LA_SER_CONFIG";
53 else if (flag == LA_SER_DEFAULT)
54 flagstr = "LA_SER_DEFAULT";
55 else if (flag == LA_SER_SECURE)
56 flagstr = "LA_SER_SECURE";
57 else
59 sprintf (buf, "unknown flag %d", flag);
60 flagstr = buf;
62 printf ("objsearch: %s, %s\n", name, flagstr);
64 return (char *) name;
67 unsigned int
68 la_objopen (struct link_map *l, Lmid_t lmid, uintptr_t *cookie)
70 printf ("objopen: %ld, %s\n", lmid, l->l_name);
72 return 3;
75 void
76 la_preinit (uintptr_t *cookie)
78 printf ("preinit\n");
81 unsigned int
82 la_objclose (uintptr_t *cookie)
84 printf ("objclose\n");
85 return 0;
88 uintptr_t
89 la_symbind32 (Elf32_Sym *sym, unsigned int ndx, uintptr_t *refcook,
90 uintptr_t *defcook, unsigned int *flags, const char *symname)
92 printf ("symbind32: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
93 symname, (long int) sym->st_value, ndx, *flags);
95 return sym->st_value;
98 uintptr_t
99 la_symbind64 (Elf64_Sym *sym, unsigned int ndx, uintptr_t *refcook,
100 uintptr_t *defcook, unsigned int *flags, const char *symname)
102 printf ("symbind64: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
103 symname, (long int) sym->st_value, ndx, *flags);
105 return sym->st_value;
108 #define pltenter la_x86_64_gnu_pltenter
109 #define pltexit la_x86_64_gnu_pltexit
110 #define La_regs La_x86_64_regs
111 #define La_retval La_x86_64_retval
112 #define int_retval lrv_rax
114 #include <tst-audit.h>
116 ElfW(Addr)
117 pltenter (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
118 uintptr_t *defcook, La_regs *regs, unsigned int *flags,
119 const char *symname, long int *framesizep)
121 printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
122 symname, (long int) sym->st_value, ndx, *flags);
124 __m128i xmm = _mm_set1_epi32 (-1);
125 asm volatile ("movdqa %0, %%xmm0" : : "x" (xmm) : "xmm0" );
126 asm volatile ("movdqa %0, %%xmm1" : : "x" (xmm) : "xmm1" );
127 asm volatile ("movdqa %0, %%xmm2" : : "x" (xmm) : "xmm2" );
128 asm volatile ("movdqa %0, %%xmm3" : : "x" (xmm) : "xmm3" );
129 asm volatile ("movdqa %0, %%xmm4" : : "x" (xmm) : "xmm4" );
130 asm volatile ("movdqa %0, %%xmm5" : : "x" (xmm) : "xmm5" );
131 asm volatile ("movdqa %0, %%xmm6" : : "x" (xmm) : "xmm6" );
132 asm volatile ("movdqa %0, %%xmm7" : : "x" (xmm) : "xmm7" );
134 return sym->st_value;
137 unsigned int
138 pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
139 uintptr_t *defcook, const La_regs *inregs, La_retval *outregs,
140 const char *symname)
142 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
143 symname, (long int) sym->st_value, ndx, outregs->int_retval);
145 __m128i xmm = _mm_set1_epi32 (-1);
146 asm volatile ("movdqa %0, %%xmm0" : : "x" (xmm) : "xmm0" );
147 asm volatile ("movdqa %0, %%xmm1" : : "x" (xmm) : "xmm1" );
148 asm volatile ("movdqa %0, %%xmm2" : : "x" (xmm) : "xmm2" );
149 asm volatile ("movdqa %0, %%xmm3" : : "x" (xmm) : "xmm3" );
150 asm volatile ("movdqa %0, %%xmm4" : : "x" (xmm) : "xmm4" );
151 asm volatile ("movdqa %0, %%xmm5" : : "x" (xmm) : "xmm5" );
152 asm volatile ("movdqa %0, %%xmm6" : : "x" (xmm) : "xmm6" );
153 asm volatile ("movdqa %0, %%xmm7" : : "x" (xmm) : "xmm7" );
155 return 0;