Subject: Re: Segfault in libfontconfig
To: Matt Dainty <matt@bodgit-n-scarper.com>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-dreamcast
Date: 09/14/2004 22:21:40
On Tue, Sep 14, 2004 at 11:13:40 +0100, Matt Dainty wrote:

> I'm getting a repeatable sigsegv in libfontconfig when I launch either
> xclock or gtk-demo:
> 
> Backtrace from xclock:
> 
> (gdb) bt
> #0  0x2046f888 in FcValueSave () from /usr/X11R6/lib/libfontconfig.so.1
> #1  0x2047060a in FcPatternAddWithBinding ()
>    from /usr/X11R6/lib/libfontconfig.so.1
> #2  0x20470710 in FcPatternAdd () from /usr/X11R6/lib/libfontconfig.so.1
> #3  0x20470880 in FcPatternAddString () from
> /usr/X11R6/lib/libfontconfig.so.1
> #4  0x204713b4 in FcNameParse () from /usr/X11R6/lib/libfontconfig.so.1
> #5  0x20475678 in FcDirSave () from /usr/X11R6/lib/libfontconfig.so.1
> 
> gtk-demo backtrace is more lengthy, but FcValueSave() is the culprit in
> both cases.
> 
> I've found these two pages:
> 
> http://www2.starcat.ne.jp/~yaoshi/diary/?200407b&to=200407200
> http://www2.starcat.ne.jp/~yaoshi/diary/?0217
> 
> Which contain the same backtrace, but with the NetBSD/Dreamcast port. I
> can't read anything else on the page, but it suggests to me that
> this is perhaps a SuperH issue rather than anything hpcsh-specific.
> 
> I can sort of make out that the Dreamcast X11 was cross-compiled. My X11
> was cross-compiled too, but I can't establish if that's pertinent to the
> problem or not.

fontconfig library uses functions that return structures.  SuperH ABI
uses r2 to pass the pointer to the memory for the returned structure.
But dynamic linker happily blows r2 away (it's a scratch register
otherwise) while doing the dynamic symbol resolution.

Grrr... Just when I thought all the sh3 vs dynamic linkage bugs are
fixed for 2.0.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen