This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] gdb.base/code_elim.exp - empty bss issue.
- From: "Andrew Burgess" <aburgess at broadcom dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 30 Aug 2013 16:11:09 +0100
- Subject: [PATCH] gdb.base/code_elim.exp - empty bss issue.
- Authentication-results: sourceware.org; auth=none
The gdb.base/code_elim.exp test builds the file
gdb.base/code_elim1.c, then runs the following
gdb command:
(gdb) add-symbol-file /projects/firepath_work/aburgess/upstream-gdb-git/build/gdb/testsuite/gdb.base/code_elim1 0x100000 -s .bss 0x120000
If there's no .bss section then this will issue a warning.
On x86-64 Linux building the code_elim1.c file /does/ result in some
.bss content, however, non of this content comes from the code_elim1.c
source file, it's all from the libraries.
On my local embeded target, and I'm guessing possibly other targets, I
get no .bss section at all (the test is compiled -fdata-sections and
-Wl,-gc-sections), which results in the no .bss warning, and the test
failing.
I could fix this by either:
1. Check the binary for a .bss before issuing the add-symbol-file
command, and not including the "-s .bss <addr>" part if it's
not needed.
2. Extend the test regexp to allow for the warning.
3. Force the test to generate some .bss content.
I chose option #3 but would be happy to rewrite to any of the other
options if they were prefered.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-08-30 Andrew Burgess <aburgess@broadcom.com>
* gdb.base/code_elim1.c (my_bss_symbol): New variable added.
(my_static_symbol): Add comment.
(main): Reference my_bss_symbol.
diff --git a/gdb/testsuite/gdb.base/code_elim1.c b/gdb/testsuite/gdb.base/code_elim1.c
index 3de92de..d55284a 100644
--- a/gdb/testsuite/gdb.base/code_elim1.c
+++ b/gdb/testsuite/gdb.base/code_elim1.c
@@ -17,6 +17,13 @@
int my_global_symbol = 42;
+/* Symbol MY_BSS_SYMBOL is referenced, and should be placed into .bss
+ section. */
+
+static int my_bss_symbol;
+
+/* Symbol MY_STATIC_SYMBOL is never referenced and so will be eliminated. */
+
static int my_static_symbol;
int
@@ -24,7 +31,7 @@ main ()
{
int v_in_main;
- return v_in_main;
+ return v_in_main + my_bss_symbol;
}
int