Update.
[glibc.git] / csu / abi-note.S
blobbaa409de4d373eec0960b1fadb9a51cc20224e26
1 /* Special .init and .fini section support.
2    Copyright (C) 1997 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
5    The GNU C Library is free software; you can redistribute it
6    and/or modify it under the terms of the GNU Library General Public
7    License as published by the Free Software Foundation; either
8    version 2 of the License, or (at your option) any later version.
10    In addition to the permissions in the GNU Library General Public
11    License, the Free Software Foundation gives you unlimited
12    permission to link the compiled version of this file with other
13    programs, and to distribute those programs without any restriction
14    coming from the use of this file.  (The Library General Public
15    License restrictions do apply in other respects; for example, they
16    cover modification of the file, and distribution when not linked
17    into another program.)
19    The GNU C Library is distributed in the hope that it will be
20    useful, but WITHOUT ANY WARRANTY; without even the implied warranty
21    of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22    GNU Library General Public License for more details.
24    You should have received a copy of the GNU Library General Public
25    License along with the GNU C Library; see the file COPYING.LIB.  If not,
26    write to the Free Software Foundation, 59 Temple Place - Suite 330,
27    Boston, MA 02111-1307, USA.  */
29 #include <sysdep.h>
31 /* The basic layout of note sections is specified by the ELF format.  */
33 #define ELF_NOTE_BEGIN(sectname, sectflags, type, name)                       \
34         .section sectname, sectflags;                                         \
35         .align ALIGNARG(2);     /* Notes are 4-byte aligned.  */              \
36         .long 1f - 0f;          /* 32-bit word: length of name field */       \
37         .long 3f - 2f;          /* 32-bit word: length of desc field */       \
38         .long (type);           /* 32-bit word: vendor-defined type field */  \
39 0:      .asciz name;            /* null-terminated string, any length: name */\
40 1:      .align ALIGNARG(2);     /* Name data padded to 4-byte alignment.  */  \
41 2:      /* Here follows the "note descriptor" data, whose format              \
42            is not specified by ELF.  The vendor name and type field           \
43            indicate what sort of data is found here.  */
45 #define ELF_NOTE_END                                                          \
46 3:      .align ALIGNARG(2)      /* Pad to 4-byte align the next note.  */
49 /* The linker (GNU ld 2.8 and later) recognize an allocated section whose
50    name begins with `.note' and creates a PT_NOTE program header entry
51    pointing at it.
53    Such a program header is the canonical way (at least in the free OS
54    community) to identify the OS environment ABI that the executable was
55    created for.  The ELF note information identifies a particular OS or
56    coordinated development effort within which the ELF header's e_machine
57    value plus (for dynamically linked programs) the PT_INTERP dynamic
58    linker name and DT_NEEDED shared library names fully identify the
59    runtime environment required by an executable.
61    The GNU project and cooperating development efforts (including the Linux
62    community) use a vendor name string of "GNU", and a note type field with
63    value 1 for a note descriptor that indicates ABI requirements.  */
65 #include <abi-tag.h>            /* OS-specific ABI tag value */
67 ELF_NOTE_BEGIN(".note.ABI-tag", "a", 1, "GNU")
68         .long ABI_TAG
69 ELF_NOTE_END