1*fae548d3Szrj /* ELF core file support for BFD.
2*fae548d3Szrj Copyright (C) 1995-2020 Free Software Foundation, Inc.
3*fae548d3Szrj
4*fae548d3Szrj This file is part of BFD, the Binary File Descriptor library.
5*fae548d3Szrj
6*fae548d3Szrj This program is free software; you can redistribute it and/or modify
7*fae548d3Szrj it under the terms of the GNU General Public License as published by
8*fae548d3Szrj the Free Software Foundation; either version 3 of the License, or
9*fae548d3Szrj (at your option) any later version.
10*fae548d3Szrj
11*fae548d3Szrj This program is distributed in the hope that it will be useful,
12*fae548d3Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of
13*fae548d3Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*fae548d3Szrj GNU General Public License for more details.
15*fae548d3Szrj
16*fae548d3Szrj You should have received a copy of the GNU General Public License
17*fae548d3Szrj along with this program; if not, write to the Free Software
18*fae548d3Szrj Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19*fae548d3Szrj MA 02110-1301, USA. */
20*fae548d3Szrj
21*fae548d3Szrj char*
elf_core_file_failing_command(bfd * abfd)22*fae548d3Szrj elf_core_file_failing_command (bfd *abfd)
23*fae548d3Szrj {
24*fae548d3Szrj return elf_tdata (abfd)->core->command;
25*fae548d3Szrj }
26*fae548d3Szrj
27*fae548d3Szrj int
elf_core_file_failing_signal(bfd * abfd)28*fae548d3Szrj elf_core_file_failing_signal (bfd *abfd)
29*fae548d3Szrj {
30*fae548d3Szrj return elf_tdata (abfd)->core->signal;
31*fae548d3Szrj }
32*fae548d3Szrj
33*fae548d3Szrj int
elf_core_file_pid(bfd * abfd)34*fae548d3Szrj elf_core_file_pid (bfd *abfd)
35*fae548d3Szrj {
36*fae548d3Szrj return elf_tdata (abfd)->core->pid;
37*fae548d3Szrj }
38*fae548d3Szrj
39*fae548d3Szrj bfd_boolean
elf_core_file_matches_executable_p(bfd * core_bfd,bfd * exec_bfd)40*fae548d3Szrj elf_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
41*fae548d3Szrj {
42*fae548d3Szrj char* corename;
43*fae548d3Szrj
44*fae548d3Szrj /* xvecs must match if both are ELF files for the same target. */
45*fae548d3Szrj
46*fae548d3Szrj if (core_bfd->xvec != exec_bfd->xvec)
47*fae548d3Szrj {
48*fae548d3Szrj bfd_set_error (bfd_error_system_call);
49*fae548d3Szrj return FALSE;
50*fae548d3Szrj }
51*fae548d3Szrj
52*fae548d3Szrj /* If both BFDs have identical build-ids, then they match. */
53*fae548d3Szrj if (core_bfd->build_id != NULL
54*fae548d3Szrj && exec_bfd->build_id != NULL
55*fae548d3Szrj && core_bfd->build_id->size == exec_bfd->build_id->size
56*fae548d3Szrj && memcmp (core_bfd->build_id->data, exec_bfd->build_id->data,
57*fae548d3Szrj core_bfd->build_id->size) == 0)
58*fae548d3Szrj return TRUE;
59*fae548d3Szrj
60*fae548d3Szrj /* See if the name in the corefile matches the executable name. */
61*fae548d3Szrj corename = elf_tdata (core_bfd)->core->program;
62*fae548d3Szrj if (corename != NULL)
63*fae548d3Szrj {
64*fae548d3Szrj const char* execname = strrchr (exec_bfd->filename, '/');
65*fae548d3Szrj
66*fae548d3Szrj execname = execname ? execname + 1 : exec_bfd->filename;
67*fae548d3Szrj
68*fae548d3Szrj if (strcmp (execname, corename) != 0)
69*fae548d3Szrj return FALSE;
70*fae548d3Szrj }
71*fae548d3Szrj
72*fae548d3Szrj return TRUE;
73*fae548d3Szrj }
74*fae548d3Szrj
75*fae548d3Szrj /* Core files are simply standard ELF formatted files that partition
76*fae548d3Szrj the file using the execution view of the file (program header table)
77*fae548d3Szrj rather than the linking view. In fact, there is no section header
78*fae548d3Szrj table in a core file.
79*fae548d3Szrj
80*fae548d3Szrj The process status information (including the contents of the general
81*fae548d3Szrj register set) and the floating point register set are stored in a
82*fae548d3Szrj segment of type PT_NOTE. We handcraft a couple of extra bfd sections
83*fae548d3Szrj that allow standard bfd access to the general registers (.reg) and the
84*fae548d3Szrj floating point registers (.reg2). */
85*fae548d3Szrj
86*fae548d3Szrj const bfd_target *
elf_core_file_p(bfd * abfd)87*fae548d3Szrj elf_core_file_p (bfd *abfd)
88*fae548d3Szrj {
89*fae548d3Szrj Elf_External_Ehdr x_ehdr; /* Elf file header, external form. */
90*fae548d3Szrj Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form. */
91*fae548d3Szrj Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form. */
92*fae548d3Szrj unsigned int phindex;
93*fae548d3Szrj const struct elf_backend_data *ebd;
94*fae548d3Szrj bfd_size_type amt;
95*fae548d3Szrj
96*fae548d3Szrj /* Read in the ELF header in external format. */
97*fae548d3Szrj if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
98*fae548d3Szrj {
99*fae548d3Szrj if (bfd_get_error () != bfd_error_system_call)
100*fae548d3Szrj goto wrong;
101*fae548d3Szrj else
102*fae548d3Szrj goto fail;
103*fae548d3Szrj }
104*fae548d3Szrj
105*fae548d3Szrj /* Check the magic number. */
106*fae548d3Szrj if (! elf_file_p (&x_ehdr))
107*fae548d3Szrj goto wrong;
108*fae548d3Szrj
109*fae548d3Szrj /* FIXME: Check EI_VERSION here ! */
110*fae548d3Szrj
111*fae548d3Szrj /* Check the address size ("class"). */
112*fae548d3Szrj if (x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
113*fae548d3Szrj goto wrong;
114*fae548d3Szrj
115*fae548d3Szrj /* Check the byteorder. */
116*fae548d3Szrj switch (x_ehdr.e_ident[EI_DATA])
117*fae548d3Szrj {
118*fae548d3Szrj case ELFDATA2MSB: /* Big-endian. */
119*fae548d3Szrj if (! bfd_big_endian (abfd))
120*fae548d3Szrj goto wrong;
121*fae548d3Szrj break;
122*fae548d3Szrj case ELFDATA2LSB: /* Little-endian. */
123*fae548d3Szrj if (! bfd_little_endian (abfd))
124*fae548d3Szrj goto wrong;
125*fae548d3Szrj break;
126*fae548d3Szrj default:
127*fae548d3Szrj goto wrong;
128*fae548d3Szrj }
129*fae548d3Szrj
130*fae548d3Szrj /* Give abfd an elf_obj_tdata. */
131*fae548d3Szrj if (! (*abfd->xvec->_bfd_set_format[bfd_core]) (abfd))
132*fae548d3Szrj goto fail;
133*fae548d3Szrj
134*fae548d3Szrj /* Swap in the rest of the header, now that we have the byte order. */
135*fae548d3Szrj i_ehdrp = elf_elfheader (abfd);
136*fae548d3Szrj elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
137*fae548d3Szrj
138*fae548d3Szrj #if DEBUG & 1
139*fae548d3Szrj elf_debug_file (i_ehdrp);
140*fae548d3Szrj #endif
141*fae548d3Szrj
142*fae548d3Szrj ebd = get_elf_backend_data (abfd);
143*fae548d3Szrj
144*fae548d3Szrj /* Check that the ELF e_machine field matches what this particular
145*fae548d3Szrj BFD format expects. */
146*fae548d3Szrj
147*fae548d3Szrj if (ebd->elf_machine_code != i_ehdrp->e_machine
148*fae548d3Szrj && (ebd->elf_machine_alt1 == 0
149*fae548d3Szrj || i_ehdrp->e_machine != ebd->elf_machine_alt1)
150*fae548d3Szrj && (ebd->elf_machine_alt2 == 0
151*fae548d3Szrj || i_ehdrp->e_machine != ebd->elf_machine_alt2))
152*fae548d3Szrj {
153*fae548d3Szrj const bfd_target * const *target_ptr;
154*fae548d3Szrj
155*fae548d3Szrj if (ebd->elf_machine_code != EM_NONE)
156*fae548d3Szrj goto wrong;
157*fae548d3Szrj
158*fae548d3Szrj /* This is the generic ELF target. Let it match any ELF target
159*fae548d3Szrj for which we do not have a specific backend. */
160*fae548d3Szrj
161*fae548d3Szrj for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
162*fae548d3Szrj {
163*fae548d3Szrj const struct elf_backend_data *back;
164*fae548d3Szrj
165*fae548d3Szrj if ((*target_ptr)->flavour != bfd_target_elf_flavour)
166*fae548d3Szrj continue;
167*fae548d3Szrj back = xvec_get_elf_backend_data (*target_ptr);
168*fae548d3Szrj if (back->s->arch_size != ARCH_SIZE)
169*fae548d3Szrj continue;
170*fae548d3Szrj if (back->elf_machine_code == i_ehdrp->e_machine
171*fae548d3Szrj || (back->elf_machine_alt1 != 0
172*fae548d3Szrj && i_ehdrp->e_machine == back->elf_machine_alt1)
173*fae548d3Szrj || (back->elf_machine_alt2 != 0
174*fae548d3Szrj && i_ehdrp->e_machine == back->elf_machine_alt2))
175*fae548d3Szrj {
176*fae548d3Szrj /* target_ptr is an ELF backend which matches this
177*fae548d3Szrj object file, so reject the generic ELF target. */
178*fae548d3Szrj goto wrong;
179*fae548d3Szrj }
180*fae548d3Szrj }
181*fae548d3Szrj }
182*fae548d3Szrj
183*fae548d3Szrj /* If there is no program header, or the type is not a core file, then
184*fae548d3Szrj we are hosed. */
185*fae548d3Szrj if (i_ehdrp->e_phoff == 0 || i_ehdrp->e_type != ET_CORE)
186*fae548d3Szrj goto wrong;
187*fae548d3Szrj
188*fae548d3Szrj /* Does BFD's idea of the phdr size match the size
189*fae548d3Szrj recorded in the file? */
190*fae548d3Szrj if (i_ehdrp->e_phentsize != sizeof (Elf_External_Phdr))
191*fae548d3Szrj goto wrong;
192*fae548d3Szrj
193*fae548d3Szrj /* If the program header count is PN_XNUM(0xffff), the actual
194*fae548d3Szrj count is in the first section header. */
195*fae548d3Szrj if (i_ehdrp->e_shoff != 0 && i_ehdrp->e_phnum == PN_XNUM)
196*fae548d3Szrj {
197*fae548d3Szrj Elf_External_Shdr x_shdr;
198*fae548d3Szrj Elf_Internal_Shdr i_shdr;
199*fae548d3Szrj file_ptr where = (file_ptr) i_ehdrp->e_shoff;
200*fae548d3Szrj
201*fae548d3Szrj /* Seek to the section header table in the file. */
202*fae548d3Szrj if (bfd_seek (abfd, where, SEEK_SET) != 0)
203*fae548d3Szrj goto fail;
204*fae548d3Szrj
205*fae548d3Szrj /* Read the first section header at index 0, and convert to internal
206*fae548d3Szrj form. */
207*fae548d3Szrj if (bfd_bread (&x_shdr, sizeof (x_shdr), abfd) != sizeof (x_shdr))
208*fae548d3Szrj goto fail;
209*fae548d3Szrj elf_swap_shdr_in (abfd, &x_shdr, &i_shdr);
210*fae548d3Szrj
211*fae548d3Szrj if (i_shdr.sh_info != 0)
212*fae548d3Szrj {
213*fae548d3Szrj i_ehdrp->e_phnum = i_shdr.sh_info;
214*fae548d3Szrj if (i_ehdrp->e_phnum != i_shdr.sh_info)
215*fae548d3Szrj goto wrong;
216*fae548d3Szrj }
217*fae548d3Szrj }
218*fae548d3Szrj
219*fae548d3Szrj /* Sanity check that we can read all of the program headers.
220*fae548d3Szrj It ought to be good enough to just read the last one. */
221*fae548d3Szrj if (i_ehdrp->e_phnum > 1)
222*fae548d3Szrj {
223*fae548d3Szrj Elf_External_Phdr x_phdr;
224*fae548d3Szrj Elf_Internal_Phdr i_phdr;
225*fae548d3Szrj file_ptr where;
226*fae548d3Szrj
227*fae548d3Szrj /* Check that we don't have a totally silly number of
228*fae548d3Szrj program headers. */
229*fae548d3Szrj if (i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (x_phdr)
230*fae548d3Szrj || i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (i_phdr))
231*fae548d3Szrj goto wrong;
232*fae548d3Szrj
233*fae548d3Szrj where = (file_ptr)(i_ehdrp->e_phoff + (i_ehdrp->e_phnum - 1) * sizeof (x_phdr));
234*fae548d3Szrj if ((bfd_size_type) where <= i_ehdrp->e_phoff)
235*fae548d3Szrj goto wrong;
236*fae548d3Szrj
237*fae548d3Szrj if (bfd_seek (abfd, where, SEEK_SET) != 0)
238*fae548d3Szrj goto fail;
239*fae548d3Szrj if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
240*fae548d3Szrj goto fail;
241*fae548d3Szrj }
242*fae548d3Szrj
243*fae548d3Szrj /* Move to the start of the program headers. */
244*fae548d3Szrj if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_phoff, SEEK_SET) != 0)
245*fae548d3Szrj goto wrong;
246*fae548d3Szrj
247*fae548d3Szrj /* Allocate space for the program headers. */
248*fae548d3Szrj amt = sizeof (*i_phdrp) * i_ehdrp->e_phnum;
249*fae548d3Szrj i_phdrp = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt);
250*fae548d3Szrj if (!i_phdrp)
251*fae548d3Szrj goto fail;
252*fae548d3Szrj
253*fae548d3Szrj elf_tdata (abfd)->phdr = i_phdrp;
254*fae548d3Szrj
255*fae548d3Szrj /* Read and convert to internal form. */
256*fae548d3Szrj for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
257*fae548d3Szrj {
258*fae548d3Szrj Elf_External_Phdr x_phdr;
259*fae548d3Szrj
260*fae548d3Szrj if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
261*fae548d3Szrj goto fail;
262*fae548d3Szrj
263*fae548d3Szrj elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
264*fae548d3Szrj }
265*fae548d3Szrj
266*fae548d3Szrj /* Set the machine architecture. Do this before processing the
267*fae548d3Szrj program headers since we need to know the architecture type
268*fae548d3Szrj when processing the notes of some systems' core files. */
269*fae548d3Szrj if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0)
270*fae548d3Szrj /* It's OK if this fails for the generic target. */
271*fae548d3Szrj && ebd->elf_machine_code != EM_NONE)
272*fae548d3Szrj goto fail;
273*fae548d3Szrj
274*fae548d3Szrj /* Let the backend double check the format and override global
275*fae548d3Szrj information. We do this before processing the program headers
276*fae548d3Szrj to allow the correct machine (as opposed to just the default
277*fae548d3Szrj machine) to be set, making it possible for grok_prstatus and
278*fae548d3Szrj grok_psinfo to rely on the mach setting. */
279*fae548d3Szrj if (ebd->elf_backend_object_p != NULL
280*fae548d3Szrj && ! ebd->elf_backend_object_p (abfd))
281*fae548d3Szrj goto wrong;
282*fae548d3Szrj
283*fae548d3Szrj /* Process each program header. */
284*fae548d3Szrj for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
285*fae548d3Szrj if (! bfd_section_from_phdr (abfd, i_phdrp + phindex, (int) phindex))
286*fae548d3Szrj goto fail;
287*fae548d3Szrj
288*fae548d3Szrj /* Check for core truncation. */
289*fae548d3Szrj {
290*fae548d3Szrj bfd_size_type high = 0;
291*fae548d3Szrj struct stat statbuf;
292*fae548d3Szrj for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
293*fae548d3Szrj {
294*fae548d3Szrj Elf_Internal_Phdr *p = i_phdrp + phindex;
295*fae548d3Szrj if (p->p_filesz)
296*fae548d3Szrj {
297*fae548d3Szrj bfd_size_type current = p->p_offset + p->p_filesz;
298*fae548d3Szrj if (high < current)
299*fae548d3Szrj high = current;
300*fae548d3Szrj }
301*fae548d3Szrj }
302*fae548d3Szrj if (bfd_stat (abfd, &statbuf) == 0)
303*fae548d3Szrj {
304*fae548d3Szrj if ((bfd_size_type) statbuf.st_size < high)
305*fae548d3Szrj {
306*fae548d3Szrj _bfd_error_handler
307*fae548d3Szrj /* xgettext:c-format */
308*fae548d3Szrj (_("warning: %pB is truncated: expected core file "
309*fae548d3Szrj "size >= %" PRIu64 ", found: %" PRIu64),
310*fae548d3Szrj abfd, (uint64_t) high, (uint64_t) statbuf.st_size);
311*fae548d3Szrj }
312*fae548d3Szrj }
313*fae548d3Szrj }
314*fae548d3Szrj
315*fae548d3Szrj /* Save the entry point from the ELF header. */
316*fae548d3Szrj abfd->start_address = i_ehdrp->e_entry;
317*fae548d3Szrj return abfd->xvec;
318*fae548d3Szrj
319*fae548d3Szrj wrong:
320*fae548d3Szrj bfd_set_error (bfd_error_wrong_format);
321*fae548d3Szrj fail:
322*fae548d3Szrj return NULL;
323*fae548d3Szrj }
324*fae548d3Szrj
325*fae548d3Szrj /* Attempt to find a build-id in a core file from the core file BFD.
326*fae548d3Szrj OFFSET is the file offset to a PT_LOAD segment that may contain
327*fae548d3Szrj the build-id note. Returns TRUE upon success, FALSE otherwise. */
328*fae548d3Szrj
329*fae548d3Szrj bfd_boolean
NAME(_bfd_elf,core_find_build_id)330*fae548d3Szrj NAME(_bfd_elf, core_find_build_id)
331*fae548d3Szrj (bfd *abfd,
332*fae548d3Szrj bfd_vma offset)
333*fae548d3Szrj {
334*fae548d3Szrj Elf_External_Ehdr x_ehdr; /* Elf file header, external form. */
335*fae548d3Szrj Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form. */
336*fae548d3Szrj Elf_Internal_Phdr *i_phdr;
337*fae548d3Szrj unsigned int i;
338*fae548d3Szrj
339*fae548d3Szrj /* Seek to the position of the segment at OFFSET. */
340*fae548d3Szrj if (bfd_seek (abfd, offset, SEEK_SET) != 0)
341*fae548d3Szrj goto fail;
342*fae548d3Szrj
343*fae548d3Szrj /* Read in the ELF header in external format. */
344*fae548d3Szrj if (bfd_bread (&x_ehdr, sizeof (x_ehdr), abfd) != sizeof (x_ehdr))
345*fae548d3Szrj {
346*fae548d3Szrj if (bfd_get_error () != bfd_error_system_call)
347*fae548d3Szrj goto wrong;
348*fae548d3Szrj else
349*fae548d3Szrj goto fail;
350*fae548d3Szrj }
351*fae548d3Szrj
352*fae548d3Szrj /* Now check to see if we have a valid ELF file, and one that BFD can
353*fae548d3Szrj make use of. The magic number must match, the address size ('class')
354*fae548d3Szrj and byte-swapping must match our XVEC entry, and it must have a
355*fae548d3Szrj section header table (FIXME: See comments re sections at top of this
356*fae548d3Szrj file). */
357*fae548d3Szrj if (! elf_file_p (&x_ehdr)
358*fae548d3Szrj || x_ehdr.e_ident[EI_VERSION] != EV_CURRENT
359*fae548d3Szrj || x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
360*fae548d3Szrj goto wrong;
361*fae548d3Szrj
362*fae548d3Szrj /* Check that file's byte order matches xvec's. */
363*fae548d3Szrj switch (x_ehdr.e_ident[EI_DATA])
364*fae548d3Szrj {
365*fae548d3Szrj case ELFDATA2MSB: /* Big-endian. */
366*fae548d3Szrj if (! bfd_header_big_endian (abfd))
367*fae548d3Szrj goto wrong;
368*fae548d3Szrj break;
369*fae548d3Szrj case ELFDATA2LSB: /* Little-endian. */
370*fae548d3Szrj if (! bfd_header_little_endian (abfd))
371*fae548d3Szrj goto wrong;
372*fae548d3Szrj break;
373*fae548d3Szrj case ELFDATANONE: /* No data encoding specified. */
374*fae548d3Szrj default: /* Unknown data encoding specified . */
375*fae548d3Szrj goto wrong;
376*fae548d3Szrj }
377*fae548d3Szrj
378*fae548d3Szrj elf_swap_ehdr_in (abfd, &x_ehdr, &i_ehdr);
379*fae548d3Szrj #if DEBUG
380*fae548d3Szrj elf_debug_file (&i_ehdr);
381*fae548d3Szrj #endif
382*fae548d3Szrj
383*fae548d3Szrj if (i_ehdr.e_phentsize != sizeof (Elf_External_Phdr) || i_ehdr.e_phnum == 0)
384*fae548d3Szrj goto fail;
385*fae548d3Szrj
386*fae548d3Szrj /* Read in program headers. */
387*fae548d3Szrj i_phdr = (Elf_Internal_Phdr *) bfd_alloc2 (abfd, i_ehdr.e_phnum,
388*fae548d3Szrj sizeof (*i_phdr));
389*fae548d3Szrj if (i_phdr == NULL)
390*fae548d3Szrj goto fail;
391*fae548d3Szrj
392*fae548d3Szrj if (bfd_seek (abfd, (file_ptr) (offset + i_ehdr.e_phoff), SEEK_SET) != 0)
393*fae548d3Szrj goto fail;
394*fae548d3Szrj
395*fae548d3Szrj /* Read in program headers and parse notes. */
396*fae548d3Szrj for (i = 0; i < i_ehdr.e_phnum; ++i, ++i_phdr)
397*fae548d3Szrj {
398*fae548d3Szrj Elf_External_Phdr x_phdr;
399*fae548d3Szrj
400*fae548d3Szrj if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr))
401*fae548d3Szrj goto fail;
402*fae548d3Szrj elf_swap_phdr_in (abfd, &x_phdr, i_phdr);
403*fae548d3Szrj
404*fae548d3Szrj if (i_phdr->p_type == PT_NOTE && i_phdr->p_filesz > 0)
405*fae548d3Szrj {
406*fae548d3Szrj elf_read_notes (abfd, offset + i_phdr->p_offset,
407*fae548d3Szrj i_phdr->p_filesz, i_phdr->p_align);
408*fae548d3Szrj if (abfd->build_id != NULL)
409*fae548d3Szrj return TRUE;
410*fae548d3Szrj }
411*fae548d3Szrj }
412*fae548d3Szrj
413*fae548d3Szrj /* Having gotten this far, we have a valid ELF section, but no
414*fae548d3Szrj build-id was found. */
415*fae548d3Szrj goto fail;
416*fae548d3Szrj
417*fae548d3Szrj wrong:
418*fae548d3Szrj bfd_set_error (bfd_error_wrong_format);
419*fae548d3Szrj fail:
420*fae548d3Szrj return FALSE;
421*fae548d3Szrj }
422