* Global constructor problem on mips-sgi-irix5.2
@ 1998-04-06 17:35 Fred Richardson
1998-04-08 2:13 ` Jim Wilson
0 siblings, 1 reply; 6+ messages in thread
From: Fred Richardson @ 1998-04-06 17:35 UTC (permalink / raw)
To: egcs, egcs-bugs
Hi-
It looks like constructors for global objects aren't called on my
mips-sgi-irix5.2 box when using egcs-1.0.2.
The following program:
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
class Foo
{
private:
int a_int;
float a_flt;
public:
Foo () :
a_int(1234), a_flt(56.78) {};
void print()
{
fprintf(stdout, "Foo: a_int=%d, a_flt=%g\n",
a_int, a_flt);
fflush(stdout);
}
void set(int _a_int, float _a_flt)
{
a_int = _a_int;
a_flt = _a_flt;
}
};
Foo the_foo;
int main(int argc, char* argv[])
{
the_foo.print();
the_foo.set(4321, 87.65);
the_foo.print();
}
compiled the following way:
% g++ -v -Wall -o main -v main.cc
Reading specs from /d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 -D__unix__ -D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB -D__SYSTYPE_SVR4__ -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB -D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi) -D__EXCEPTIONS -D__CHAR_UNSIGNED__ -Wall -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__EXTENSIONS__ -D_SGI_SOURCE -D_LONGLONG -D_MIPS_FPSET=16 -D_MIPS_ISA=_MIPS_ISA_MIPS1 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 main.cc /var/tmp/cca0040A.ii
GNU CPP version egcs-2.90.27 980315 (egcs-1.0.2 release) [AL 1.1, MM 40] SGI running IRIX 5.x
#include "..." search starts here:
#include <...> search starts here:
/d4mutl/bybrad/include/g++
/usr/local/include
/d4mutl/bybrad/mips-sgi-irix5.2/include
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/include
/usr/include
End of search list.
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/cc1plus /var/tmp/cca0040A.ii -quiet -dumpbase main.cc -Wall -version -o /var/tmp/cca0040A.s
GNU C++ version egcs-2.90.27 980315 (egcs-1.0.2 release) (mips-sgi-irix5.2) compiled by GNU C version 2.7.2.1.
/d4mutl/bybrad/mips-sgi-irix5.2/bin/as -v -o /var/tmp/cca0040A1.o /var/tmp/cca0040A.s
GNU assembler version 980320 (mips-sgi-irix5.2), using BFD version 2.8.1.0.24
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/ld -call_shared -no_unresolved -_SYSTYPE_SVR4 -o main /usr/lib/crt1.o -L/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27 -L/d4mutl/bybrad/mips-sgi-irix5.2/lib -L/d4mutl/bybrad/lib /var/tmp/cca0040A1.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/crtn.o
%
Gives the following output:
% main
Foo: a_int=0, a_flt=0
Foo: a_int=4321, a_flt=87.65
%
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Global constructor problem on mips-sgi-irix5.2
1998-04-08 2:13 ` Jim Wilson
@ 1998-04-08 2:13 ` Fred Richardson
1998-04-08 13:11 ` H.J. Lu
1 sibling, 0 replies; 6+ messages in thread
From: Fred Richardson @ 1998-04-08 2:13 UTC (permalink / raw)
To: wilson; +Cc: egcs, egcs-bugs
>> It looks like constructors for global objects aren't called on my
>> mips-sgi-irix5.2 box when using egcs-1.0.2.
>>
>> Yes, there is something wrong, but it is not clear what is wrong.
I found the problem. Sorry I didn't report back! It turns out that
I was specifying " --with-gnu-ld" on the SGI's even though GNU LD is
not supported here (although GNU AS is). So, getting rid of this flag
to configure fixed everything for me.
-Fred
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Global constructor problem on mips-sgi-irix5.2
1998-04-06 17:35 Global constructor problem on mips-sgi-irix5.2 Fred Richardson
@ 1998-04-08 2:13 ` Jim Wilson
1998-04-08 2:13 ` Fred Richardson
1998-04-08 13:11 ` H.J. Lu
0 siblings, 2 replies; 6+ messages in thread
From: Jim Wilson @ 1998-04-08 2:13 UTC (permalink / raw)
To: frichard; +Cc: egcs, egcs-bugs
It looks like constructors for global objects aren't called on my
mips-sgi-irix5.2 box when using egcs-1.0.2.
Yes, there is something wrong, but it is not clear what is wrong.
GNU assembler version 980320 (mips-sgi-irix5.2), using BFD version 2.8.1.0.24
I see that you are using a funny version of binutils. I think that is one
of H.J. Lu's linux binutils releases. Perhaps it doesn't work right under
Irix 5. It was probably never tested there. Try using binutils-2.8.1 instead.
I am guessing that there might be some confusion over whether pointers are
32 bit or 64 bits in the ctor/dtor handling code in binutils. If binutils
puts a 64 bit value in the ctor list, and then gcc's ctor code read a 32 bit
value, it would see a zero and think that there were no ctors. If this is
the problem, then you will have to rebuild all of egcs with a different
binutils.
Jim
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Global constructor problem on mips-sgi-irix5.2
1998-04-08 2:13 ` Jim Wilson
1998-04-08 2:13 ` Fred Richardson
@ 1998-04-08 13:11 ` H.J. Lu
1998-04-08 15:08 ` Jim Wilson
1 sibling, 1 reply; 6+ messages in thread
From: H.J. Lu @ 1998-04-08 13:11 UTC (permalink / raw)
To: Jim Wilson; +Cc: frichard, egcs, egcs-bugs
>
> It looks like constructors for global objects aren't called on my
> mips-sgi-irix5.2 box when using egcs-1.0.2.
>
> Yes, there is something wrong, but it is not clear what is wrong.
>
> GNU assembler version 980320 (mips-sgi-irix5.2), using BFD version 2.8.1.0.24
>
> I see that you are using a funny version of binutils. I think that is one
> of H.J. Lu's linux binutils releases. Perhaps it doesn't work right under
> Irix 5. It was probably never tested there. Try using binutils-2.8.1 instead.
>
FYI, my binutils is binutils snapshot + ARM + some x86 changes. I
don't think they should affect mips/irix. Try binutils 2.9 prereleae
instead. Quite a few bugs have been fixed since 2.8.1.
H.J.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Global constructor problem on mips-sgi-irix5.2
1998-04-08 13:11 ` H.J. Lu
@ 1998-04-08 15:08 ` Jim Wilson
1998-04-10 17:12 ` Alexandre Oliva
0 siblings, 1 reply; 6+ messages in thread
From: Jim Wilson @ 1998-04-08 15:08 UTC (permalink / raw)
To: H.J. Lu; +Cc: frichard, egcs, egcs-bugs
FYI, my binutils is binutils snapshot + ARM + some x86 changes.
That begs the question as to whether the binutils snapshots have been tested
on a mips/irix5 machine anytime recently though.
I don't think they should affect mips/irix.
FYI mips/irix is ambiguous. irix4 is different from irix5 is different from
irix6.
Jim
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Global constructor problem on mips-sgi-irix5.2
1998-04-08 15:08 ` Jim Wilson
@ 1998-04-10 17:12 ` Alexandre Oliva
0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 1998-04-10 17:12 UTC (permalink / raw)
To: Jim Wilson; +Cc: H.J. Lu, frichard, egcs, egcs-bugs
H.J. Lu wrote:
> FYI, my binutils is binutils snapshot + ARM + some x86 changes.
Jim Wilson writes:
> That begs the question as to whether the binutils snapshots have been tested
> on a mips/irix5 machine anytime recently though.
I've been successfully running binutils-2.8.1.0.18 on IRIX 5.2.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1998-04-10 17:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-06 17:35 Global constructor problem on mips-sgi-irix5.2 Fred Richardson
1998-04-08 2:13 ` Jim Wilson
1998-04-08 2:13 ` Fred Richardson
1998-04-08 13:11 ` H.J. Lu
1998-04-08 15:08 ` Jim Wilson
1998-04-10 17:12 ` Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).