Le mardi 03 août 2010 17:13:23, Aharon Robbins a écrit : > Hi. I built tinycc on my x86_64 Fedora 12 system. Here's a report. > > 1. Below is a patch that was necessary to get it to find the libraries; > something should be done with configuring etc. to handle this. My patch > is definitely quick and dirty. > > 2. When built, my program could not find some of the string functions, > such as strlen, strcmp, strncmp and strcpy. I put in replacement > versions, but that's not a scalable solution. Any idea what's not working? Yes, since recent version of glibc, they are all indirect function symbols. According to man nm: For ELF format files this indicates that the symbol is an indirect function. This is a GNU extension to the standard set of ELF symbol types. It indicates a symbol which if referenced by a relocation does not evaluate to its address, but instead must be invoked at runtime. The runtime execution will then return the value to be used in the relocation.
I started looking about this in binutils (which hold ld) but although there is not so much code, I couldn't find the relevant code (I'm not a specialist of linkers and compilers, I only know the basics). It should be just a few line but what I found was about creating space in some ELF section. > > 3. I have a static table with some function pointers to static functions. > This compiles, but the table values are NULL. Any idea why? Nope, sorry. Are the functions and the table local or extern ? > > 4. The external variable `char **environ' was accessable, but initialized > to NULL. I had to use the (really old style) three argument version of > main to get access to the environment and then initalize environ from > within main. Any idea why? Yes, and there is a patch in the mob branch. Try to apply this commit http://repo.or.cz/w/tinycc.git/commitdiff/a28b18fa16edaeb6bc7d34cf1ddac690b27ba610?hp=036ff17916586febc968b964ee416e1d4d1da70f > > I am overall quite impressed; the compiler is blazingly fast, which is > quite refreshing when one normally uses GCC. > > Thanks, > -- > Aharon (Arnold) Robbins arnold AT skeeve DOT com > P.O. Box 354 Home Phone: +972 8 979-0381 > Nof Ayalon Cell Phone: +972 50 729-7545 > D.N. Shimshon 99785 In the afterlife, all the computers run Linux. You get > ISRAEL to decide if you're in Heaven or Hell. -- A. > Robbins > ------------------------------------------------------------------------ > diff -u tcc-0.9.25/libtcc.c tcc-0.9.25.adr/libtcc.c > --- tcc-0.9.25/libtcc.c 2009-05-18 17:27:06.000000000 +0300 > +++ tcc-0.9.25.adr/libtcc.c 2010-07-20 17:22:10.000000000 +0300 > @@ -1824,8 +1824,8 @@ > #ifndef TCC_TARGET_PE > /* default library paths */ > tcc_add_library_path(s, CONFIG_SYSROOT "/usr/local/lib"); > - tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib"); > - tcc_add_library_path(s, CONFIG_SYSROOT "/lib"); > + tcc_add_library_path(s, CONFIG_SYSROOT "/usr/lib64"); > + tcc_add_library_path(s, CONFIG_SYSROOT "/lib64"); > #endif > > /* no section zero */ > diff -u tcc-0.9.25/tcc.h tcc-0.9.25.adr/tcc.h > --- tcc-0.9.25/tcc.h 2009-05-18 17:27:06.000000000 +0300 > +++ tcc-0.9.25.adr/tcc.h 2010-07-20 17:14:49.000000000 +0300 > @@ -126,7 +126,7 @@ > > /* path to find crt1.o, crti.o and crtn.o. Only needed when generating > executables or dlls */ > -#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib" > +#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr/lib64" > > #define INCLUDE_STACK_SIZE 32 > #define IFDEF_STACK_SIZE 64 > diff -u tcc-0.9.25/tccelf.c tcc-0.9.25.adr/tccelf.c > --- tcc-0.9.25/tccelf.c 2009-05-18 17:27:06.000000000 +0300 > +++ tcc-0.9.25.adr/tccelf.c 2010-07-20 17:20:51.000000000 +0300 > @@ -1199,7 +1199,7 @@ > tcc_add_library(s1, "c"); > > #ifdef CONFIG_USE_LIBGCC > - tcc_add_file(s1, CONFIG_SYSROOT "/lib/libgcc_s.so.1"); > + tcc_add_file(s1, CONFIG_SYSROOT "/lib64/libgcc_s.so.1"); > #else > snprintf(buf, sizeof(buf), "%s/%s", s1->tcc_lib_path, > "libtcc1.a"); tcc_add_file(s1, buf); > @@ -1277,7 +1277,7 @@ > #elif defined TCC_ARM_EABI > static char elf_interp[] = "/lib/ld-linux.so.3"; > #elif defined(TCC_TARGET_X86_64) > -static char elf_interp[] = "/lib/ld-linux-x86-64.so.2"; > +static char elf_interp[] = "/lib64/ld-linux-x86-64.so.2"; > #elif defined(TCC_UCLIBC) > static char elf_interp[] = "/lib/ld-uClibc.so.0"; > #else > > > _______________________________________________ > Tinycc-devel mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/tinycc-devel
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/tinycc-devel
