Thread: Tools DIY - KeK
View Single Post
Old 07-14-2012, 03:12 PM   #76
knc1
Embedded Cheerleader
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 6,226
Karma: 5830430
Join Date: Feb 2012
Device: Too many.
Quote:
Originally Posted by twobob View Post
Brain hurt.

Need two lifetimes to catch up with your headspace.

*goes and gets second lifetime*

This information is golddust. thanks mate
Ah, but I wasn't quite done.

Continued from: http://www.mobileread.com/forums/sho...1&postcount=73

Now that you have a working, emulated native, arm build environment ...
And you have just built a copy of tcc v-0.9.26 dynamically linked against uClibc ...
How do you get a static linked tcc out of this when the ./configure and make sequence does not observe the standard --static --static-libgcc sequence?

Thought no one would ask.
Look at the gcc link commands output during the build, in this case there is only one of them of any significance, the final linking:
Code:
gcc -o tcc tcc.o libtcc.a -lm -ldl
Which makes this one a piece of cake, invent your own as:
Code:
(armv6l:1) /home/tinycc # gcc --static --static-libgcc -o tcc-static tcc.o libtcc.a -lm -ldl
(armv6l:1) /home/tinycc # ldd tcc-static
    not a dynamic executable
(armv6l:1) /home/tinycc # strip --strip-unneeded tcc-static
Which disables the functioning of libdl but if you can live without the -run option ...
(The -run option causes this tcc-static to hang, it would take a bit of further tweaking to make -run work while libdl was statically linked).

Check it:
Code:
(armv6l:1) /home # ./tcc-static -o hello hello.c
(armv6l:1) /home # ./hello
Hello World
Now I am done, a static build of tcc v-0.9.26 (un-released) taken from the head of the tcc project repository @ Debian. With the Debian patches installed (which shouldn't have changed ARM behavior).

Edit:
What some users probably need is a build of this with SYSROOT=/mnt/us included in the configure; maybe even add /mnt/us/lib and /mnt/us/include into the tcc-static search paths. But those are documented options in the ./configure --help file and now anyone can do it with these two posts.
Attached Files
File Type: gz tcc-static.gz (108.1 KB, 45 views)

Last edited by knc1; 07-15-2012 at 05:04 AM.
knc1 is offline   Reply With Quote