clang confuses kgdb on static symbols
Konstantin Belousov
kostikbel at gmail.com
Tue Oct 20 19:56:00 UTC 2015
On Tue, Oct 20, 2015 at 03:44:13PM -0400, Ed Maste wrote:
> On 20 October 2015 at 13:27, John Baldwin <jhb at freebsd.org> wrote:
> >
> > If '-gdwarf-4' works then you can just set that in the DEBUG makeoptions as a
> > test, otherwise try hacking kern.mk to disable this bit:
> >
> > #
> > # Add -gdwarf-2 when compiling -g. The default starting in clang v3.4
> > # and gcc 4.8 is to generate DWARF version 4. However, our tools don't
> > # cope well with DWARF 4, so force it to genereate DWARF2, which they
> > # understand. Do this unconditionally as it is harmless when not needed,
> > # but critical for these newer versions.
> > #
> > .if ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf*} == ""
> > CFLAGS+= -gdwarf-2
> > .endif
>
> Note that Clang defaults to DWARF 2 on FreeBSD, so removing the
> override in kern.mk isn't sufficient.
>
> >From contrib/llvm/tools/clang/lib/Driver/Tools.cpp:
> else if (!A->getOption().matches(options::OPT_g0) &&
> !A->getOption().matches(options::OPT_ggdb0)) {
> // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
> const llvm::Triple &Triple = getToolChain().getTriple();
> if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
> Triple.getOS() == llvm::Triple::FreeBSD ||
> Triple.getOS() == llvm::Triple::Solaris)
> CmdArgs.push_back("-gdwarf-2");
> else
> CmdArgs.push_back("-g");
> }
>
> It may be time for us to remove this default from Clang.
I doubt that names of the local symbols have anything to do with the dwarf
version.
We cannot stop generating dwarf-2 until in tree gdb and kgdb are substituted
by a working replacement.
More information about the freebsd-toolchain
mailing list