Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / unix / sysv / linux / m68k / init-first.c
blob5d37af76542d172662966012d80f1758f91f1409
1 /* Initialization code run first thing by the ELF startup code. Linux/m68k.
2 Copyright (C) 2010-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library. If not, see
18 <http://www.gnu.org/licenses/>. */
20 /* Note: linking in vDSO to a static binary requires changes to
21 the main GLIBC proper. Not yet implemented. */
22 #ifdef SHARED
24 #include <dl-vdso.h>
25 #include <bits/m68k-vdso.h>
27 static inline void
28 _libc_vdso_platform_setup (void)
30 void *p;
32 PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
34 /* It may happen that rtld didn't initialize the vDSO, so fallback
35 to the syscall implementations if _dl_vdso_vsym returns NULL.
36 This may happen when a static executable dlopen's a dynamic library.
37 This really is nothing more than a workaround for rtld/csu
38 deficiency. Ideally, init code would setup the vDSO for static
39 binaries too. */
41 p = _dl_vdso_vsym ("__kernel_read_tp", &linux26);
42 if (p != NULL)
44 __vdso_read_tp = p;
45 __rtld___vdso_read_tp = p;
47 else
48 assert (__vdso_read_tp == (void *) __vdso_read_tp_stub);
50 p = _dl_vdso_vsym ("__kernel_atomic_cmpxchg_32", &linux26);
51 if (p != NULL)
53 __vdso_atomic_cmpxchg_32 = p;
54 __rtld___vdso_atomic_cmpxchg_32 = p;
56 else
57 assert (__vdso_atomic_cmpxchg_32
58 == (void *) __vdso_atomic_cmpxchg_32_stub);
60 p = _dl_vdso_vsym ("__kernel_atomic_barrier", &linux26);
61 if (p != NULL)
63 __vdso_atomic_barrier = p;
64 __rtld___vdso_atomic_barrier = p;
66 else
67 assert (__vdso_atomic_barrier == (void *) __vdso_atomic_barrier_stub);
70 #define VDSO_SETUP _libc_vdso_platform_setup
72 #endif /* SHARED */
74 #include <csu/init-first.c>