[PATCH] Fix gdb.base/code_elim.exp failures for PowerPC 32-bit

Luis Machado lgustavo@codesourcery.com
Tue Jul 1 09:46:00 GMT 2014


Another case of slight variations between targets and compiler options.

gdb.base/code_elim.exp assumes the linker generates the same sections 
for all architectures. For x86, this works fine and the testcase binary 
code_elim2 contains the .data section to hold our initialized global int 

For PowerPC 32-bit though, the small initialized global int variable is 
sent to the .sdata section as an optimization. Since there is no more 
data to store, the .data section doesn't get created.

GDB complains about the lack of such a section and expect doesn't like 
seeing that warning, which results in a couple failures for powerpc.

One of them:

add-symbol-file gdb.base/code_elim2 0x200000 -s .data 0x210000 -s .bss 
add symbol table from file "gdb.d/gdb.base/code_elim2" at^M
         .text_addr = 0x200000^M
         .data_addr = 0x210000^M
         .bss_addr = 0x220000^M
(y or n) y^M
Reading symbols from gdb.base/code_elim2...warning: section .data not 
found in gdb.base/code_elim2^M
(gdb) FAIL: gdb.base/code_elim.exp: order1: add-symbol-file code_elim2 

I have tweaked the testcase sources a little to hold a bigger 
initialized global variable, forcing the linker to create a regular 
.data section in order to prevent GDB's warning. The testcase still runs 
fine, but now PowerPC 32-bit sees full passes on this one.

I thought about tweaking the optimization options, but that would need 
to be target-specific, which is more cumbersome.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: code_elim.diff
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20140701/ccf8d1bf/attachment.bin>

More information about the Gdb-patches mailing list