Bug 6484 - 64 Bit mesa-6.4.2 crashes on Solaris 9 compiled with gcc 4.0.2
Summary: 64 Bit mesa-6.4.2 crashes on Solaris 9 compiled with gcc 4.0.2
Status: RESOLVED WORKSFORME
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 6.4
Hardware: SPARC Solaris
: highest critical
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-04 00:16 UTC by Roland Egger
Modified: 2010-05-06 15:44 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Roland Egger 2006-04-04 00:16:19 UTC
For compiling Mesa 64 Bit on Solaris 9 with the gcc 4.0.2 (with Solaris patches)
I changed configs/sunos5-gcc
diff configs/sunos5-gcc configs/sunos5-gcc.orig
12c12
< OPT_FLAGS  = -O3 -m64 -mcpu=ultrasparc -mv8plus -mvis -g -fomit-frame-pointer
-pipe
---
> OPT_FLAGS  = -O3 -g -fomit-frame-pointer -pipe
15,16c15
< #ARCH_FLAGS ?=
< ARCH_FLAGS = -m64
---
> ARCH_FLAGS ?=

And bin/mklib
##############
            #OPTS="-G" R.Egger (It should work)
            OPTS="-m64 -shared -Wl,-Bdynamic"

It compiled and linked fine. For 32 Bit I build everything without
-m64 and that compiled and linked fine, too.

The 32 Bit version runs all tests successful so far. The 64 Bit demos
starts, too and run some seconds. Then they crash e.g. teapot, gears,
glxgears ...
gdb glxgears core 
shows the following
Loaded symbols for /usr/platform/SUNW,Sun-Blade-1500/lib/sparcv9/libc_psr.so.1
#0  0xffffffff7e98f348 in choose_emit_func (ctx=0x1001205c0, count=162,
    dest=0x10067d440 "B\331\233\204B\251y\fGs\275\342?\200") at tnl/t_vertex.c:120
120           a[j].emit = a[j].insert[vptr->size - 1]; /* not always used */
(gdb) bt
#0  0xffffffff7e98f348 in choose_emit_func (ctx=0x1001205c0, count=162,
    dest=0x10067d440 "B\331\233\204B\251y\fGs\275\342?\200") at tnl/t_vertex.c:120
#1  0xffffffff7e9902cc in _tnl_build_vertices (ctx=0x1001205c0, start=0,
    end=162, newinputs=2123952832) at tnl/t_vertex.c:409
#2  0xffffffff7e975910 in run_render (ctx=0x1001205c0, stage=0x100398b48)
    at tnl/t_vb_render.c:295
#3  0xffffffff7e962f30 in _tnl_run_pipeline (ctx=0x1001205c0)
    at tnl/t_pipeline.c:158
#4  0xffffffff7e97013c in _tnl_playback_vertex_list (ctx=0x1001205c0,
    data=<value optimized out>) at tnl/t_save_playback.c:209
#5  0xffffffff7e891964 in execute_list (ctx=0x1001205c0,
    list=<value optimized out>) at main/dlist.c:5681
#6  0xffffffff7e8944fc in _mesa_CallList (list=164) at main/dlist.c:6749
#7  0x0000000100002dd8 in do_draw () at glxgears.c:254
#8  0x00000001000039cc in main (argc=<value optimized out>,
    argv=<value optimized out>) at glxgears.c:304

And the teapot seems to have the same problem:
Loaded symbols for /usr/platform/SUNW,Sun-Blade-1500/lib/sparcv9/libc_psr.so.1
#0  0xffffffff7e98f348 in choose_emit_func (ctx=0x100121fa0, count=112,
    dest=0x10067f060 "C\235/\216CRt\025GxK*?\200") at tnl/t_vertex.c:120
120           a[j].emit = a[j].insert[vptr->size - 1]; /* not always used */
(gdb) bt
#0  0xffffffff7e98f348 in choose_emit_func (ctx=0x100121fa0, count=112,
    dest=0x10067f060 "C\235/\216CRt\025GxK*?\200") at tnl/t_vertex.c:120
#1  0xffffffff7e9902cc in _tnl_build_vertices (ctx=0x100121fa0, start=0,
    end=112, newinputs=2123952832) at tnl/t_vertex.c:409
#2  0xffffffff7e975910 in run_render (ctx=0x100121fa0, stage=0x10039a748)
    at tnl/t_vb_render.c:295
#3  0xffffffff7e962f30 in _tnl_run_pipeline (ctx=0x100121fa0)
    at tnl/t_pipeline.c:158
#4  0xffffffff7e9a2cec in _tnl_flush_vtx (ctx=0x100121fa0)
    at tnl/t_vtx_exec.c:277
#5  0xffffffff7e996c00 in _tnl_FlushVertices (ctx=0x100121fa0, flags=1)
    at tnl/t_vtx_api.c:863
#6  0xffffffff7e8a78c8 in map2 (target=3511, u1=0, u2=1, ustride=12, uorder=4,
    v1=0, v2=1, vstride=3, vorder=4, points=0x100924cf0, type=5126)
    at main/eval.c:504
#7  0xffffffff7e8a7a58 in _mesa_Map2f (target=3511, u1=0.553605318,
    u2=0.287203312, ustride=12, uorder=4, v1=0, v2=0.501697302, vstride=3,
    vorder=4, points=0x7fffffff8) at main/eval.c:525
#8  0xffffffff7e892810 in execute_list (ctx=0x100121fa0,
    list=<value optimized out>) at main/dlist.c:6020
#9  0xffffffff7e8944fc in _mesa_CallList (list=64) at main/dlist.c:6749
#10 0x0000000100003dc8 in draw () at teapot.c:340
#11 0xffffffff7f024974 in glutMainLoop () at glut_event.c:962
#12 0x000000010000390c in main (ac=1, av=<value optimized out>) at teapot.c:672

The line seems to be interesting:
120           a[j].emit = a[j].insert[vptr->size - 1]; /* not always used */

(gdb) print j
$1 = 1
(gdb) print vptr
$2 = (GLvector4f *) 0x10039d6e0
(gdb) p vptr->size
$3 = 0
(gdb) p vptr->size - 1
$4 = 18446744073709551615

This seems to be the bug!

Can you please fix it and make please fix 
OPTS="-shared -Wl,-Bdynamic" for solaris 32 Bit and
OPTS="-m64 -shared -Wl,-Bdynamic" for solaris 64 Bit.
It would be nice if there'll be a config file for sunos5-gcc-64 ...

By the way, the version 6.1 works fine even if i take the new executables
of version 6.4.2. I've just to change the LD_LIBRARY_PATH.
It would be nice if you could fix the problem.
Comment 1 Roland Egger 2006-04-04 01:38:29 UTC
I compiled 64 bit mesa now with gcc 3.4.2 from sunfreeware and it crashes, too
but with other errors.

./gears
One time I get an assertion:

146 frames in  5.007 seconds = 29.159 FPS
Assertion failed: a[j].inputstride == vptr->stride, file tnl/t_vertex.c, line 382
Abort (core dumped)

Loaded symbols for /usr/platform/SUNW,Sun-Blade-1500/lib/sparcv9/libc_psr.so.1
#0  0xffffffff7e4a8cbc in _libc_kill () from /usr/lib/64/libc.so.1
(gdb) bt
#0  0xffffffff7e4a8cbc in _libc_kill () from /usr/lib/64/libc.so.1
#1  0xffffffff7e43e440 in abort () from /usr/lib/64/libc.so.1
#2  0xffffffff7e43e744 in _assert () from /usr/lib/64/libc.so.1
#3  0xffffffff7e9a0a30 in _tnl_build_vertices (ctx=0x100120df0, start=0,
end=164, newinputs=2124021760) at tnl/t_vertex.c:382
#4  0xffffffff7e98e014 in run_render (ctx=0x100120df0, stage=0x100399598) at
tnl/t_vb_render.c:295
#5  0xffffffff7e974728 in _tnl_run_pipeline (ctx=0x100120df0) at
tnl/t_pipeline.c:158
#6  0xffffffff7e981ae4 in _tnl_playback_vertex_list (ctx=0x100120df0, data=0xf)
at tnl/t_save_playback.c:209
#7  0xffffffff7e89edc4 in execute_list (ctx=0x100120df0, list=8063928) at
main/dlist.c:5681
#8  0xffffffff7e89f814 in _mesa_CallList (list=4097) at main/dlist.c:6749
#9  0x0000000100002ec4 in draw () at gears.c:189
#10 0xffffffff7f023ba0 in processWindowWorkList (window=0x100110b40) at
glut_event.c:1297
#11 0xffffffff7f023f88 in glutMainLoop () at glut_event.c:1344
#12 0x000000010000394c in main (argc=1, argv=0xffffffff7ffff0a8) at gears.c:379

