Specifications.
[pintos-anon] / specs / sysv-abi-update.html / ch4.strtab.html
1 <html>
2 <title>String Table</title><p>
3 <h1>String Table</h1><p>
4 String table sections hold null-terminated character sequences,
5 commonly called strings.
6 The object file uses these strings to represent symbol and section names.
7 One references a string as an index into the
8 string table section.
9 The first byte, which is index zero, is defined to hold
10 a null character.
11 Likewise, a string table's last byte is defined to hold
12 a null character, ensuring null termination for all strings.
13 A string whose index is zero specifies
14 either no name or a null name, depending on the context.
15 An empty string table section is permitted; its section header's <code>sh_size</code>
16 member would contain zero.
17 Non-zero indexes are invalid for an empty string table.
18 <p>
19 A section header's <code>sh_name</code>
20 member holds an index into the section header string table
21 section, as designated by the <code>e_shstrndx</code>
22 member of the ELF header.
23 The following figures show a string table with 25 bytes
24 and the strings associated with various indexes.
25 <p>
26 <table border cellspacing=0>
27 <th>Index</th>
28 <th>+0</th>
29 <th>+1</th>
30 <th>+2</th>
31 <th>+3</th>
32 <th>+4</th>
33 <th>+5</th>
34 <th>+6</th>
35 <th>+7</th>
36 <th>+8</th>
37 <th>+9</th>
38 <tr>
39 <td align=right><b>0</b></td>
40 <td align=center width="50"><code>\0</code></td>
41 <td align=center width="50"><code>n</code></td>
42 <td align=center width="50"><code>a</code></td>
43 <td align=center width="50"><code>m</code></td>
44 <td align=center width="50"><code>e</code></td>
45 <td align=center width="50"><code>.</code></td>
46 <td align=center width="50"><code>\0</code></td>
47 <td align=center width="50"><code>V</code></td>
48 <td align=center width="50"><code>a</code></td>
49 <td align=center width="50"><code>r</td>
50 </tr>
51 <tr>
52 <td align=right><b>10</b></td>
53 <td align=center width="50"><code>i</code></td>
54 <td align=center width="50"><code>a</code></td>
55 <td align=center width="50"><code>b</code></td>
56 <td align=center width="50"><code>l</code></td>
57 <td align=center width="50"><code>e</code></td>
58 <td align=center width="50"><code>\0</code></td>
59 <td align=center width="50"><code>a</code></td>
60 <td align=center width="50"><code>b</code></td>
61 <td align=center width="50"><code>l</code></td>
62 <td align=center width="50"><code>e</code></td>
63 </tr>
64 <tr>
65 <td align=right><b>20</b></td>
66 <td align=center width="50"><code>\0</code></td>
67 <td align=center width="50"><code>\0</code></td>
68 <td align=center width="50"><code>x</code></td>
69 <td align=center width="50"><code>x</code></td>
70 <td align=center width="50"><code>\0</code></td>
71 <td colspan=5><code>&nbsp</code></td>
72 </tr>
73 </table>
74 <hr>
75 <b>Figure 4-15: String Table Indexes</b>
76 <p>
77 <table border cellspacing=0>
78 <th>Index</th>
79 <th>String</th>
80 <tr>
81 <td align=right>0</td>
82 <td><i>none</i></td>
83 </tr>
84 <tr>
85 <td align=right>1</td>
86 <td>name.</td>
87 </tr>
88 <tr>
89 <td align=right>7</td>
90 <td>Variable</td>
91 </tr>
92 <tr>
93 <td align=right>11</td>
94 <td>able</td>
95 </tr>
96 <tr>
97 <td align=right>16</td>
98 <td>able</td>
99 </tr>
100 <tr>
101 <td align=right>24</td>
102 <td><i>null string</i></td>
103 </tr>
104 </tr>
105 </table>
106 <hr>
107 <p>
108 As the example shows, a string table index may refer
109 to any byte in the section.
110 A string may appear more than once;
111 references to substrings may exist;
112 and a single string may be referenced multiple times.
113 Unreferenced strings also are allowed.
114 <hr>
115 <a href=ch4.sheader.html><img src=previous.gif alt="Previous"></a>
116 <a href=contents.html><img src=contents.gif alt="Contents"></a>
117 <a href=ch4.symtab.html><img src=next.gif alt="Next"></a>
118 <hr>
119 <i>
120 <small>
121 &#169; 1997, 1998, 1999, 2000, 2001 The Santa Cruz Operation, Inc.  All rights reserved.
122 </small>
123 </i>
124 </html>