This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Trying to develop new frontend
- From: Iain Buclaw <ibuclaw at gdcproject dot org>
- To: Daniel Neis <danielneis at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 5 Aug 2014 16:42:13 +0100
- Subject: Re: Trying to develop new frontend
- Authentication-results: sourceware.org; auth=none
- References: <CAM5mFrywsFeMmY=BUFrxFWW6wwLCNUuHgBRZkJ9nVK6q29dfFw at mail dot gmail dot com>
On 5 August 2014 15:17, Daniel Neis <danielneis@gmail.com> wrote:
> Hello,
>
> i am trying to develop a GCC frontend using flex and bison as lexer/parser.
>
> i've read several documentation (the list below and also the gccint.info)
>
> * https://github.com/rabishah/Mini-C-Compiler-using-Flex-And-Yacc/
> * http://www.tldp.org/HOWTO/GCC-Frontend-HOWTO.html
> * https://gcc.gnu.org/wiki/WritingANewFrontEnd
> * https://gcc.gnu.org/ml/gcc-patches/2006-06/msg00648.html
> * https://gcc.gnu.org/wiki/FrontEnd/skeleton
> * http://blog.lxgcc.net/wp-content/uploads/2011/03/GCC_frontend.pdf
> * http://cobolforgcc.sourceforge.net/cobol_14.html#SEC96
> * https://gcc.gnu.org/onlinedocs/gccint/Parsing-pass.html#Parsing-pass
>
> but still having some problems to make it work.
>
> the code is on github:
>
> https://github.com/danielneis/gcc-neis-frontend
>
> the project compiles and generates my compiler "neis1". it is a valid
> elf and i can run it with --help and it shows me the help.
>
> I am testing it with a simple .c file like this:
>
> int main() {
> return 0;
> }
>
> ~/bin$ ./gcc -x neis /home/neis/test.c
> /usr/lib/x86_64-linux-gnu/crt1.o: In function `_start':
> /home/aurel32/glibc/glibc-2.19/csu/../sysdeps/x86_64/start.S:118:
> undefined reference to `main'
> collect2: error: ld returned 1 exit status
>
>
> I think I may be missing some part of code generation with generic,
> but could not find any references...
>
> Any thoughts?
>
I couldn't see any reference to cgraph_finalize_function nor
finalize_compilation_unit. So it looks like you are not sending any
code to the backend to be compiled.
This is a nice point of reference for a skeleton front-end.
https://github.com/giuseppe/gccbrainfuck
Regards
Iain