Subject: Re: Global variable name which equals to func name causes
To: None <tech-userlevel@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 09/27/2007 09:46:23
>> Now I think it is a very terrible problem: I can't have any global
>> varible whose name is the same with those in libraries. For
>> example, __srefill, __sread called by fread, or thounds of any other
> You can't have any variable starting with _ in your programs -
> they're for system use.
I'm not sure what kind of "can't" this is. They certainly work for me.
They're risky, true, because of this kind of thing, but that's hardly
"can't have" them.
It does mean that this problem definitely isn't a bug as applied to
such variables, but that's a very different statement. (I'm not sure
whether I'd call this a bug as applied to things like read or mmap.
It's certainly an unpleasant surprise, though, and IWBNI symbols and
references to them were somehow tagged with enough information that ld
could warn about a code-type relocation referring to a non-text-segment
symbol. Some machines have enough information in their relocation data
to support this already, I think - for exmaple, SPARC "call" uses a
relocation type not used for anything else. (I do think it should be
just a warning, preferably with some way to shut it off for a given
symbol; I've seen occasionally hacks of various sorts that would be
broken by making it an error.)
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML email@example.com
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B