Date: Wed, 12 Mar 2003 15:48:45 +0100 (CET) From: Martin Blapp <mb@imp.ch> To: current@freebsd.org Cc: kan@freebsd.org Subject: ld -Bsharable broken in CURRENT ? Message-ID: <20030312154243.C59497@cvs.imp.ch>
next in thread | raw e-mail | index | archive | help
See testcase STABLE: mb@stable:~/cxxtest2$ export LD_LIBRARY_PATH=. mb@stable:~/cxxtest2$ ./a.out cought string: x == 1 bar: cought string: x == 1 mb@stable:~/cxxtest2$ ./b.out cought string: x == 1 bar: cought string: x == 1 CURRENT: mb@current:~/cxxtest2$ ./a.out cought string: x == 1 bar: cought string: x == 1 mb@current:~/cxxtest2$ ./b.out Abort trap (core dumped) cxxtest2/Makefile ---------------------------------------------------- CXX=g++ LD=ld CXXFLAGS=-fpic -fexceptions all: a.out b.out # # Works # a.out: main.o foo.so bar.so ${CXX} -o a.out main.o foo.so bar.so # # Broken # b.out: main.o foo2.so bar2.so ${CXX} -o b.out main.o foo2.so bar2.so # # Works # bar.so: bar.o ${CXX} -shared -o bar.so bar.o foo.so: foo.o ${CXX} -shared -o foo.so foo.o # # Broken # bar2.so: bar.o ${LD} -Bshareable -o bar2.so bar.o foo2.so: foo.o ${LD} -Bshareable -o foo2.so foo.o clean: rm -f a.out *.o *.so ---------------------------------------------------- cxxtest2/bar.cc ---------------------------------------------------- /* compile with "g++ -shared -fPIC -o bar.so bar.cc" */ #include <iostream> #include <string> using namespace std; using std::cerr; extern void foo(int); void bar(int x) { try { foo(x); } catch (string s) { cerr << "bar: cought string: " << s << endl; } catch (int i) { cerr << "bar: cought int: " << i << endl; } catch (...) { cerr << "bar: cought something" << endl; } } ---------------------------------------------------- cxxtest2/foo.cc ---------------------------------------------------- /* compile with "g++ -shared -fPIC -o foo.so foo.cc" */ #include <string> using namespace std; void foo(int x) { switch(x) { case 1: throw string("x == 1"); case 2: throw int(2); default: throw float(3.1415); } } ---------------------------------------------------- cxxtest2/main.cc ---------------------------------------------------- /* compile with "g++ main.cc ./foo.so ./bar.so" */ #include <string> #include <iostream> using namespace std; extern void foo(int); extern void bar(int); main(int argc, char *argv[]) { try { foo(argc); } catch (string s) { cerr << "cought string: " << s << endl; } catch (int i) { cerr << "cought int: " << i << endl; } catch (...) { cerr << "cought something" << endl; } bar(argc); return 0; } ---------------------------------------------------- Martin Blapp, <mb@imp.ch> <mbr@FreeBSD.org> ------------------------------------------------------------------ ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH Phone: +41 61 826 93 00 Fax: +41 61 826 93 01 PGP: <finger -l mbr@freebsd.org> PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E ------------------------------------------------------------------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030312154243.C59497>