tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] build perl5 with tcc?


From: Chris Marshall
Subject: Re: [Tinycc-devel] build perl5 with tcc?
Date: Mon, 20 Jul 2015 08:16:19 -0400

./configure yields:

 ./configure 2>&1 | tee configure-log.txt
Binary  directory   /usr/local/bin
TinyCC directory    /usr/local/lib/tcc
Library directory   /usr/local/lib64
Include directory   /usr/local/include
Manual directory    /usr/local/share/man
Info directory      /usr/local/share/info
Doc directory       /usr/local/share/doc//usr/local/lib/tcc
Target root prefix 
Source path      /home/chm/pdl/git/tinycc
C compiler       gcc
cross compilers  no
Target CPU       x86-64
Host OS          CYGWIN_NT-6.1
Target OS        CYGWIN_NT-6.1
Big Endian       no
gprof enabled    no
use libgcc       no
Creating config.mak and config.h
config.h is unchanged


after which make yields:

 gcc -o tcc.o -c tcc.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
gcc -o libtcc.o -c libtcc.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
gcc -o tccpp.o -c tccpp.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
gcc -o tccgen.o -c tccgen.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
gcc -o tccelf.o -c tccelf.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
gcc -o tccasm.o -c tccasm.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
gcc -o tccrun.o -c tccrun.c -DTCC_TARGET_X86_64 -I.  -Wall -g -O0 -Wdeclaration-after-statement -Wno-deprecated-declarations -Wno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-uninitialized -fno-strict-aliasing
tccrun.c: In function 'rt_get_caller_pc':
tccrun.c:544:33: error: 'mcontext_t' has no member named 'gregs'
         *paddr = uc->uc_mcontext.gregs[REG_RIP];
                                 ^
tccrun.c:544:40: error: 'REG_RIP' undeclared (first use in this function)
         *paddr = uc->uc_mcontext.gregs[REG_RIP];
                                        ^
tccrun.c:544:40: note: each undeclared identifier is reported only once for each function it appears in
tccrun.c:555:29: error: 'mcontext_t' has no member named 'gregs'
         fp = uc->uc_mcontext.gregs[REG_RBP];
                             ^
tccrun.c:555:36: error: 'REG_RBP' undeclared (first use in this function)
         fp = uc->uc_mcontext.gregs[REG_RBP];
                                    ^
Makefile:234: recipe for target 'tccrun.o' failed
make: *** [tccrun.o] Error 1


where the ucontext.h for cygwin has this:

 /* ucontext.h

   Copyright 2015 Red Hat, Inc.

This file is part of Cygwin.

This software is a copyrighted work licensed under the terms of the
Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
details. */

#ifndef _SYS_UCONTEXT_H_
#define _SYS_UCONTEXT_H_

#include <signal.h>

typedef struct __mcontext mcontext_t;

typedef __attribute__ ((aligned (16))) struct __ucontext {
        mcontext_t      uc_mcontext;
        struct __ucontext *uc_link;
        sigset_t        uc_sigmask;
        stack_t uc_stack;
        unsigned long int       uc_flags;
} ucontext_t;

#endif /* !_SYS_UCONTEXT_H_ */


 where I note the lack of the gregs[].

--Chris

On Mon, Jul 20, 2015 at 12:25 AM, Jared Maddox <address@hidden> wrote:
> Date: Fri, 17 Jul 2015 09:11:02 -0400
> From: Chris Marshall <address@hidden>
> To: address@hidden
> Subject: Re: [Tinycc-devel] build perl5 with tcc?
> Message-ID:
>         <address@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Hi David-
>

> I definitely plan to look at the C::TinyCompiler and XS::TCC
> modules once I can get tcc and libtcc running on my cygwin
> setup.  Unfortunately, a direct cygwin build is not possible
> since the needed access to the program counter is not supported.
>

If you're talking about the x86 instruction pointer, the hardware
doesn't support direct access. If you're talking about something else,
please clarify.

The "standard" trick is to make a function call to some location, and
grab the return address from the stack. I recall that in some cases
the call is to literally the address immediately after the call,
though writing a function that returns it's own return address is
probably better if you think you'll do it twice or more.

Example code here:
http://stackoverflow.com/questions/599968/reading-program-counter-directly

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


reply via email to

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