(gdb) f 3
#3  0xffffffff7e9a0a30 in _tnl_build_vertices (ctx=0x100120df0, start=0,
end=164, newinputs=2124021760) at tnl/t_vertex.c:382
382              assert(a[j].inputstride == vptr->stride);
(gdb) print j
No symbol "j" in current context.
(gdb) print vptr
$1 = (GLvector4f *) 0x10039c530
(gdb) print vptr->stride
$2 = 0

Normally an bus error occurs
#0  0xffffffff7e98fcc0 in run_vertex_stage (ctx=0x1003bfd9f, stage=0x10039c4e0)
at tnl/t_vb_vertex.c:194
194        if (ctx->Transform.ClipPlanesEnabled) {
(gdb) bt
#0  0xffffffff7e98fcc0 in run_vertex_stage (ctx=0x1003bfd9f, stage=0x10039c4e0)
at tnl/t_vb_vertex.c:194
#1  0xffffffff7e974728 in _tnl_run_pipeline (ctx=0x100120df0) at
tnl/t_pipeline.c:158
#2  0xffffffff7e981ae4 in _tnl_playback_vertex_list (ctx=0x100120df0, data=0xf)
at tnl/t_save_playback.c:209
#3  0xffffffff7e89edc4 in execute_list (ctx=0x100120df0, list=8136520) at
main/dlist.c:5681
#4  0xffffffff7e89f814 in _mesa_CallList (list=4097) at main/dlist.c:6749
#5  0x0000000100002fec in draw () at gears.c:201
#6  0xffffffff7f023ba0 in processWindowWorkList (window=0x100110b40) at
glut_event.c:1297
#7  0xffffffff7f023f88 in glutMainLoop () at glut_event.c:1344
#8  0x000000010000394c in main (argc=1, argv=0xffffffff7ffff0a8) at gears.c:379

(gdb) print ctx
$1 = (GLcontext *) 0x1003bfd9f
(gdb) print ctx->Transform
$2 = {MatrixMode = 0, EyeUserPlane = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}},
  _ClipUserPlane = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0,
0, 0, 0}, {0, 0, 0, 0}},
  ClipPlanesEnabled = 0, Normalize = 0 '\0', RescaleNormals = 0 '\0',
RasterPositionUnclipped = 0 '\0',
  CullVertexFlag = 0 '\0', CullEyePos = {0, 0, 0, 0}, CullObjPos = {0, 0, 0, 0}}
(gdb) p ctx->Transform.ClipPlanesEnabled
$3 = 0

Maybe the memory has a wrong alignment and trying to read from this misaligned
memory sends
an bus error.

