svn commit: r247960 - head/cddl/contrib/opensolaris/tools/ctf/cvt
Andriy Gapon
avg at FreeBSD.org
Thu Mar 7 22:29:38 UTC 2013
on 08/03/2013 00:16 Dimitry Andric said the following:
> Author: dim
> Date: Thu Mar 7 22:16:35 2013
> New Revision: 247960
> URL: http://svnweb.freebsd.org/changeset/base/247960
>
> Log:
> Make ctfconvert work correctly on clang-compiled object files. Clang
> puts the full original source filename in the STT_FILE entry of the ELF
> symbol table, while gcc saves only the basename.
>
> Since the DWARF DW_AT_name attribute contains the full source filename,
> both for clang and gcc, ctfconvert takes just the basename of it, for
> matching with the STT_FILE entry. So when attempting to match with such
> an entry, use its basename, if necessary.
I was not really kidding when I said that this change, as is, is a nop:
> Reported by: avg
> MFC after: 1 week
>
> Modified:
> head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c
>
> Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c
> ==============================================================================
> --- head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:05:27 2013 (r247959)
> +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Thu Mar 7 22:16:35 2013 (r247960)
> @@ -363,6 +363,7 @@ sort_iidescs(Elf *elf, const char *file,
>
> for (i = 0; i < nent; i++) {
> GElf_Sym sym;
> + char *bname;
> iidesc_t **tolist;
> GElf_Sym ssym;
> iidesc_match_t smatch;
> @@ -377,6 +378,8 @@ sort_iidescs(Elf *elf, const char *file,
>
> switch (GELF_ST_TYPE(sym.st_info)) {
> case STT_FILE:
> + bname = strrchr(match.iim_name, '/');
> + bname = bname == NULL ? match.iim_name : bname + 1;
It would probably make sense to make use of bname after going to through all the
trouble of calculating it:
> match.iim_file = match.iim_name;
Should be match.iim_file = bname ?
Surprised that clang hasn't warned you about this one :-)
> continue;
> case STT_OBJECT:
>
--
Andriy Gapon
More information about the svn-src-all
mailing list