This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for csu/gmon-start.c


On Wed, Apr 19, 2000 at 02:55:47PM -0400, Roland McGrath wrote:
> I think your change is ok.  It is usual to use `extern void _end;' and the
> like for this, so that &_end has type void *.  Another good choice is
> `extern void _end[];' or the like; that has the benefit of `_end' rather
> than `&_end' doing the right thing as it does when using a function
> declaration.  (Note that `extern void _end;' has the benefit of giving you
> an error if you use `_end' instead of `&_end', while your declaration using
> a real type can result in confusingly bogus code that fetches from *&_end.)

Thanks. I like it. Here is the new one.


H.J.
---
2000-04-19  H.J. Lu  <hjl@gnu.org>

	* csu/gmon-start.c (_start): Declared as "extern void".
	(etext): Likewise.

--- /work/gnu/import/glibc-2.1/libc/csu/gmon-start.c	Mon Jul 28 14:35:38 1997
+++ csu/gmon-start.c	Wed Apr 19 11:57:28 2000
@@ -22,8 +22,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-/* Beginning and end of our code segment.  */
-extern void _start (void), etext (void);
+/* Beginning and end of our code segment. We cannot declare them
+   as the external functions since we want the addresses of those
+   labels. Taking the address of a function may have different
+   meanings on different platforms. */
+extern void _start, etext;
 
 #ifndef HAVE_INITFINI
 /* This function gets called at startup by the normal constructor

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]