7 #include <bits/wordsize.h>
8 #include <gnu/lib-names.h>
12 la_version (unsigned int v
)
16 printf ("version: %u\n", v
);
19 sprintf (buf
, "%u", v
);
25 la_activity (uintptr_t *cookie
, unsigned int flag
)
27 if (flag
== LA_ACT_CONSISTENT
)
28 printf ("activity: consistent\n");
29 else if (flag
== LA_ACT_ADD
)
30 printf ("activity: add\n");
31 else if (flag
== LA_ACT_DELETE
)
32 printf ("activity: delete\n");
34 printf ("activity: unknown activity %u\n", flag
);
38 la_objsearch (const char *name
, uintptr_t *cookie
, unsigned int flag
)
42 if (flag
== LA_SER_ORIG
)
43 flagstr
= "LA_SET_ORIG";
44 else if (flag
== LA_SER_LIBPATH
)
45 flagstr
= "LA_SER_LIBPATH";
46 else if (flag
== LA_SER_RUNPATH
)
47 flagstr
= "LA_SER_RUNPATH";
48 else if (flag
== LA_SER_CONFIG
)
49 flagstr
= "LA_SER_CONFIG";
50 else if (flag
== LA_SER_DEFAULT
)
51 flagstr
= "LA_SER_DEFAULT";
52 else if (flag
== LA_SER_SECURE
)
53 flagstr
= "LA_SER_SECURE";
56 sprintf (buf
, "unknown flag %d", flag
);
59 printf ("objsearch: %s, %s\n", name
, flagstr
);
65 la_objopen (struct link_map
*l
, Lmid_t lmid
, uintptr_t *cookie
)
67 printf ("objopen: %ld, %s\n", lmid
, l
->l_name
);
73 la_preinit (uintptr_t *cookie
)
79 la_objclose (uintptr_t *cookie
)
81 printf ("objclose\n");
86 la_symbind32 (Elf32_Sym
*sym
, unsigned int ndx
, uintptr_t *refcook
,
87 uintptr_t *defcook
, unsigned int *flags
, const char *symname
)
89 printf ("symbind32: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
90 symname
, (long int) sym
->st_value
, ndx
, *flags
);
96 la_symbind64 (Elf64_Sym
*sym
, unsigned int ndx
, uintptr_t *refcook
,
97 uintptr_t *defcook
, unsigned int *flags
, const char *symname
)
99 printf ("symbind64: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
100 symname
, (long int) sym
->st_value
, ndx
, *flags
);
102 return sym
->st_value
;
106 # define pltenter la_i86_gnu_pltenter
107 # define pltexit la_i86_gnu_pltexit
108 # define La_regs La_i86_regs
109 # define La_retval La_i86_retval
110 # define int_retval lrv_eax
111 #elif defined __x86_64__
112 # define pltenter la_x86_64_gnu_pltenter
113 # define pltexit la_x86_64_gnu_pltexit
114 # define La_regs La_x86_64_regs
115 # define La_retval La_x86_64_retval
116 # define int_retval lrv_rax
117 #elif defined __powerpc__ && __WORDSIZE == 32
118 # define pltenter la_ppc32_gnu_pltenter
119 # define pltexit la_ppc32_gnu_pltexit
120 # define La_regs La_ppc32_regs
121 # define La_retval La_ppc32_retval
122 # define int_retval lrv_r3
123 #elif defined __powerpc__ && __WORDSIZE == 64
124 # define pltenter la_ppc64_gnu_pltenter
125 # define pltexit la_ppc64_gnu_pltexit
126 # define La_regs La_ppc64_regs
127 # define La_retval La_ppc64_retval
128 # define int_retval lrv_r3
130 # define pltenter la_sh_gnu_pltenter
131 # define pltexit la_sh_gnu_pltexit
132 # define La_regs La_sh_regs
133 # define La_retval La_sh_retval
134 # define int_retval lrv_r0
135 #elif defined __mc68000__
136 # define pltenter la_m68k_gnu_pltenter
137 # define pltexit la_m68k_gnu_pltexit
138 # define La_regs La_m68k_regs
139 # define La_retval La_m68k_retval
140 # define int_retval lrv_d0
141 #elif defined __alpha__
142 # define pltenter la_alpha_gnu_pltenter
143 # define pltexit la_alpha_gnu_pltexit
144 # define La_regs La_alpha_regs
145 # define La_retval La_alpha_retval
146 # define int_retval lrv_r0
147 #elif defined __s390__ && __WORDSIZE == 32
148 # define pltenter la_s390_32_gnu_pltenter
149 # define pltexit la_s390_32_gnu_pltexit
150 # define La_regs La_s390_32_regs
151 # define La_retval La_s390_32_retval
152 # define int_retval lrv_r2
153 #elif defined __s390__ && __WORDSIZE == 64
154 # define pltenter la_s390_64_gnu_pltenter
155 # define pltexit la_s390_64_gnu_pltexit
156 # define La_regs La_s390_64_regs
157 # define La_retval La_s390_64_retval
158 # define int_retval lrv_r2
159 #elif defined __ia64__
160 # define pltenter la_ia64_gnu_pltenter
161 # define pltexit la_ia64_gnu_pltexit
162 # define La_regs La_ia64_regs
163 # define La_retval La_ia64_retval
164 # define int_retval lrv_r8
165 #elif defined __mips__ && _MIPS_SIM == _ABIO32
166 # define pltenter la_mips_o32_gnu_pltenter
167 # define pltexit la_mips_o32_gnu_pltexit
168 # define La_regs La_mips_32_regs
169 # define La_retval La_mips_32_retval
170 # define int_retval lrv_v0
171 #elif defined __mips__ && _MIPS_SIM == _ABIN32
172 # define pltenter la_mips_n32_gnu_pltenter
173 # define pltexit la_mips_n32_gnu_pltexit
174 # define La_regs La_mips_64_regs
175 # define La_retval La_mips_64_retval
176 # define int_retval lrv_v0
177 #elif defined __mips__ && _MIPS_SIM == _ABI64
178 # define pltenter la_mips_n64_gnu_pltenter
179 # define pltexit la_mips_n64_gnu_pltexit
180 # define La_regs La_mips_64_regs
181 # define La_retval La_mips_64_retval
182 # define int_retval lrv_v0
183 #elif defined __sparc__ && __WORDSIZE == 32
184 # define pltenter la_sparc32_gnu_pltenter
185 # define pltexit la_sparc32_gnu_pltexit
186 # define La_regs La_sparc32_regs
187 # define La_retval La_sparc32_retval
188 # define int_retval lrv_reg[0]
189 #elif defined __sparc__ && __WORDSIZE == 64
190 # define pltenter la_sparc64_gnu_pltenter
191 # define pltexit la_sparc64_gnu_pltexit
192 # define La_regs La_sparc64_regs
193 # define La_retval La_sparc64_retval
194 # define int_retval lrv_reg[0]
197 #include <tst-audit.h>
198 #if (!defined (pltenter) || !defined (pltexit) || !defined (La_regs) \
199 || !defined (La_retval) || !defined (int_retval))
200 # error "architecture specific code needed in sysdeps/CPU/tls-audit.h or here"
205 pltenter (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
206 uintptr_t *defcook
, La_regs
*regs
, unsigned int *flags
,
207 const char *symname
, long int *framesizep
)
209 printf ("pltenter: symname=%s, st_value=%#lx, ndx=%u, flags=%u\n",
210 symname
, (long int) sym
->st_value
, ndx
, *flags
);
212 return sym
->st_value
;
216 pltexit (ElfW(Sym
) *sym
, unsigned int ndx
, uintptr_t *refcook
,
217 uintptr_t *defcook
, const La_regs
*inregs
, La_retval
*outregs
,
220 printf ("pltexit: symname=%s, st_value=%#lx, ndx=%u, retval=%tu\n",
221 symname
, (long int) sym
->st_value
, ndx
, outregs
->int_retval
);