150
main()
{
/* Initialize stack pointer */
init_sp (stack + sizeof (stack));
/* Initialize initialized data */
memcpy (&init_data, &data, &edata - &data);
/* Turn on the serial ports */
init_duart (&a);
init_duart (&b);
}
Use the
section
example. GCC issues a warning and otherwise ignores the
variable declarations.
You may only use the
way linkers work. The linker requires each object be defined once, with the exception that unini-
tialized variables tentatively go in the
You can force a variable to be initialized with the
Some file formats do not support arbitrary sections so the
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.
shared
On Windows NT, in addition to putting variable definitions in a named section, the section
can also be shared among all running copies of an executable or DLL. For example, this small
program defines shared data by putting it in a named section
shareable:
int foo __attribute__((section ("shared"), shared)) = 0;
int
main()
{
/* Read and write foo.
copies see the same value.
return 0;
}
You may only use the
global definition because of the way linkers work. See
The
attribute is only available on Windows NT.
shared
tls_model ("
tls_model
The
tls_model
Storage) of a particular
on a per-variable basis. The
local-dynamic
Not all targets support this attribute.
transparent_union
This attribute, attached to a function parameter which is a union, means that the corresponding
argument may have the type of any union member, but the argument is passed as if its type were
that of the first union member. For more details see Section 6.34 Specifying Attributes of Types.
attribute with an initialized definition of a global variable, as shown in the
attribute with a fully initialized global definition because of the
section
All running
attribute along with
shared
")
attribute sets thread-local storage model (refer to Section 6.50 Thread-Local
variable, overriding
__thread
tls_model
,
or
initial-exec
Chapter 6. Extensions to the C Language Family
(or
) section and can be multiply "defined".
common
bss
-fno-common
section
*/
section
section
-ftls-model=
argument should be one of
.
local-exec
attribute in uninitialized
section
flag or the
nocommon
attribute is not available on
and marking the section
shared
attribute with a fully initialized
attribute for more information.
command line switch
global-dynamic
attribute.
,
Need help?
Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?
Questions and answers