1 /* Test case for i386 preserved registers in dynamic linker.
2 Copyright (C) 2015-2017 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 <http://www.gnu.org/licenses/>. */
27 #include <bits/wordsize.h>
28 #include <gnu/lib-names.h>
31 la_version (unsigned int v
)
35 printf ("version: %u\n", v
);
38 sprintf (buf
, "%u", v
);
44 la_activity (uintptr_t *cookie
, unsigned int flag
)
49 case LA_ACT_CONSISTENT
:
50 flagstr
= "consistent";
59 printf ("activity: unknown activity %u\n", flag
);
62 printf ("activity: %s\n", flagstr
);
66 la_objsearch (const char *name
, uintptr_t *cookie
, unsigned int flag
)
72 flagstr
= "LA_SET_ORIG";
75 flagstr
= "LA_SER_LIBPATH";
78 flagstr
= "LA_SER_RUNPATH";
81 flagstr
= "LA_SER_CONFIG";
84 flagstr
= "LA_SER_DEFAULT";
87 flagstr
= "LA_SER_SECURE";
90 printf ("objsearch: %s, unknown flag %d\n", name
, flag
);
94 printf ("objsearch: %s, %s\n", name
, flagstr
);
99 la_objopen (struct link_map
*l
, Lmid_t lmid
, uintptr_t *cookie
)
101 printf ("objopen: %ld, %s\n", lmid
, l
->l_name
);
107 la_preinit (uintptr_t *cookie
)
109 printf ("preinit\n");
113 la_objclose (uintptr_t *cookie
)
115 printf ("objclose\n");
120 la_symbind32 (Elf32_Sym
*sym
, unsigned int ndx
, uintptr_t *refcook
,
121 uintptr_t *defcook
, unsigned int *flags
, const char *symname
)
123 printf ("symbind32: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
124 symname
, (long int) sym
->st_value
, ndx
, *flags
);
126 return sym
->st_value
;
129 #include "tst-audit.h"
132 pltenter (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
133 uintptr_t *defcook
, La_regs
*regs
, unsigned int *flags
,
134 const char *symname
, long int *framesizep
)
136 printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
137 symname
, (long int) sym
->st_value
, ndx
, *flags
);
139 if (strcmp (symname
, "audit1_test") == 0
140 || strcmp (symname
, "audit2_test") == 0)
142 if (regs
->lr_eax
!= 1
144 || regs
->lr_ecx
!= 3)
150 return sym
->st_value
;
154 pltexit (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
155 uintptr_t *defcook
, const La_regs
*inregs
, La_retval
*outregs
,
158 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
159 symname
, (long int) sym
->st_value
, ndx
,
160 (ptrdiff_t) outregs
->int_retval
);
162 if (strcmp (symname
, "audit1_test") == 0
163 || strcmp (symname
, "audit2_test") == 0)
165 if (inregs
->lr_eax
!= 1
166 || inregs
->lr_edx
!= 2
167 || inregs
->lr_ecx
!= 3)
170 if (strcmp (symname
, "audit1_test") == 0)
172 long long x
= ((unsigned long long) outregs
->lrv_eax
173 | (unsigned long long) outregs
->lrv_edx
<< 32);
178 else if (strcmp (symname
, "audit2_test") == 0)
180 if (outregs
->lrv_st0
!= 30)