[cfe-dev] choosing the gcc toolchain

Simon Atanasyan simon at atanasyan.com
Fri Feb 28 12:38:51 PST 2014


The problem seems to be clear. By default Debian MIPS toolchain 4.7
has libraries for o32 ABI only. In that case sizes of
DebianMipsMultilibs, CSMipsMultilibs and FSFMipsMultilibs are equal to
1. So in the following code we always incorrectly select CS Toolchain:

[[
  if (TargetTriple.getEnvironment() == llvm::Triple::Android)
    Multilibs.combineWith(AndroidMipsMultilibs);
  else if (DebianMipsMultilibs.size() == 3) {
    Multilibs.combineWith(DebianMipsMultilibs);
    BiarchSibling = Multilib();
  } else if (FSFMipsMultilibs.size() > CSMipsMultilibs.size())
    Multilibs.combineWith(FSFMipsMultilibs);
  else
    Multilibs.combineWith(CSMipsMultilibs);
]]

On Fri, Feb 28, 2014 at 11:20 PM, Reed Kotler <rkotler at mips.com> wrote:
> Seems to almost work.

[...]

> On 02/27/2014 10:00 PM, Simon Atanasyan wrote:
>>
>> It looks like a regression after r201205. The problem is in the end of
>> the findMIPSMultilibs routine in the following line:
>>
>> [[
>> else if (DebianMipsMultilibs.size() == 3) {
>> ]]
>>
>> The clang driver does not select a regular Debian MIPS toolchain if
>> the toolchain includes 32-bit libraries only and does not include 64
>> and n32 variants.
>>
>> If temporarily delete FSF and CS toolchain selection it solves the
>> problem at least on my x86-64 Debian machines with a regular MIPS 4.7
>> toolchain.
>>
>> [[
>> --- a/lib/Driver/ToolChains.cpp
>> +++ b/lib/Driver/ToolChains.cpp
>> @@ -1802,13 +1802,10 @@ bool
>> Generic_GCC::GCCInstallationDetector::findMIPSMultilibs(
>>     //  a bit of overlap in the directories that each specifies)
>>     if (TargetTriple.getEnvironment() == llvm::Triple::Android)
>>       Multilibs.combineWith(AndroidMipsMultilibs);
>> -  else if (DebianMipsMultilibs.size() == 3) {
>> +  else {
>>       Multilibs.combineWith(DebianMipsMultilibs);
>>       BiarchSibling = Multilib();
>> -  } else if (FSFMipsMultilibs.size() > CSMipsMultilibs.size())
>> -    Multilibs.combineWith(FSFMipsMultilibs);
>> -  else
>> -    Multilibs.combineWith(CSMipsMultilibs);
>> +  }
>>
>>     llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
>>
>> ]]
>>
>> Reed, could you check this hack on the cavium board?

-- 
Simon Atanasyan



More information about the cfe-dev mailing list