Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 2015 22:55:53 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ed Maste <emaste@freebsd.org>
Cc:        John Baldwin <jhb@freebsd.org>, "freebsd-toolchain@freebsd.org" <freebsd-toolchain@freebsd.org>, Andriy Gapon <avg@freebsd.org>
Subject:   Re: clang confuses kgdb on static symbols
Message-ID:  <20151020195553.GQ2257@kib.kiev.ua>
In-Reply-To: <CAPyFy2AyhV2HO1CRAp0EVty%2BD0VJGLb-wXGC_H8rnrdeB0V=iQ@mail.gmail.com>
References:  <562627C8.5060108@FreeBSD.org> <2309223.qpHU2DNGVF@ralph.baldwin.cx> <CAPyFy2AyhV2HO1CRAp0EVty%2BD0VJGLb-wXGC_H8rnrdeB0V=iQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 20, 2015 at 03:44:13PM -0400, Ed Maste wrote:
> On 20 October 2015 at 13:27, John Baldwin <jhb@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151020195553.GQ2257>