From owner-freebsd-toolchain@freebsd.org Tue Oct 20 19:44:33 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 B3366A19738 for ; Tue, 20 Oct 2015 19:44:33 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 818A3BC5; Tue, 20 Oct 2015 19:44:33 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by iow1 with SMTP id 1so34357665iow.1; Tue, 20 Oct 2015 12:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=mHk6ScfxwZcGIAy7n9enLM26uhHj+NTLzpudNq1VjbI=; b=qcnumr1pYlVdx7eOgm8jMAfx5GfCJUTQ8BwSfB3RIn92gMLMKEcE4y2O+Dghk4hSsF pyXZph5Ivw2vVhq3zRtd2V7TlI33X0bwD7KzQML9mSfTuACm63GvdxFHYhGRvls933+t pkrs+VDm4lm8mKOZvX9i9DoPOdKmX+qBP0Kg7ezju8LuR2CCyW8SY4f5nnHvXByEwLYl 6YUK7SUAY+A7vNKXVVZjHjMDOpouVj/AcpPWoTcSFGCDfCCZHYNr6CBRRnZnsOuAgkwK OpVhrGdE4hWIRaeGFmj06F/U84oKs3Puu79rZMUAkCpZVYNdtLHdMQV0QeUsrx7fvmAE fMdw== X-Received: by 10.107.10.95 with SMTP id u92mr6126222ioi.180.1445370272951; Tue, 20 Oct 2015 12:44:32 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.158.75 with HTTP; Tue, 20 Oct 2015 12:44:13 -0700 (PDT) In-Reply-To: <2309223.qpHU2DNGVF@ralph.baldwin.cx> References: <562627C8.5060108@FreeBSD.org> <2309223.qpHU2DNGVF@ralph.baldwin.cx> From: Ed Maste Date: Tue, 20 Oct 2015 15:44:13 -0400 X-Google-Sender-Auth: HpJL95ozUpmfytWVvGHYM9OzK7g Message-ID: Subject: Re: clang confuses kgdb on static symbols To: John Baldwin Cc: Andriy Gapon , "freebsd-toolchain@freebsd.org" Content-Type: text/plain; charset=UTF-8 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:44:33 -0000 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.