This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH,Testsuite] Add .align 2 for labels on Thumb
On Thu, Aug 12, 2010 at 11:35:51AM +0200, Mark Kettenis wrote:
> > Date: Thu, 12 Aug 2010 16:18:14 +0800
> > From: Yao Qi <yao@codesourcery.com>
> > Content-Disposition: inline
> >
> > We find test failures in gdb.dwarf2/dw2-ref-missing-frame.exp when
> > test cases are compiled as thumb.
> > https://bugs.launchpad.net/gdb-linaro/+bug/615997
> >
> > In dw2-ref-missing-frame-func.c, it is assumed that address of label
> > 'func_loopfb_start' is equal to address of function func_loopfb.
> > However, in thumb, the label is 16-bit aligned, while function is
> > 32-bit aligned, so label address may not be equal to function address.
> >
> > Patch below is to set labels 32-bit aligned. Tested this patch on
> > both x86 and armel. OK to apply?
>
> Unfortunately not. The .align pseudo-op has different effects on
> different architectures. On most architectures .align 2 actually
> means 16-bit alignment, which is certainly not what you want on RISC
> architectures that have 32-bit wide instructions.
Thanks for your explanation.
In original test case, breakpoint is set on insn nop, while main
branches to insn push, so breakpoint is not hit.
0000000a <func_loopfb_start>:
a: bf00 nop
0000000c <func_loopfb>:
c: b480 push {r7}
I thought this nop is generated for alignment, so I added '.align 2'
for label func_loopfb_start to force it to be equal to func_loopfb. I
make a mistake here.
I don't know why nop is generated on label func_loopfb_start, and once
'.align 2' is added, nop is *not* generated, so failures go away by
accident.
--
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739