This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


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

Re: allocating code to sections in source code


On Sat, Jan 27, 2001 at 09:32:58PM +0000, chris.r.lipchik@att.net wrote:

> I'm looking for a reference guide on line which would 
> have the proper syntax for allocating code in a C or 
> ASM source file to a specific section which can be later 
> referenced by the linker.  Specifially, I'm interested in 
> the syntax for the gcc.

In assembly, use the .section directive:

	  .section foobar
        
          <your stuff here>

In gcc, use the __attribute__(()) mechanism:

    char myBuffer[512] __attribute__((section("foobar")));

Both of these are explained in the "info" files:

$ info gcc
$ info gas

-- 
Grant Edwards
grante@visi.com

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