[PATCH] D97574: [AIX][clang][driver] Restrict /usr/lib to internal library search paths

2021-03-03 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG66799bf0e281: [AIX][clang][driver] Restrict /usr/lib to 
internal library search paths (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97574/new/

https://reviews.llvm.org/D97574

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -17,7 +17,6 @@
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NOT: "-lm"
@@ -39,7 +38,6 @@
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NOT: "-lm"
@@ -62,7 +60,6 @@
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -86,7 +83,6 @@
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -110,7 +106,6 @@
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PROF-NOT: "-lm"
@@ -133,7 +128,6 @@
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-GPROF-NOT: "-lm"
@@ -156,7 +150,6 @@
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-STATIC-NOT: "-lm"
@@ -180,7 +173,6 @@
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
-// CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-LIBP-NOT: "-lm"
@@ -204,7 +196,6 @@
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -229,7 +220,6 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: 

[PATCH] D97574: [AIX][clang][driver] Restrict /usr/lib to internal library search paths

2021-02-26 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, stevewan, jasonliu.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Adding it to the general filepaths results in it being added to the
linker arguments. The AIX linker always looks in this path anyway
and adds it as a default library path component. Adding this duplicate
explicitly results in duplicate entries in path in the loader section
of executables and messes up tools like CMake that parse the default
library flags.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97574

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -17,7 +17,6 @@
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NOT: "-lm"
@@ -39,7 +38,6 @@
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NOT: "-lm"
@@ -62,7 +60,6 @@
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -86,7 +83,6 @@
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -110,7 +106,6 @@
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PROF-NOT: "-lm"
@@ -133,7 +128,6 @@
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-GPROF-NOT: "-lm"
@@ -156,7 +150,6 @@
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-STATIC-NOT: "-lm"
@@ -180,7 +173,6 @@
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
-// CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-LIBP-NOT: "-lm"
@@ -204,7 +196,6 @@
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -229,7 +220,6 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: 

[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-12-01 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: llvm/lib/CodeGen/AsmPrinter/AIXException.cpp:68
+Per = dyn_cast(F.getPersonalityFn()->stripPointerCasts());
+  bool EmitEHBlock =
+  HasLandingPads || (F.hasPersonalityFn() &&

jasonliu wrote:
> daltenty wrote:
> > This logic seems very similar to the base class. 
> > 
> > The pattern there and in other instance of EHStreamer seems to be to make 
> > these queries in beginFunction, store the results in a member and just 
> > early exit if we have nothing to emit in endFunction, etc. Is that 
> > something we should be doing here? (e.g. presumably the traceback emission 
> > will want to know if we plan to emit anything so it can emit the 
> > appropriate info)
> I agree that this is a query that we want to share with the traceback table 
> emission. 
> Presumably, we need to do the traceback table emission somewhere in 
> PPCAIXAsmPrinter.
> So that means we would need to have a query that could accessible from 
> PPCAIXAsmPrinter and here. 
> And there are other EHStreamer that have similar queries (but not all of 
> them), so this makes it trickier to get it right if we want to do it for all 
> platforms. 
> I was hoping to address this issue when we actually do the traceback table 
> emission for EH info so that we could keep the scope of the patch reasonable.
Thanks, I think that helps explain the structure here. This should be amenable 
to later refactoring, so that sounds good for now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91455/new/

https://reviews.llvm.org/D91455

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-12-01 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/AIXException.cpp:68
+Per = dyn_cast(F.getPersonalityFn()->stripPointerCasts());
+  bool EmitEHBlock =
+  HasLandingPads || (F.hasPersonalityFn() &&

This logic seems very similar to the base class. 

The pattern there and in other instance of EHStreamer seems to be to make these 
queries in beginFunction, store the results in a member and just early exit if 
we have nothing to emit in endFunction, etc. Is that something we should be 
doing here? (e.g. presumably the traceback emission will want to know if we 
plan to emit anything so it can emit the appropriate info)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91455/new/

https://reviews.llvm.org/D91455

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-11-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:889
+  CompactUnwindSection =
+  Ctx->getXCOFFSection(".eh_info_table", 
XCOFF::StorageMappingClass::XMC_RW,
+   XCOFF::XTY_SD, SectionKind::getData());

jasonliu wrote:
> daltenty wrote:
> > I think this may have been discussed elsewhere, but why do we want to emit 
> > this as a RW section?
> Yes, this has been discussed before. And it's a good question.
> If we emit this as an RO section, then we could not put 
> ```
> .vbyte4, GCC_except_table1
> .vbyte4, __xlcxx_personality_v1[DS]
> ```
> into this csect directly. 
> If we do that, we would hit linker error during link time. It seems that for 
> read only csects (RO, PR mapping classes), we could not have relocation types 
> like `R_POS` or `R_NEG` because the result coming out of it is not link-time 
> constant. And the relocation types in read only csects needs to be link time 
> constant.
> 
> Extra work (both compiler and runtime) will be needed if we want to make this 
> RO.
Thanks for clarifying. I guess we'd presumably need to add the TOC indirections 
to get to the LSDA and personality routine's function descriptor,  similar  to 
elsewhere. 

Since this structure is version'd, seems like we have the flexibility to defer 
that work, so I guess that's OK.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91455/new/

https://reviews.llvm.org/D91455

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-11-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:889
+  CompactUnwindSection =
+  Ctx->getXCOFFSection(".eh_info_table", 
XCOFF::StorageMappingClass::XMC_RW,
+   XCOFF::XTY_SD, SectionKind::getData());

I think this may have been discussed elsewhere, but why do we want to emit this 
as a RW section?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91455/new/

https://reviews.llvm.org/D91455

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-11-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/AIXException.cpp:48
+  const DataLayout  = MMI->getModule()->getDataLayout();
+  const unsigned PointerSize = DL.getPointerSizeInBits() == 64 ? 8 : 4;
+

nit: Why not just call `getPointerSize()` instead? (`getPointerSizeInBits()` 
does `getPointerSize()*8` under the hood anyway)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91455/new/

https://reviews.llvm.org/D91455

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91361: [AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

2020-11-13 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91361/new/

https://reviews.llvm.org/D91361

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91361: [AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

2020-11-12 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:137
 
-if (D.CCCIsCXX())
+if (D.CCCIsCXX() || D.CCCIsCC())
   CmdArgs.push_back(Args.MakeArgString(

Xiangling_L wrote:
> daltenty wrote:
> > I think that rather that adding CC, we should just pull the if and 
> > unconditionally link crti.o. This is consistent with what is done on other 
> > platforms and since the `llvm.global_c/dtors` are generally allowable in 
> > the IR, we might see them in more than just the two driver scenarios 
> > suggested here.
> > we should just pull the if and unconditionally link crti.o. ...we might see 
> > them in more than just the two driver scenarios suggested here.
> 
> I was thinking to use the code to document what exactly  happen is under c++ 
> and c mode we link crti.o. But I think it makes sense to just remove `if` as 
> you said. But we can indicate it's something for C and CXX mode only? Cuz as 
> far as I know, there are c++, c, preprocessor, cl and flang driver mode. I 
> think it only make sense for us to see static init functions generated in IR 
> in c++ and c mode on AIX?  
> 
> 
These mode flags don't exactly correspond to input languages though, so it's 
not quite right to say this is "something for C and CXX mode only"  (i.e. CXX 
isn't defined as "C++" mode, it's "behave similar to g++"). 

For example, it seems like if someone tired to link a mixed C and Fortran 
program using --driver-mode=flang, the static init in the C portion would stop 
working because we'd omit crit.o. I don't know if there is an advantage to 
being more specific in this case,  and it definitely seems like it could run us 
into problems.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91361/new/

https://reviews.llvm.org/D91361

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91361: [AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

2020-11-12 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:137
 
-if (D.CCCIsCXX())
+if (D.CCCIsCXX() || D.CCCIsCC())
   CmdArgs.push_back(Args.MakeArgString(

I think that rather that adding CC, we should just pull the if and 
unconditionally link crti.o. This is consistent with what is done on other 
platforms and since the `llvm.global_c/dtors` are generally allowable in the 
IR, we might see them in more than just the two driver scenarios suggested here.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:146
+  // forward.
+  if (D.CCCIsCXX() || D.CCCIsCC())
 CmdArgs.push_back("-bcdtors:all:0:s");

Ditto the previous comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91361/new/

https://reviews.llvm.org/D91361

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89904: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-21 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

Thanks! I've verified this fixes the test on AIX.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89904/new/

https://reviews.llvm.org/D89904

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89696: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-21 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D89696#2344797 , @jhuber6 wrote:

> In D89696#2344753 , @daltenty wrote:
>
>> In D89696#2344508 , @jhuber6 wrote:
>>
>>> @daltenty Do you think this will fix the problem on AIX?
>>
>> It's not just AIX that will have this problem I suspect. If you configure 
>> any cross-compiling build with a 64-bit host, targeting a 32-bit arch, your 
>> going to run into the problem. I think checking against a list of known 
>> 64-bit arches is good enough for the purposes here, but the check still 
>> needs to be against the target, not the host.
>>
>> Also, the frontend diagnostic looks like it is off for the same reason:
>>
>>   else if (getArchPtrSize(T) != getArchPtrSize(TT))
>> Diags.Report(diag::err_drv_incompatible_omp_arch)
>>
>> T seems to be the target triple, not the host, but the diagnostic reads: 
>> `pointer size is incompatible with host`.
>
> TT is the target triple, otherwise the error message would be backwards, x86 
> is the OpenMP target architecture and PPC is the host architecture. I'm not 
> sure what you mean by checking the target rather than the host. The target is 
> set explicitly by `-fopenmp-targets=`, since it's being set in the 
> test file we try to make sure that the host matches it. If this was just a 
> frontend test we could just specify the host Triple and be done with it. 
> Maybe we could add some CMake options for which offloading libraries were 
> built?

Sorry I think I understand what's maybe happening here. I guess the OpenMP 
terminology here doesn't mesh with really well with the LLVM usages. The term 
"host" seems to be overloaded to mean two different things, either the OpenMP 
host target arch ("OpenMP host") or the arch LLVM was compiled for ("LLVM host 
triple").

So in this case, with AIX we have:

The OpenMP target from commandine is x86
The architecture clang/llvm is compiled for is PPC64 ("LLVM host triple")
The architecture the frontend is set to emit for/target is PPC32 ("OpenMP host 
architecture", "LLVM target triple")

(This is also what makes the diagnostic confusing, is it talking about the 
OpenMP host or the compiler host?)

The lit infrastructure uses the LLVM meaning, so config.host_triple is the 
compiler host, not the LLVM target / OpenMP host architecture. That is what I 
mean when I say "check the target instead", I mean check the LLVM target 
instead of the LLVM host triple.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89696/new/

https://reviews.llvm.org/D89696

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89696: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-21 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D89696#2344508 , @jhuber6 wrote:

> @daltenty Do you think this will fix the problem on AIX?

It's not just AIX that will have this problem I suspect. If you configure any 
cross-compiling build with a 64-bit host, targeting a 32-bit arch, your going 
to run into the problem. I think checking against a list of known 64-bit arches 
is good enough for the purposes here, but the check still needs to be against 
the target, not the host.

Also, the frontend diagnostic looks like it is off for the same reason:

  else if (getArchPtrSize(T) != getArchPtrSize(TT))
Diags.Report(diag::err_drv_incompatible_omp_arch)

T seems to be the target triple, not the host, but the diagnostic reads: 
`pointer size is incompatible with host`.




Comment at: clang/test/lit.cfg.py:172
+known_arches = ["x86_64", "mips64", "ppc64", "aarch64"]
+if (config.host_ldflags.find("-m32") < 0
+and any(config.host_triple.startswith(x) for x in known_arches)):

I don't think this check is meaningful. This just checks how llvm was built, it 
doesn't tell you anything about what clang driver is going to target out of the 
box, which is what we care about here.



Comment at: clang/test/lit.cfg.py:174
+and any(config.host_triple.startswith(x) for x in known_arches)):
   config.available_features.add("clang-64-bits")
 

Maybe this should be something like `clang-64-bit-default-target` instead to 
clarify what we mean.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89696/new/

https://reviews.llvm.org/D89696

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89696: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-20 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/OpenMP/driver-openmp-target.c:2
+// REQUIRES: x86-registered-target
+// REQUIRES: clang-64-bits
+// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=45 
-fopenmp-targets=x86_64-unknown-unknown -o - | FileCheck 
--check-prefix=CHECK-45-VERSION --check-prefix=CHECK-45-VERSION2 %s

This tests still fails on AIX, presumably because we have a 64-bit host but the 
compiler is targeting 32-bit by default:

```
error: OpenMP target architecture 'x86_64-unknown-unknown' pointer size is 
incompatible with host 'powerpc-ibm-aix7.2.0.0'
```

Maybe adjust the test to check the default target instead of just the host?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89696/new/

https://reviews.llvm.org/D89696

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87451: add new option -mignore-xcoff-visibility

2020-10-06 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, other minor nit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87451/new/

https://reviews.llvm.org/D87451

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87451: add new option -mignore-xcoff-visibility

2020-10-06 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:2622
+
+Do not emit any visibility attribute for asm on AIX or give all symbols 
'unspecified' visibility in xcoff object file (XCOFF only)
+

nit: plural. capitalization.



Comment at: clang/include/clang/Driver/Options.td:2566
+def mignore_xcoff_visibility : Flag<["-"], "mignore-xcoff-visibility">, 
Group,
+HelpText<"Not emit the visibility attribute for asm in AIX OS or give all 
symbols 'unspecified' visibility in xcoff object file">,
+  Flags<[CC1Option]>;





Comment at: llvm/lib/CodeGen/CommandFlags.cpp:340
+  cl::desc("Not emit the visibility attribute for asm in AIX OS or give "
+   "all symbols 'unspecified' visibility in xcoff object file"),
+  cl::init(false));

nit: capitalize XCOFF


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87451/new/

https://reviews.llvm.org/D87451

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87451: add new option -mignore-xcoff-visibility

2020-10-06 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/CodeGen/CommandFlags.cpp:339
+  "ignore-xcoff-visibility",
+  cl::desc("Not emit the visibility attribute for asm in AIX OS or give "
+   "all symbols 'unspecified' visibility in xcoff object file"),

nit: match description above


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87451/new/

https://reviews.llvm.org/D87451

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87451: add new option ignore-xcoff-visibility

2020-10-02 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:2622
+
+Do not emit any visibility attribute for asm on AIX or give all symbols 
'unspecified' visibility in xcoff object file(XCOFF only)
+

nit: add a space before parens



Comment at: clang/docs/ClangCommandLineReference.rst:2622
+
+Do not emit any visibility attribute for asm on AIX or give all symbols 
'unspecified' visibility in xcoff object file(XCOFF only)
+

daltenty wrote:
> nit: add a space before parens
I don't think the object file writing case was handled yet? This makes it sound 
like it is.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5242
 
+  if (const Arg *A = Args.getLastArg(options::OPT_mignore_xcoff_visibility)) {
+if (Triple.isOSAIX())

Use `Args.hasFlag` instead, since this option doesn't have a value we need to 
check.



Comment at: clang/test/CodeGen/aix-ignore-xcoff-visibility.cpp:72
+
+// ERROR: unsupported option '-mignore-xcoff-visibility' for target 
'powerpc-unknown-linux'
+

This isn't being checked anymore, also probably belongs in the other file



Comment at: clang/test/Driver/ignore-xcoff-visibility.cpp:2
+// RUN: %clang -### -target powerpc-unknown-aix  -mignore-xcoff-visibility -S 
%s 2> %t.log
+// RUN: FileCheck -check-prefix=CHECK %s < %t.log
+// CHECK: "-mignore-xcoff-visibility"

We should check the diagnostic here



Comment at: clang/test/Driver/ignore-xcoff-visibility.cpp:3
+// RUN: FileCheck -check-prefix=CHECK %s < %t.log
+// CHECK: "-mignore-xcoff-visibility"

nit: We should constrain this to be following the cc1 invocation


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87451/new/

https://reviews.llvm.org/D87451

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88500: [AIX][Clang][Driver] Link libm in c++ mode

2020-09-30 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGafc277b0ed0d: [AIX][Clang][Driver] Link libm in c++ mode 
(authored by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D88500?vs=295111=295355#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88500/new/

https://reviews.llvm.org/D88500

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-ORDER: "-lm"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
@@ -266,6 +277,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-LCXX: "-lm"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
@@ -285,6 +297,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: 

[PATCH] D88500: [AIX][Clang][Driver] Link libm in c++ mode

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 295111.
daltenty marked an inline comment as done.
daltenty added a comment.

- Make dependant on just c++ mode
- Add missing colons


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88500/new/

https://reviews.llvm.org/D88500

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-ORDER: "-lm"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
@@ -266,6 +277,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-LCXX: "-lm"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
@@ -285,6 +297,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-CXX-ARG-LCXX: "-lm"
 // 

[PATCH] D88500: [AIX][Clang][Driver] Link libm when we would libc++

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 295107.
daltenty added a comment.

- Add blank line


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88500/new/

https://reviews.llvm.org/D88500

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-ORDER: "-lm"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
@@ -266,6 +277,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-LCXX: "-lm"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
@@ -285,6 +297,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-CXX-ARG-LCXX: "-lm"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 

[PATCH] D88500: [AIX][Clang][Driver] Link libm when we would libc++

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 295105.
daltenty added a comment.

- Remove deps comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88500/new/

https://reviews.llvm.org/D88500

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-ORDER: "-lm"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
@@ -266,6 +277,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-LCXX: "-lm"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
@@ -285,6 +297,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-CXX-ARG-LCXX: "-lm"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 

[PATCH] D88500: [AIX][Clang][Driver] Link libm along with libc++

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, DiggerLin.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

since libc++ has dependencies on libm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88500

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-ORDER: "-lm"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. lc++ and lc order.
@@ -266,6 +277,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-CXX-ARG-LCXX: "-lm"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. lc++ and lc order.
@@ -285,6 +297,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-CXX-ARG-LCXX: "-lm"
 

[PATCH] D88182: [clang][driver][AIX] Set compiler-rt as default rtlib

2020-09-28 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGee80615b5c1c: [clang][driver][AIX] Set compiler-rt as 
default rtlib (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88182/new/

https://reviews.llvm.org/D88182

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-ld.c
  clang/test/Driver/aix-rtlib.c

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
 // CHECK-LD32-PTHREAD-NOT: warning:
 // CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthreads \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
 // CHECK-LD64-PTHREAD-NOT: warning:
 // CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // 

[PATCH] D88182: [clang][driver][AIX] Set compiler-rt as default rtlib

2020-09-28 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 294822.
daltenty added a comment.

- Remove blankline
- Fix path seperators in second test as well


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88182/new/

https://reviews.llvm.org/D88182

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-ld.c
  clang/test/Driver/aix-rtlib.c

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
 // CHECK-LD32-PTHREAD-NOT: warning:
 // CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthreads \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
 // CHECK-LD64-PTHREAD-NOT: warning:
 // CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
 // 

[PATCH] D87451: add new clang option -mno-xcoff-visibility

2020-09-24 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/include/llvm/Target/TargetMachine.h:265
+  /// corresponding to -mno-xcoff-visibility.
+  bool getNoXCOFFVisibility() const { return Options.NoXCOFFVisibility; }
+

DiggerLin wrote:
> jasonliu wrote:
> > DiggerLin wrote:
> > > daltenty wrote:
> > > > This seems like it needs the corresponding comand-line option for llc 
> > > > added and an llc test.
> > > I think it will be in another separate  patch.
> > I would actually prefer to have that in the same patch, as that would give 
> > us a full picture. It's not a huge patch even if we combine them. 
> yes, it is not huge patch, one patch for the clang with option 
> -mno-xcoff-visibility, another patch for llc option -no-xcoff-visibility , I 
> think it is different functionality. and I have post the 
> https://reviews.llvm.org/D88234 "add new option -no-xcoff-visibility for llc"
But the problem is this patch actually introduces the backend functionality 
with no test in the LLVM component itself, because the test here is Clang only. 
Either the patches should be merged so both components get tests in one patch 
or both refactored so we have one llc/LLVM patch and one clang patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87451/new/

https://reviews.llvm.org/D87451

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88182: [clang][driver][AIX] Set compiler-rt as default rtlib

2020-09-24 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 294053.
daltenty added a comment.

- Fix formating
- Fix typos
- Replace pattern with windows-friendly directory seperators


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88182/new/

https://reviews.llvm.org/D88182

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-ld.c
  clang/test/Driver/aix-rtlib.c

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir/lib/aix/libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir/lib/aix/libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
 // CHECK-LD32-PTHREAD-NOT: warning:
 // CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthreads \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
 // CHECK-LD64-PTHREAD-NOT: warning:
 // CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
 // 

[PATCH] D88182: [clang][driver][AIX] Set compiler-rt as default rtlib

2020-09-23 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, hubert.reinterpretcast, jasonliu, 
Xiangling_L.
Herald added subscribers: cfe-commits, dberris.
Herald added a project: clang.
daltenty requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88182

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-ld.c
  clang/test/Driver/aix-rtlib.c

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,8 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:		-resource-dir=%S/Inputs/resource_dir | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:		-resource-dir=%S/Inputs/resource_dir   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir/lib/aix/libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir/lib/aix/libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]/lib/aix/libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]/lib/aix/libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
 // CHECK-LD32-PTHREAD-NOT: warning:
 // CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]/lib/aix/libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthreads \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
 // CHECK-LD64-PTHREAD-NOT: warning:
 // CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
 // CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // 

[PATCH] D88105: [NFC] [PPC] Add PowerPC expected IR tests for C99 complex

2020-09-23 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88105/new/

https://reviews.llvm.org/D88105

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87451: add new clang option -mno-xcoff-visibility

2020-09-22 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/include/llvm/Target/TargetMachine.h:265
+  /// corresponding to -mno-xcoff-visibility.
+  bool getNoXCOFFVisibility() const { return Options.NoXCOFFVisibility; }
+

This seems like it needs the corresponding comand-line option for llc added and 
an llc test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87451/new/

https://reviews.llvm.org/D87451

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87927: [AIX][clang][driver] Make sure crti[_64].o is linked in C++ mode

2020-09-22 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe8fb4eba4fb6: [AIX][clang][driver] Make sure crti[_64].o is 
linked in C++ mode (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87927/new/

https://reviews.llvm.org/D87927

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -14,6 +14,7 @@
 // CHECK-LD32: "-b32"
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "-lc"
@@ -31,6 +32,7 @@
 // CHECK-LD64: "-b64"
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "-lc"
@@ -49,6 +51,7 @@
 // CHECK-LD32-PTHREAD: "-b32"
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -68,6 +71,7 @@
 // CHECK-LD64-PTHREAD: "-b64"
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -87,6 +91,7 @@
 // CHECK-LD32-PROF: "-b32"
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
+// CHECK-LD32-PROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "-lc"
@@ -105,6 +110,7 @@
 // CHECK-LD64-GPROF: "-b64"
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
+// CHECK-LD64-GPROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "-lc"
@@ -123,6 +129,7 @@
 // CHECK-LD32-STATIC: "-b32"
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-STATIC-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "-lc"
@@ -141,6 +148,7 @@
 // CHECK-LD32-LIBP: "-b32"
 // CHECK-LD32-LIBP: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-LIBP-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
@@ -161,6 +169,7 @@
 // CHECK-LD32-NO-STD-LIB: "-b32"
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -181,6 +190,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-b64"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
@@ -199,6 +209,7 @@
 // CHECK-LD32-CXX-ARG-ORDER: "-b32"
 // CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
@@ -216,6 +227,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-b32"
 // CHECK-LD32-CXX-ARG-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // 

[PATCH] D87927: [AIX][clang][driver] Make sure crti[_64].o is linked in C++ mode

2020-09-21 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 293262.
daltenty added a comment.

- Check absence in C cases
- Add a note about crti in the nostdlib++ case


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87927/new/

https://reviews.llvm.org/D87927

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -14,6 +14,7 @@
 // CHECK-LD32: "-b32"
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "-lc"
@@ -31,6 +32,7 @@
 // CHECK-LD64: "-b64"
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "-lc"
@@ -49,6 +51,7 @@
 // CHECK-LD32-PTHREAD: "-b32"
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -68,6 +71,7 @@
 // CHECK-LD64-PTHREAD: "-b64"
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -87,6 +91,7 @@
 // CHECK-LD32-PROF: "-b32"
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
+// CHECK-LD32-PROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "-lc"
@@ -105,6 +110,7 @@
 // CHECK-LD64-GPROF: "-b64"
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
+// CHECK-LD64-GPROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "-lc"
@@ -123,6 +129,7 @@
 // CHECK-LD32-STATIC: "-b32"
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-STATIC-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "-lc"
@@ -141,6 +148,7 @@
 // CHECK-LD32-LIBP: "-b32"
 // CHECK-LD32-LIBP: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-LIBP-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
@@ -161,6 +169,7 @@
 // CHECK-LD32-NO-STD-LIB: "-b32"
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -181,6 +190,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-b64"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
@@ -199,6 +209,7 @@
 // CHECK-LD32-CXX-ARG-ORDER: "-b32"
 // CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
@@ -216,6 +227,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-b32"
 // CHECK-LD32-CXX-ARG-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-LCXX: 

[PATCH] D87914: [AIX][Clang][Driver] Add handling of shared option

2020-09-21 Thread David Tenty via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd8540427419e: [AIX][Clang][Driver] Add handling of shared 
option (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87914/new/

https://reviews.llvm.org/D87914

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-SHARED: "-bM:SRE"
+// CHECK-LD64-SHARED: "-bnoentry"
+// CHECK-LD64-SHARED: "-b64"
+// CHECK-LD64-SHARED: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-SHARED: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -92,6 +92,12 @@
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-bnso");
 
+  // Add options for shared libraries.
+  if (Args.hasArg(options::OPT_shared)) {
+CmdArgs.push_back("-bM:SRE");
+CmdArgs.push_back("-bnoentry");
+  }
+
   // Specify linker output file.
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
@@ -123,7 +129,8 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+   options::OPT_shared)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// 

[PATCH] D87904: [AIX][Clang][Driver] Add handling of nostartfiles option

2020-09-21 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG699089f2a970: [AIX][Clang][Driver] Add handling of 
nostartfiles option (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87904/new/

https://reviews.llvm.org/D87904

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -123,7 +123,7 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" 

[PATCH] D87927: [AIX][clang][driver] Make sure ctri.o is linked in C++ mode

2020-09-18 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

since crti is required for functional static initialization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87927

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -199,6 +199,7 @@
 // CHECK-LD32-CXX-ARG-ORDER: "-b32"
 // CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
@@ -216,6 +217,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-b32"
 // CHECK-LD32-CXX-ARG-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
@@ -231,6 +233,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-b64"
 // CHECK-LD64-CXX-ARG-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc"
@@ -247,6 +250,7 @@
 // CHECK-LD32-NODEFLIB-LCXX: "-b32"
 // CHECK-LD32-NODEFLIB-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NODEFLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NODEFLIB-LCXX-NOT: "-lc++"
 // CHECK-LD32-NODEFLIB-LCXX-NOT: "-lc"
@@ -263,6 +267,7 @@
 // CHECK-LD64-NODEFLIB-LCXX: "-b64"
 // CHECK-LD64-NODEFLIB-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NODEFLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NODEFLIB-LCXX-NOT: "-lc++"
 // CHECK-LD64-NODEFLIB-LCXX-NOT: "-lc"
@@ -279,6 +284,7 @@
 // CHECK-LD32-NOSTDLIB-LCXX: "-b32"
 // CHECK-LD32-NOSTDLIB-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NOSTDLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTDLIB-LCXX-NOT: "-lc++"
 // CHECK-LD32-NOSTDLIB-LCXX-NOT: "-lc"
@@ -295,6 +301,7 @@
 // CHECK-LD64-NOSTDLIB-LCXX: "-b64"
 // CHECK-LD64-NOSTDLIB-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NOSTDLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOSTDLIB-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIB-LCXX-NOT: "-lc"
@@ -311,6 +318,7 @@
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-b32"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-lc"
@@ -327,6 +335,7 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-b64"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
@@ -343,6 +352,7 @@
 // CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
 // CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
 // CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
@@ -359,6 +369,7 @@
 // CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
 // CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// 

[PATCH] D87914: [AIX][Clang][Driver] Add handling of shared option

2020-09-18 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87914

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-SHARED: "-bM:SRE"
+// CHECK-LD64-SHARED: "-bnoentry"
+// CHECK-LD64-SHARED: "-b64"
+// CHECK-LD64-SHARED: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-SHARED: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -92,6 +92,12 @@
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-bnso");
 
+  // Add options for shared libraries.
+  if (Args.hasArg(options::OPT_shared)) {
+CmdArgs.push_back("-bM:SRE");
+CmdArgs.push_back("-bnoentry");
+  }
+
   // Specify linker output file.
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
@@ -123,7 +129,8 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+   options::OPT_shared)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-SHARED: "-bM:SRE"
+// CHECK-LD64-SHARED:  

[PATCH] D87904: [AIX][Clang][Driver] Add handling of nostartfiles option

2020-09-18 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87904

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -123,7 +123,7 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// 

[PATCH] D84880: [AIX] Temporarily disable IncrementalProcessingTest partially

2020-07-29 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84880/new/

https://reviews.llvm.org/D84880

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81958: [clangd] Add library to semantically strip flags by name.

2020-07-14 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang-tools-extra/clangd/CompileCommands.cpp:15
 #include "clang/Tooling/ArgumentsAdjusters.h"
+#include "llvm/Option/Option.h"
+#include "llvm/Support/Allocator.h"

This breaks the powerpc64le bots. Looks like we aren't linking against Option:

```
CompileCommands.cpp:(.text._ZZN5clang6clangd11ArgStripper8rulesForEN4llvm9StringRefEENK3$_3clEv+0x514c):
 undefined reference to 
`llvm::opt::OptTable::getOption(llvm::opt::OptSpecifier) const'
```

http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/5697/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81958/new/

https://reviews.llvm.org/D81958



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82476: [Clang][Driver] Recognize the AIX OBJECT_MODE environment setting

2020-07-09 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG25ec96d91a3a: [Clang][Driver] Recognize the AIX OBJECT_MODE 
environment setting (authored by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D82476?vs=273071=276803#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82476/new/

https://reviews.llvm.org/D82476

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/aix-object-mode.c


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check that setting an OBJECT_MODE converts the AIX triple to the right 
variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck 
-check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck 
-check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG 
%s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid 
setting.
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -475,6 +475,26 @@
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  llvm::Triple::ArchType AT = llvm::Triple::UnknownArch;
+
+  if (ObjectMode.equals("64")) {
+AT = Target.get64BitArchVariant().getArch();
+  } else if (ObjectMode.equals("32")) {
+AT = Target.get32BitArchVariant().getArch();
+  } else {
+D.Diag(diag::err_drv_invalid_object_mode) << ObjectMode;
+  }
+
+  if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
+Target.setArch(AT);
+}
+  }
+
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
   Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_mx32,
options::OPT_m32, options::OPT_m16);
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -509,4 +509,6 @@
   InGroup>;
 
 def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
+
+def err_drv_invalid_object_mode : Error<"OBJECT_MODE setting %0 is not 
recognized and is not a valid setting.">;
 }


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check that setting an OBJECT_MODE converts the AIX triple to the right variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck -check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG %s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid setting.
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -475,6 +475,26 @@
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  

[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-07-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a2f4824cb2d: [Clang] Handle AIX Include management in the 
driver (authored by ShuhongL, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/lib/Frontend/InitHeaderSearch.cpp
  clang/test/Driver/aix-toolchain-include.cpp

Index: clang/test/Driver/aix-toolchain-include.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-toolchain-include.cpp
@@ -0,0 +1,136 @@
+// Tests that the AIX toolchain adds system includes to its search path.
+
+// Check powerpc-ibm-aix, 32-bit/64-bit.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// CHECK-INTERNAL-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[SYSROOT]]/usr/include"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// CHECK-NOSTDINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE-NOT:	"-internal-isystem"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdlibinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// CHECK-NOSTDLIBINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// 

[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-07-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a2f4824cb2d: [Clang] Handle AIX Include management in the 
driver (authored by ShuhongL, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/lib/Frontend/InitHeaderSearch.cpp
  clang/test/Driver/aix-toolchain-include.cpp

Index: clang/test/Driver/aix-toolchain-include.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-toolchain-include.cpp
@@ -0,0 +1,136 @@
+// Tests that the AIX toolchain adds system includes to its search path.
+
+// Check powerpc-ibm-aix, 32-bit/64-bit.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// CHECK-INTERNAL-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[SYSROOT]]/usr/include"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// CHECK-NOSTDINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE-NOT:	"-internal-isystem"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdlibinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// CHECK-NOSTDLIBINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// 

[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-07-03 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:195
+  // Return if -nostdlibinc is specified as a driver option.
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+return;

hubert.reinterpretcast wrote:
> stevewan wrote:
> > Can we rewrite this block of code so that it's in consistent with the 
> > previous one?
> > ```
> >   if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) {
> > // Add /usr/include.
> > SmallString<128> UP(Sysroot);
> > path::append(UP, "/usr/include");
> > addSystemInclude(DriverArgs, CC1Args, UP.str());
> >   }
> > ```
> I think the current expression with the early exit is friendlier for future 
> expansion. @daltenty, do you have an opinion on this?
I tend to agree, everything below this point should be standard system includes 
that all should get ignored with `nostdlibinc` so I think the early exit makes 
sense.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-07-02 Thread David Tenty via Phabricator via cfe-commits
daltenty requested changes to this revision.
daltenty added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:172
+return;
+
+  const Driver  = getDriver();

hubert.reinterpretcast wrote:
> Please investigate the handling of `OPT_nostdlibinc`.
If we are looking at this, should we also consider adding `/usr/local/include`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-07-02 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM other than minor nit




Comment at: clang/test/Driver/aix-toolchain-include.cpp:13
+
+// Check powerpc-ibm-aix, 64-bit.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \

nit: we usually put the 32-bit / 64-bit run lines together before the CHECK 
block for readabliity


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-06-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:8
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL32-INCLUDE %s
+// CHECK-INTERNAL32-INCLUDE: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL32-INCLUDE: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"

I don't think we need a separate check prefix for 32/64-bit cases, just the RUN 
statements. Since the expected output is the same they can share the same 
prefix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-06-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:1
+// Tests that aix toolchain adds system includes to the search path
+

nit: aix->AIX
nit: period at end of comment.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:5
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:-resource-dir=%S/Inputs/resource_dir \

I think we should test the 64-bit target as well.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:15
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:-resource-dir=%S/Inputs/resource_dir \

Same comment as above


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82677/new/

https://reviews.llvm.org/D82677



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D82476: [Clang][Driver] Recognize the AIX OBJECT_MODE environment setting

2020-06-24 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, hubert.reinterpretcast, ShuhongL.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

AIX uses an environment variable called OBJECT_MODE to indicate to
utilities in the toolchain whether they should be operating in 32-bit or
64-bit mode. This patch makes the clang driver recognize the current
OBJECT_MODE setting when we are operating with an AIX target and adds a
custom diagnostic for invalid settings.

For more details about OBJECT_MODE on AIX see:

https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/tusetenv1.html
https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/opt_3264.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82476

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/aix-object-mode.c


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check setting an OBJECT_MODE converts the AIX triple to the right variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck 
-check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck 
-check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG 
%s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid 
setting.
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -474,6 +474,26 @@
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  llvm::Triple::ArchType AT = llvm::Triple::UnknownArch;
+
+  if (ObjectMode.equals("64")) {
+AT = Target.get64BitArchVariant().getArch();
+  } else if (ObjectMode.equals("32")) {
+AT = Target.get32BitArchVariant().getArch();
+  } else {
+D.Diag(diag::err_drv_invalid_object_mode) << ObjectMode;
+  }
+
+  if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
+Target.setArch(AT);
+}
+  }
+
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
   Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_mx32,
options::OPT_m32, options::OPT_m16);
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -509,4 +509,6 @@
   InGroup>;
 
 def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
+
+def err_drv_invalid_object_mode : Error<"OBJECT_MODE setting %0 is not 
recognized and is not a valid setting.">;
 }


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check setting an OBJECT_MODE converts the AIX triple to the right variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck -check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG %s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid setting.
Index: clang/lib/Driver/Driver.cpp
===
--- 

[PATCH] D74166: [AIX][Frontend] Static init implementation for AIX considering no priority

2020-04-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:583
+  if (UseSinitAndSterm)
+GlobalUniqueModuleId = getUniqueModuleId(()).substr(1);
+

if `getUniqueModuleId()` returns an empy string, which it does for modules 
which don't export any symbols, the `substr()` will throw an `OutOfRange` 
exception.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74166/new/

https://reviews.llvm.org/D74166



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69825: [Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation

2020-03-11 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

On AIX and PPC LE Linux after this change we are seeing invalid accesses when 
the backend asserts/fatal_errors. Looks like the driver and CC1 now share some 
global TimerGroup state that points to Timers which got created by CC1 but 
didn't get cleanup after the assert. Reported as: 
https://bugs.llvm.org/show_bug.cgi?id=45164

Example failure:

  ./bin/clang ./llvm-project/clang/test/CodeGenObjC/illegal-UTF8.m -S -target 
powerpc-ibm-aix
  ...
  fatal error: error in backend: Unhandled linkage when mapping linkage to 
StorageClass.
  Stack dump:
  ...
  ***
  AddressSanitizer:DEADLYSIGNAL
  =
  ==37262==ERROR: AddressSanitizer: SEGV on unknown address 0x10715768 (pc 
0x3fffb7cdb2c4 bp 0x3e1fb764cdb0 sp 0x3fffc460 T0)
  ==37262==The signal is caused by a UNKNOWN memory access.
  #0 0x3fffb7cdb2c0 in std::basic_string, 
std::allocator >::basic_string(std::string const&) 
(/lib64/libstdc++.so.6+0x11b2c0)
  #1 0x16ca75c0 in PrintRecord 
/home/daltenty/llvm/dev/llvm-project/llvm/include/llvm/Support/Timer.h:180:21
  #2 0x16ca75c0 in construct &, std::basic_string &> 
/opt/rh/devtoolset-7/root/usr/lib/gcc/ppc64le-redhat-linux/7/../../../../include/c++/7/ext/new_allocator.h:136:23
  #3 0x16ca75c0 in construct &, std::basic_string &> 
/opt/rh/devtoolset-7/root/usr/lib/gcc/ppc64le-redhat-linux/7/../../../../include/c++/7/bits/alloc_traits.h:475:8
  #4 0x16ca75c0 in void std::vector 
>::_M_realloc_insert(__gnu_cxx::__normal_iterator > >, llvm::TimeRecord&, 
std::string&, std::string&) 
/opt/rh/devtoolset-7/root/usr/lib/gcc/ppc64le-redhat-linux/7/../../../../include/c++/7/bits/vector.tcc:415:4
  #5 0x16ca2220 in emplace_back 
&, std::basic_string &> 
/opt/rh/devtoolset-7/root/usr/lib/gcc/ppc64le-redhat-linux/7/../../../../include/c++/7/bits/vector.tcc:105:4
  #6 0x16ca2220 in llvm::TimerGroup::prepareToPrintList(bool) 
/home/daltenty/llvm/dev/llvm-project/llvm/lib/Support/Timer.cpp:359:19
  #7 0x16ca2498 in llvm::TimerGroup::print(llvm::raw_ostream&, bool) 
/home/daltenty/llvm/dev/llvm-project/llvm/lib/Support/Timer.cpp:373:5
  #8 0x16ca2a4c in llvm::TimerGroup::printAll(llvm::raw_ostream&) 
/home/daltenty/llvm/dev/llvm-project/llvm/lib/Support/Timer.cpp:391:9
  #9 0x107f1940 in main 
/home/daltenty/llvm/dev/llvm-project/clang/tools/driver/driver.cpp:535:3
  #10 0x3fffb79b497c in generic_start_main.isra.0 (/lib64/libc.so.6+0x2497c)
  
  AddressSanitizer can not provide additional info.
  SUMMARY: AddressSanitizer: SEGV (/lib64/libstdc++.so.6+0x11b2c0) in 
std::basic_string, std::allocator 
>::basic_string(std::string const&)
  ==37262==ABORTING




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69825/new/

https://reviews.llvm.org/D69825



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-18 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG58817a0783ca: [clang][XCOFF] Indicate that XCOFF does not 
support COMDATs (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74631/new/

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/docs/LangRef.rst
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -910,8 +910,8 @@
 The linker may choose any COMDAT key but the sections must contain the
 same amount of data.
 
-Note that the Mach-O platform doesn't support COMDATs, and ELF and WebAssembly
-only support ``any`` as a selection kind.
+Note that XCOFF and the Mach-O platform don't support COMDATs, and ELF and
+WebAssembly only support ``any`` as a selection kind.
 
 Here is an example of a COMDAT group where a function will only be selected if
 the COMDAT key's section is the largest:
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -910,8 +910,8 @@
 The linker may choose any COMDAT key but the sections must contain the
 same amount of data.
 
-Note that the Mach-O platform doesn't support COMDATs, and ELF and WebAssembly
-only support ``any`` as a selection kind.
+Note that XCOFF and the Mach-O platform don't support COMDATs, and ELF and
+WebAssembly only support ``any`` as a selection kind.
 
 Here is an example of a COMDAT group where a function will only be selected if
 the COMDAT key's section is the largest:
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-18 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 245201.
daltenty added a comment.
Herald added subscribers: aheejin, dschuff.

- Update lang doc to indicate XCOFF doesn't support COMDAT


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74631/new/

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/docs/LangRef.rst
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -910,8 +910,8 @@
 The linker may choose any COMDAT key but the sections must contain the
 same amount of data.
 
-Note that the Mach-O platform doesn't support COMDATs, and ELF and WebAssembly
-only support ``any`` as a selection kind.
+Note that XCOFF and the Mach-O platform don't support COMDATs, and ELF and
+WebAssembly only support ``any`` as a selection kind.
 
 Here is an example of a COMDAT group where a function will only be selected if
 the COMDAT key's section is the largest:
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: llvm/docs/LangRef.rst
===
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -910,8 +910,8 @@
 The linker may choose any COMDAT key but the sections must contain the
 same amount of data.
 
-Note that the Mach-O platform doesn't support COMDATs, and ELF and WebAssembly
-only support ``any`` as a selection kind.
+Note that XCOFF and the Mach-O platform don't support COMDATs, and ELF and
+WebAssembly only support ``any`` as a selection kind.
 
 Here is an example of a COMDAT group where a function will only be selected if
 the COMDAT key's section is the largest:
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-18 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D74631#1876995 , @sfertile wrote:

> 1. We should probably update the COMDAT section of the lang ref to mention 
> XCOFF doesn't support COMDATS.


I will update the langref as suggested.

> 2. Will we report an error somewhere in the backend if we encounter a COMDAT?

As mentioned by @Xiangling_L, we will run into `report_fatal_error("COMDAT not 
yet supported by AIX.")`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74631/new/

https://reviews.llvm.org/D74631



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-14 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 244708.
daltenty added a comment.

- Add missing newline


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74631/new/

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-14 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, sfertile, Xiangling_L.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith.
Herald added projects: clang, LLVM.
daltenty updated this revision to Diff 244708.
daltenty added a comment.

- Add missing newline


XCOFF doesn't support COMDATs, so clang shouldn't emit them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74015: [AIX][Frontend] C++ ABI customizations for AIX boilerplate

2020-02-11 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/include/clang/Basic/TargetCXXABI.h:116
+///   - static initialization is adjusted to use sinit and sterm functions;
+XL_Clang,
+

Why the underscore in the name? This is a bit inconsistent with both the LLVM 
naming convention here and the name as it appears in other sources.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74015/new/

https://reviews.llvm.org/D74015



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69620: Add AIX assembler support

2019-12-02 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3ebfab709583: Add AIX assembler support (authored by 
stevewan, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69620/new/

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/Inputs/aix_ppc_tree/dummy0.s
  clang/test/Driver/Inputs/aix_ppc_tree/dummy1.s
  clang/test/Driver/Inputs/aix_ppc_tree/dummy2.s
  clang/test/Driver/aix-as.c

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,73 @@
+// General tests that as(1) invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-u" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-u" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-Xassembler %s
+// CHECK-AS32-Xassembler-NOT: warning:
+// CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-Xassembler: "-a32" 
+// CHECK-AS32-Xassembler: "-u" 
+// CHECK-AS32-Xassembler: "-many"
+// CHECK-AS32-Xassembler: "-w"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-Wa %s
+// CHECK-AS64-Wa-NOT: warning:
+// CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-Wa: "-a64" 
+// CHECK-AS64-Wa: "-u" 
+// CHECK-AS64-Wa: "-many"
+// CHECK-AS64-Wa: "-v"
+// CHECK-AS64-Wa: "-w"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Multiple input files.
+// RUN: %clang -no-canonical-prefixes -### -c \
+// RUN: %S/Inputs/aix_ppc_tree/dummy0.s \
+// RUN: %S/Inputs/aix_ppc_tree/dummy1.s \
+// RUN: %S/Inputs/aix_ppc_tree/dummy2.s 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-MultiInput %s
+// CHECK-AS32-MultiInput-NOT: warning:
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool isPICDefaultForced() const override { return true; }
 
 protected:
+  Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
 };
 
Index: clang/lib/Driver/ToolChains/AIX.cpp

[PATCH] D69620: Add AIX assembler support

2019-11-29 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

Other than minor nit, LGTM




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:68
+  if (Inputs.size() != 1)
+llvm_unreachable("Invalid number of input file.");
+  const InputInfo  = Inputs[0];

nit: plural, "files"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69620/new/

https://reviews.llvm.org/D69620



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70675: [AIX] Disable clang python binding tests

2019-11-26 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa38fc6164879: [AIX] Disable clang python binding tests 
(authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70675/new/

https://reviews.llvm.org/D70675

Files:
  clang/bindings/python/tests/CMakeLists.txt


Index: clang/bindings/python/tests/CMakeLists.txt
===
--- clang/bindings/python/tests/CMakeLists.txt
+++ clang/bindings/python/tests/CMakeLists.txt
@@ -32,6 +32,11 @@
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# The Python FFI interface is broken on AIX: 
https://bugs.python.org/issue38628.
+if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # AArch64, Hexagon, and Sparc have known test failures that need to be
 # addressed.
 # SystemZ has broken Python/FFI interface:


Index: clang/bindings/python/tests/CMakeLists.txt
===
--- clang/bindings/python/tests/CMakeLists.txt
+++ clang/bindings/python/tests/CMakeLists.txt
@@ -32,6 +32,11 @@
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# The Python FFI interface is broken on AIX: https://bugs.python.org/issue38628.
+if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # AArch64, Hexagon, and Sparc have known test failures that need to be
 # addressed.
 # SystemZ has broken Python/FFI interface:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70675: [AIX] Disable clang python binding tests

2019-11-25 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

The Python ctypes FFI interface is broken on AIX, it cannot properly pass
structures containing  arrays ( https://bugs.python.org/issue38628). So
disable the clang python binding tests on AIX till this is resolved.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70675

Files:
  clang/bindings/python/tests/CMakeLists.txt


Index: clang/bindings/python/tests/CMakeLists.txt
===
--- clang/bindings/python/tests/CMakeLists.txt
+++ clang/bindings/python/tests/CMakeLists.txt
@@ -32,6 +32,11 @@
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# The Python FFI interface is broken on AIX: 
https://bugs.python.org/issue38628.
+if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # AArch64, Hexagon, and Sparc have known test failures that need to be
 # addressed.
 # SystemZ has broken Python/FFI interface:


Index: clang/bindings/python/tests/CMakeLists.txt
===
--- clang/bindings/python/tests/CMakeLists.txt
+++ clang/bindings/python/tests/CMakeLists.txt
@@ -32,6 +32,11 @@
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# The Python FFI interface is broken on AIX: https://bugs.python.org/issue38628.
+if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # AArch64, Hexagon, and Sparc have known test failures that need to be
 # addressed.
 # SystemZ has broken Python/FFI interface:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69620: Add AIX assembler support

2019-11-18 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.h:26
+
+  bool hasIntegratedCPP() const override { return false; }
+

stevewan wrote:
> Xiangling_L wrote:
> > I saw a lot of other target also set `hasIntegratedCPP()` as false, but I 
> > didn't find any explanation in documentation, so I am curious that what 
> > this is about?
> I also failed to find useful resources that explains the purpose of this 
> function. The main rationales of adding it were essentially that,
> 1. It's a pure virtual function in the base `Tool` class,
> 2. Most if not all of other targets had overridden this function such that it 
> returns false.
> 
> I'll leave this comment open, and see if someone could enlighten us. 
Only "Compiler" tools set hasIntegratedCPP() to true. Looking into it, it seems 
combineWithPreprocessor() uses this to decide whether the tool supports 
preprocessor actions so it may fold them in to one step.  I think we are safe 
leaving this as is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69620/new/

https://reviews.llvm.org/D69620



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69638: [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()

2019-11-06 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6740a88dc18d: [NFC] Add SUPPORT_PLUGINS to 
add_llvm_executable() (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69638/new/

https://reviews.llvm.org/D69638

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt

Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -24,9 +24,6 @@
   Passes
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(opt
   AnalysisWrappers.cpp
   BreakpointPrinter.cpp
@@ -39,6 +36,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(opt)
 
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -19,13 +19,11 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(llc
   llc.cpp
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(llc)
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -21,9 +21,6 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(bugpoint
   BugDriver.cpp
   CrashDebugger.cpp
@@ -37,6 +34,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(bugpoint)
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -732,7 +732,7 @@
 
 macro(add_llvm_executable name)
   cmake_parse_arguments(ARG
-"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
+"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
 "ENTITLEMENTS;BUNDLE_PATH"
 "DEPENDS"
 ${ARGN})
@@ -782,6 +782,11 @@
   if(NOT LLVM_ENABLE_OBJLIB)
 llvm_update_compile_flags(${name})
   endif()
+
+  if (ARG_SUPPORT_PLUGINS)
+set(LLVM_NO_DEAD_STRIP On)
+  endif()
+
   add_link_opts( ${name} )
 
   # Do not add -Dname_EXPORTS to the command-line when building files in this
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -19,10 +19,9 @@
 
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
-# Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# Support plugins.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(support_plugins SUPPORT_PLUGINS)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)
@@ -37,6 +36,7 @@
 
   DEPENDS
   ${tablegen_deps}
+  ${support_plugins}
   )
 
 clang_target_link_libraries(clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69638: [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()

2019-11-01 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 227463.
daltenty marked an inline comment as done.
daltenty added a comment.

- Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69638/new/

https://reviews.llvm.org/D69638

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt

Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -24,9 +24,6 @@
   Passes
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(opt
   AnalysisWrappers.cpp
   BreakpointPrinter.cpp
@@ -39,6 +36,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(opt)
 
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -19,13 +19,11 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(llc
   llc.cpp
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(llc)
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -21,9 +21,6 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(bugpoint
   BugDriver.cpp
   CrashDebugger.cpp
@@ -37,6 +34,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(bugpoint)
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -732,7 +732,7 @@
 
 macro(add_llvm_executable name)
   cmake_parse_arguments(ARG
-"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
+"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
 "ENTITLEMENTS;BUNDLE_PATH"
 "DEPENDS"
 ${ARGN})
@@ -782,6 +782,11 @@
   if(NOT LLVM_ENABLE_OBJLIB)
 llvm_update_compile_flags(${name})
   endif()
+
+  if (ARG_SUPPORT_PLUGINS)
+set(LLVM_NO_DEAD_STRIP On)
+  endif()
+
   add_link_opts( ${name} )
 
   # Do not add -Dname_EXPORTS to the command-line when building files in this
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -19,10 +19,9 @@
 
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
-# Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# Support plugins.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(support_plugins SUPPORT_PLUGINS)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)
@@ -37,6 +36,7 @@
 
   DEPENDS
   ${tablegen_deps}
+  ${support_plugins}
   )
 
 clang_target_link_libraries(clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69638: [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()

2019-11-01 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 227461.
daltenty added a comment.

- Address review comments round 1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69638/new/

https://reviews.llvm.org/D69638

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt

Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -24,9 +24,6 @@
   Passes
   )
 
-# Support plugins.
-set(LLVM_SUPPORT_PLUGINS 1)
-
 add_llvm_tool(opt
   AnalysisWrappers.cpp
   BreakpointPrinter.cpp
@@ -39,6 +36,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(opt)
 
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -19,13 +19,11 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_SUPPORT_PLUGINS 1)
-
 add_llvm_tool(llc
   llc.cpp
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(llc)
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -21,9 +21,6 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_SUPPORT_PLUGINS 1)
-
 add_llvm_tool(bugpoint
   BugDriver.cpp
   CrashDebugger.cpp
@@ -37,6 +34,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(bugpoint)
 
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -744,7 +744,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_SUPPORT_PLUGINS is set.
+# flags instead if LLVM_NO_DEAD_STRIP is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_SUPPORT_PLUGINS)
+if(NOT LLVM_NO_DEAD_STRIP)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_SUPPORT_PLUGINS
+else() #LLVM_NO_DEAD_STRIP
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")
@@ -732,7 +732,7 @@
 
 macro(add_llvm_executable name)
   cmake_parse_arguments(ARG
-"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
+"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
 "ENTITLEMENTS;BUNDLE_PATH"
 "DEPENDS"
 ${ARGN})
@@ -782,6 +782,11 @@
   if(NOT LLVM_ENABLE_OBJLIB)
 llvm_update_compile_flags(${name})
   endif()
+
+  if (ARG_SUPPORT_PLUGINS)
+set(LLVM_NO_DEAD_STRIP On)
+  endif()
+
   add_link_opts( ${name} )
 
   # Do not add -Dname_EXPORTS to the command-line when building files in this
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -19,10 +19,9 @@
 
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
-# Support plugins. This must be before add_clang_executable as it reads
-# LLVM_SUPPORT_PLUGINS.
+# Support plugins.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_SUPPORT_PLUGINS 1)
+  set(support_plugins SUPPORT_PLUGINS)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)
@@ -37,6 +36,7 @@
 
   DEPENDS
   ${tablegen_deps}
+  ${support_plugins}
   )
 
 clang_target_link_libraries(clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Revised direction in https://reviews.llvm.org/D69638


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69638: [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()

2019-10-30 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added subscribers: llvm-commits, cfe-commits, mgorny.
Herald added projects: clang, LLVM.
daltenty edited the summary of this revision.
daltenty added reviewers: hubert.reinterpretcast, beanz, lhames.
daltenty added a reverted change: D69356: [NFC] Rename LLVM_NO_DEAD_STRIP.

this allows us to move logic about when it is appropriate set
LLVM_NO_DEAD_STRIP out of each tool and into add_llvm_executable,
which will enable future platform specific handling.

This is a follow on to the reverted D69356 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69638

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt

Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -24,9 +24,6 @@
   Passes
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(opt
   AnalysisWrappers.cpp
   BreakpointPrinter.cpp
@@ -39,6 +36,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(opt)
 
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -19,13 +19,11 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(llc
   llc.cpp
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(llc)
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -21,9 +21,6 @@
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(bugpoint
   BugDriver.cpp
   CrashDebugger.cpp
@@ -37,6 +34,7 @@
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(bugpoint)
 
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -732,7 +732,7 @@
 
 macro(add_llvm_executable name)
   cmake_parse_arguments(ARG
-"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
+"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
 "ENTITLEMENTS;BUNDLE_PATH"
 "DEPENDS"
 ${ARGN})
@@ -782,6 +782,11 @@
   if(NOT LLVM_ENABLE_OBJLIB)
 llvm_update_compile_flags(${name})
   endif()
+
+  if (ARG_SUPPORT_PLUGINS)
+set(LLVM_NO_DEAD_STRIP 1)
+  endif()
+
   add_link_opts( ${name} )
 
   # Do not add -Dname_EXPORTS to the command-line when building files in this
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -19,12 +19,6 @@
 
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
-# Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
-if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
-endif()
-
 if(NOT CLANG_BUILT_STANDALONE)
   set(tablegen_deps intrinsics_gen)
 endif()
@@ -37,6 +31,7 @@
 
   DEPENDS
   ${tablegen_deps}
+  SUPPORT_PLUGINS
   )
 
 clang_target_link_libraries(clang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D69356#1727581 , 
@hubert.reinterpretcast wrote:

> In D69356#1727484 , @beanz wrote:
>
> > We should not be adding more variables that are passed around by CMake's 
> > scope inheritance. Instead if we need to change this we should do it 
> > correctly.
>
>
> Just to clarify, the actions to take are to restore `LLVM_NO_DEAD_STRIP` in 
> order to support other uses and then to replace its use as an internal 
> variable? Given that direction, I agree the first course of action is to 
> revert this patch and then to pursue a patch to do the replacement separately.


Based on the discussion, I will revert this change and open a new review 
introducing SUPPORT_PLUGINS as an option to the add_llvm_tool macro.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

> I'm actually opposed to that happening, on two fronts.
>  (2) we already have `LLVM_ENABLE_PLUGINS` why do we also need 
> `LLVM_SUPPORT_PLUGINS` seems like duplication and bad design.

As I understand it LLVM_ENABLE_PLUGINS is a user-facing option which indicates 
whether the user wants to build with plugin support.

The intention of LLVM_SUPPORT_PLUGINS was as an internal option set by tools 
which may have plugins and need to be built in a specific way (such as avoiding 
deadstriping) if plugins are enabled.

> (1) dead stripping support is useful independent of plugins, so it is 
> valuable to have that option be separate

We could keep LLVM_NO_DEAD_STRIP as is and have it set by LLVM_SUPPORT_PLUGINS 
when appropriate. That should accommodate both uses.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D69356#1726527 , 
@hubert.reinterpretcast wrote:

> In D69356#1726354 , @beanz wrote:
>
> > If what you say is correct that "no dead strip" is harmful to plugins on 
> > some platforms it seems like this rename was a step in the direction of 
> > more confusion.
>
>
> Only when focusing on the implementation and not the intent.


Indeed, the goal of this rename was trying to clarify the the intent of this 
option and separate it from it's implementation, which will need to vary by 
platform and will do so in a follow on patch on AIX.

> Perhaps the more accurate intent for both the JIT host process and the 
> plug-in support case is that the executable is expected to make symbols 
> available for run-time linking. Maybe `LLVM_EXPORT_SYMBOLS_FROM_EXEC` is a 
> better name?

I'm in favor of this name, the proposed option name was chosen because the only 
current usage seemed to be with plugins. I think LLVM_EXPORT_SYMBOLS_FROM_EXEC 
much more correctly expresses what users expect the option to do for them with 
out tying it to the specific mechanism  (which may include avoiding dead 
striping on some platforms but not others) and would accommodate both uses


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-25 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG11c2a85db884: [NFC] Rename LLVM_NO_DEAD_STRIP (authored by 
daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_NO_DEAD_STRIP is set.
+# flags instead if LLVM_SUPPORT_PLUGINS is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_NO_DEAD_STRIP)
+if(NOT LLVM_SUPPORT_PLUGINS)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_NO_DEAD_STRIP
+else() #LLVM_SUPPORT_PLUGINS
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# LLVM_SUPPORT_PLUGINS.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(LLVM_SUPPORT_PLUGINS 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if 

[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-24 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 226319.
daltenty added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Address comments round 1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69356/new/

https://reviews.llvm.org/D69356

Files:
  clang/tools/driver/CMakeLists.txt
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/tools/bugpoint/CMakeLists.txt
  llvm/tools/llc/CMakeLists.txt
  llvm/tools/opt/CMakeLists.txt


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_NO_DEAD_STRIP is set.
+# flags instead if LLVM_SUPPORT_PLUGINS is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_NO_DEAD_STRIP)
+if(NOT LLVM_SUPPORT_PLUGINS)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_NO_DEAD_STRIP
+else() #LLVM_SUPPORT_PLUGINS
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# LLVM_SUPPORT_PLUGINS.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(LLVM_SUPPORT_PLUGINS 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb6a27fc257f: Add AIX toolchain and basic linker 
functionality (authored by stevewan, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68340/new/

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0/dummy.a
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0_64.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0.o
  clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0_64.o
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
+// CHECK-LD32-NOT: warning:
+// CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
+// CHECK-LD64-NOT: warning:
+// CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: 

[PATCH] D65688: [AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX

2019-08-06 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65688/new/

https://reviews.llvm.org/D65688



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-06-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362808: Build with _XOPEN_SOURCE defined on AIX (authored by 
daltenty, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62533?vs=202822=203563#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62533/new/

https://reviews.llvm.org/D62533

Files:
  cfe/trunk/tools/libclang/CMakeLists.txt
  llvm/trunk/CMakeLists.txt
  llvm/trunk/cmake/config-ix.cmake
  llvm/trunk/utils/unittest/CMakeLists.txt


Index: llvm/trunk/cmake/config-ix.cmake
===
--- llvm/trunk/cmake/config-ix.cmake
+++ llvm/trunk/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/trunk/CMakeLists.txt
===
--- llvm/trunk/CMakeLists.txt
+++ llvm/trunk/CMakeLists.txt
@@ -819,6 +819,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: llvm/trunk/utils/unittest/CMakeLists.txt
===
--- llvm/trunk/utils/unittest/CMakeLists.txt
+++ llvm/trunk/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: cfe/trunk/tools/libclang/CMakeLists.txt
===
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/trunk/cmake/config-ix.cmake
===
--- llvm/trunk/cmake/config-ix.cmake
+++ llvm/trunk/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/trunk/CMakeLists.txt
===
--- llvm/trunk/CMakeLists.txt
+++ llvm/trunk/CMakeLists.txt
@@ -819,6 +819,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: llvm/trunk/utils/unittest/CMakeLists.txt
===
--- llvm/trunk/utils/unittest/CMakeLists.txt
+++ llvm/trunk/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES 

[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-06-03 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 202822.
daltenty added a comment.

Fix grammar in comments. Fix up the way we define the macros for Google Test.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62533/new/

https://reviews.llvm.org/D62533

Files:
  clang/tools/libclang/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/utils/unittest/CMakeLists.txt


Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: clang/tools/libclang/CMakeLists.txt

[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-05-28 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, xingxue, andusy.
daltenty added projects: LLVM, clang.
Herald added subscribers: llvm-commits, cfe-commits, jsji, mgorny.

It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open
and POSIX compatibility mode, to work around stray macros and other
bugs in the headers provided by the system and build compiler.

This patch adds the config to cmake to build with _XOPEN_SOURCE defined on AIX 
with a few exceptions. Google Test internals require access to platform 
specific thread info constructs on AIX so in that case we build with 
_ALL_SOURCE defined instead. Libclang also uses header which needs _ALL_SOURCE 
on AIX so we leave that as is as well..

We also add building on AIX with the large file API and doing CMake header 
checks with X/OPEN definitions so the results are consistent with the 
environment that will be present in the build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62533

Files:
  clang/tools/libclang/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/utils/unittest/CMakeLists.txt
  llvm/utils/unittest/googletest/src/gtest-port.cc


Index: llvm/utils/unittest/googletest/src/gtest-port.cc
===
--- llvm/utils/unittest/googletest/src/gtest-port.cc
+++ llvm/utils/unittest/googletest/src/gtest-port.cc
@@ -59,6 +59,7 @@
 #endif  // GTEST_OS_QNX
 
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 
 # include 
 #endif  // GTEST_OS_AIX
Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,11 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and LARGE FILE API on AIX, as we will build with
+# that too
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the LARGE FILE API as well
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/utils/unittest/googletest/src/gtest-port.cc
===
--- llvm/utils/unittest/googletest/src/gtest-port.cc
+++ llvm/utils/unittest/googletest/src/gtest-port.cc
@@ -59,6 +59,7 @@
 #endif  // GTEST_OS_QNX
 
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 
 # include 
 #endif  // GTEST_OS_AIX
Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,11 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake