aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2012-08-19 09:17:21 +0000
committerMartin Matuska <mm@FreeBSD.org>2012-08-19 09:17:21 +0000
commitd6a9bc60b0f90d843c0c10d72533bfbcd2737895 (patch)
tree6d3092e0c5a70e6d69460223f86531160e6052af /tools
parent3c306da80d77021c012776234924b30e70fa51b1 (diff)
downloadsrc-d6a9bc60b0f90d843c0c10d72533bfbcd2737895.tar.gz
src-d6a9bc60b0f90d843c0c10d72533bfbcd2737895.zip
Update vendor/illumos to illumos-gate 13754:7231b684c18b
References: https://www.illumos.org/issues/2978 Obtained from: ssh://anonhg@hg.illumos.org/illumos-gate
Notes
Notes: svn path=/vendor/illumos/dist/; revision=239384
Diffstat (limited to 'tools')
-rw-r--r--tools/ctf/cvt/dwarf.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/tools/ctf/cvt/dwarf.c b/tools/ctf/cvt/dwarf.c
index ef92e384e435..e261818d3a66 100644
--- a/tools/ctf/cvt/dwarf.c
+++ b/tools/ctf/cvt/dwarf.c
@@ -1839,21 +1839,53 @@ die_resolve(dwarf_t *dw)
}
/*
- * Any object containing at least one allocatable section of non-0 size is
- * taken to be a file which should contain DWARF type information
+ * Any object containing a function or object symbol at any scope should also
+ * contain DWARF data.
*/
static boolean_t
should_have_dwarf(Elf *elf)
{
Elf_Scn *scn = NULL;
+ Elf_Data *data = NULL;
+ GElf_Shdr shdr;
+ GElf_Sym sym;
+ uint32_t symdx = 0;
+ size_t nsyms = 0;
+ boolean_t found = B_FALSE;
while ((scn = elf_nextscn(elf, scn)) != NULL) {
- GElf_Shdr shdr;
gelf_getshdr(scn, &shdr);
- if ((shdr.sh_flags & SHF_ALLOC) &&
- (shdr.sh_size != 0))
- return (B_TRUE);
+ if (shdr.sh_type == SHT_SYMTAB) {
+ found = B_TRUE;
+ break;
+ }
+ }
+
+ if (!found)
+ terminate("cannot convert stripped objects\n");
+
+ data = elf_getdata(scn, NULL);
+ nsyms = shdr.sh_size / shdr.sh_entsize;
+
+ for (symdx = 0; symdx < nsyms; symdx++) {
+ gelf_getsym(data, symdx, &sym);
+
+ if ((GELF_ST_TYPE(sym.st_info) == STT_FUNC) ||
+ (GELF_ST_TYPE(sym.st_info) == STT_TLS) ||
+ (GELF_ST_TYPE(sym.st_info) == STT_OBJECT)) {
+ char *name;
+
+ name = elf_strptr(elf, shdr.sh_link, sym.st_name);
+
+ /* Studio emits these local symbols regardless */
+ if ((strcmp(name, "Bbss.bss") != 0) &&
+ (strcmp(name, "Ttbss.bss") != 0) &&
+ (strcmp(name, "Ddata.data") != 0) &&
+ (strcmp(name, "Ttdata.data") != 0) &&
+ (strcmp(name, "Drodata.rodata") != 0))
+ return (B_TRUE);
+ }
}
return (B_FALSE);