ldd gears
        libX11.so.4 =>   /usr/lib/64/libX11.so.4
        libglut.so =>    /opt64/mesa-6.4.2/lib/libglut.so
        libGLU.so =>     /opt64/mesa-6.4.2/lib/libGLU.so
        libGL.so =>      /opt64/mesa-6.4.2/lib/libGL.so
        libm.so.1 =>     /usr/lib/64/libm.so.1
        libc.so.1 =>     /usr/lib/64/libc.so.1
        libXext.so.0 =>  /usr/openwin/lib/sparcv9/libXext.so.0
        libsocket.so.1 =>        /usr/lib/64/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/64/libnsl.so.1
        libdl.so.1 =>    /usr/lib/64/libdl.so.1
        libgcc_s.so.1 =>         /usr/local/lib/sparcv9/libgcc_s.so.1
        libstdc++.so.6 =>        /usr/local/lib/sparcv9/libstdc++.so.6
        libXmu.so.4 =>   /usr/lib/64/libXmu.so.4
        libXi.so.5 =>    /usr/lib/64/libXi.so.5
        libmp.so.2 =>    /usr/lib/64/libmp.so.2
        libXt.so.4 =>    /usr/openwin/lib/sparcv9/libXt.so.4
        libSM.so.6 =>    /usr/openwin/lib/sparcv9/libSM.so.6
        libICE.so.6 =>   /usr/openwin/lib/sparcv9/libICE.so.6
        /usr/platform/SUNW,Sun-Blade-1500/lib/sparcv9/libc_psr.so.1

 file gears
gears:          ELF 64-bit MSB executable SPARCV9 Version 1, UltraSPARC1
Extensions Required, dynamically linked, not stripped


######################################################################
running the ray demo I got the same segmentation fault like mesa compiled with
gcc 4.0.2.

#0  0xffffffff7e9a008c in choose_emit_func (ctx=0x100242eb0, count=84,
dest=0x10079ff60 "C\246\016;CZ\035(Gg]\342?\200")
    at tnl/t_vertex.c:120
120           a[j].emit = a[j].insert[vptr->size - 1]; /* not always used */
(gdb) bt
#0  0xffffffff7e9a008c in choose_emit_func (ctx=0x100242eb0, count=84,
dest=0x10079ff60 "C\246\016;CZ\035(Gg]\342?\200")
    at tnl/t_vertex.c:120
#1  0xffffffff7e9a0b0c in _tnl_build_vertices (ctx=0x100242eb0, start=0, end=84,
newinputs=84) at tnl/t_vertex.c:409
#2  0xffffffff7e98e014 in run_render (ctx=0x100242eb0, stage=0x1004bb658) at
tnl/t_vb_render.c:295
#3  0xffffffff7e974728 in _tnl_run_pipeline (ctx=0x100242eb0) at
tnl/t_pipeline.c:158
#4  0xffffffff7e981ae4 in _tnl_playback_vertex_list (ctx=0x100242eb0, data=0xf)
at tnl/t_save_playback.c:209
#5  0xffffffff7e89edc4 in execute_list (ctx=0x100242eb0, list=10951056) at
main/dlist.c:5681
#6  0xffffffff7e89f814 in _mesa_CallList (list=4097) at main/dlist.c:6749
#7  0x0000000100003cec in draw () at ray.c:658
#8  0xffffffff7f023f74 in glutMainLoop () at glut_event.c:962
#9  0x00000001000053e8 in main (ac=1, av=0x13) at ray.c:899
Comment 2 Brian Paul 2006-04-04 02:09:20 UTC
I'll add the sunos5-64-gcc config.

For the mklib script we need a test to determine if the object files are 32 or
64-bit, then pass the right options to the linker.  For Linux we parse the
output of 'file file.o'.

Could you send me the output of running 'file' on both a 32 and 64-bit object
file?  I'll use that info to update the mklib script.

As for the runtime problems, you might be able to get more debug info if you
recompiled without -O3.  If things run OK w/out -O3 it might be a compiler bug.
Comment 3 Roland Egger 2006-04-05 23:21:43 UTC
Thank you for adding the the sunos5-64-gcc config.

The output of file <object file> vary a little bit depending on
the compiler flags
32 Bit mit gcc CGLAGS -mcpu=ultrasparc -mv8plus -mvis
or at least -mcpu=ultrasparc
=>
file ./progs/xdemos/pbutil.o
./progs/xdemos/pbutil.o:        ELF 32-bit MSB relocatable SPARC32PLUS Version
1, V8+ Required, UltraSPARC1 Extensions Required

64 Bit CFLAGS at least -m64 -mcpu=ultrasparc
=>
file ./progs/xdemos/pbutil.o
./progs/xdemos/pbutil.o:        ELF 64-bit MSB relocatable SPARCV9 Version 1,
UltraSPARC1 Extensions Required

