This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


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

Re: Assembly, GCC and the linker



nev@roadrunner.ipc.com said:
> I tried to #include the .h file in the assembley file and feed it to 
> the c preprocessor. The output had the #include file data in it, so 
> 'as' choked.

Use gcc to preprocess the assembly, like so:

	gcc -c foo.S

Both .S and .s are assembler. By convention, .S is assembly source that
needs to be preprocessed. Otherwise, gcc doesn't care.

nev@roadrunner.ipc.com said:
> I need to allocate a block of memory in the linker file. The size of 
> the block is a function of values declared in the .h  file but the 
> location must be specified by the linker 

I would consider defining the size in the linker script and have the C
program look at the external symbol instead of the #define. This may not
be optimal, but will work. However, you can almost certainly do what you
are trying to do in assembly, then load the specific file explicitly
by the linker script. Create a section that you can locate by the linker
script, and allocate the space relative the beginning of the section in
the assembly file.