tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Error: File crti.o/crt1.o Not Found and No Function R


From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] Error: File crti.o/crt1.o Not Found and No Function Renaming
Date: Mon, 16 Sep 2013 15:18:08 +0200
User-agent: KMail/4.10.5 (Linux/3.10-1-amd64; KDE/4.10.5; x86_64; ; )

Le lundi 16 septembre 2013 07:51:49 Cayce Pollard a écrit :
> On Sun, Sep 15, 2013 at 2:03 PM, Thomas Preud'homme 
<address@hidden>wrote:
> > > 
> > > 1) There are crt* files on my device, but they are not crt1.o or crti.o.
> > 
> > What are they?
> 
> Here's the list of crt* files in the sysroot/usr/lib of the android NDK:
> crtbegin_dynamic.o  crtbegin_static.o  crtend_so.o crtbegin_so.o
> crtend_android.o
> 

> > 
> > Anyway, crti.o and crt1.o are hardcoded in tcc so you'd have to change the
> > code to look for files named differently.

Take a loot at tcc_set_output_type in libtcc.c. Just add tcc_add_crt call to 
link these crt files and then recompile tcc.

> > 
> > If you could paste the relevant bits (around line 252) of file
> > /usr/include/sys/cdefs.h we could help you more efficiently.
> 
> Sorry about that.  Here's the relevant lines  in cdefs.h
> 
> 245 #if !defined(_STANDALONE) && !defined(_KERNEL)
>     246 #ifdef __GNUC__
>     247 #define __RENAME(x)     ___RENAME(x)
>     248 #else
>     249 #ifdef __lint__
>     250 #define __RENAME(x)     __symbolrename(x)
>     251 #else
>     252 #error "No function renaming possible"
>     253 #endif /* __lint__ */
>     254 #endif /* __GNUC__ */
>     255 #else /* _STANDALONE || _KERNEL */
>     256 #define __RENAME(x)     no renaming in kernel or standalone
> environment
>     257 #endif
>     258

Tcc definitely can't define __GNUC__ as this means "compiled by gcc". However, 
as you modify tcc to change the crt files linked in each program, you can add a 
tcc_define_symbol and use the asm label machinery to define a ___RENAME 
function. Check commit 2596273 for how to do a function rename.

Then, define __GNUC__ before including anything and that might work. It might 
also fail because it now compiles lots of gcc-specific constructs because 
__GNUC__ is defined. If it fail you're out of luck because you probably can't 
change the contents of cdefs.h.

> 
> There's also this bit that may be relevant:

Why is that relevant? Do you need __func__ to be defined and it's not by tcc?

Best regards,

Thomas

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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