ldelfgen.c revision 1.1.1.4 1 1.1 christos /* Emulation code used by all ELF targets.
2 1.1.1.4 christos Copyright (C) 1991-2025 Free Software Foundation, Inc.
3 1.1 christos
4 1.1 christos This file is part of the GNU Binutils.
5 1.1 christos
6 1.1 christos This program is free software; you can redistribute it and/or modify
7 1.1 christos it under the terms of the GNU General Public License as published by
8 1.1 christos the Free Software Foundation; either version 3 of the License, or
9 1.1 christos (at your option) any later version.
10 1.1 christos
11 1.1 christos This program is distributed in the hope that it will be useful,
12 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
13 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 1.1 christos GNU General Public License for more details.
15 1.1 christos
16 1.1 christos You should have received a copy of the GNU General Public License
17 1.1 christos along with this program; if not, write to the Free Software
18 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 1.1 christos MA 02110-1301, USA. */
20 1.1 christos
21 1.1 christos #include "sysdep.h"
22 1.1.1.3 christos #include "libiberty.h"
23 1.1 christos #include "bfd.h"
24 1.1 christos #include "bfdlink.h"
25 1.1 christos #include "ctf-api.h"
26 1.1 christos #include "ld.h"
27 1.1 christos #include "ldmain.h"
28 1.1 christos #include "ldmisc.h"
29 1.1 christos #include "ldexp.h"
30 1.1 christos #include "ldlang.h"
31 1.1.1.2 christos #include "ldctor.h"
32 1.1 christos #include "elf-bfd.h"
33 1.1.1.2 christos #include "elf/internal.h"
34 1.1 christos #include "ldelfgen.h"
35 1.1 christos
36 1.1.1.2 christos /* Info attached to an output_section_statement about input sections,
37 1.1.1.2 christos used when sorting SHF_LINK_ORDER sections. */
38 1.1.1.2 christos
39 1.1.1.2 christos struct os_sections
40 1.1.1.2 christos {
41 1.1.1.2 christos /* Size allocated for isec. */
42 1.1.1.2 christos unsigned int alloc;
43 1.1.1.2 christos /* Used entries in isec. */
44 1.1.1.2 christos unsigned int count;
45 1.1.1.2 christos /* How many are SHF_LINK_ORDER. */
46 1.1.1.2 christos unsigned int ordered;
47 1.1.1.2 christos /* Input sections attached to this output section. */
48 1.1.1.2 christos struct os_sections_input {
49 1.1.1.2 christos lang_input_section_type *is;
50 1.1.1.2 christos unsigned int idx;
51 1.1.1.2 christos } isec[1];
52 1.1.1.2 christos };
53 1.1.1.2 christos
54 1.1.1.2 christos /* Add IS to data kept for OS. */
55 1.1.1.2 christos
56 1.1.1.2 christos static bool
57 1.1.1.2 christos add_link_order_input_section (lang_input_section_type *is,
58 1.1.1.2 christos lang_output_section_statement_type *os)
59 1.1.1.2 christos {
60 1.1.1.2 christos struct os_sections *os_info = os->data;
61 1.1.1.2 christos asection *s;
62 1.1.1.2 christos
63 1.1.1.2 christos if (os_info == NULL)
64 1.1.1.2 christos {
65 1.1.1.2 christos os_info = xmalloc (sizeof (*os_info) + 63 * sizeof (*os_info->isec));
66 1.1.1.2 christos os_info->alloc = 64;
67 1.1.1.2 christos os_info->count = 0;
68 1.1.1.2 christos os_info->ordered = 0;
69 1.1.1.2 christos os->data = os_info;
70 1.1.1.2 christos }
71 1.1.1.2 christos if (os_info->count == os_info->alloc)
72 1.1.1.2 christos {
73 1.1.1.2 christos size_t want;
74 1.1.1.2 christos os_info->alloc *= 2;
75 1.1.1.2 christos want = sizeof (*os_info) + (os_info->alloc - 1) * sizeof (*os_info->isec);
76 1.1.1.2 christos os_info = xrealloc (os_info, want);
77 1.1.1.2 christos os->data = os_info;
78 1.1.1.2 christos }
79 1.1.1.2 christos os_info->isec[os_info->count].is = is;
80 1.1.1.2 christos os_info->isec[os_info->count].idx = os_info->count;
81 1.1.1.2 christos os_info->count++;
82 1.1.1.2 christos s = is->section;
83 1.1.1.2 christos if (bfd_get_flavour (s->owner) == bfd_target_elf_flavour
84 1.1.1.2 christos && (s->flags & SEC_LINKER_CREATED) == 0
85 1.1.1.2 christos && elf_linked_to_section (s) != NULL)
86 1.1.1.2 christos os_info->ordered++;
87 1.1.1.2 christos return false;
88 1.1.1.2 christos }
89 1.1.1.2 christos
90 1.1.1.2 christos /* Run over the linker's statement list, extracting info about input
91 1.1.1.2 christos sections attached to each output section. */
92 1.1.1.2 christos
93 1.1.1.2 christos static bool
94 1.1.1.2 christos link_order_scan (lang_statement_union_type *u,
95 1.1.1.2 christos lang_output_section_statement_type *os)
96 1.1.1.2 christos {
97 1.1.1.2 christos asection *s;
98 1.1.1.2 christos bool ret = false;
99 1.1.1.2 christos
100 1.1.1.2 christos for (; u != NULL; u = u->header.next)
101 1.1.1.2 christos {
102 1.1.1.2 christos switch (u->header.type)
103 1.1.1.2 christos {
104 1.1.1.2 christos case lang_wild_statement_enum:
105 1.1.1.2 christos if (link_order_scan (u->wild_statement.children.head, os))
106 1.1.1.2 christos ret = true;
107 1.1.1.2 christos break;
108 1.1.1.2 christos case lang_constructors_statement_enum:
109 1.1.1.2 christos if (link_order_scan (constructor_list.head, os))
110 1.1.1.2 christos ret = true;
111 1.1.1.2 christos break;
112 1.1.1.2 christos case lang_output_section_statement_enum:
113 1.1.1.2 christos if (u->output_section_statement.constraint != -1
114 1.1.1.2 christos && link_order_scan (u->output_section_statement.children.head,
115 1.1.1.2 christos &u->output_section_statement))
116 1.1.1.2 christos ret = true;
117 1.1.1.2 christos break;
118 1.1.1.2 christos case lang_group_statement_enum:
119 1.1.1.2 christos if (link_order_scan (u->group_statement.children.head, os))
120 1.1.1.2 christos ret = true;
121 1.1.1.2 christos break;
122 1.1.1.2 christos case lang_input_section_enum:
123 1.1.1.2 christos s = u->input_section.section;
124 1.1.1.2 christos if (s->output_section != NULL
125 1.1.1.2 christos && s->output_section->owner == link_info.output_bfd
126 1.1.1.2 christos && (s->output_section->flags & SEC_EXCLUDE) == 0
127 1.1.1.2 christos && ((s->output_section->flags & SEC_HAS_CONTENTS) != 0
128 1.1.1.2 christos || ((s->output_section->flags & (SEC_LOAD | SEC_THREAD_LOCAL))
129 1.1.1.2 christos == (SEC_LOAD | SEC_THREAD_LOCAL))))
130 1.1.1.2 christos if (add_link_order_input_section (&u->input_section, os))
131 1.1.1.2 christos ret = true;
132 1.1.1.2 christos break;
133 1.1.1.2 christos default:
134 1.1.1.2 christos break;
135 1.1.1.2 christos }
136 1.1.1.2 christos }
137 1.1.1.2 christos return ret;
138 1.1.1.2 christos }
139 1.1.1.2 christos
140 1.1.1.2 christos /* Compare two sections based on the locations of the sections they are
141 1.1.1.2 christos linked to. Used by fixup_link_order. */
142 1.1.1.2 christos
143 1.1.1.2 christos static int
144 1.1.1.2 christos compare_link_order (const void *a, const void *b)
145 1.1.1.2 christos {
146 1.1.1.2 christos const struct os_sections_input *ai = a;
147 1.1.1.2 christos const struct os_sections_input *bi = b;
148 1.1.1.2 christos asection *asec = NULL;
149 1.1.1.2 christos asection *bsec = NULL;
150 1.1.1.2 christos bfd_vma apos, bpos;
151 1.1.1.2 christos
152 1.1.1.2 christos if (bfd_get_flavour (ai->is->section->owner) == bfd_target_elf_flavour)
153 1.1.1.2 christos asec = elf_linked_to_section (ai->is->section);
154 1.1.1.2 christos if (bfd_get_flavour (bi->is->section->owner) == bfd_target_elf_flavour)
155 1.1.1.2 christos bsec = elf_linked_to_section (bi->is->section);
156 1.1.1.2 christos
157 1.1.1.2 christos /* Place unordered sections before ordered sections. */
158 1.1.1.2 christos if (asec == NULL || bsec == NULL)
159 1.1.1.2 christos {
160 1.1.1.2 christos if (bsec != NULL)
161 1.1.1.2 christos return -1;
162 1.1.1.2 christos else if (asec != NULL)
163 1.1.1.2 christos return 1;
164 1.1.1.2 christos return ai->idx - bi->idx;
165 1.1.1.2 christos }
166 1.1.1.2 christos
167 1.1.1.2 christos apos = asec->output_section->lma + asec->output_offset;
168 1.1.1.2 christos bpos = bsec->output_section->lma + bsec->output_offset;
169 1.1.1.2 christos
170 1.1.1.2 christos if (apos < bpos)
171 1.1.1.2 christos return -1;
172 1.1.1.2 christos else if (apos > bpos)
173 1.1.1.2 christos return 1;
174 1.1.1.2 christos
175 1.1.1.2 christos if (! bfd_link_relocatable (&link_info))
176 1.1.1.2 christos {
177 1.1.1.2 christos /* The only way we should get matching LMAs is when the first of
178 1.1.1.2 christos the two sections has zero size, or asec and bsec are the
179 1.1.1.2 christos same section. */
180 1.1.1.2 christos if (asec->size < bsec->size)
181 1.1.1.2 christos return -1;
182 1.1.1.2 christos else if (asec->size > bsec->size)
183 1.1.1.2 christos return 1;
184 1.1.1.2 christos }
185 1.1.1.2 christos
186 1.1.1.2 christos /* If they are both zero size then they almost certainly have the same
187 1.1.1.2 christos VMA and thus are not ordered with respect to each other. Test VMA
188 1.1.1.2 christos anyway, and fall back to idx to make the result reproducible across
189 1.1.1.2 christos qsort implementations. */
190 1.1.1.2 christos apos = asec->output_section->vma + asec->output_offset;
191 1.1.1.2 christos bpos = bsec->output_section->vma + bsec->output_offset;
192 1.1.1.2 christos if (apos < bpos)
193 1.1.1.2 christos return -1;
194 1.1.1.2 christos else if (apos > bpos)
195 1.1.1.2 christos return 1;
196 1.1.1.2 christos else
197 1.1.1.2 christos return ai->idx - bi->idx;
198 1.1.1.2 christos }
199 1.1.1.2 christos
200 1.1.1.2 christos /* Rearrange sections with SHF_LINK_ORDER into the same order as their
201 1.1.1.2 christos linked sections. */
202 1.1.1.2 christos
203 1.1.1.2 christos static bool
204 1.1.1.2 christos fixup_link_order (lang_output_section_statement_type *os)
205 1.1.1.2 christos {
206 1.1.1.2 christos struct os_sections *os_info = os->data;
207 1.1.1.2 christos unsigned int i, j;
208 1.1.1.2 christos lang_input_section_type **orig_is;
209 1.1.1.2 christos asection **save_s;
210 1.1.1.2 christos
211 1.1.1.2 christos for (i = 0; i < os_info->count; i = j)
212 1.1.1.2 christos {
213 1.1.1.2 christos /* Normally a linker script will select SHF_LINK_ORDER sections
214 1.1.1.2 christos with an input section wildcard something like the following:
215 1.1.1.2 christos *(.IA_64.unwind* .gnu.linkonce.ia64unw.*)
216 1.1.1.2 christos However if some other random sections are smashed into an
217 1.1.1.2 christos output section, or if SHF_LINK_ORDER are split up by the
218 1.1.1.2 christos linker script, then we only want to sort sections matching a
219 1.1.1.2 christos given wildcard. That's the purpose of the pattern test. */
220 1.1.1.2 christos for (j = i + 1; j < os_info->count; j++)
221 1.1.1.2 christos if (os_info->isec[j].is->pattern != os_info->isec[i].is->pattern)
222 1.1.1.2 christos break;
223 1.1.1.2 christos if (j - i > 1)
224 1.1.1.2 christos qsort (&os_info->isec[i], j - i, sizeof (*os_info->isec),
225 1.1.1.2 christos compare_link_order);
226 1.1.1.2 christos }
227 1.1.1.2 christos for (i = 0; i < os_info->count; i++)
228 1.1.1.2 christos if (os_info->isec[i].idx != i)
229 1.1.1.2 christos break;
230 1.1.1.2 christos if (i == os_info->count)
231 1.1.1.2 christos return false;
232 1.1.1.2 christos
233 1.1.1.2 christos /* Now reorder the linker input section statements to reflect the
234 1.1.1.2 christos proper sorting. The is done by rewriting the existing statements
235 1.1.1.2 christos rather than fiddling with lists, since the only thing we need to
236 1.1.1.2 christos change is the bfd section pointer. */
237 1.1.1.2 christos orig_is = xmalloc (os_info->count * sizeof (*orig_is));
238 1.1.1.2 christos save_s = xmalloc (os_info->count * sizeof (*save_s));
239 1.1.1.2 christos for (i = 0; i < os_info->count; i++)
240 1.1.1.2 christos {
241 1.1.1.2 christos orig_is[os_info->isec[i].idx] = os_info->isec[i].is;
242 1.1.1.2 christos save_s[i] = os_info->isec[i].is->section;
243 1.1.1.2 christos }
244 1.1.1.2 christos for (i = 0; i < os_info->count; i++)
245 1.1.1.2 christos if (os_info->isec[i].idx != i)
246 1.1.1.2 christos {
247 1.1.1.2 christos orig_is[i]->section = save_s[i];
248 1.1.1.2 christos /* Restore os_info to pristine state before the qsort, for the
249 1.1.1.2 christos next pass over sections. */
250 1.1.1.2 christos os_info->isec[i].is = orig_is[i];
251 1.1.1.2 christos os_info->isec[i].idx = i;
252 1.1.1.2 christos }
253 1.1.1.2 christos free (save_s);
254 1.1.1.2 christos free (orig_is);
255 1.1.1.2 christos return true;
256 1.1.1.2 christos }
257 1.1.1.2 christos
258 1.1 christos void
259 1.1.1.2 christos ldelf_map_segments (bool need_layout)
260 1.1 christos {
261 1.1 christos int tries = 10;
262 1.1.1.2 christos static bool done_link_order_scan = false;
263 1.1 christos
264 1.1 christos do
265 1.1 christos {
266 1.1 christos lang_relax_sections (need_layout);
267 1.1.1.2 christos need_layout = false;
268 1.1 christos
269 1.1.1.2 christos if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour)
270 1.1.1.2 christos {
271 1.1.1.2 christos lang_output_section_statement_type *os;
272 1.1.1.2 christos if (!done_link_order_scan)
273 1.1.1.2 christos {
274 1.1.1.2 christos link_order_scan (statement_list.head, NULL);
275 1.1.1.2 christos done_link_order_scan = true;
276 1.1.1.2 christos }
277 1.1.1.2 christos for (os = (void *) lang_os_list.head; os != NULL; os = os->next)
278 1.1.1.2 christos {
279 1.1.1.2 christos struct os_sections *os_info = os->data;
280 1.1.1.2 christos if (os_info != NULL && os_info->ordered != 0)
281 1.1.1.2 christos {
282 1.1.1.2 christos if (os_info->ordered != os_info->count
283 1.1.1.2 christos && bfd_link_relocatable (&link_info))
284 1.1.1.2 christos {
285 1.1.1.4 christos fatal (_("%P: "
286 1.1.1.2 christos "%pA has both ordered and unordered sections\n"),
287 1.1.1.2 christos os->bfd_section);
288 1.1.1.2 christos return;
289 1.1.1.2 christos }
290 1.1.1.2 christos if (os_info->count > 1
291 1.1.1.2 christos && fixup_link_order (os))
292 1.1.1.2 christos need_layout = true;
293 1.1.1.2 christos }
294 1.1.1.2 christos }
295 1.1.1.2 christos }
296 1.1.1.2 christos
297 1.1.1.2 christos if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
298 1.1 christos && !bfd_link_relocatable (&link_info))
299 1.1 christos {
300 1.1 christos bfd_size_type phdr_size;
301 1.1 christos
302 1.1 christos phdr_size = elf_program_header_size (link_info.output_bfd);
303 1.1 christos /* If we don't have user supplied phdrs, throw away any
304 1.1 christos previous linker generated program headers. */
305 1.1 christos if (lang_phdr_list == NULL)
306 1.1 christos elf_seg_map (link_info.output_bfd) = NULL;
307 1.1 christos if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
308 1.1.1.2 christos &link_info,
309 1.1.1.2 christos &need_layout))
310 1.1.1.4 christos fatal (_("%P: map sections to segments failed: %E\n"));
311 1.1 christos
312 1.1 christos if (phdr_size != elf_program_header_size (link_info.output_bfd))
313 1.1 christos {
314 1.1 christos if (tries > 6)
315 1.1 christos /* The first few times we allow any change to
316 1.1 christos phdr_size . */
317 1.1.1.2 christos need_layout = true;
318 1.1 christos else if (phdr_size
319 1.1 christos < elf_program_header_size (link_info.output_bfd))
320 1.1 christos /* After that we only allow the size to grow. */
321 1.1.1.2 christos need_layout = true;
322 1.1 christos else
323 1.1 christos elf_program_header_size (link_info.output_bfd) = phdr_size;
324 1.1 christos }
325 1.1 christos }
326 1.1 christos }
327 1.1 christos while (need_layout && --tries);
328 1.1 christos
329 1.1 christos if (tries == 0)
330 1.1.1.4 christos fatal (_("%P: looping in map_segments\n"));
331 1.1.1.2 christos
332 1.1.1.2 christos if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
333 1.1.1.2 christos && lang_phdr_list == NULL)
334 1.1.1.2 christos {
335 1.1.1.2 christos /* If we don't have user supplied phdrs, strip zero-sized dynamic
336 1.1.1.2 christos sections and regenerate program headers. */
337 1.1.1.2 christos const struct elf_backend_data *bed
338 1.1.1.2 christos = get_elf_backend_data (link_info.output_bfd);
339 1.1.1.2 christos if (bed->elf_backend_strip_zero_sized_dynamic_sections
340 1.1.1.4 christos && !bed->elf_backend_strip_zero_sized_dynamic_sections (&link_info))
341 1.1.1.4 christos fatal (_("%P: failed to strip zero-sized dynamic sections\n"));
342 1.1.1.2 christos }
343 1.1 christos }
344 1.1 christos
345 1.1.1.2 christos #ifdef ENABLE_LIBCTF
346 1.1 christos /* We want to emit CTF early if and only if we are not targetting ELF with this
347 1.1 christos invocation. */
348 1.1 christos
349 1.1 christos int
350 1.1 christos ldelf_emit_ctf_early (void)
351 1.1 christos {
352 1.1 christos if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour)
353 1.1 christos return 0;
354 1.1 christos return 1;
355 1.1 christos }
356 1.1 christos
357 1.1 christos /* Callbacks used to map from bfd types to libctf types, under libctf's
358 1.1 christos control. */
359 1.1 christos
360 1.1.1.2 christos struct ctf_strtab_iter_cb_arg
361 1.1 christos {
362 1.1.1.2 christos struct elf_strtab_hash *strtab;
363 1.1 christos size_t next_i;
364 1.1 christos size_t next_idx;
365 1.1 christos };
366 1.1 christos
367 1.1 christos /* Return strings from the strtab to libctf, one by one. Returns NULL when
368 1.1 christos iteration is complete. */
369 1.1 christos
370 1.1 christos static const char *
371 1.1 christos ldelf_ctf_strtab_iter_cb (uint32_t *offset, void *arg_)
372 1.1 christos {
373 1.1 christos bfd_size_type off;
374 1.1 christos const char *ret;
375 1.1 christos
376 1.1.1.2 christos struct ctf_strtab_iter_cb_arg *arg =
377 1.1.1.2 christos (struct ctf_strtab_iter_cb_arg *) arg_;
378 1.1 christos
379 1.1 christos /* There is no zeroth string. */
380 1.1 christos if (arg->next_i == 0)
381 1.1 christos arg->next_i = 1;
382 1.1 christos
383 1.1.1.2 christos /* Hunt through strings until we fall off the end or find one with
384 1.1.1.2 christos a nonzero refcount. */
385 1.1.1.2 christos do
386 1.1 christos {
387 1.1.1.2 christos if (arg->next_i >= _bfd_elf_strtab_len (arg->strtab))
388 1.1.1.2 christos {
389 1.1.1.2 christos arg->next_i = 0;
390 1.1.1.2 christos return NULL;
391 1.1.1.2 christos }
392 1.1.1.2 christos
393 1.1.1.2 christos ret = _bfd_elf_strtab_str (arg->strtab, arg->next_i++, &off);
394 1.1 christos }
395 1.1.1.2 christos while (ret == NULL);
396 1.1 christos
397 1.1 christos *offset = off;
398 1.1 christos
399 1.1 christos /* If we've overflowed, we cannot share any further strings: the CTF
400 1.1 christos format cannot encode strings with such high offsets. */
401 1.1 christos if (*offset != off)
402 1.1 christos return NULL;
403 1.1 christos
404 1.1 christos return ret;
405 1.1 christos }
406 1.1 christos
407 1.1 christos void
408 1.1.1.2 christos ldelf_acquire_strings_for_ctf
409 1.1.1.2 christos (struct ctf_dict *ctf_output, struct elf_strtab_hash *strtab)
410 1.1.1.2 christos {
411 1.1.1.2 christos struct ctf_strtab_iter_cb_arg args = { strtab, 0, 0 };
412 1.1.1.2 christos if (!ctf_output)
413 1.1.1.2 christos return;
414 1.1 christos
415 1.1.1.2 christos if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour)
416 1.1 christos {
417 1.1 christos if (ctf_link_add_strtab (ctf_output, ldelf_ctf_strtab_iter_cb,
418 1.1 christos &args) < 0)
419 1.1.1.4 christos fatal (_("%P: warning: CTF strtab association failed; strings will "
420 1.1 christos "not be shared: %s\n"),
421 1.1 christos ctf_errmsg (ctf_errno (ctf_output)));
422 1.1.1.2 christos }
423 1.1.1.2 christos }
424 1.1.1.2 christos
425 1.1.1.2 christos void
426 1.1.1.2 christos ldelf_new_dynsym_for_ctf (struct ctf_dict *ctf_output, int symidx,
427 1.1.1.2 christos struct elf_internal_sym *sym)
428 1.1.1.2 christos {
429 1.1.1.2 christos ctf_link_sym_t lsym;
430 1.1 christos
431 1.1.1.2 christos if (!ctf_output)
432 1.1.1.2 christos return;
433 1.1.1.2 christos
434 1.1.1.2 christos /* New symbol. */
435 1.1.1.2 christos if (sym != NULL)
436 1.1.1.2 christos {
437 1.1.1.2 christos lsym.st_name = NULL;
438 1.1.1.2 christos lsym.st_nameidx = sym->st_name;
439 1.1.1.2 christos lsym.st_nameidx_set = 1;
440 1.1.1.2 christos lsym.st_symidx = symidx;
441 1.1.1.2 christos lsym.st_shndx = sym->st_shndx;
442 1.1.1.2 christos lsym.st_type = ELF_ST_TYPE (sym->st_info);
443 1.1.1.2 christos lsym.st_value = sym->st_value;
444 1.1.1.2 christos if (ctf_link_add_linker_symbol (ctf_output, &lsym) < 0)
445 1.1.1.2 christos {
446 1.1.1.4 christos fatal (_("%P: warning: CTF symbol addition failed; CTF will "
447 1.1.1.2 christos "not be tied to symbols: %s\n"),
448 1.1.1.2 christos ctf_errmsg (ctf_errno (ctf_output)));
449 1.1.1.2 christos }
450 1.1 christos }
451 1.1.1.2 christos else
452 1.1.1.2 christos {
453 1.1.1.2 christos /* Shuffle all the symbols. */
454 1.1.1.2 christos
455 1.1.1.2 christos if (ctf_link_shuffle_syms (ctf_output) < 0)
456 1.1.1.4 christos fatal (_("%P: warning: CTF symbol shuffling failed; CTF will "
457 1.1.1.2 christos "not be tied to symbols: %s\n"),
458 1.1.1.2 christos ctf_errmsg (ctf_errno (ctf_output)));
459 1.1.1.2 christos }
460 1.1.1.2 christos }
461 1.1.1.2 christos #else
462 1.1.1.2 christos int
463 1.1.1.2 christos ldelf_emit_ctf_early (void)
464 1.1.1.2 christos {
465 1.1.1.2 christos return 0;
466 1.1 christos }
467 1.1.1.2 christos
468 1.1.1.2 christos void
469 1.1.1.2 christos ldelf_acquire_strings_for_ctf (struct ctf_dict *ctf_output ATTRIBUTE_UNUSED,
470 1.1.1.2 christos struct elf_strtab_hash *strtab ATTRIBUTE_UNUSED)
471 1.1.1.2 christos {}
472 1.1.1.2 christos void
473 1.1.1.2 christos ldelf_new_dynsym_for_ctf (struct ctf_dict *ctf_output ATTRIBUTE_UNUSED,
474 1.1.1.2 christos int symidx ATTRIBUTE_UNUSED,
475 1.1.1.2 christos struct elf_internal_sym *sym ATTRIBUTE_UNUSED)
476 1.1.1.2 christos {}
477 1.1.1.2 christos #endif
478