aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2009-06-05 21:32:57 +0000
committerDoug Kwan <dougkwan@google.com>2009-06-05 21:32:57 +0000
commitbb04269c747a7aa5acffa2355efd1d7343338faf (patch)
treec0146d3edcbd719434f09eee57c611a592170761 /gold/testsuite/discard_locals_test.c
parent * varobj.c (update_dynamic_varobj_children): Wrap error text in (diff)
downloadbinutils-gdb-bb04269c747a7aa5acffa2355efd1d7343338faf.tar.gz
binutils-gdb-bb04269c747a7aa5acffa2355efd1d7343338faf.tar.bz2
binutils-gdb-bb04269c747a7aa5acffa2355efd1d7343338faf.zip
2009-06-05 Doug Kwan <dougkwan@google.com>
* Makefile.am (CCFILES): Add target.cc. * Makefile.in: Regenerate. * i386.cc (class Target_i386): Define new virtual method to override do_is_local_label_name in parent. * object.cc (Sized_relobj::do_count_local_symbols): Discard local symbols if --discard-locals or -X is given. * options.h (class General_options): Declare new options '--discard-locals' and '-X' for discarding locals. * target.h (class Target): Define new methods is_local_label_name. Declare new virtual method do_is_local_label_name. * target.cc: New file. * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test. (check_SCRIPTS): Add discard_locals_test.sh. (check_DATA): Add discard_local_tests.syms. (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define. (discard_local_tests.syms, discard_locals_test.o): New make rules. * testsuite/Makefile.in: Regenerate. * testsuite/discard_locals_test.c: New file. * testsuite/discard_locals_test.sh: Same.
Diffstat (limited to 'gold/testsuite/discard_locals_test.c')
-rw-r--r--gold/testsuite/discard_locals_test.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gold/testsuite/discard_locals_test.c b/gold/testsuite/discard_locals_test.c
new file mode 100644
index 00000000000..b7224471b6f
--- /dev/null
+++ b/gold/testsuite/discard_locals_test.c
@@ -0,0 +1,40 @@
+/* discard_locals_test.c -- test --discard-locals option.
+
+ Copyright 2009 Free Software Foundation, Inc.
+ Doug Kwan <dougkwan@google.com>.
+
+ This file is part of gold.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ This is a test of a common symbol in the main program and a
+ versioned symbol in a shared library. The common symbol in the
+ main program should override the shared library symbol. */
+
+/* Local symbol format for generic ELF target. */
+asm (".Lshould_be_discarded:");
+
+#ifdef __i386__
+/* Additional local symbol format for the i386 target. */
+asm (".Xshould_be_discarded:");
+#endif
+
+int
+main (void)
+{
+ return 0;
+}
+