[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] GCC 4.2.2 - Keith's Latest Progress (or lack thereof)



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