This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Binary compatibility loss regarding errno
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Mon, 23 Dec 2002 11:03:51 -0500
- Subject: Binary compatibility loss regarding errno
Consider this program:
int rename (const char *, const char *);
extern int errno;
int main()
{
printf ("%d\n", errno);
errno = 1;
printf ("%d\n", errno);
rename ("foof", "barf");
printf ("%d\n", errno);
return 0;
}
OK, we all know that's not correct. And it won't link with current CVS
glibc, which is OK. However, it doesn't _work_ either, if compiled against
an older glibc (say 2.2.5, since that's what I've got lying around). The
program has an R_386_COPY relocation for errno, glibc 2.2.5 had an
R_386_GLOB_DAT relocation for its accesses to errno. But glibc 2.3 doesn't,
and the call to rename() sets errno inside of libc instead of in the
application's .bss section.
This is a pretty severe problem, since it silently makes applications ignore
errno. I don't know how to resolve this without putting the external
relocation back in glibc, which I suspect you're trying to avoid. Any
ideas?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer