tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Run-time issue with static variables using tcc for archit


From: Nicolas Bertolotti
Subject: [Tinycc-devel] Run-time issue with static variables using tcc for architecture x86_64 with -DTCC_UCLIBC
Date: Wed, 11 Jan 2012 17:18:34 +0000

Hi,

 

I am trying to use ‘tcc’ for the architecture x86_64 and the uClibc.

 

I built ‘tcc’ using the --extra-cflags="-O2 -DTCC_UCLIBC" configure option and got the uClibc headers and libraries from a binary package that I downloaded on the uClibc Web site (cross-compiler-x86_64.tar.bz2).

 

I also had to update the file « tccelf.c » to fix the name of the ELF interpreter:

  #if defined __FreeBSD__

  static char elf_interp[] = "/usr/libexec/ld-elf.so.1";

  #elif defined TCC_ARM_EABI

  static char elf_interp[] = "/lib/ld-linux.so.3";

+ #elif defined(TCC_TARGET_X86_64) && defined(TCC_UCLIBC)

+ static char elf_interp[] = "/lib/ld64-uClibc.so.0";

  #elif defined(TCC_TARGET_X86_64)

  static char elf_interp[] = "/lib/ld-linux-x86-64.so.2";

  #elif defined(TCC_UCLIBC)

  static char elf_interp[] = "/lib/ld-uClibc.so.0";

 

If I compile the following sample code :

#include <stdio.h>

 

static int toto;

 

int main()

{

  int x = 0;

  printf("Hello, World!\n");

  x++;

  toto = x;

  return 0;

}

tcc is able to produce a binary but, when I run it, I get the following error message:

./toto.exe: can't resolve symbol 'toto'

 

Now, if I build the same sample code with –Dstatic=, it works perfectly fine.

 

… and now, if I rebuild tcc without the flag -DTCC_UCLIBC, it also works perfectly fine.

 

So, there is something weird with the combination x86_64 + tcc + uClibc that I cannot explain.

 

Any help would be greatly appreciated.

 

Thanks in advance

 

Nicolas

 

P.S. : I initially faced this issue using the version 0.9.25 of ‘tcc’. Anyway, it is still present on the latest version of the code (I downloaded the latest snapshot from the GIT repository yesterday and I have exactly the same crash).

 

 

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]