Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Segfault with Faster MDCT patch and -fPIC

Re: Segfault with Faster MDCT patch and -fPIC

From: Slawomir Testowy <slawomir.testowy_at_gmail.com>
Date: Mon, 20 Sep 2010 11:00:01 +0200

2010/9/17 Rafaël Carré <rafael.carre_at_gmail.com>:
> On Fri, 17 Sep 2010 16:26:31 +0200
> Slawomir Testowy <slawomir.testowy_at_gmail.com> wrote:
>
>> 2010/9/17 Rafaël Carré <rafael.carre_at_gmail.com>:
>> > On Fri, 17 Sep 2010 14:01:48 +0200
>> > Slawomir Testowy <slawomir.testowy_at_gmail.com> wrote:
>> >
>> >> Hi,
>> >>
>> >> thanks for quick response.
>> >>
>> >> 2010/9/17 Rafaël Carré <rafael.carre_at_gmail.com>:
>> >> > I think the OP should post .S output of gcc and also give
>> >> > us compiler version and options being used
>> >> >
>> >> > --
>> >> > Rafaël Carré
>> >> >
>> >>
>> >> Here it is:
>> >>
>> >> /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnue
>> >> abi/bin/arm-none-linux-gnueabi-gcc --version
>> >> arm-none-linux-gnueabi-gcc (GCC) 4.1.2
>> >> Copyright (C) 2006 Free Software Foundation, Inc.
>> >> This is free software; see the source for copying conditions.
>> >>  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR
>> >> A PARTICULAR PURPOSE.
>> >>
>> >> Exact command line:
>> >>
>> >> /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnue
>> >> abi/bin/arm-none-linux-gnueabi-gcc -std=gnu89 -fPIC -DHAVE_CONFIG_H
>> >> -I. -I./ -O2 -D_ARM_ASSEM_ -fsigned-char -ffast-math
>> >> -fsingle-precision-constant -D_REENTRANT -DUSE_MEMORY_H -MT
>> >> fft-ffmpeg.lo -MD -MP -MF .deps/fft-ffmpeg.Tpo -c fft-ffmpeg.c -o
>> >> fft-ffmpeg.o
>> >>
>> >> Outputs of gcc -S and gcc -E are included in attachments.
>> >>
>> >> I'm afraid I won't be able to test proposed patch today. I'll try
>> >> on Monday.
>> >
>> > I think the patch wouldn't compile on ARM because I missed the ldmia
>> > ordering constraints like Dave mentioned
>> >
>> > otherwise I see that fft8_dispatch only differs on 1 register (-fPIC
>> > use r9 and without it uses r10==sl) but I don't see r10/sl being
>> > used as a pointer.. perhaps it's only done at linking phase?
>> >
>> > BTW building gdb should be as simple as:
>> > ./configure --target=arm-none-linux-gnueabi ; make
>> >
>> > --
>> > Rafaël Carré
>> >
>>
>> I managed to build gdbserver + gdb. Here is the stacktrace:
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0003b3a0 in pass (z_arg=<value optimized out>,
>>     STEP_arg=<value optimized out>, n_arg=<value optimized out>)
>>     at fft-ffmpeg.c:243
>> 243       w += STEP;
>> (gdb) bt
>> #0  0x0003b3a0 in pass (z_arg=<value optimized out>,
>>     STEP_arg=<value optimized out>, n_arg=<value optimized out>)
>>     at fft-ffmpeg.c:243
>> #1  0x0003c080 in fft64 (z=0x1b10190) at fft-ffmpeg.c:355
>> #2  0x0003c0b0 in fft128 (z=0x1b10190) at fft-ffmpeg.c:356
>> #3  0x0003c0e0 in fft256 (z=0x1b10190) at fft-ffmpeg.c:357
>> #4  0x0003b924 in ff_fft_calc_c (nbits=<value optimized out>,
>> z=0x1ae2dc0) at fft-ffmpeg.c:370
>> #5  0x0003ad78 in ff_imdct_half (nbits=28199880, output=0x1b100c8,
>>     input=<value optimized out>) at mdct-ffmpeg.c:112
>> #6  0x0003b178 in ff_imdct_calc (nbits=28377488, output=0x1afa5c8,
>> input=0x0) at mdct-ffmpeg.c:348
>> #7  0x0003a5ac in mapping0_inverse (vb=0xbef3c670, l=0x1b0b538)
>>     at mapping0.c:290
>> #8  0x00033270 in vorbis_synthesis (vb=0xbef3c670, op=<value
>> optimized out>, decodep=1) at synthesis.c:75
>>
>> Unfortunately, most values are optimized out. On Monday, I will
>> rebuild tremor with -O0 and try again.
>
> 'info all-registers' + 'disass $pc-32 $pc+32' can give a hint also
> (from http://ffmpeg.org/bugreports.html)

Here it is:

(gdb) info all-registers
r0 0x1b10190 28377488
r1 0x1ae2dc0 28192192
r2 0x0 0
r3 0x100 256
r4 0x0 0
r5 0x0 0
r6 0x0 0
r7 0x0 0
r8 0x0 0
r9 0x0 0
r10 0x0 0
r11 0x40 64
r12 0x400 1024
sp 0xbeeb7450 0xbeeb7450
lr 0x0 0
pc 0x3b3a0 0x3b3a0 <pass+360>
f0 0 (raw 0x0003f8cc0000000000000000)
f1 0 (raw 0x0003f8cc0000000000000000)
f2 0 (raw 0x0003f8cc0000000000000000)
f3 0 (raw 0x0003f8cc0000000000000000)
f4 0 (raw 0x0003f8cc0000000000000000)
f5 0 (raw 0x0003f8cc0000000000000000)
f6 0 (raw 0x0003f8cc0000000000000000)
f7 0 (raw 0x0003f8cc0000000000000000)
fps 0x0 0
cpsr 0x60000010 1610612752

(gdb) disass $pc-32 $pc+32
A syntax error in expression, near `$pc+32'.
(gdb) disass $pc-32
Dump of assembler code for function pass:
   0x0003b238 <+0>: push {r4, r5, r6, r7, r8, r9, r10, r11, lr}
   0x0003b23c <+4>: lsl r1, r1, #2
   0x0003b240 <+8>: sub sp, sp, #44 ; 0x2c
   0x0003b244 <+12>: ldr r10, [pc, #1252] ; 0x3b730 <pass+1272>
   0x0003b248 <+16>: str r1, [sp, #16]
   0x0003b24c <+20>: ldr r3, [pc, #1248] ; 0x3b734 <pass+1276>
   0x0003b250 <+24>: lsl r1, r2, #4
   0x0003b254 <+28>: add r10, pc, r10
   0x0003b258 <+32>: str r1, [sp, #20]
   0x0003b25c <+36>: ldr r12, [sp, #20]
   0x0003b260 <+40>: ldr r1, [r10, r3]
   0x0003b264 <+44>: ldr r3, [sp, #16]
   0x0003b268 <+48>: add r0, r0, r12
   0x0003b26c <+52>: add r1, r3, r1
   0x0003b270 <+56>: ldm r0, {r5, r6}
   0x0003b274 <+60>: lsl r11, r2, #3
   0x0003b278 <+64>: add r0, r0, r11
   0x0003b27c <+68>: ldm r0, {r7, r8}
   0x0003b280 <+72>: lsl r2, r2, #5
   0x0003b284 <+76>: rsb r2, r11, r2
   0x0003b288 <+80>: str r2, [sp, #24]
   0x0003b28c <+84>: ldr r12, [sp, #24]
   0x0003b290 <+88>: rsb r3, r8, r6
   0x0003b294 <+92>: rsb r2, r5, r7
   0x0003b298 <+96>: rsb r0, r12, r0
   0x0003b29c <+100>: add r4, r7, r5
   0x0003b2a0 <+104>: add r6, r6, r8
   0x0003b2a4 <+108>: ldm r0, {r9, r10}
   0x0003b2a8 <+112>: add r9, r4, r9
   0x0003b2ac <+116>: add r10, r6, r10
   0x0003b2b0 <+120>: sub r4, r9, r4, lsl #1
   0x0003b2b4 <+124>: sub r6, r10, r6, lsl #1
   0x0003b2b8 <+128>: stm r0, {r9, r10}
   0x0003b2bc <+132>: add r0, r11, r0
   0x0003b2c0 <+136>: ldm r0, {r9, r10}
   0x0003b2c4 <+140>: add r9, r3, r9
   0x0003b2c8 <+144>: add r10, r2, r10
   0x0003b2cc <+148>: sub r7, r9, r3, lsl #1
   0x0003b2d0 <+152>: sub r8, r10, r2, lsl #1
   0x0003b2d4 <+156>: stm r0, {r9, r10}
   0x0003b2d8 <+160>: add r0, r11, r0
   0x0003b2dc <+164>: stm r0, {r4, r6}
   0x0003b2e0 <+168>: add r0, r11, r0
   0x0003b2e4 <+172>: stm r0, {r7, r8}
   0x0003b2e8 <+176>: rsb r0, r12, r0
   0x0003b2ec <+180>: add r0, r0, #8
   0x0003b2f0 <+184>: ldm r1, {r4, r12}
   0x0003b2f4 <+188>: ldr r2, [sp, #20]
   0x0003b2f8 <+192>: add r0, r2, r0
   0x0003b2fc <+196>: ldm r0, {r9, r10}
   0x0003b300 <+200>: smull r3, r8, r12, r9
   0x0003b304 <+204>: rsb r6, r9, #0
   0x0003b308 <+208>: smlal r3, r8, r4, r10
   0x0003b30c <+212>: smull r3, r6, r4, r6
   0x0003b310 <+216>: smlal r3, r6, r12, r10
   0x0003b314 <+220>: add r0, r11, r0


>
> btw you mentioned TRANSFORM_EQUAL (only used in fft8) in your first mail
> but this time it's in a different function, a different crash?
>
> --
> Rafaël Carré
>

Yeah, just like I stated before I was putting printf's in all
functions to find out
the cause of segfault. These calls could change something.


-- 
regards,
Slawomir Testowy
Received on 2010-09-20

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy