From owner-FreeBSD-users-jp@jp.freebsd.org  Wed Feb  4 03:29:35 1998
Received: by jaz.jp.freebsd.org (8.8.8+3.0Wbeta7/8.7.3) id DAA11963
	Wed, 4 Feb 1998 03:29:35 +0900 (JST)
Received: by jaz.jp.freebsd.org (8.8.8+3.0Wbeta7/8.7.3) with ESMTP id DAA11944
	for <FreeBSD-users-jp@jp.freebsd.org>; Wed, 4 Feb 1998 03:29:21 +0900 (JST)
Received: (from shimizu@localhost)
	by psun0.phys.kyushu-u.ac.jp (8.8.7/3.6Wbeta7) id DAA17024;
	Wed, 4 Feb 1998 03:29:20 +0900 (JST)
Date: Wed, 4 Feb 1998 03:29:20 +0900 (JST)
Message-Id: <199802031829.DAA17024@psun0.phys.kyushu-u.ac.jp>
To: FreeBSD-users-jp@jp.freebsd.org
Cc: shimizu@phys.kyushu-u.ac.jp
From: shimizu@phys.kyushu-u.ac.jp (Yoshifumi R. Shimizu)
X-Mailer: mnews [version 1.20] 1996-12/08(Sun)
Reply-To: FreeBSD-users-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=24]
X-Sequence: FreeBSD-users-jp 24157
Subject: [FreeBSD-users-jp 24157] Mystery of __main.o in libgcc.a
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org

$@@6?e!w6eBgM}J*M}$G$9!#(J

$@!!:#F|$O$A$g$C$HIT;W5D$J8=>]$KAx6x$7$F:$$C$F$$$k$N$G<1<T$N0U8+$r(J
$@$*;G$$$7$?$$$H;W$$=P$F$-$^$7$?!#(J

