2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
10 typedef void (*FUN_PTR) (void);
12 #define ATTR_SEC(sec)\
13 __attribute__ ((__used__, section(sec), aligned(sizeof(FUN_PTR))))
15 #define MAKE_FUN(name) void name(void) { printf(#name "\n");}
17 MAKE_FUN(main_preinit1)
18 MAKE_FUN(main_preinit2)
19 MAKE_FUN(main_preinit3)
20 static const FUN_PTR array_preinit[] ATTR_SEC(".preinit_array") =
21 { main_preinit1, main_preinit2, main_preinit3 };
27 static const FUN_PTR array_init[] ATTR_SEC(".init_array") =
28 { main_init1, main_init2, main_init3 };
33 static const FUN_PTR array_fini[] ATTR_SEC(".fini_array") =
34 { main_fini1, main_fini2, main_fini3 };
36 /* NOTE: there is NO .prefini_array */