]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/generic/bb_init_func.c
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[thirdparty/glibc.git] / sysdeps / generic / bb_init_func.c
CommitLineData
c08bc50a 1/* Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
ebbad4cc 2 This file is part of the GNU C Library.
b20e47cb
RM
3 Contributed by David Mosberger (davidm@cs.arizona.edu).
4
ebbad4cc 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
b20e47cb 9
ebbad4cc
UD
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
41bdb6e2 13 Lesser General Public License for more details.
b20e47cb 14
41bdb6e2
AJ
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
b20e47cb
RM
19
20/* __bb_init_func is invoked at the beginning of each function, before
ebbad4cc
UD
21 any registers have been saved. This generic routine should work
22 provided that calling this function doesn't mangle the arguments
23 passed to the function being called. If that's not the case, a
24 system specific routine must be provided. */
b20e47cb
RM
25
26#include <sys/types.h>
27#include <sys/gmon.h>
28
b20e47cb
RM
29#include <stdlib.h>
30
31void
b13927da 32__bb_init_func (struct __bb *bb)
b20e47cb
RM
33{
34 struct gmonparam *p = &_gmonparam;
35
36 if (bb->zero_word != 0)
37 {
38 return; /* handle common case quickly */
39 }
40
41 /* insert this basic-block into basic-block list: */
42 bb->zero_word = 1;
43 bb->next = __bb_head;
44 __bb_head = bb;
45
46 if (bb->next == 0 && p->state != GMON_PROF_ON)
47 {
48 /* we didn't register _mcleanup yet and pc profiling doesn't seem
49 to be active, so let's register it now: */
c08bc50a
UD
50 extern void *__dso_handle __attribute__ ((__weak__));
51 __cxa_atexit ((void (*) (void *)) _mcleanup, NULL,
52 &__dso_handle ? __dso_handle : NULL);
b20e47cb
RM
53 }
54}