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

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 13:13:16 PST 2016


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


More information about the llvm-commits mailing list