Article View: gnu.gcc.help
Article #42285Re: gcc 2.7.0 ELF problem
From: Ronald F. Guilmette
Date: Thu, 21 Dec 1995 00:00
Date: Thu, 21 Dec 1995 00:00
62 lines
2595 bytes
2595 bytes
In article <DJH3J0.5s@temic-ech.spacenet.de>,
Karsten Keil <keil@temic-ech.spacenet.de> wrote:
>Hello,
>if this is a FAQ sorry, but in the GCC FAQ on my CD I found nothing.
>I have trouble to run xbench under linux and gcc 2.7.0 (ELF system).
>It segfault's.
>While debbuging it I found that a assignment of a global
>variable is the reason:
>...
>int sync;
>main ( ...
>
>
>sync=0;
>here is the SEGFAULT
>...
>
>I wrote a little test prog that give the same result:
>/*########################*/
>#include <stdio.h>
>
>int sync;
>
>main(argc,argv)
> int argc;
> char **argv;
>{
>
> sync = 0;
> printf("sync=%d\n",sync);
>
>}
>/*########################*/
>With ELF (default) this prog segfaults,
>with aout (gcc -b i486-linuxaout) it runs.
>
>What's wrong ?
>(I have an idea that sync is allready an symbol in libc, but why does it
>work under aout ?).
I have already made the exact same report as you have made, because I also
found the exact same problem (segfaulting due to the presence of a variable
named `sync') in the exact same environment (Linux) and with the exact same
program (xbench).
As it turns out, this is a NOT a problem with either GCC or the assembler
or the linker. It has been reported to me that the problem is due to
a rather serious bug in the linux C library (ELF version). It apparently
fails to properly export its symbols as ELF ``weak linkage'' symbols
(as all good ELF libc libraries should).
I have been assured (by H.J. Lu, maintainer of the linux C library) that
this problem in the library will be fixed in the next release of the
library. For the time being, the simplest workaround is just to avoid
using the names of libc library functions in your own programs (e.g.
as names of your own global variables or functions).
--
-- Ron Guilmette, Roseville, CA -------- Infinite Monkeys & Co. ------------
---- E-mail: rfg@monkeys.com ----------- Purveyors of Compiler Test Suites -
------ Copyright (c) 1995 by Ronald F. Guilmette; All rights reserved. -----
Technical Details
Message-ID:
<4bb61k$255@segfault.monkeys.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<DJH3J0.5s@temic-ech.spacenet.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,5ff2217ff6c2d590 X-Google-Attributes: gid11318c,public X-Google-Thread: f5392,de3537fad1cb676d,start X-Google-Attributes: gidf5392,public From: rfg@monkeys.com (Ronald F. Guilmette) Subject: Re: gcc 2.7.0 ELF problem Date: 1995/12/21 Message-ID: <4bb61k$255@segfault.monkeys.com> X-Deja-AN: 122475246 references: <DJH3J0.5s@temic-ech.spacenet.de> organization: Infinite Monkeys & Co. newsgroups: gnu.gcc.help,comp.os.linux.development.system