diff options
author | Jing Yu <jingyu@google.com> | 2011-12-20 10:27:58 -0800 |
---|---|---|
committer | Jing Yu <jingyu@google.com> | 2011-12-20 10:27:58 -0800 |
commit | cf3cdbf8b3cda61a619299e7966a83df66244036 (patch) | |
tree | 201e2bcfc955f16802d3257112d29736cb3a3ce8 /binutils-2.21/ld/testsuite/ld-srec/sr3.cc | |
parent | e4df3e0a5bb640ccfa2f30ee67fe9b3146b152d6 (diff) | |
download | toolchain_binutils-cf3cdbf8b3cda61a619299e7966a83df66244036.zip toolchain_binutils-cf3cdbf8b3cda61a619299e7966a83df66244036.tar.gz toolchain_binutils-cf3cdbf8b3cda61a619299e7966a83df66244036.tar.bz2 |
Add binutils-2.21.
Use --enable-gold=default for dual linker support.
Change-Id: Id1a744c7db58a0b5e7a3be174cdfa875f2f86e49
Diffstat (limited to 'binutils-2.21/ld/testsuite/ld-srec/sr3.cc')
-rw-r--r-- | binutils-2.21/ld/testsuite/ld-srec/sr3.cc | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/binutils-2.21/ld/testsuite/ld-srec/sr3.cc b/binutils-2.21/ld/testsuite/ld-srec/sr3.cc new file mode 100644 index 0000000..0b5fa7e --- /dev/null +++ b/binutils-2.21/ld/testsuite/ld-srec/sr3.cc @@ -0,0 +1,127 @@ +// This file is compiled and linked into the S-record format. + +#define FOO_MSG_LEN 80 + +class Foo { + static int foos; + int i; + static const int len = FOO_MSG_LEN; + char message[len]; +public: + static void init_foo (); + static int nb_foos() { return foos; } + Foo(); + Foo(const char* message); + Foo(const Foo&); + Foo & operator= (const Foo&); + ~Foo (); +}; + +static Foo static_foo( "static_foo"); + +int +main () +{ + Foo automatic_foo( "automatic_foo"); + return 0; +} + +void +terminate(void) +{ + /* This recursive call prevents a compiler warning that the noreturn + function terminate actually does return. */ + terminate (); +} + +extern "C" { +void +__main () +{ +} + +void +__builtin_delete () +{ +} + +void +__builtin_new () +{ +} + +void +__throw () +{ +} + +void +__rethrow () +{ +} + +void +__terminate () +{ +} + +void *__eh_pc; + +void *** +__get_dynamic_handler_chain () +{ + return 0; +} + +void * +__get_eh_context () +{ + return 0; +} + +} + +int Foo::foos = 0; + +void Foo::init_foo () +{ + foos = 80; +} + +Foo::Foo () +{ + i = ++foos; +} + +Foo::Foo (const char*) +{ + i = ++foos; +} + +Foo::Foo (const Foo& foo) +{ + i = ++foos; + for (int k = 0; k < FOO_MSG_LEN; k++) + message[k] = foo.message[k]; +} + +Foo& Foo::operator= (const Foo& foo) +{ + for (int k = 0; k < FOO_MSG_LEN; k++) + message[k] = foo.message[k]; + return *this; +} + +Foo::~Foo () +{ + foos--; +} + +void *__dso_handle; + +extern "C" +int +__cxa_atexit (void) +{ + return 0; +} |