But you can compile binaries for old 32 Bit only sparc machines 
(might be 10 years old)
but the default of gcc on sun (without mcpu option)
hallo.o:        ELF 32-bit MSB relocatable SPARC Version 1

For 64 Bit without mpcu
hallo.o:        ELF 64-bit MSB relocatable SPARCV9 Version 1

For better supporting the solaris platform it would be the best thing if
you try to compile it on a old cheap ultrasparc machine. E.g. an ultra5/10
with about 400 MHz could be bought for about less than 100 $.
With a 440 MHz prozessor it's even a nice machine that can play DVDs with xine
...

I'll try to compile mesa without -O3 option and tell you my results but
for further more complicate activities it would be the best thing if one
Mesa developer can do it on a sun on his own.
Comment 4 Brian Paul 2006-04-05 23:44:49 UTC
OK, I think I've got the mklib script updated.  Can you try the version in cvs
at http://webcvs.freedesktop.org/mesa/Mesa/bin/

Comment 5 Roland Egger 2006-04-08 01:05:24 UTC
Hello Brian,
thank you for the changed configs file for solaris (sunos5-64-gcc).
To run make sunos5-64-gcc I've to correct the Makefile first:

/opt/sfw/bin/cvs diff Makefile
Index: Makefile
===================================================================
RCS file: /cvs/mesa/Mesa/Makefile,v
retrieving revision 1.63
diff -r1.63 Makefile
128a129
> sunos5-64-gcc \

So, please add this line to the main Makefile.
(Does anybody of the Mesa developer team has access 
to an old cheap ultrasparc solaris system? That could make
bug fixing more easy)

The build stopped at:
make[2]: Entering directory `/mnt/home/egger/src/Mesa/cvs/Mesa/progs/demos'
gcc -I../../include -Wall -O3 -m64 -mcpu=ultrasparc -mv8plus -mvis -g
-fomit-frame-pointer -pipe -fPIC -m64 -D_REENTRANT -DUSE_XSHM -DUSE_SPARC_ASM
-std=c99 -ffast-math -I/usr/openwin/include arbfplight.c readtex.o -L../../lib
-lX11 -lglut -lGLU -lGL -lm -o arbfplight
Undefined                       first referenced
 symbol                             in file
glGetQueryObjecti64vEXT             ../../lib/libGL.so
glBlitFramebufferEXT                ../../lib/libGL.so
glGetQueryObjectui64vEXT            ../../lib/libGL.so
ld: fatal: Symbol referencing errors. No output written to arbfplight
collect2: ld returned 1 exit status
make[2]: *** [arbfplight] Error 1
make[2]: Leaving directory `/mnt/home/egger/src/Mesa/cvs/Mesa/progs/demos'
make[1]: *** [subdirs] Error 1
make[1]: Leaving directory `/mnt/home/egger/src/Mesa/cvs/Mesa/progs'
make: *** [default] Error 1

Comment 6 Brian Paul 2006-04-08 01:22:26 UTC
OK, I've added sunos5-64-gcc to the toplevel Makefile.

The src/mesa/sparc/glapi_sparc.S file wasn't getting regenerated so it was
missing those three functions you listed.  Should be OK now.

I suppose having an old sparc machine would be handy, but I've already got at
least 10 computers in my office.
Comment 7 Alan Hourihane 2006-04-08 01:28:05 UTC
If there's ever a need Brian - give me a shout. I've got an Ultra 60 here that
you can either ssh into or I'll build test.
Comment 8 Roland Egger 2006-04-10 21:09:38 UTC
Thank you Alan, I hope that could help solving the solaris problem.
I hope you've an installed at least gcc 3.4.2 on that machine, too.
Comment 9 Roland Egger 2006-05-17 00:38:49 UTC
The cvs version of last weak compiled fine but still crashed for 64 Bit on
Solaris 9 (ultrasparc).
Comment 10 Ian Romanick 2010-05-06 15:44:51 UTC
This bug has not been updated in four years.  Closing.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.