This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: preprocessing by gcc


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]