1 /* Test that lazy binding does not clobber r0.
2 Copyright (C) 2018-2021 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/>. */
25 #if defined (__s390x__)
26 static const unsigned long magic_value
= 0x0011223344556677UL
;
28 static const unsigned long magic_value
= 0x00112233;
31 unsigned long r0x2_trampoline (unsigned long);
33 /* Invoke r0x2, which doubles the value in r0. If we get
34 value * 2 back, this means nothing clobbers r0, particularly,
35 _dl_runtime_resolve and _dl_runtime_profile. */
36 asm (" .type r0x2_trampoline, @function\n"
38 #if defined (__s390x__)
40 " stg %r14,112(%r15)\n"
42 " brasl %r14,r0x2@plt\n"
44 " lg %r14,112(%r15)\n"
47 #elif defined (__zarch__)
51 " brasl %r14,r0x2@plt\n"
61 " l %r14,1f-.(%r14)\n"
78 for (i
= 0; i
< 2; i
++)
80 run
= (i
== 0) ? "lazy" : "non-lazy";
82 printf ("-> %s r0 = 0x%lx\n", run
, r0
);
83 r0
= r0x2_trampoline (r0
);
84 printf ("<- %s r0 * 2 = 0x%lx\n", run
, r0
);
85 if (r0
!= magic_value
* 2)
91 #include <support/test-driver.c>