Hi again,

I'll try to keep this short, but I don't want to leave out
any important details.

I looked into the problem I saw with GTK 1.2.0, and it looks like 
a value is getting clobbered due to some bad assembly code
(using gcc -O2).

The symptom that alerted me was in the "testgtk" program (built
in the gtk/ subdirectory as part of the GTK build), there is a
color wheel in the "color selection" dialog that is supposed to 
have a few arcs drawn around it to give it a 3D-looking edge.
The code to do this is in gtk/gtkcolorsel.c lines 1287..1307,
in a function called "gtk_color_selection_draw_wheel_frame".

I found that the arcs were being drawn incorrectly:

http://www.bluebutton.com/jamie/gtk/buggy.jpg

I added a printf in the code to see what values were being
passed to gdk_draw_arc(), and (of course!) that made the
symptom go away (notice the intended 3D edge):

http://www.bluebutton.com/jamie/gtk/working.jpg

The .c module gets compiled into "gtkcolorsel.lo" before
being linked into the main gtk library.  I ran "objdump --source"
on this .lo file with and without the printf statement, and
studyed the output.  Rather than put it in this message, I
annotated the results in HTML complete with color text 
which I invite anyone who understands the ARM gcc backend
(should be several of you out there) to come have a look at, at,

  http://www.bluebutton.com/jamie/gtk/

You'll only have to read through 20 or 30 instructions.
And please excuse my meager understanding of ARM assembler.
The annotations are more for me than for you. :)

Since someone might want to verify this (or point out that I'm
using a bad combination of tools or something), here is a summary 
of what I'm using:

$ cat /etc/issue
Red Hat Linux release 5.1 (Manhattan)
NetWinder DM version 2.0 [Build 10]
Kernel 2.0.35 on an armv4l
$ uname -a
Linux newt 2.0.35 #4 Wed Mar 24 09:17:46 EST 1999 armv4l
$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/arm-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990325/philb (egcs-1.1.2 release)
$ as -v
GNU assembler version 2.9.1 (netwinder), using BFD version 2.9.1.0.20
$ ld -v
GNU ld version 2.9.1 (with BFD 2.9.1.0.20)
$ libtool --version
ltmain.sh (GNU libtool) 1.2
$ ls -l glib-1.2.0.tar.gz gtk+-1.2.0.tar.gz 
-rw-------   1 guinan   guinan     387282 Feb 25 21:42 glib-1.2.0.tar.gz
-rw-r--r--   1 guinan   guinan    2668541 Mar  7 02:53 gtk+-1.2.0.tar.gz

I configured both glib and gtk with,
$ ./configure --prefix=/usr/local --host=arm-linux

Then did "make", "make install" for each before running testgtk.

The gcc command that the makefile used for gtkcolorsel.c (via libtool)
was,

gcc -DHAVE_CONFIG_H -I. -I. -I.. -DGTK_DISABLE_COMPAT_H 
 -DG_LOG_DOMAIN=\"Gtk\" -DGTK_EXE_PREFIX=\"/usr/local\" 
 -DGTK_DATA_PREFIX=\"/usr/local\" -DGTK_SYSCONFDIR=\"/usr/local/etc\" 
 -DGTK_LOCALEDIR=\"/usr/local/share/locale\" -I.. -DGTK_NO_CHECK_CASTS 
 -DUSE_XIM -I/usr/local/lib/glib/include -I/usr/local/include -D_REENTRANT 
 -g -O2 -Wall -c -fPIC -DPIC gtkcolorsel.c -o gtkcolorsel.lo

Quick spoilers:
  - turning off optimization fixes the symptom.
  - set optimization to "-O" still has problems, the app core
    dumps (I didn't get around to objdump --source'ing this one).

Hope all this helps find and fix a compiler bug, if one exists.  
I'm having fun learning, anyway.

Thanks,
-Jamie


================================================================
Jamie Guinan                               Blue Button Solutions
[EMAIL PROTECTED]                  http://www.bluebutton.com
================================================================

unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]

Reply via email to