diff options
| author | christos <christos@NetBSD.org> | 2022-12-25 20:23:42 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2022-12-25 20:23:42 +0000 |
| commit | 7673a2f736e59e649f4f0e890930feb1aa71b79d (patch) | |
| tree | 406035dfcf2f6b967834c9c0e671f13493ea469c /external | |
| parent | 7a951a1184dacef07c547f418ffc4f3f735c35b5 (diff) | |
Don't bail out if the input file does not have a symbol table. This happens
with crtn.o which used to have an empty symbol table with binutils 2.34,
with binutils 2.39 has no symbol table.
Diffstat (limited to 'external')
| -rw-r--r-- | external/cddl/osnet/dist/tools/ctf/cvt/output.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/external/cddl/osnet/dist/tools/ctf/cvt/output.c b/external/cddl/osnet/dist/tools/ctf/cvt/output.c index ab68e97291c..349f3bfc858 100644 --- a/external/cddl/osnet/dist/tools/ctf/cvt/output.c +++ b/external/cddl/osnet/dist/tools/ctf/cvt/output.c @@ -353,15 +353,17 @@ sort_iidescs(Elf *elf, const char *file, tdata_t *td, int fuzzymatch, match.iim_file = NULL; if ((stidx = findelfsecidx(elf, file, - dynsym ? ".dynsym" : ".symtab")) < 0) - terminate("%s: Can't open symbol table\n", file); - scn = elf_getscn(elf, stidx); - data = elf_getdata(scn, NULL); - gelf_getshdr(scn, &shdr); - nent = shdr.sh_size / shdr.sh_entsize; - - scn = elf_getscn(elf, shdr.sh_link); - strdata = elf_getdata(scn, NULL); + dynsym ? ".dynsym" : ".symtab")) < 0) { + nent = 0; + } else { + scn = elf_getscn(elf, stidx); + data = elf_getdata(scn, NULL); + gelf_getshdr(scn, &shdr); + nent = shdr.sh_size / shdr.sh_entsize; + + scn = elf_getscn(elf, shdr.sh_link); + strdata = elf_getdata(scn, NULL); + } iiburst = iiburst_new(td, nent); @@ -665,8 +667,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname, } if (symtab_idx == -1) { - terminate("%s: Cannot find %s section\n", srcname, - dynsym ? "SHT_DYNSYM" : "SHT_SYMTAB"); + goto out; } /* Add the ctf section */ @@ -709,6 +710,7 @@ write_file(Elf *src, const char *srcname, Elf *dst, const char *dstname, /* commit to disk */ dehdr.e_shstrndx = secxlate[sehdr.e_shstrndx]; gelf_update_ehdr(dst, &dehdr); +out: if (elf_update(dst, ELF_C_WRITE) < 0) elfterminate(dstname, "Cannot finalize temp file"); |
