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
9 The first byte, which is index zero, is defined to hold
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.
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.
26 <table border cellspacing=0>
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>
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>
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> </code></td>
75 <b>Figure 4-15: String Table Indexes</b>
77 <table border cellspacing=0>
81 <td align=right>0</td>
85 <td align=right>1</td>
89 <td align=right>7</td>
93 <td align=right>11</td>
97 <td align=right>16</td>
101 <td align=right>24</td>
102 <td><i>null string</i></td>
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.
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>
121 © 1997, 1998, 1999, 2000, 2001 The Santa Cruz Operation, Inc. All rights reserved.