diff options
author | 2017-11-06 14:59:27 +0000 | |
---|---|---|
committer | 2017-11-06 14:59:27 +0000 | |
commit | 622b739246a8b0b7ebd0c74ff84ccabf5eade42d (patch) | |
tree | 905226b7cc21b687cad0a347a03d6c40c000a2ca /usr.bin/ctfconv/ctfconv.c | |
parent | Add lease declaration 'epoch' to hold the time() when a lease is (diff) | |
download | wireguard-openbsd-622b739246a8b0b7ebd0c74ff84ccabf5eade42d.tar.xz wireguard-openbsd-622b739246a8b0b7ebd0c74ff84ccabf5eade42d.zip |
Use the symtab's sh_link to get the string table section.
This is technically more correct than looking for ".strtab" and allows
us to get rid of unportable ELF_STRTAB.
We can also get rid of the hack for some incorrect ELF files since we
no longer try to apply relocations for the string table.
From Mark Johnston, markj@FreeBSD
Diffstat (limited to 'usr.bin/ctfconv/ctfconv.c')
-rw-r--r-- | usr.bin/ctfconv/ctfconv.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/ctfconv/ctfconv.c b/usr.bin/ctfconv/ctfconv.c index 31eb7bc7fb0..a7f65090a8c 100644 --- a/usr.bin/ctfconv/ctfconv.c +++ b/usr.bin/ctfconv/ctfconv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctfconv.c,v 1.15 2017/11/03 12:55:43 mpi Exp $ */ +/* $OpenBSD: ctfconv.c,v 1.16 2017/11/06 14:59:27 mpi Exp $ */ /* * Copyright (c) 2016-2017 Martin Pieuchot @@ -60,7 +60,7 @@ void dump_obj(struct itype *, int *); int iself(const char *, size_t); int elf_getshstab(const char *, size_t, const char **, size_t *); ssize_t elf_getsymtab(const char *, size_t, const char *, size_t, - const Elf_Sym **, size_t *); + const Elf_Sym **, size_t *, const char **, size_t *); ssize_t elf_getsection(char *, size_t, const char *, const char *, size_t, const char **, size_t *); @@ -221,15 +221,11 @@ elf_convert(char *p, size_t filesize) if (elf_getshstab(p, filesize, &shstab, &shstabsz)) return 1; - /* Find symbol table location and number of symbols. */ - if (elf_getsymtab(p, filesize, shstab, shstabsz, &symtab, &nsymb) == -1) + /* Find symbol table and associated string table. */ + if (elf_getsymtab(p, filesize, shstab, shstabsz, &symtab, &nsymb, + &strtab, &strtabsz) == -1) warnx("symbol table not found"); - /* Find string table location and size. */ - if (elf_getsection(p, filesize, ELF_STRTAB, shstab, shstabsz, &strtab, - &strtabsz) == -1) - warnx("string table not found"); - /* Find abbreviation location and size. */ if (elf_getsection(p, filesize, DEBUG_ABBREV, shstab, shstabsz, &abbuf, &ablen) == -1) { |