At some point in the past few years, binutils became more aggressive at removing unused symbols. To function as a symbol requirement, a relocation record must now be in a section marked with @progbits and must not be in a section which gets discarded during the link (either via --gc-sections or via /DISCARD/). Update REQUIRE_SYMBOL() to generate relocation records meeting these criteria. To minimise the impact upon the final binary size, we use existing symbols (specified via the REQUIRING_SYMBOL() macro) as the relocation targets where possible. We use R_386_NONE or R_X86_64_NONE relocation types to prevent any actual unwanted relocation taking place. Where no suitable symbol exists for REQUIRING_SYMBOL() (such as in config.c), the macro PROVIDE_REQUIRING_SYMBOL() can be used to generate a one-byte-long symbol to act as the relocation target. If there are versions of binutils for which this approach fails, then the fallback will probably involve killing off REQUEST_SYMBOL(), redefining REQUIRE_SYMBOL() to use the current definition of REQUEST_SYMBOL(), and postprocessing the linked ELF file with something along the lines of "nm -u | wc -l" to check that there are no undefined symbols remaining. Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
3 |
|
3 |
|
4 |
|
4 |
|
5 |
|
5 |
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
6 |
|
9 |
|
7 |
|
10 |
|
8 |
|
11 |
|
|
|
||
346 |
|
346 |
|
347 |
|
347 |
|
348 |
|
348 |
|
|
349 |
|
|
349 |
|
350 |
|
350 |
|
351 |
|
351 |
|
352 |
|
|
|
||
8 |
|
8 |
|
9 |
|
9 |
|
10 |
|
10 |
|
|
11 |
|
|
11 |
|
12 |
|
12 |
|
13 |
|
13 |
|
14 |
|
|
|
||
875 |
|
875 |
|
876 |
|
876 |
|
877 |
|
877 |
|
|
878 |
|
|
|
879 |
|
|
|
880 |
|
|
878 |
|
881 |
|
879 |
|
882 |
|
|
|
||
118 |
|
118 |
|
119 |
|
119 |
|
120 |
|
120 |
|
|
121 |
|
|
121 |
|
122 |
|
|
|
||
590 |
|
590 |
|
591 |
|
591 |
|
592 |
|
592 |
|
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
593 |
|
596 |
|
594 |
|
597 |
|
|
|
||
496 |
|
496 |
|
497 |
|
497 |
|
498 |
|
498 |
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
499 |
|
502 |
|
500 |
|
503 |
|
|
|
||
1 |
|
1 |
|
2 |
|
2 |
|
3 |
|
3 |
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
4 |
|
7 |
|
5 |
|
8 |
|
6 |
|
9 |
|
|
|
||
44 |
|
44 |
|
45 |
|
45 |
|
46 |
|
46 |
|
|
47 |
|
|
|
48 |
|
|
47 |
|
49 |
|
48 |
|
50 |
|
49 |
|
51 |
|
|
|
||
29 |
|
29 |
|
30 |
|
30 |
|
31 |
|
31 |
|
|
32 |
|
|
|
33 |
|
|
32 |
|
34 |
|
33 |
|
35 |
|
34 |
|
36 |
|
|
|
||
29 |
|
29 |
|
30 |
|
30 |
|
31 |
|
31 |
|
|
32 |
|
|
|
33 |
|
|
32 |
|
34 |
|
33 |
|
35 |
|
34 |
|
36 |
|
|
|
||
29 |
|
29 |
|
30 |
|
30 |
|
31 |
|
31 |
|
|
32 |
|
|
|
33 |
|
|
32 |
|
34 |
|
33 |
|
35 |
|
34 |
|
36 |
|
|
|
||
25 |
|
25 |
|
26 |
|
26 |
|
27 |
|
27 |
|
|
28 |
|
|
|
29 |
|
|
28 |
|
30 |
|
29 |
|
31 |
|
30 |
|
32 |
|
|
|
||
29 |
|
29 |
|
30 |
|
30 |
|
31 |
|
31 |
|
|
32 |
|
|
|
33 |
|
|
32 |
|
34 |
|
33 |
|
35 |
|
34 |
|
36 |
|
|
|
||
29 |
|
29 |
|
30 |
|
30 |
|
31 |
|
31 |
|
|
32 |
|
|
|
33 |
|
|
32 |
|
34 |
|
33 |
|
35 |
|
34 |
|
36 |
|
|
|
||
29 |
|
29 |
|
30 |
|
30 |
|
31 |
|
31 |
|
|
32 |
|
|
|
33 |
|
|
32 |
|
34 |
|
33 |
|
35 |
|
34 |
|
36 |
|
|
|
||
1765 |
|
1765 |
|
1766 |
|
1766 |
|
1767 |
|
1767 |
|
|
1768 |
|
|
|
1769 |
|
|
|
1770 |
|
|
1768 |
|
1771 |
|
1769 |
|
1772 |
|
|
|
||
1903 |
|
1903 |
|
1904 |
|
1904 |
|
1905 |
|
1905 |
|
|
1906 |
|
|
|
1907 |
|
|
|
1908 |
|
|
1906 |
|
1909 |
|
1907 |
|
1910 |
|
1908 |
|
1911 |
|
|
|
||
4 |
|
4 |
|
5 |
|
5 |
|
6 |
|
6 |
|
|
7 |
|
|
7 |
|
8 |
|
8 |
|
9 |
|
9 |
|
10 |
|
|
|
||
4 |
|
4 |
|
5 |
|
5 |
|
6 |
|
6 |
|
|
7 |
|
|
7 |
|
8 |
|
8 |
|
9 |
|
9 |
|
10 |
|
|
|
||
9 |
|
9 |
|
10 |
|
10 |
|
11 |
|
11 |
|
|
12 |
|
|
12 |
|
13 |
|
13 |
|
14 |
|
14 |
|
15 |
|
|
|
||
173 |
|
173 |
|
174 |
|
174 |
|
175 |
|
175 |
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
176 |
|
179 |
|
177 |
|
180 |
|
178 |
|
181 |
|
|
|
||
57 |
|
57 |
|
58 |
|
58 |
|
59 |
|
59 |
|
60 |
|
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
61 |
|
65 |
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
67 |
|
71 |
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
71 |
|
75 |
|
72 |
|
|
|
|
76 |
|
|
73 |
|
77 |
|
74 |
|
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
75 |
|
82 |
|
76 |
|
|
|
77 |
|
|
|
|
83 |
|
|
|
84 |
|
|
78 |
|
85 |
|
79 |
|
86 |
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
91 |
|
92 |
|
92 |
|
93 |
|
93 |
|
|
|
|
94 |
|
|
|
95 |
|
|
94 |
|
96 |
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
100 |
|
105 |
|
101 |
|
106 |
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
108 |
|
155 |
|
109 |
|
156 |
|
110 |
|
157 |
|
|
|
||
119 |
|
166 |
|
120 |
|
167 |
|
121 |
|
168 |
|
122 |
|
|
|
123 |
|
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
124 |
|
178 |
|
125 |
|
|
|
126 |
|
|
|
|
179 |
|
|
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
127 |
|
192 |
|
128 |
|
193 |
|
129 |
|
194 |
|
|
|
||
685 |
|
750 |
|
686 |
|
751 |
|
687 |
|
752 |
|
688 |
|
|
|
689 |
|
|
|
|
753 |
|
|
|
754 |
|
|
690 |
|
755 |
|
691 |
|
756 |
|
692 |
|
757 |
|
|
|
||
276 |
|
276 |
|
277 |
|
277 |
|
278 |
|
278 |
|
279 |
|
|
|
|
279 |
|
|
|
280 |
|
|
280 |
|
281 |
|
281 |
|
282 |
|
|
|
||
2827 |
|
2827 |
|
2828 |
|
2828 |
|
2829 |
|
2829 |
|
|
2830 |
|
|
|
2831 |
|
|
|
2832 |
|
|
2830 |
|
2833 |
|
2831 |
|
2834 |
|
|
|
||
912 |
|
912 |
|
913 |
|
913 |
|
914 |
|
914 |
|
|
915 |
|
|
915 |
|
916 |
|
|
|
||
239 |
|
239 |
|
240 |
|
240 |
|
241 |
|
241 |
|
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
242 |
|
245 |
|
243 |
|
246 |
|
244 |
|
247 |
|
|
|
||
1940 |
|
1940 |
|
1941 |
|
1941 |
|
1942 |
|
1942 |
|
|
1943 |
|
|
|
1944 |
|
|
|
1945 |
|
|
1943 |
|
1946 |
|
1944 |
|
1947 |
|
|
|
||
999 |
|
999 |
|
1000 |
|
1000 |
|
1001 |
|
1001 |
|
|
1002 |
|
|
|
1003 |
|
|
|
1004 |
|
|
1002 |
|
1005 |
|
1003 |
|
1006 |
|
1004 |
|
1007 |
|
|
|
||
841 |
|
841 |
|
842 |
|
842 |
|
843 |
|
843 |
|
|
844 |
|
|
|
845 |
|
|
|
846 |
|
|
844 |
|
847 |
|
845 |
|
848 |
|
|
|
||
1104 |
|
1104 |
|
1105 |
|
1105 |
|
1106 |
|
1106 |
|
|
1107 |
|
|
|
1108 |
|
|
|
1109 |
|
|
1107 |
|
1110 |
|
1108 |
|
1111 |
|
1109 |
|
1112 |
|
|
|
||
1474 |
|
1474 |
|
1475 |
|
1475 |
|
1476 |
|
1476 |
|
|
1477 |
|
|
1477 |
|
1478 |
|
1478 |
|
1479 |
|
1479 |
|
1480 |
|
|
|
||
1861 |
|
1861 |
|
1862 |
|
1862 |
|
1863 |
|
1863 |
|
|
1864 |
|
|
1864 |
|
1865 |
|
1865 |
|
1866 |
|
|
|
||
30 |
|
30 |
|
31 |
|
31 |
|
32 |
|
32 |
|
|
33 |
|
|
33 |
|
34 |
|
34 |
|
35 |
|
35 |
|
36 |
|
|
|
||
1109 |
|
1109 |
|
1110 |
|
1110 |
|
1111 |
|
1111 |
|
|
1112 |
|
|
1112 |
|
1113 |
|
1113 |
|
1114 |
|
1114 |
|
1115 |
|
|
|
||
48 |
|
48 |
|
49 |
|
49 |
|
50 |
|
50 |
|
|
51 |
|
|
51 |
|
52 |
|
|
|
||
478 |
|
478 |
|
479 |
|
479 |
|
480 |
|
480 |
|
|
481 |
|
|
|
482 |
|
|
|
483 |
|
|
481 |
|
484 |
|
482 |
|
485 |
|
483 |
|
486 |
|