]>
Commit | Line | Data |
---|---|---|
779ae82e | 1 | /* Special .init and .fini section support. |
04277e02 | 2 | Copyright (C) 1997-2019 Free Software Foundation, Inc. |
779ae82e UD |
3 | This file is part of the GNU C Library. |
4 | ||
e2cb5c1d AJ |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | |
779ae82e | 7 | License as published by the Free Software Foundation; either |
e2cb5c1d | 8 | version 2.1 of the License, or (at your option) any later version. |
779ae82e | 9 | |
e2cb5c1d | 10 | In addition to the permissions in the GNU Lesser General Public |
779ae82e UD |
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 | |
e2cb5c1d | 14 | coming from the use of this file. (The Lesser General Public |
779ae82e UD |
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.) | |
18 | ||
e2cb5c1d AJ |
19 | The GNU C Library is distributed in the hope that it will be useful, |
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
22 | Lesser General Public License for more details. | |
779ae82e | 23 | |
e2cb5c1d | 24 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 25 | License along with the GNU C Library; if not, see |
5a82c748 | 26 | <https://www.gnu.org/licenses/>. */ |
779ae82e | 27 | |
e7c5513d UD |
28 | /* Define an ELF note identifying the operating-system ABI that the |
29 | executable was created for. The ELF note information identifies a | |
30 | particular OS or coordinated development effort within which the | |
31 | ELF header's e_machine value plus (for dynamically linked programs) | |
32 | the PT_INTERP dynamic linker name and DT_NEEDED shared library | |
33 | names fully identify the runtime environment required by an | |
34 | executable. | |
779ae82e | 35 | |
e7c5513d UD |
36 | The general format of ELF notes is as follows. |
37 | Offsets and lengths are bytes or (parenthetical references) to the | |
38 | values in other fields. | |
779ae82e | 39 | |
f6aa506f | 40 | offset length contents |
e7c5513d UD |
41 | 0 4 length of name |
42 | 4 4 length of data | |
43 | 8 4 note type | |
44 | 12 (0) vendor name | |
45 | - null-terminated ASCII string, padded to 4-byte alignment | |
f6aa506f | 46 | 12+(0) (4) note data, |
779ae82e | 47 | |
e7c5513d UD |
48 | The GNU project and cooperating development efforts (including the |
49 | Linux community) use note type 1 and a vendor name string of "GNU" | |
50 | for a note descriptor that indicates ABI requirements. The note data | |
51 | is four 32-bit words. The first of these is an operating system | |
de71a46a | 52 | number (0=Linux, 1=Hurd, 2=Solaris, ...) and the remaining three |
e7c5513d UD |
53 | identify the earliest release of that OS that supports this ABI. |
54 | See abi-tags (top level) for details. */ | |
779ae82e | 55 | |
a986484f | 56 | #include <config.h> |
779ae82e | 57 | #include <abi-tag.h> /* OS-specific ABI tag value */ |
f6aa506f | 58 | |
e7c5513d UD |
59 | /* The linker (GNU ld 2.8 and later) recognizes an allocated section whose |
60 | name begins with `.note' and creates a PT_NOTE program header entry | |
61 | pointing at it. */ | |
779ae82e | 62 | |
e7c5513d | 63 | .section ".note.ABI-tag", "a" |
f6aa506f | 64 | .p2align 2 |
e7c5513d UD |
65 | .long 1f - 0f /* name length */ |
66 | .long 3f - 2f /* data length */ | |
67 | .long 1 /* note type */ | |
68 | 0: .asciz "GNU" /* vendor name */ | |
f6aa506f | 69 | 1: .p2align 2 |
a986484f UD |
70 | 2: .long __ABI_TAG_OS /* note data: the ABI tag */ |
71 | .long __ABI_TAG_VERSION | |
f6aa506f | 72 | 3: .p2align 2 /* pad out section */ |