lkml.org 
[lkml]   [1996]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe:Possible kernel optimizati
Date

In article <9612141007.aa08415@ax433.mclink.it> Tekno Soft Snc
<MC3641@mclink.it> writes:

| Good! How can do it with a gcc ? In a C code we need to declare this
| functions as part of this section (with #pragma ?), in new exception
| handling we can do it with __asm__(".section __ex_table,\"ax\"").

RTFM:

Declaring Attributes of Functions
=================================

In GNU C, you declare certain things about functions called in your
program which help the compiler optimize function calls and check your
code more carefully.

The keyword `__attribute__' allows you to specify special attributes
when making a declaration. This keyword is followed by an attribute
specification inside double parentheses. Eight attributes, `noreturn',
`const', `format', `section', `constructor', `destructor', `unused' and
`weak' are currently defined for functions. Other attributes, including
`section' are supported for variables declarations (*note Variable
Attributes::.) and for types (*note Type Attributes::.).

You may also specify attributes with `__' preceding and following
each keyword. This allows you to use them in header files without
being concerned about a possible macro of the same name. For example,
you may use `__noreturn__' instead of `noreturn'.

...

`section ("section-name")'
Normally, the compiler places the code it generates in the `text'
section. Sometimes, however, you need additional sections, or you
need certain particular functions to appear in special sections.
The `section' attribute specifies that a function lives in a
particular section. For example, the declaration:

extern void foobar (void) __attribute__ ((section ("bar")));

puts the function `foobar' in the `bar' section.

Some file formats do not support arbitrary sections so the
`section' attribute is not available on all platforms. If you
need to map the entire contents of a module to a particular
section, consider using the facilities of the linker instead.
--
Michael Meissner, Cygnus Support (East Coast)
4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA
meissner@cygnus.com, 617-354-5416 (office), 617-354-7161 (fax)

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.046 / U:5.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site