Module Name: src Committed By: christos Date: Sun Dec 25 20:23:43 UTC 2022
Modified Files: src/external/cddl/osnet/dist/tools/ctf/cvt: output.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dist/tools/ctf/cvt/output.c diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.10 --- src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.9 Mon May 28 17:05:06 2018 +++ src/external/cddl/osnet/dist/tools/ctf/cvt/output.c Sun Dec 25 15:23:42 2022 @@ -353,15 +353,17 @@ sort_iidescs(Elf *elf, const char *file, 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; + 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); + 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 } 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 /* 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");