* preprocessing by gcc @ 2011-05-31 19:45 PRASANTH RAJAGOPAL [not found] ` <4DE54C39.4010803@andihellmund.com> 0 siblings, 1 reply; 4+ messages in thread From: PRASANTH RAJAGOPAL @ 2011-05-31 19:45 UTC (permalink / raw) To: gcc-help Hi, I am using eclipse to cross compile for an embedded processor, using its bare metal gcc tools (assembler, compiler, linker). The toolchains are installed properly and the toolchain calls the gcc tools and utils one by one. All works well. I am trying to build a C project that also has a CRT.S file included as the preprocessed file for startup. I read the following: Preprocessing - The *as* internal preprocessor:It does not do macro processing, include file handling, or anything else you may get from your C compiler's preprocessor. Now the way the toolchains are used, it appears that .S files are preprocessed by the Assembler, because my MACROs in the .S are never getting defined & in the make files I see that the .S files are given to Assembler. Without going inside eclipse, how can I let the pre processing to be done by Compiler instead of Assembler? Hope it make sense, being new to some of these things! Thanks ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <4DE54C39.4010803@andihellmund.com>]
* Re: preprocessing by gcc [not found] ` <4DE54C39.4010803@andihellmund.com> @ 2011-06-01 5:34 ` PRASANTH RAJAGOPAL 2011-06-01 8:12 ` David Paterson 0 siblings, 1 reply; 4+ messages in thread From: PRASANTH RAJAGOPAL @ 2011-06-01 5:34 UTC (permalink / raw) To: Andi Hellmund; +Cc: gcc-help You are right. I ran the *.S through gcc and it worked. I then ran it through gas and the MACROs were not defined and errors were thrown. Wondering how I can make it work with Eclipse? They seem to have locked *.S as an assembly source code & I am unable to remove the gas from toolchain list. I posted this in Eclipse forum, but have'n't got a reply yet. Thanks On Wed, Jun 1, 2011 at 1:44 AM, Andi Hellmund <mail@andihellmund.com> wrote: > Hi >> >> I read the following: >> Preprocessing - The *as* internal preprocessor:It does not do macro >> processing, include file handling, or anything else you may get from >> your C compiler's preprocessor. > > Yes, that's true. The preprocessor of GNU as is not a pre-processor in the > sense of the C compiler. >> >> Now the way the toolchains are used, it appears that .S files are >> preprocessed by the Assembler, because my MACROs in the .S are never >> getting defined& in the make files I see that the .S files are given >> to Assembler. > > There is a "convention" that .s are pure assembler-files which could be > passed to the assembler directly, but .S files do contain pre-processor > macros (known from C). So, the .S must be passed to the pre-processor before > passing the output to the assembler. > > The usual way is to NOT pass the .S file to 'as' but to pass it to 'gcc', > e.g. gcc <file>.S -c. gcc will then do the steps as described above > (preprocessor -> assembler). > > Best regards, > Andi > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: preprocessing by gcc 2011-06-01 5:34 ` PRASANTH RAJAGOPAL @ 2011-06-01 8:12 ` David Paterson 2011-06-01 13:00 ` PRASANTH RAJAGOPAL 0 siblings, 1 reply; 4+ messages in thread From: David Paterson @ 2011-06-01 8:12 UTC (permalink / raw) To: PRASANTH RAJAGOPAL; +Cc: Andi Hellmund, gcc-help On Wed, Jun 1, 2011 at 6:33 AM, PRASANTH RAJAGOPAL <prasanthris@gmail.com> wrote: > You are right. I ran the *.S through gcc and it worked. I then ran it > through gas and the MACROs were not defined and errors were thrown. > > Wondering how I can make it work with Eclipse? They seem to have > locked *.S as an assembly source code & I am unable to remove the gas > from toolchain list. > I posted this in Eclipse forum, but have'n't got a reply yet. You can either switch it for the individual file, or if you have several .S files in your project, do it for the whole project. Open the properties for the file or project, select "C/C++ Build", then "Settings", "GCC Assembler", and simply change "as" to "gcc". Easy as that :-) Cheers, David P. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: preprocessing by gcc 2011-06-01 8:12 ` David Paterson @ 2011-06-01 13:00 ` PRASANTH RAJAGOPAL 0 siblings, 0 replies; 4+ messages in thread From: PRASANTH RAJAGOPAL @ 2011-06-01 13:00 UTC (permalink / raw) To: David Paterson; +Cc: Andi Hellmund, gcc-help You are a saviour! I just kept playing around in Eclipse, and all options broke one or the other thing, but this one is an easy workaround. Thanks On Wed, Jun 1, 2011 at 1:42 PM, David Paterson <dnpaterson@gmail.com> wrote: > On Wed, Jun 1, 2011 at 6:33 AM, PRASANTH RAJAGOPAL > <prasanthris@gmail.com> wrote: >> You are right. I ran the *.S through gcc and it worked. I then ran it >> through gas and the MACROs were not defined and errors were thrown. >> >> Wondering how I can make it work with Eclipse? They seem to have >> locked *.S as an assembly source code & I am unable to remove the gas >> from toolchain list. >> I posted this in Eclipse forum, but have'n't got a reply yet. > > You can either switch it for the individual file, or if you have > several .S files > in your project, do it for the whole project. > > Open the properties for the file or project, select "C/C++ Build", > then "Settings", > "GCC Assembler", and simply change "as" to "gcc". Easy as that :-) > > Cheers, > > David P. > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-01 13:00 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-05-31 19:45 preprocessing by gcc PRASANTH RAJAGOPAL [not found] ` <4DE54C39.4010803@andihellmund.com> 2011-06-01 5:34 ` PRASANTH RAJAGOPAL 2011-06-01 8:12 ` David Paterson 2011-06-01 13:00 ` PRASANTH RAJAGOPAL
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).