From: "Andrew Burgess" <aburgess@broadcom.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] gdb.base/code_elim.exp - empty bss issue.
Date: Fri, 30 Aug 2013 15:11:00 -0000 [thread overview]
Message-ID: <5220B60D.2090807@broadcom.com> (raw)
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
next reply other threads:[~2013-08-30 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-30 15:11 Andrew Burgess [this message]
2013-08-30 16:26 ` Tom Tromey
2013-08-30 16:36 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5220B60D.2090807@broadcom.com \
--to=aburgess@broadcom.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox