From owner-freebsd-toolchain@freebsd.org Tue Oct 20 19:56:00 2015 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE0E4A19B6F for ; Tue, 20 Oct 2015 19:56:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 457E01297; Tue, 20 Oct 2015 19:56:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t9KJtrng011469 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 20 Oct 2015 22:55:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t9KJtrng011469 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t9KJtrCW011405; Tue, 20 Oct 2015 22:55:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Oct 2015 22:55:53 +0300 From: Konstantin Belousov To: Ed Maste Cc: John Baldwin , "freebsd-toolchain@freebsd.org" , Andriy Gapon Subject: Re: clang confuses kgdb on static symbols Message-ID: <20151020195553.GQ2257@kib.kiev.ua> References: <562627C8.5060108@FreeBSD.org> <2309223.qpHU2DNGVF@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2015 19:56:00 -0000 On Tue, Oct 20, 2015 at 03:44:13PM -0400, Ed Maste wrote: > On 20 October 2015 at 13:27, John Baldwin 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.