bugTiny C Compiler - Bugs: bug #30457, GNU extensions 'i' relocations not...


bug #30457: GNU extensions 'i' relocations not supported on Linux (x86_64)

Submitter:  None
Submitted:  Thu 15 Jul 2010 09:18:07 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  robotux
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:
       No canned response available


Tue 19 Oct 2010 10:14:02 AM UTC, comment #1: 

similar  problem ?

linux 2.6.35-22-generic
tcc version 0.9.25

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, const char *argv[])
char *pollo= "ppooo";
printf("%s", pollo);
return 0;

calling tcc -b (mem/ptr bounds checker) fails :
tcc: undefined symbol 'memset'
tcc: undefined symbol 'memmove'
tcc: undefined symbol 'memcpy'

whitout -b, it works fine. why ?

Massimo Sala <massimosala>
Thu 15 Jul 2010 09:18:07 PM UTC, original submission:  

TCC fails to bootstrap on recent version on Linux for failing to
support 'i' relocations (see below)
A similar problem arises when trying to use TCC to 'finalize'
Eiffel projects (that use a C generating backend)

The bootstrapping issue on x86_64 Linux is due to a GNU extension, the missing linker symbols:

tcc -o tcc tcc.c -DTCC_TARGET_X86_64 -O2 -g -Wall -Wno-pointer-sign -lm -ldl
tcc: undefined symbol 'strlen'
tcc: undefined symbol 'strchr'
tcc: undefined symbol 'strrchr'
tcc: undefined symbol 'strcpy'
tcc: undefined symbol 'strcmp'
tcc: undefined symbol 'memcmp'
tcc: undefined symbol 'strncmp'

are 'i' not 'T' symbols in libc.a:
<man nm>

 "i"  For PE format files this indicates that the symbol is in
      a section specific to the implementation of DLLs.  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.
 "t"             The symbol is in the text (code) section.

 nm -A --defined-only /usr/lib/libc.a | grep strcpy

/usr/lib/libc.a:strcpy.o:0000000000000030 T __GI_strcpy
/usr/lib/libc.a:strcpy.o:0000000000000030 t __strcpy_sse2
/usr/lib/libc.a:strcpy.o:0000000000000000 t __strcpy_ssse3
/usr/lib/libc.a:strcpy.o:0000000000000000 i strcpy
 <--- 'i' not 'T', hence not picked up by TCC
/usr/lib/libc.a:string-inlines.o:00000000000000c0 T __strcpy_small
/usr/lib/libc.a:strcpy_chk.o:0000000000000000 T __strcpy_chk

Fixing this will entail an upgrade of the TCC linker (and possibly a TCC runtime upgrade as well)



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by robotux (Updated the item)
  • -email is unavailable- added by massimosala (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.





    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-10-18 robotux Open/ClosedOpen Closed
    2012-10-18 robotux StatusNone Fixed
        Assigned toNone robotux

    Back to the top

    Powered by Savane 3.9