From owner-freebsd-toolchain@FreeBSD.ORG Tue Jun 10 02:44:38 2014 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 177B1CA for ; Tue, 10 Jun 2014 02:44:38 +0000 (UTC) Received: from mail-qc0-x235.google.com (mail-qc0-x235.google.com [IPv6:2607:f8b0:400d:c01::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDBF92CC3 for ; Tue, 10 Jun 2014 02:44:37 +0000 (UTC) Received: by mail-qc0-f181.google.com with SMTP id x3so1578193qcv.26 for ; Mon, 09 Jun 2014 19:44:36 -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:date:message-id:subject :from:to:cc:content-type; bh=gJIc6OjtYrPcA0IAeF5fVrRm2H8zQSA71Rl+Qo/iSb8=; b=rH6wddpGCo4RoL+Pw5DEJslqYIuw4KJwWrfe+wiKBmCjx/exOCrhroRqXDvlEZNPap 8on9dpN/4tts3A6fz8cCEEANxr62zA9JwkHVRQ4jNU1teIPs01qURmIgpdXRi4ULMmhV raZcDCh3qMW1hHmL/E161ITiyW/aeA/tzfO/P+fqhxQ4FHDlHufR0emvHxzd+F7VMANo KzrWlR89cVwVJsSeHgdSay/6RR8+rHKNt9TSdh0LfA7lpXjREtNT/gk3Z70+IixY/y3M NnYm1FsjW5dAeUglhVVV109NqJld2LELLhdfCTifUrbECIWiuux6MZCj5jUsxMuZcxzv veFA== MIME-Version: 1.0 X-Received: by 10.140.48.1 with SMTP id n1mr9091407qga.107.1402368276857; Mon, 09 Jun 2014 19:44:36 -0700 (PDT) Sender: carpeddiem@gmail.com Received: by 10.140.49.239 with HTTP; Mon, 9 Jun 2014 19:44:36 -0700 (PDT) In-Reply-To: References: Date: Mon, 9 Jun 2014 22:44:36 -0400 X-Google-Sender-Auth: rY7ju9JbUzOLuvGwTgvQMhIjzKc Message-ID: Subject: Re: abi::__cxa_demangle provides invalid result on non-mangled symbols From: Ed Maste To: Ryan Stone Content-Type: text/plain; charset=UTF-8 Cc: freebsd-toolchain@freebsd.org X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.18 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, 10 Jun 2014 02:44:38 -0000 On 9 June 2014 21:48, Ryan Stone wrote: > abi::__cxa_demangle is giving me an invalid result if I pass it a > symbol that is not mangled. This is causing me problems as in my > application, I'm getting symbol names from libelf and have no way of > know a priori whether a symbol is mangled or not. I had the same issue in LLVM, and as hacky as it seems, the solution is to check that the name starts with "_Z" before passing it to __cxa_demangle. For reference the LLVM review for the change is here: http://reviews.llvm.org/D2552 I didn't get around to testing it on Linux; since you have a test application ready it would be interesting to see the result of __cxa_demangle("f") there.