From mint-bounce@lists.fishpool.fi  Tue Jan 22 22:12:33 2008
X-Original-To: fnaumann@mail.boerde.de
Delivered-To: fnaumann@mail.boerde.de
Message-ID: <479656E6.1000206@freesbee.fr>
Date: Tue, 22 Jan 2008 21:49:42 +0100
From: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= <vincent.riviere@freesbee.fr>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: Keith Scroggins <kws@radix.net>
Cc: mint <mint@fishpool.com>
Subject: Re: [MiNT] GCC 4.2.2 - Keith's Latest Progress (or lack thereof)
References: <c6533ef60801131156h2f0d69e7qeff2c8ce8b78df09@mail.gmail.com> <478A8F44.3030702@freesbee.fr> <47936072.4050702@freesbee.fr> <Pine.GSO.4.63.0801201617480.16497@saltmine.radix.net> <4793D6BA.9030806@freesbee.fr> <Pine.GSO.4.63.0801221306580.2928
In-Reply-To: <Pine.GSO.4.63.0801221306580.29288@saltmine.radix.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
X-ecartis-version: Ecartis v1.0.0
Sender: mint-bounce@lists.fishpool.fi
Errors-To: mint-bounce@lists.fishpool.fi
X-original-sender: vincent.riviere@freesbee.fr
Precedence: bulk
List-help: <mailto:ecartis@lists.fishpool.fi?Subject=help>
List-unsubscribe: <mailto:mint-request@lists.fishpool.fi?Subject=unsubscribe>
List-Id: <mint.lists.fishpool.fi>
X-List-ID: <mint.lists.fishpool.fi>
List-subscribe: <mailto:mint-request@lists.fishpool.fi?Subject=subscribe>
List-owner: <mailto:tjhukkan@fishpool.fi>
List-post: <mailto:mint@lists.fishpool.fi>
X-Virus-Scanned: by amavisd-new at relay.boerde.de
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on relay.boerde.de
X-Spam-Status: No, hits=-1.0 tagged_above=-50.5 required=7.0 tests=AWL,
 BAYES_00
X-Spam-Level: 
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by freemint id m0MLCVTk025663

Keith Scroggins wrote :
> Hello Vincent,
> 
> Here is hello.tos compressed with bzip2, it is just under 3 megs in size.
> 
> I was unable to strip the built binary.  Here is the info (compile 
> string I used, compiler info, strip error, and strip version, and also 
> my source):
> 
> bash-2.05a# g++ hello.cpp -o hello.tos -Wl,--traditional-format
> bash-2.05a# g++ -v
> Using built-in specs.
> Target: m68k-atari-mint
> Configured with: ../gcc-4.2.2/configure --target=m68k-atari-mint 
> --host=m68k-atari-mint --enable-languages=c,c++ --disable-nls 
> --disable-libstdcxx-pch --program-suffix=-4.2.2 --disable-bootstrap 
> --build=i686-pc-cygwin
> Thread model: single
> gcc version 4.2.2
> 
> bash-2.05a# strip hello.tos
> strip: hello.tos: File format not recognized
> bash-2.05a# strip --version
> GNU strip (GNU Binutils) 2.18
> Copyright 2007 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License version 3 or (at your option) any later 
> version.
> This program has absolutely no warranty.
> bash-2.05a# cat hello.cpp
> #include <iostream>
> 
> int main()
> {
> std::cout << "Hello Keith!" << std::flush;
> return(0);
> }

Hello, Keith.

 > bash-2.05a# g++ hello.cpp -o hello.tos -Wl,--traditional-format
 > bash-2.05a# strip hello.tos
 > strip: hello.tos: File format not recognized

The strip utility provided by the binutils has never been able to work 
with executables linked with --traditional-format. That's why it fails 
with "File format not recognized". Hopefully, it failed, because I asked 
you to link with --traditional-format in order to have the debugging 
symbols in MonST ! Unfortunatly, MonST was unable to load the symbols 
because the symbol table is huge :-( due to the usage of iostream.
Nevertheless, I'm used to walk into the startup code 8-)

The problem is that
you use gcc-4.2.2-mint-20080107 (especially libgcc.a)
with binutils < binutils-2.18-mint-20080106 (especially ld)

You fall into the CONSTRUCTORS problem. I saw in your program that a 
single "Hello, World !" using cout produces 6 global contructors in the 
final executable (probably produced inside libstdc++). Shame on me, I 
didn't check that. I thunk that the usage of global constructors was not 
usual, I was wrong.

So the new rule is:
When you make C++ programs with gcc >= 4.2.2-mint-20080107,
you MUST use binutils >= 2.18-mint-20080106
If you don't do so, your program will crash at startup.

I definitively should display the patch version with --version !

You can make a quick test by using my cross-compiled binutils for MiNT:
http://vincent.riviere.free.fr/soft/m68k-atari-mint/archives/unsupported/binutils-2.18-mint-20080119-bin-mint-20080119.tar.bz2
For the test purpose, you might only use the ld program from that archive.
Your C++ programs will work immediately (after relink !)

Please give me feedback !

-- 
Vincent Rivière


