Article View: gnu.gcc.bug
Article #21Bug in gnu-ld using gcc, g++ and gas
From: Helmut Kaufmann
Date: Fri, 30 Oct 1992 15:31
Date: Fri, 30 Oct 1992 15:31
23 lines
1318 bytes
1318 bytes
We're using Sparc stations running SunOs4.1.1.
We've compiled gcc2.2.2 with the -with-gnu-as and -with-gnu-ld options
We've compiled glibc1.05 and libg++2.2.
We tried to link a program containing c and c++ object files and found
out the following:
If u use only c u can have an object file containing only global variables
with their initializations (int i=0, j=12; ). j will be initilized
correctly at the beginning of the main program.
If u link c++ code and c code together, j won't be initialized but set to
zero. U have to include a dummy function (void dummy(void) {}; ) in the
module containing the global vars and call it BEFORE accessing j. Then,
j will be set correctly.
This looks like a bug to us. Probably the linker doesnt't work correctly.
Can u give us a helping hand?
Thanks a lot
Helmut Kaufmann & Martin Wunderli
{kaufmann,wunderli}@inf.ethz.ch
Technical Details
Message-ID:
<9210301331.AA24834@neptune>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!inf.ethz.CH!kaufmannShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!inf.ethz.CH!kaufmann From: kaufmann@inf.ethz.CH (Helmut Kaufmann) Subject: Bug in gnu-ld using gcc, g++ and gas Message-ID: <9210301331.AA24834@neptune> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Fri, 30 Oct 1992 15:31:09 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 25