$@!!$=$l$O(J g77 $@$G:n$C$?(J binary $@$N$3$H$J$s$G$9$,!"(Jg77 $@$=$N$b$N$K4X78$,(J
$@$"$k$+$I$&$+$O$o$+$j$^$;$s!#:G6a!"(J2.2.5-RELEASE $@$KJQ99$7$F5$$E$$$?(J
$@$N$G$9$,LdBj$O(J 2.2.2-RELEASE $@$G$b$"$C$?$O$:$G$9!#$3$H$N5/$3$j$O?7$7$$(J
version $@$N(J g77$@$rF3F~$7$h$&$H$7$F!"$$$D$b(J bench mark $@Be$o$j$K;H$C$F$$$k(J
fortran program $@$r(J compile $@$7$FAv$i$;$?$H$3$m!"7k2L$OF1$8$J$N$G$9$,(J
performance $@$,Ls(J 2$@G\?7$7$$(J g77 $@$G(J compile $@$7$?$b$N$,CY$/$J$C$F$7$^(J
$@$C$F$$$k$3$H$G$7$?!#$=$s$J$P$+$J$H;W$$!"8E$$(J g77 $@$G$b2~$a$F(J compile
$@$7D>$7$F@N(J compile $@$7$?(J binary $@$HHf$Y$k$H3N$+$K(J performance $@$,Ls(J 2$@G\(J
$@CY$/$J$C$F$*$j!"$I$&$7$F$3$s$J$3$H$,$H;W$$$3$N(J 2, 3$@F|860x$NDI5a$r(J
$@$7$F$$$^$7$?!#$G!"$d$C$H$=$l$i$7$-860x$K$?$I$j$D$$$?!J$h$&$K;W$&!K(J
$@$N$G$9$,!"2?8N$=$&$J$k$+A4$/$o$+$j$^$;$s!"$$$d!"?.$8$i$l$^$;$s!#(J

$@!!860x$O(J libgcc.a $@Cf$N(J __main.o $@$H$$$&(J __main() $@$r4^$`(J routine $@$N$h$&(J
$@$J$s$G$9!#8E$$(J binary $@$O(J gcc-2.6.x $@$N$b$N!J(JFreeBSD-2.0.5R $@ImB0!K$G!"(J
$@:G6a$N(J gcc-2.7.x $@$N$b$N!J(JFreeBSD-2.2.5R $@ImB0!K$G$=$N:9$O(J

*** 205/__main.c   Tue Feb  3 02:25:53 1998
--- 225/__main.c   Tue Feb  3 02:26:07 1998

***************
*** 170,176 ****
  SYMBOL__MAIN ()
  {
    /* Support recursive calls to `main': run initializers just once.  */
!   static int initialized = 0;
    if (! initialized) 
      {
        initialized = 1;
      __do_global_ctors ();
    }
}
--- 180,186 ----
  SYMBOL__MAIN ()
  {
    /* Support recursive calls to `main': run initializers just once.  */ 
!   static int initialized;
    if (! initialized)
      {
        initialized = 1;
      __do_global_ctors ();
    }
}

$@$G$9!J$3$3$G!"(J#define SYMBOL__MAIN __main $@$G$9!K!#(Jobject $@$O%=!<%9(J
libgcc2.c $@$+$i(J -o __main.o -DL__main $@$G@8@.$5$l!"$b$A$m$sB>$K$b(J
gcc-2.6.x $@$H(Jgcc-2.7.x $@$G0c$$$O$"$k$N$G$9$,!"(Jgcc-2.7.x $@$N%=!<%9$G(J

 static int initialized;   $@$NItJ,$r(J    static int initialized = 0;

$@$KJQ99$9$k$H(J gcc-2.6.x $@$N(J __main.o $@$r;H$C$?>l9g$HF1$87W;;;~4V$K$J$k(J
$@$3$H$O3N$+$a$^$7$?!#$b$A$m$s%3!<%I$H$7$F$OF1$8$b$N$K$J$k$O$:$G$9$h$M!#(J
$@$^$?$[$s$H$K$3$N(J __main.o $@$K0c$$$K$h$k$N$@$H$$$&$3$H$O<!$N$h$&$J$3$H$r(J
$@$7$F3N$+$a$^$7$?!#$=$l$>$l$N(J __main.o $@$r(J /tmp/205, /tmp/225 $@$KCV$$$F!"(J

$ g77 -O3 -o cws-205 cws.f libcws.a /tmp/205/__main.o
$ g77 -O3 -o cws-225 cws.f libcws.a /tmp/225/__main.o
$ time ./cws-205 < cws.inp >AA-205                                       
./cws-205 < cws.inp > AA-205  13.84s user 0.05s system 99% cpu 13.963 total
$ time ./cws-225 < cws.inp >AA-225                                       
./cws-225 < cws.inp > AA-225  6.98s user 0.02s system 98% cpu 7.099 total

$ g77 -O3 -o crs-205 crs.f libcrs.a /tmp/205/__main.o
$ g77 -O3 -o crs-225 crs.f libcrs.a /tmp/225/__main.o
$ time ./crs-205 < crs.inp >AA-205
./crs-205 < crs.inp > AA-205  4.44s user 0.04s system 96% cpu 4.644 total
$ time ./crs-225 < crs.inp >AA-225
./crs-225 < crs.inp > AA-225  9.07s user 0.05s system 97% cpu 9.393 total

$@8fMw$N$h$&$K(J 2$@$D$N(J programs $@$K$D$$$F(J performance $@$N:9$OA4$/5U$K$J$C$F$$$^$9!#(J
$@$5$i$KIT;W5D$J$N$O$=$l$>$l$N(J __main.o $@$r(J strip $@$7$?$b$N$r(J __main.o1 $@$H$7$F!"(J

$ g77 -O3 -o cws-205 cws.f libcws.a /tmp/205/__main.o1
$ g77 -O3 -o cws-225 cws.f libcws.a /tmp/225/__main.o1
$ time ./cws-205 < cws.inp >AA-205     
./cws-205 < cws.inp > AA-205  6.96s user 0.02s system 98% cpu 7.060 total
$ time ./cws-225 < cws.inp >AA-225
./cws-225 < cws.inp > AA-225  13.92s user 0.03s system 98% cpu 14.169 total

$ g77 -O3 -o crs-205 crs.f libcrs.a /tmp/205/__main.o1
$ g77 -O3 -o crs-225 crs.f libcrs.a /tmp/225/__main.o1
$ time ./crs-205 < crs.inp >AA-205
./crs-205 < crs.inp > AA-205  8.45s user 0.09s system 97% cpu 8.718 total
$ time ./crs-225 < crs.inp >AA-225
./crs-225 < crs.inp > AA-225  4.44s user 0.04s system 95% cpu 4.679 total

$@$H!"$^$?$^$?7k2L$,5UE>$7$^$9!#$3$3$GN>J}$N(J __main.o $@$N(J size $@$OF1$8(J
$@$G$9$,!"3N$+$K$$$/$D$+$N(J bytes $@$G:9$,$"$j$^$9!#?.Mj$G$-$k(J disassembler
$@$,$"$l$P$$$$$N$G$9$,!"(Jbinary $@$N(J dump file $@$rIU$1$?J}$,$$$$$G$9$+!#(J
__main.o $@$O(J 599bytes, __main.o1 $@$O(J 208bytes $@$G$9$,!#(J

$@!!(JCPU $@$O(J Pentium Pro $@$G$9!#$I$&$b(J code $@$N(J alignment $@$,$:$l$k$+$J$K$+(J
$@$9$k$N$G$7$g$&$+!#$G$b!"(Jassembler $@$G$b$J$$8B$j(J compiler $@$,$=$NLLE]$O(J
$@$_$F$/$l$k$O$:$G$9$h$M!#Ls(J 2$@G\$N(J performance $@$N:9$OBgJQBg$-$$$G$9!#(J
$@$3$l$O$[$s$H$KLs(J 2$@G\$N:9$G$"$j!"<B:](J input $@$N(J parameter $@$G7W;;$N(J loop
$@$N?t$rA}$d$;$P$I$A$i$N(J binary $@$bF1$8$h$&$K;~4V$,$+$+$j!":9$O(J 2$@G\$N(J
$@$^$^$G$9!JEvA3$G$9$,!K!#(J

$@!!0x$_$K(J Pentium $@$N%^%7%s$GF1$8(J binaries $@$rAv$i$;$k$H$d$O$j:9$O=P$k$N(J
$@$G$9$,$3$l$[$I$R$I$/$J$/:9$O(J 30%$@DxEY$G$7$?!#(J

$@!!$3$ND4;R$G$O$3$NFs$D$N(J __main.o $@$rMQ0U$7$F$*$$$F$I$A$i$+B.$/$J$k(J
$@J}$r(J link $@$9$k!"$H$$$&$3$H$r$$$A$$$A$7$J$$$H$$$1$J$$$h$&$J$N$G$9$,!"(J
$@$[$s$H$K$3$s$J$3$H$C$F$"$k$N$G$7$g$&$+!#;d$NNO$G$O$3$l0J>e$NDI5a$O(J
$@Fq$7$$$G$9!#(J

$@!!2?$+;W$$Ev$?$k@a$N$"$kJ}$O65$($F2<$5$l$P=u$+$j$^$9!#$^$?!"$3$N$h$&$J(J
$@!JIT;W5D$J!K$3$H$K$D$$$F$O$I$3$=$3%a!<%j%s%0%j%9%H$X0\F0$;$h$H$$$&$N$G(J
$@$"$l$P!"8f65<($/$@$l$P9,$$$G$9!#D9$/$J$C$F$I$&$b:Q$_$^$;$s!#(J

$@!!6e=#Bg3XM}3XItJ*M}(J  $@@6?eNIJ8(J
