compiler that just does "compiling"... nothing more...
compiler that just does "compiling"... nothing more...
Hello,
that might not be a totally osdev question but I couldn't find the answer on net.
I want to build a compiler ( gcc ) that just does "compiling" i.e. it takes a ( already preprocessed ) source file and produces assembly code for it. nothing more, no assembling, no objects, no linking, no external libraries, no calling of external programs etc... I read the "building cross gcc" tutorial on wiki but no answer there too... How can I ( or can I ) build gcc without binutils? I will use the gcc only with "-S" option ( produce asm code ) if gcc can't do this, can another open source c++ compiler do it?
Thanks, best regards.
that might not be a totally osdev question but I couldn't find the answer on net.
I want to build a compiler ( gcc ) that just does "compiling" i.e. it takes a ( already preprocessed ) source file and produces assembly code for it. nothing more, no assembling, no objects, no linking, no external libraries, no calling of external programs etc... I read the "building cross gcc" tutorial on wiki but no answer there too... How can I ( or can I ) build gcc without binutils? I will use the gcc only with "-S" option ( produce asm code ) if gcc can't do this, can another open source c++ compiler do it?
Thanks, best regards.
Re: compiler that just does "compiling"... nothing more...
You should have put this is the general programming Forum.
-S in the gcc command line, will make it only output assembly, but I have no idea how to remove preprocessing
Jules
-S in the gcc command line, will make it only output assembly, but I have no idea how to remove preprocessing
Jules
Re: compiler that just does "compiling"... nothing more...
As mentioned, -S. There's no need to remove preprocessing because if you've already preprocessed the file, there will be no preprocessor instructions left in it.
Wrong forum.
Wrong forum.
Re: compiler that just does "compiling"... nothing more...
ok... May be i couldn't tell exactly what i need... I know about the "-S" option as I mentioned.
My OS currently has a minimal ( almost no ) filesystem support. I simulate standard C files ( stdin and stdout ) to memory, so programs are not able to call and execute an external program like gcc. gcc tries to call "cpp (preprocessor)" "as" and "ld". I want to "build" a gcc that only takes an input from stdin and produces the assembly code to stdout. My question is: how can I configure gcc so that it will not include any code which will try to call an external program. How can I exclude this unneeded part of gcc from build?
For the "wrong forum" thing; can an admin move this thread to the appropriate forum?
Thanks, Best regards.
My OS currently has a minimal ( almost no ) filesystem support. I simulate standard C files ( stdin and stdout ) to memory, so programs are not able to call and execute an external program like gcc. gcc tries to call "cpp (preprocessor)" "as" and "ld". I want to "build" a gcc that only takes an input from stdin and produces the assembly code to stdout. My question is: how can I configure gcc so that it will not include any code which will try to call an external program. How can I exclude this unneeded part of gcc from build?
For the "wrong forum" thing; can an admin move this thread to the appropriate forum?
Thanks, Best regards.
Re: compiler that just does "compiling"... nothing more...
I very much doubt you would find an off the shelf way to do this, it's not a common thing to want to do. The place to start looking would be the help file to ./configure. If there isn't an option in there (and I doubt there will be), then it's time to go off and start hacking the sources. At that stage, you'd want to pick a simple compiler... GCC isn't the most friendly thing, with all it's backends.
Re: compiler that just does "compiling"... nothing more...
There isn't an off-the-shelf way to do it. You'd have to manually run cc1 and collect2, and who knows what cans of worms that will uncover.
All in all, getting a compiler like GCC to run without the proper runtime support is a losing game. Implement a filesystem.
All in all, getting a compiler like GCC to run without the proper runtime support is a losing game. Implement a filesystem.
Re: compiler that just does "compiling"... nothing more...
What's the point of a C compiler if there is no filesystem and no way of running programs from a filesystem? Are you going to actually type a program in and then just hope that there are no mistakes?
Re: compiler that just does "compiling"... nothing more...
200,000 lines of code, the most complex God knows what known to man...iammisc wrote:What's the point of a C compiler if there is no filesystem and no way of running programs from a filesystem? Are you going to actually type a program in and then just hope that there are no mistakes?
*Power failure*
jules
Re: compiler that just does "compiling"... nothing more...
It's a bit like going back to the times when they used punch cards... just hoping that the huge program you've written all at once works.
Re: compiler that just does "compiling"... nothing more...
If you're targeting i386 or ARM, there's tcc, which includes a C preprocessor, compiler, assembler and linker all in one binary.
Re: compiler that just does "compiling"... nothing more...
Thank you very much... this link ( tinycc ) is very helpful...niteice wrote:If you're targeting i386 or ARM, there's tcc, which includes a C preprocessor, compiler, assembler and linker all in one binary.
Re: compiler that just does "compiling"... nothing more...
Totally wasn't paying attention to this thread, but once reading it, Nwcc comes to mind.
C8H10N4O2 | #446691 | Trust the nodes.
Re: compiler that just does "compiling"... nothing more...
Alboin wrote:Totally wasn't paying attention to this thread, but once reading it, Nwcc comes to mind.
Thank you both both links are really helpful...niteice wrote:If you're targeting i386 or ARM, there's tcc, which includes a C preprocessor, compiler, assembler and linker all in one binary.
Both links are really close to what i want: "compiler that just produces asm code from c,c++ code"
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
- AndrewAPrice
- Member
- Posts: 2300
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
Re: compiler that just does "compiling"... nothing more...
Virtually every compiler has a switch that only outputs assembly code. That's how I compile things for my console since I use my own tool for assembling and linking.Cemre wrote:Thank you both both links are really helpful...
Both links are really close to what i want: "compiler that just produces asm code from c,c++ code"
My OS is Perception.