[PATCH] D18360: Add AIX Target/ToolChain to Clang Driver

WuZhao via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 20 09:34:24 PDT 2016


WuZhao added a comment.

I wan to point to some issues, because I am also doing AIX support based on your patch and I tested and verified.

Firstly, in the lib/Driver/ToolChains.cpp line 3756

  case llvm::Triple::ppc64:
    addPathIfExists(D, getDriver().SysRoot + getDriver().Dir + "/../lib64", Paths);
    addPathIfExists(D, getDriver().SysRoot + "/usr/lib64", Paths);
    break;

In fact, in AIX there is no /usr/lib64, we only have /usr/lib and crt0.o for 32 bits, crt0_64.o for 64 bits. We also have crti.o / crti_64.o for C++.

Secondly, we should also define  _AIX71 for AIX 7.1 in the lib/Basic/Targets.cpp.

Thirdly, the linker construct job has many issues (maybe because you have not supported code generation) in the lib/Driver/Tools.cpp, AIX has much difference with Solaris in fact.

we should code like this:

   if (Args.hasArg(options::OPT_shared)) {
     CmdArgs.push_back("-bM:SRE");
     CmdArgs.push_back("-bnoentry");
   }
   
   if (Args.hasArg(options::OPT_static)) {
     CmdArgs.push_back("-bnso");
     CmdArgs.push_back("-bI:/lib/syscalls.exp");
  }
  
  .......

I will try my best to complete linker work and so on based on your patch.

I notice that one thing, you define _THREAD_SAFE for posix thread, it is right. In AIX, we do not have _REENTRANT.

Lastly, you should be careful one thing: In AIX, when we use -pthread option, gcc standard headers directory and linker directory is changed. You should consider this. You can try gcc -pthread -v to see the output.

In collusion, this patch has some work to do in AIX from the view of my point.


https://reviews.llvm.org/D18360





More information about the cfe-commits mailing list