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: Cayce Pollard
Subject: Re: [Tinycc-devel] Error: File crti.o/crt1.o Not Found and No Function Renaming
Date: Mon, 16 Sep 2013 10:41:55 -0500




On Mon, Sep 16, 2013 at 8:18 AM, Thomas Preud'homme <address@hidden> wrote:
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.

Thanks!  Not sure how to do that but I'm headed to figure it out. 
Also, for those struggling with an Android port of tcc that find this mailing list, there's a good explanation of the crt* files here:  http://dev.gentoo.org/~vapier/crt.txt


> >
> > 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.

I think this answers the question I was trying to ask, but didn't know how to.  Basically I was trying to ask how to indicate to cdefs.h that tinycc can do function renaming. 

Once again, very, *very* new to all of this.

>
> 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?

Nope. Sorry about that.  In my original email I wrote that I wanted to indicate to cdefs.h that the compiler implemented C99, but I was looking at the wrong section of the code.  What I need to do is implement a function rename for tcc and define __GNUC__ as mentioned in your reply.
I assume I take care of defining __GNUC__ with -D? 

Best regards,

Thomas

Thanks again.

reply via email to

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