On Sun, Sep 15, 2013 at 2:03 PM, Thomas Preud'homme <[email protected]>wrote:
> Le vendredi 13 septembre 2013 18:43:14 Cayce Pollard a écrit :
> > I'm once again testing a build of tcc on my device by compiling SCM.
> > Determined to get this working
> >
> > /home/kbox/devel/scm $ tcc -vv scm.c
> > tcc version 0.9.26 (ARM Linux)
> > tcc: error: file 'crt1.o' not found
> > tcc: error: file 'crti.o' not found
> > -> scm.c
> > -> /usr/include/signal.h
> > -> /usr/include/sys/cdefs.h
> > -> /usr/include/sys/cdefs_elf.h
> > In file included from scm.c:24:
> > In file included from /usr/include/signal.h:31:
> > /usr/include/sys/cdefs.h:252: error: #error "No function renaming
> possible"
> > /home/kbox/devel/scm $
> >
> > 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
>
> > When building tcc for my device, I specified the crt location and
> included
> > crtbegin_dynamic and crtend_android to --extra-ldflags during configure.
> > Why is tcc complaining about crti.o and crt1.o?
>
> --extra-ldflags is to set the LDFLAGS to be used during compilation of
> tcc. It
> doesn't affect the behavior of tcc but the behavior of the compiler
> compiling
> tcc. What you seem to want here is that tcc link the extra files
> crtbegin_dynamic and crtent_android to each program generated.
>
> Anyway, crti.o and crt1.o are hardcoded in tcc so you'd have to change the
> code to look for files named differently.
>
>
> >
> > 2) Is there a way to indicate to cdefs.h that compiler implements C99
> > without editing cdefs.h?
>
> It should already be done. See function tcc_new in libtcc.c:
>
> /* standard defines */
> tcc_define_symbol(s, "__STDC__", NULL);
> tcc_define_symbol(s, "__STDC_VERSION__", "199901L");
> tcc_define_symbol(s, "__STDC_HOSTED__", NULL);
>
> 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
There's also this bit that may be relevant:
224 /*
225 * C99 defines __func__ predefined identifier, which was made
available
226 * in GCC 2.95.
227 */
228 #if !defined(__STDC_VERSION__) || !(__STDC_VERSION__ >= 199901L)
229 #if __GNUC_PREREQ__(2, 6)
230 #define __func__ __PRETTY_FUNCTION__
231 #elif __GNUC_PREREQ__(2, 4)
232 #define __func__ __FUNCTION__
233 #else
234 #define __func__ ""
235 #endif
236 #endif /* !(__STDC_VERSION__ >= 199901L) */
237
238 #if defined(_KERNEL)
239 #if defined(NO_KERNEL_RCSIDS)
240 #undef __KERNEL_RCSID
241 #define __KERNEL_RCSID(_n, _s) /* nothing */
242 #endif /* NO_KERNEL_RCSIDS */
243 #endif /* _KERNEL */
244
Let me know if you need more info. Thanks again.
>
>
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel