diff options
author | Roland McGrath <roland@gnu.org> | 1996-01-17 02:29:57 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-01-17 02:29:57 +0000 |
commit | 5f3d5c2bbb4757e9cc5b30bc66b1d7555739bc4a (patch) | |
tree | 57d9fa3f28869526d8a1482982bc01cefdacbcb6 /csu/initfini.c | |
parent | d99d7e264430e26e9070b4908a6e81103aa92747 (diff) | |
download | glibc-5f3d5c2bbb4757e9cc5b30bc66b1d7555739bc4a.tar.gz glibc-5f3d5c2bbb4757e9cc5b30bc66b1d7555739bc4a.tar.xz glibc-5f3d5c2bbb4757e9cc5b30bc66b1d7555739bc4a.zip |
* csu/initfini.c (_init): Call __gmon_start__ if defined (weak ref).
* csu/gmon-start.c (__gmon_start__): Renamed from gmon_start, made global. [! HAVE_INITFINI]: Only make it a constructor in this case.
Diffstat (limited to 'csu/initfini.c')
-rw-r--r-- | csu/initfini.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/csu/initfini.c b/csu/initfini.c index b0d0e68cbd..a3c3b3b7bc 100644 --- a/csu/initfini.c +++ b/csu/initfini.c @@ -63,6 +63,17 @@ SECTION (".init") void _init (void) { + /* We cannot use the normal constructor mechanism in gcrt1.o because it + appears before crtbegin.o in the link, so the header elt of .ctors + would come after the elt for __gmon_start__. One approach is for + gcrt1.o to reference a symbol which would be defined by some library + module which has a constructor; but then user code's constructors + would come first, and not be profiled. */ + extern void __gmon_start__ (void) __attribute__ ((weak)); + weak_symbol (__gmon_start__) + if (&__gmon_start__) + __gmon_start__ (); + /* End the here document containing the .init prologue code. Then fetch the .section directive just written and append that to crtn.s-new, followed by the function epilogue. */ |