xref: /netbsd-src/tests/libexec/ld.elf_so/helper_def_static/h_def_static.c (revision 12037d6a69ca3a6ed21a5e0a5a34f55ca2f34157)
1*12037d6aSriastradh /*	$NetBSD: h_def_static.c,v 1.1 2023/05/31 00:18:44 riastradh Exp $	*/
2*12037d6aSriastradh 
3*12037d6aSriastradh /*-
4*12037d6aSriastradh  * Copyright (c) 2023 The NetBSD Foundation, Inc.
5*12037d6aSriastradh  * All rights reserved.
6*12037d6aSriastradh  *
7*12037d6aSriastradh  * Redistribution and use in source and binary forms, with or without
8*12037d6aSriastradh  * modification, are permitted provided that the following conditions
9*12037d6aSriastradh  * are met:
10*12037d6aSriastradh  * 1. Redistributions of source code must retain the above copyright
11*12037d6aSriastradh  *    notice, this list of conditions and the following disclaimer.
12*12037d6aSriastradh  * 2. Redistributions in binary form must reproduce the above copyright
13*12037d6aSriastradh  *    notice, this list of conditions and the following disclaimer in the
14*12037d6aSriastradh  *    documentation and/or other materials provided with the distribution.
15*12037d6aSriastradh  *
16*12037d6aSriastradh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*12037d6aSriastradh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*12037d6aSriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*12037d6aSriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*12037d6aSriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*12037d6aSriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*12037d6aSriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*12037d6aSriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*12037d6aSriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*12037d6aSriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*12037d6aSriastradh  * POSSIBILITY OF SUCH DAMAGE.
27*12037d6aSriastradh  */
28*12037d6aSriastradh 
29*12037d6aSriastradh __thread int mysym __attribute__((tls_model("initial-exec"))) = 0;
30*12037d6aSriastradh 
31*12037d6aSriastradh int *fdef(void);
32*12037d6aSriastradh int *
fdef(void)33*12037d6aSriastradh fdef(void)
34*12037d6aSriastradh {
35*12037d6aSriastradh 
36*12037d6aSriastradh 	return &mysym;
37*12037d6aSriastradh }
38