Tiny Core Linux

dCore Import Debian Packages to Mountable SCE extensions => dCore X86 => dCore x86 Imported Extensions => Topic started by: nitram on October 12, 2016, 02:05:02 AM

Title: Illegal Instruction crash multiple software old hardware
Post by: nitram on October 12, 2016, 02:05:02 AM
On older SSE only (non-SSE2) hardware both Midori and QupZilla crash with Illegal Instruction error. More information linked, apparently if affects other software too, including VLC, mplayer and Xombrero: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=783293

In dCore-jessie problems experienced with Midori, QupZilla and Firefox. Firefox is robust, no outright crash but without the workaround was unable to properly view important bank site information (information did not display, greyed out). For privacy reasons, didn't go through the trouble of an altered screenshot.

Fortunately a work-around was provided, which actually works :-)
Code: [Select]
export JavaScriptCoreUseJIT=0

Example crash JIT set to default (1) fron non SSE2 system:
Code: [Select]
tc@box:~$ echo $JavaScriptCoreUseJIT
1
tc@box:~$ qupzilla news.google.ca
QupZilla: 0 extensions loaded
Illegal instruction

JIT set to 0 everything okay:
Code: [Select]
tc@box:~$ export JavaScriptCoreUseJIT=0
tc@box:~$ echo $JavaScriptCoreUseJIT
0
tc@box:~$ qupzilla news.google.ca
QupZilla: 0 extensions loaded
tc@box:~$

A modified OnDemand script or manually adding the workaround from a terminal only works when the application is launched from OnDemand or that terminal, not global. Adding something like this to ~/.ashrc works:
Code: [Select]
# Illegal instruction workaround for older processor, affects multiple applications:
if cat /proc/cpuinfo | grep sse2 >/dev/null; then
:
else
export JavaScriptCoreUseJIT=0
fi

Not sure if you would consider this Jason or if each individual application needs a special start up script. I'm sure there may be a way, but with poor hacking ability i was unable to set up startup script that globally set JIT=0 so it works if the application is re-launched later in a session.

I have not spent as much time in TC6 and TC7 recently, but did play with several browsers, no outright crashes, didn't properly test banking site via Firefox. Edit: To clarify, TC7 Epiphany does not load web pages with SSE only processor, Oops something went wrong just like dCore-jessie. Works fine in SSE2 system though. Also a few browsers in TC7 are outdated (eg. Icecat, Opera) so maybe not infected with this issue.
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: Jason W on October 12, 2016, 09:04:10 AM
This is definitely something that would be good for the wiki or README files.  As few users are now on a Pentium 3 or less, I will ponder putting code in the default dCore .ashrc.  I don't think there is a way to export this variable globally with the startup scripts, and I don't want to resort to using wrapper scripts for the apps though that is a way to export variables and such when launching them.
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: curaga on October 12, 2016, 10:50:45 AM
As that var affects most Webkit browsers, why not export it in your .profile?
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: nitram on October 12, 2016, 11:56:41 AM
Hi curaga. Not sure if you were addressing Jason/dCore or myself. I've placed it in .ashrc and it works well, as it seems that's where the environment comes from based on .profile entry:
Code: [Select]
if [ -f "$HOME/.ashrc" ]; then
   export ENV="$HOME/.ashrc"
   . "$HOME/.ashrc"
fi

...but this is foreign to me, don't recall how it worked placing direct into .profile, will try again with later reboot.
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: nitram on October 12, 2016, 12:41:12 PM
Simply pasting this into .profile doesn't work, in .ashrc it does:
Code: [Select]
export JavaScriptCoreUseJIT=0
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: marinux on June 03, 2017, 04:23:29 PM
Many, many thanks to Nitram.
As I use PIII and Athlon, I was desesperated to find a kiss solution (since some years !) for non SSE2 procs. Recompilation of webkit, use of netsurf (nice but too much sid for using every day) and QTweb (very good but abandonned), your workaround is excellent and I will integrate it as wrapper in futures releases of Xinutop.
Thanks again
Frank
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: JustinCB on June 06, 2017, 10:05:42 AM
firefox_ESR.tcz works on non-SSE2 processors, but firefox.tcz made by firefox_getLatest.tcz does not.  I like to use CFLAGS="-march=i386 -mtune=i386 -Os -pipe" and CXXFLAGS="-march=i386 -mtune=i386 -Os -pipe" when compiling for extensions.  It might be "-mtune=i686"(from the recommended CFLAGS and CXXFLAGS) that causes the crashes, but I don't think it is(but I don't know much about the internals of gcc). 
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: curaga on June 06, 2017, 11:01:51 AM
getLatest does not compile anything, so your flags don't matter. It just downloads Mozilla's binary.
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: Rich on June 06, 2017, 11:08:01 AM
Hi JustinCB
It might be "-mtune=i686"(from the recommended CFLAGS and CXXFLAGS) that causes the crashes, but I don't think it is(but I don't know much about the internals of gcc).

The  -mtune=i686  reorders instructions to take advantage of the internal architecture of the  i686  but does not generate
i686  specific instructions.
Title: Re: Illegal Instruction crash multiple software old hardware
Post by: coreplayer2 on June 06, 2017, 02:06:46 PM
firefox_ESR.tcz works on non-SSE2 processors,
I'm not sure if this is still true since the latest ESR update??