Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Oct 1998 09:40:53 -0700
From:      John Polstra <jdp@polstra.com>
To:        David Holland <dholland@cs.toronto.edu>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: mail in free(): warning: junk pointer, too high to make sense. 
Message-ID:  <199810101640.JAA15044@austin.polstra.com>
In-Reply-To: Your message of "Sat, 10 Oct 1998 03:21:33 EDT." <98Oct10.032139edt.37814-22953@qew.cs.toronto.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
>  > The rationale is no mystery.  It comes directly from the ELF
>  > specification, aka "System V Application Binary Interface,"
>  > Prentice-Hall, 1990, ISBN 0-13-877598-2, page 4-25:
>  > 
>  >     External C symbols have the same names in C, assembly code, and
>  >     object files' symbol tables.
> 
> That's not a rationale, just a standard :-)

:-)

> (what *was* the rationale, anyway?)

I wasn't privy to their thinking process, but one advantage is that it
makes dlsym() a lot less confusing.  You don't have to decide whether
to pass in the assembly language name or the C name, because they're
the same.

But a better question might be: what was the rationale for adding
those leading underscores in the first place?  The answer is that the
PDP-11 assembler used names like "r0" for its registers.  Without the
leading underscore, a C variable "r0" would have collided with the
register name.  In order to get rid of the underscores for SVR4, they
had to give the registers names that were illegal in C (like "%eax").

John
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                Seattle, Washington USA
   "Self-knowledge is always bad news."                 -- John Barth

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810101640.JAA15044>