[lld] r257661 - Attempt to make FreeBSD buildbot green.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 13:39:10 PST 2016


In any way, it is better to add a comment here to describe why we check _Z
prefix. I'll do that.

On Wed, Jan 13, 2016 at 1:36 PM, Davide Italiano <davide at freebsd.org> wrote:

> On Wed, Jan 13, 2016 at 1:13 PM, Ed Maste <emaste at freebsd.org> wrote:
> > On 13 January 2016 at 20:14, Davide Italiano <davide at freebsd.org> wrote:
> >> On Wed, Jan 13, 2016 at 11:40 AM, Rui Ueyama via llvm-commits
> >> <llvm-commits at lists.llvm.org> wrote:
> >>> Author: ruiu
> >>> Date: Wed Jan 13 13:40:13 2016
> >>> New Revision: 257661
> >>>
> >>> URL: http://llvm.org/viewvc/llvm-project?rev=257661&view=rev
> >>> Log:
> >>> Attempt to make FreeBSD buildbot green.
> >>>
> >>> It seems that __cxa_demangle function on the buildbot tried to demangle
> >>> a variable "tlsvar" as a C++ symbol. Do not call that function unless
> >>> it does not start with "_Z" which is the prefix of mangled names.
> >>>
> >>> Modified:
> >>>     lld/trunk/ELF/Symbols.cpp
> >>>
> >>> Modified: lld/trunk/ELF/Symbols.cpp
> >>> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=257661&r1=257660&r2=257661&view=diff
> >>>
> ==============================================================================
> >>> --- lld/trunk/ELF/Symbols.cpp (original)
> >>> +++ lld/trunk/ELF/Symbols.cpp Wed Jan 13 13:40:13 2016
> >>> @@ -145,6 +145,11 @@ std::string elf2::demangle(StringRef Nam
> >>>  #else
> >>>    if (!Config->Demangle)
> >>>      return Name;
> >>> +
> >>> +  // Return if it does not look like a C++ symbol.
> >>> +  if (!Name.startswith("_Z"))
> >>> +    return Name;
> >>> +
> >>>    char *Buf =
> >>>        abi::__cxa_demangle(Name.str().c_str(), nullptr, nullptr,
> nullptr);
> >>>    if (!Buf)
> >>>
> >>
> >> This seems to be a bug in libcxxabi.
> >
> > If __cxa_demangle is being used to demangle external names the _Z test
> > is correct, and required. __cxa_demangle can also be used to demangle
> > types, and will for example correctly return "float" for input "f".
> >
> > On FreeBSD __cxa_demangle is provided by libcxxrt, and this issue has
> > come up a few times in the past. libcxxrt's __cxa_demangle ought to
> > reject names with additional characters following a mangled string,
> > but it becomes much less of an issue once callers are fixed to add the
> > _Z test.
> >
> > Some previous instances:
> >
> https://lists.freebsd.org/pipermail/freebsd-toolchain/2014-June/001153.html
> > http://reviews.llvm.org/D2552
>
> Thank you. I read the thread and I agree (therefore disagreeing with
> David C.) that this is an hack. Probably not a terrible one, but
> ideally lld (and all the other tools) shouldn't be concerned with this
> particular bit of the ABI.
>
> --
> Davide
>
> "There are no solved problems; there are only problems that are more
> or less solved" -- Henri Poincare
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160113/a9a17031/attachment.html>


More information about the llvm-commits mailing list