public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb.base/code_elim.exp - empty bss issue.
@ 2013-08-30 15:11 Andrew Burgess
  2013-08-30 16:26 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Burgess @ 2013-08-30 15:11 UTC (permalink / raw)
  To: gdb-patches

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb.base/code_elim.exp - empty bss issue.
  2013-08-30 15:11 [PATCH] gdb.base/code_elim.exp - empty bss issue Andrew Burgess
@ 2013-08-30 16:26 ` Tom Tromey
  2013-08-30 16:36   ` Andrew Burgess
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2013-08-30 16:26 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

>>>>> "Andrew" == Andrew Burgess <aburgess@broadcom.com> writes:

Andrew> I could fix this by either:
[...]
Andrew>   3. Force the test to generate some .bss content.

Andrew> I chose option #3 but would be happy to rewrite to any of the other
Andrew> options if they were prefered.

I think your choice is fine.

Andrew> 2013-08-30  Andrew Burgess  <aburgess@broadcom.com>
Andrew> 	* gdb.base/code_elim1.c (my_bss_symbol): New variable added.
Andrew> 	(my_static_symbol): Add comment.
Andrew> 	(main): Reference my_bss_symbol.

Ok.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gdb.base/code_elim.exp - empty bss issue.
  2013-08-30 16:26 ` Tom Tromey
@ 2013-08-30 16:36   ` Andrew Burgess
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2013-08-30 16:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

On 30/08/2013 5:26 PM, Tom Tromey wrote:
>>>>>> "Andrew" == Andrew Burgess <aburgess@broadcom.com> writes:
> 
> Andrew> 2013-08-30  Andrew Burgess  <aburgess@broadcom.com>
> Andrew> 	* gdb.base/code_elim1.c (my_bss_symbol): New variable added.
> Andrew> 	(my_static_symbol): Add comment.
> Andrew> 	(main): Reference my_bss_symbol.
> 
> Ok.

Committed.  Thanks for the quick review.

Andrew


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-30 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-30 15:11 [PATCH] gdb.base/code_elim.exp - empty bss issue Andrew Burgess
2013-08-30 16:26 ` Tom Tromey
2013-08-30 16:36   ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).