Back to index

cell-binutils  2.17cvs20070401
3.cc
Go to the documentation of this file.
00001 struct A
00002 {
00003   virtual void foo();
00004   virtual void bar();
00005 };
00006 
00007 void A::foo() { }                  // keep
00008 void A::bar() { }                  // lose
00009 
00010 struct B : public A
00011 {
00012   virtual void foo();
00013 };
00014 
00015 void B::foo() { }                  // keep
00016 
00017 void _start() __asm__("_start"); // keep
00018 void start() __asm__("start"); // some toolchains use this name.
00019 
00020 A a;                               // keep
00021 B b;
00022 A *getme() { return &a; }          // keep
00023 
00024 void _start()
00025 {
00026   getme()->foo();
00027 #ifdef __GNUC__
00028 #if (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
00029 // gcc-2.95.2 gets this test wrong, and loses B::foo().
00030 // Cheat.  After all, we aren't trying to test the compiler here.
00031   b.foo();
00032 #endif
00033 #endif
00034 }
00035 
00036 void start ()
00037 {
00038   _start ();
00039 }
00040 
00041 // In addition, keep A's virtual table.
00042 
00043 // We'll wind up keeping `b' and thus B's virtual table because
00044 // `a' and `b' are both referenced from the constructor function.
00045 
00046 extern "C" void __main() { }