View Single Post
Old 04-15-2018, 09:26 PM   #12
jmiller099
Junior Member
jmiller099 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Apr 2018
Device: PW2
Quote:
Originally Posted by geekmaster View Post
I packaged up lrizzo's tcc build, with the tinycc headers and the amazon gpl 5.0.0 headers, plus I added install and uninstall scripts, and a tccmake script to add the header include path and bind-mount a tcc-compatible replacement libc.so loader script needed to use this on newer kindles. I also include a demo.c program in the package, so it is ready to compile and test immediately after installing.
geekmaster's simple guide to tcc (tinycc):
https://www.mobileread.com/forums/sh...d.php?t=175834

Although my demos run several times faster when compiled with a cross-toolchain, using tinycc (tcc) on the device is a LOT easier for development and testing, then doing a full cross-build for final distribution.

Many thanks to you and lrizzo for this! Some quick feedback.

Downloaded the geekmaster package with the highest version number.

tccmake of demo.c and then executing it seg fault.

tccmake of my helloworld was okay. So then I went a little more complex and tried an eightball app my friend wrote and it was successful. Then I really pushed it by trying my eslisten program which uses pthread. To my surprise stat and fstat weren't available as unfindable by the linker. Pulling the libs to my computer and dumpobj it was confirmed as truth.

Then, after seeing what linaro's cross compiler did with those function calls via hex editing the binary and searching stat came to know about __xstat and __fxstat. After doing the needful, it successfully ran!

tldr; if you have to use stat, then use __xstat(3, filename, &statstruct); and if fstat then use __fxstat(3, filehandle, &statstruct);
jmiller099 is offline   Reply With Quote