Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Sep 2000 00:01:19 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dag-Erling Smorgrav <des@flood.ping.uio.no>
Cc:        Peter Wemm <peter@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sbin/savecore savecore.c
Message-ID:  <Pine.BSF.4.21.0009042344390.22760-100000@besplex.bde.org>
In-Reply-To: <xzplmx9tnte.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3 Sep 2000, Dag-Erling Smorgrav wrote:

> Peter Wemm <peter@FreeBSD.org> writes:
> >   Log:
> >   I'm not sure what changed to cause this, but using 'dirname' as a variable

Someone added namespace pollution (dirname and basename) to libc.

> >   was colliding with dirname() in libc.a and causing a Sig 10/bus error.
> >   Just change dirname to savedir and be done with it.

> Umm, sounds like linker bogosity to me. It could probably have been
> solved by making dirname (and various other global variables) static.

The collision is detected for static linkage, but not for dynamic linkage:

$ echo 'char *dirname; main() { dirname = "core"; }' >z.c
$ cc -o z z.c
$ ./z
$ cc -static -o z z.c
/usr/libexec/elf/ld: Warning: size of symbol `dirname' changed from 4 to 206 in dirname.o
/usr/libexec/elf/ld: Warning: type of symbol `dirname' changed from 1 to 2 in dirname.o
$ ./z
Bus error (core dumped)

savecore is statically linked, so the error should have been noticed at
makeworld time.

I think the linker should know that the symols are in different sections,
not just that they have different sizes.

Bruce



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009042344390.22760-100000>