WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: failed to start X by bad Mesa packages on TC9.0  (Read 1534 times)

Offline y_satou70

  • Jr. Member
  • **
  • Posts: 52
failed to start X by bad Mesa packages on TC9.0
« on: July 05, 2018, 04:35:51 AM »
I hit the issue that fail to start X (xorg) with SIGILL on TC9.0 (both x86_64 and x86) - and looks this is the build problem of Mesa packages.

I know that enabling LTO options ("-flto -fuse-linker-plugin") in CFLAGS/CXXFLAGS is general way at TinyCoreLinux pkg build, but looks having those LTO related options caused this issue.
Can we remove LTO option for building mesa library packages (libGL.tcz / libGL-dev.tcz / libEGL.tcz / libEGL-dev.tcz / libGLESv2.tcz / libGLESv2-dev.tcz / Xorg-7.7-3d.tcz / Xorg-7.7-3d-dev.tcz) ?
This could increase each binary file size little bit, but at least it enables us to start up X without crash.

Here is the details:

I have the boxes which have Radeon HD6320 video card - that use ATI/Radeon video driver (xf86-video-ati.tcz)
at start up X, I got SIGILL - as in Xorg.0.log:

Code: [Select]
(EE) Backtrace:
(EE) 0: /usr/local/bin/Xorg (xorg_backtrace+0x49) [0x51b05c]
(EE) 1: /usr/local/bin/Xorg (0x400000+0x13bdf2) [0x53bdf2]
(EE) 2: /lib/libpthread.so.0 (0x7fc5261b2000+0x10030) [0x7fc5261c2030]
(EE) 3: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x3f14a1) [0x7fc520c844a1]
(EE) 4: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x3f1a0b) [0x7fc520c84a0b]
(EE) 5: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x3f1e4b) [0x7fc520c84e4b]
(EE) 6: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x3f2656) [0x7fc520c85656]
(EE) 7: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x21f332) [0x7fc520ab2332]
(EE) 8: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x221760) [0x7fc520ab4760]
(EE) 9: /usr/local/lib/dri/r600_dri.so (0x7fc520893000+0x21fdbd) [0x7fc520ab2dbd]
(EE) 10: /usr/local/lib/libgbm.so.1 (0x7fc521b8d000+0x3210) [0x7fc521b90210]
(EE) 11: /usr/local/lib/libgbm.so.1 (0x7fc521b8d000+0x36ed) [0x7fc521b906ed]
(EE) 12: /usr/local/lib/libgbm.so.1 (gbm_create_device+0x7b) [0x7fc521b90796]
(EE) 13: /usr/local/lib/xorg/modules/libglamoregl.so (glamor_egl_init+0x5f) [0x7fc521d9f36f]
(EE) 14: /usr/local/lib/xorg/modules/drivers/radeon_drv.so (0x7fc522a00000+0x31d4a) [0x7fc522a31d4a]
(EE) 15: /usr/local/bin/Xorg (InitOutput+0xb91) [0x490d59]
(EE) 16: /usr/local/bin/Xorg (0x400000+0x2d738) [0x42d738]
(EE) 17: /lib/libc.so.6 (__libc_start_main+0x15a) [0x7fc52530f09d]
(EE) 18: /usr/local/bin/Xorg (_start+0x2a) [0x42defa]
(EE)
(EE) Illegal instruction at address 0x7fc520c844a1
(EE)
Fatal server error:
(EE) Caught signal 4 (Illegal instruction). Server aborting

and confirmed SIGILL is happened both x86 and x86_64.

So I tested with xorg-server, rebuilt with debug option and run it with gdb - gdb caught it comes from /usr/local/lib/dri/r600_dri.so

Code: [Select]
Program received signal SIGILL, Illegal instruction.
0x00007f46058a94a1 in ?? () from /usr/local/lib/dri/r600_dri.so

So I rebuilt mesa-18.0.0 with debug option (-g3) all keep other options are same as http://tinycorelinux.net/9.x/x86_64/tcz/src/Xorg/compile_mesa, but that binary just worked without SIGILL - that led us to suspect GCC compiler bug.
I tested various GCC options, and figured out that when I built with LTO options, I had bad binary that caused SIGILL. By removing "-flto -fuse-linker-plugin" options, I could get working binary.

In our case, just replace /usr/local/lib/dri/r600_dri.so (from Xorg-7.7-3d.tcz) and /usr/local/lib/libglapi.so.0.0.0 (dependent file from r600_dri.so - from libGL.tcz) that helps to avoid SIGILL and launch X - but this could be affected other files combinations as well.