Hi all,
When I compile the following program with llvm-gcc on Mac x86, it segfaults:
int main(int argc, char **argv) {
try {
throw argc;
} catch(int i) {
return i;
}
return 0;
}
$ llvm-g++ -o t t.cpp
$ ./t
Segmentation fault
However, if I compile it to a .s file and then compile it with gcc, it
works fine:
$ llvm-g++ -S t.cpp -o zz.s
$ g++ -o zz zz.s
$ ./zz 1 2 3
$ echo $?
4
This is weird. Anyone have an idea of what's going on?
-bw
On 9/10/07, Chris Lattner <sabre at nondot.org> wrote:> On Mon, 10 Sep 2007, Bill Wendling wrote: > > When I compile the following program with llvm-gcc on Mac x86, it segfaults: > > However, if I compile it to a .s file and then compile it with gcc, it > > works fine: > > This is weird. Anyone have an idea of what's going on? > > They are probably linking against different libstdc++ versions. Passing > -v to the compiler should print the command line passed to the linker. > > Note that libstdc++ in the llvm-gcc repo isn't ABI compatible with the mac > OS X system libstdc++. >Ah! Okay. That would seem to be the problem then. GCC's getting the libstdc++ from another directory. -bw
On Mon, 10 Sep 2007, Bill Wendling wrote:> When I compile the following program with llvm-gcc on Mac x86, it segfaults: > However, if I compile it to a .s file and then compile it with gcc, it > works fine: > This is weird. Anyone have an idea of what's going on?They are probably linking against different libstdc++ versions. Passing -v to the compiler should print the command line passed to the linker. Note that libstdc++ in the llvm-gcc repo isn't ABI compatible with the mac OS X system libstdc++. -Chris -- http://nondot.org/sabre/ http://llvm.org/