[PATCH] D25017: [mips][msa] Range check MSA intrinsics with immediates

2016-10-18 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added inline comments.



Comment at: lib/Sema/SemaChecking.cpp:1633-1637
+  if (!m)
+return SemaBuiltinConstantArgRange(TheCall, i, l, u);
+
+return SemaBuiltinConstantArgRange(TheCall, i, l, u) ||
+   SemaBuiltinConstantArgMultiple(TheCall, i, m);

Also, can you fix the indentation here and check with clang-format for long 
lines in the code?


https://reviews.llvm.org/D25017



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


[PATCH] D25017: [mips][msa] Range check MSA intrinsics with immediates

2016-10-18 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.

LGTM. See inline comments for a few small changes.

The only issue I've found with test/CodeGen/builtins-mips-msa-error.c is that 
GCC checks strictly the signedness of the arguments passed to the builtins. 
Having a FIXME comment in order to make Clang follow the same behaviour in the 
future would be nice.




Comment at: test/CodeGen/builtins-mips-msa-error.c:24-35
+  v16u8 v16u8_a = (v16u8) {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
15};
+  v16u8 v16u8_b = (v16u8) {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16};
+  v16u8 v16u8_r;
+  v8u16 v8u16_a = (v8u16) {0, 1, 2, 3, 4, 5, 6, 7};
+  v8u16 v8u16_b = (v8u16) {1, 2, 3, 4, 5, 6, 7, 8};
+  v8u16 v8u16_r;
+  v4u32 v4u32_a = (v4u32) {0, 1, 2, 3};

We don't use the `v_b` vectors anywhere.



Comment at: test/CodeGen/builtins-mips-msa-error.c:37-45
+  v8f16 v8f16_a = (v8f16) {0.5, 1, 2, 3, 4, 5, 6, 7};
+  v8f16 v8f16_b = (v8f16) {1.5, 2, 3, 4, 5, 6, 7, 8};
+  v8f16 v8f16_r;
+  v4f32 v4f32_a = (v4f32) {0.5, 1, 2, 3};
+  v4f32 v4f32_b = (v4f32) {1.5, 2, 3, 4};
+  v4f32 v4f32_r;
+  v2f64 v2f64_a = (v2f64) {0.5, 1};

We don't test anything with these. We can delete them along with the typedef 
above.



Comment at: test/CodeGen/builtins-mips-msa-error.c:49
+  long long ll_r;
+  int int_a = 0;
+

Unused as well.



Comment at: test/CodeGen/builtins-mips-msa-error.c:119
+  int_r = __msa_copy_s_h(v8i16_a, 8);// expected-error 
{{argument should be a value from 0 to 7}}
+  int_r = __msa_copy_s_w(v4i32_a, 3);// expected-error 
{{argument should be a value from 0 to 3}}
+  ll_r  = __msa_copy_s_d(v2i64_a, 2);// expected-error 
{{argument should be a value from 0 to 1}}

The passed argument is in the valid value range.



Comment at: test/CodeGen/builtins-mips-msa-error.c:308-311
+  v16i8_r = __msa_clti_s_b(v16i8_a, -1); // expected-error 
{{argument should be a value from -16 to 15}}
+  v8i16_r = __msa_clti_s_h(v8i16_a, -1); // expected-error 
{{argument should be a value from -16 to 15}}
+  v4i32_r = __msa_clti_s_w(v4i32_a, -1); // expected-error 
{{argument should be a value from -16 to 15}}
+  v2i64_r = __msa_clti_s_d(v2i64_a, -1); // expected-error 
{{argument should be a value from -16 to 15}}

The passed argument is in the valid range of values.


https://reviews.llvm.org/D25017



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


Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D24674#547589, @vkalintiris wrote:

> @sdardis: can you update the review request before committing this because I 
> don't think that test/CodeGen/builtins-mips-msa.c has ever been properly 
> reviewed before.


Never mind, I didn't realize that you intend to write a follow-up patch.


https://reviews.llvm.org/D24674



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


Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris requested changes to this revision.
vkalintiris added a comment.
This revision now requires changes to proceed.

@sdardis: can you update the review request before committing this because I 
don't think that test/CodeGen/builtins-mips-msa.c has ever been properly 
reviewed before.


https://reviews.llvm.org/D24674



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


Re: [PATCH] D24448: [atomics] New warning -Watomic-libcall when atomic operation expands to a library call

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a subscriber: vkalintiris.
vkalintiris added a comment.

I removed myself from the reviewers because I'm not quite familiar with this 
area. @joerg I added you as reviewer because you've already commented, feel 
free to undo my change if you don't have time to review this.


https://reviews.llvm.org/D24448



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


Re: [PATCH] D24674: [mips] MSA intrinsics header file

2016-09-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a subscriber: mpf.
vkalintiris added a comment.
This revision is now accepted and ready to land.

LGTM with one comment/question inline.



Comment at: test/CodeGen/builtins-mips-msa.c:8
@@ -13,4 +7,3 @@
+
 typedef __fp16 v8f16 __attribute__ ((vector_size(16)));
 

@mpf

Would it be problematic to expose this typedef from msa.h?


https://reviews.llvm.org/D24674



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


RE: r275095 - [NFC] Reorder fields of VersionTuple to reduce size

2016-09-06 Thread Vasileios Kalintiris via cfe-commits
It turns out that there's no need to revert this as the problem persists even 
without your patch. I'm preparing a patch that fixes the underlying issue.

- V. Kalintiris

From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Vasileios 
Kalintiris via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 06 September 2016 10:12
To: Erik Pilkington; cfe-commits@lists.llvm.org
Subject: RE: r275095 - [NFC] Reorder fields of VersionTuple to reduce size

Hi Erik, would you mind reverting this temporarily? It broke our recursive 
builds buildbot because the re-ordering of VersionTuple's bitfields generates 
an i128 which our MIPS backend erroneously accepts for the o32 ABI.

- V. Kalintiris


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Erik 
Pilkington via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 11 July 2016 21:00
To: cfe-commits@lists.llvm.org
Subject: r275095 - [NFC] Reorder fields of VersionTuple to reduce size

Author: epilk
Date: Mon Jul 11 15:00:48 2016
New Revision: 275095

URL: http://llvm.org/viewvc/llvm-project?rev=275095&view=rev
Log:
[NFC] Reorder fields of VersionTuple to reduce size

Differential revision: http://reviews.llvm.org/D19934

Modified:
cfe/trunk/include/clang/Basic/VersionTuple.h

Modified: cfe/trunk/include/clang/Basic/VersionTuple.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VersionTuple.h?rev=275095&r1=275094&r2=275095&view=diff
==
--- cfe/trunk/include/clang/Basic/VersionTuple.h (original)
+++ cfe/trunk/include/clang/Basic/VersionTuple.h Mon Jul 11 15:00:48 2016
@@ -25,39 +25,44 @@ namespace clang {
 /// \brief Represents a version number in the form 
major[.minor[.subminor[.build]]].
 class VersionTuple {
   unsigned Major : 31;
+
+  unsigned UsesUnderscores : 1;
+
   unsigned Minor : 31;
-  unsigned Subminor : 31;
-  unsigned Build : 31;
   unsigned HasMinor : 1;
+
+  unsigned Subminor : 31;
   unsigned HasSubminor : 1;
+
+  unsigned Build : 31;
   unsigned HasBuild : 1;
-  unsigned UsesUnderscores : 1;

 public:
   VersionTuple()
-  : Major(0), Minor(0), Subminor(0), Build(0), HasMinor(false),
-HasSubminor(false), HasBuild(false), UsesUnderscores(false) {}
+  : Major(0), UsesUnderscores(false), Minor(0), HasMinor(false),
+Subminor(0), HasSubminor(false), Build(0), HasBuild(false) {}

   explicit VersionTuple(unsigned Major)
-  : Major(Major), Minor(0), Subminor(0), Build(0), HasMinor(false),
-HasSubminor(false), HasBuild(false), UsesUnderscores(false) {}
+  : Major(Major), UsesUnderscores(false), Minor(0), HasMinor(false),
+Subminor(0), HasSubminor(false), Build(0), HasBuild(false) {}

   explicit VersionTuple(unsigned Major, unsigned Minor,
 bool UsesUnderscores = false)
-  : Major(Major), Minor(Minor), Subminor(0), Build(0), HasMinor(true),
-HasSubminor(false), HasBuild(false), UsesUnderscores(UsesUnderscores) 
{}
+  : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+HasMinor(true), Subminor(0), HasSubminor(false), Build(0),
+HasBuild(false) {}

   explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor,
 bool UsesUnderscores = false)
-  : Major(Major), Minor(Minor), Subminor(Subminor), Build(0),
-HasMinor(true), HasSubminor(true), HasBuild(false),
-UsesUnderscores(UsesUnderscores) {}
+  : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+HasMinor(true), Subminor(Subminor), HasSubminor(true), Build(0),
+HasBuild(false) {}

   explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor,
 unsigned Build, bool UsesUnderscores = false)
-  : Major(Major), Minor(Minor), Subminor(Subminor), Build(Build),
-HasMinor(true), HasSubminor(true), HasBuild(true),
-UsesUnderscores(UsesUnderscores) {}
+  : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+HasMinor(true), Subminor(Subminor), HasSubminor(true), Build(Build),
+HasBuild(true) {}

   /// \brief Determine whether this version information is empty
   /// (e.g., all version components are zero).


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


RE: r275095 - [NFC] Reorder fields of VersionTuple to reduce size

2016-09-06 Thread Vasileios Kalintiris via cfe-commits
Hi Erik, would you mind reverting this temporarily? It broke our recursive 
builds buildbot because the re-ordering of VersionTuple's bitfields generates 
an i128 which our MIPS backend erroneously accepts for the o32 ABI.

- V. Kalintiris


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Erik 
Pilkington via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 11 July 2016 21:00
To: cfe-commits@lists.llvm.org
Subject: r275095 - [NFC] Reorder fields of VersionTuple to reduce size

Author: epilk
Date: Mon Jul 11 15:00:48 2016
New Revision: 275095

URL: http://llvm.org/viewvc/llvm-project?rev=275095&view=rev
Log:
[NFC] Reorder fields of VersionTuple to reduce size

Differential revision: http://reviews.llvm.org/D19934

Modified:
cfe/trunk/include/clang/Basic/VersionTuple.h

Modified: cfe/trunk/include/clang/Basic/VersionTuple.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VersionTuple.h?rev=275095&r1=275094&r2=275095&view=diff
==
--- cfe/trunk/include/clang/Basic/VersionTuple.h (original)
+++ cfe/trunk/include/clang/Basic/VersionTuple.h Mon Jul 11 15:00:48 2016
@@ -25,39 +25,44 @@ namespace clang {
 /// \brief Represents a version number in the form 
major[.minor[.subminor[.build]]].
 class VersionTuple {
   unsigned Major : 31;
+
+  unsigned UsesUnderscores : 1;
+
   unsigned Minor : 31;
-  unsigned Subminor : 31;
-  unsigned Build : 31;
   unsigned HasMinor : 1;
+
+  unsigned Subminor : 31;
   unsigned HasSubminor : 1;
+
+  unsigned Build : 31;
   unsigned HasBuild : 1;
-  unsigned UsesUnderscores : 1;

 public:
   VersionTuple()
-  : Major(0), Minor(0), Subminor(0), Build(0), HasMinor(false),
-HasSubminor(false), HasBuild(false), UsesUnderscores(false) {}
+  : Major(0), UsesUnderscores(false), Minor(0), HasMinor(false),
+Subminor(0), HasSubminor(false), Build(0), HasBuild(false) {}

   explicit VersionTuple(unsigned Major)
-  : Major(Major), Minor(0), Subminor(0), Build(0), HasMinor(false),
-HasSubminor(false), HasBuild(false), UsesUnderscores(false) {}
+  : Major(Major), UsesUnderscores(false), Minor(0), HasMinor(false),
+Subminor(0), HasSubminor(false), Build(0), HasBuild(false) {}

   explicit VersionTuple(unsigned Major, unsigned Minor,
 bool UsesUnderscores = false)
-  : Major(Major), Minor(Minor), Subminor(0), Build(0), HasMinor(true),
-HasSubminor(false), HasBuild(false), UsesUnderscores(UsesUnderscores) 
{}
+  : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+HasMinor(true), Subminor(0), HasSubminor(false), Build(0),
+HasBuild(false) {}

   explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor,
 bool UsesUnderscores = false)
-  : Major(Major), Minor(Minor), Subminor(Subminor), Build(0),
-HasMinor(true), HasSubminor(true), HasBuild(false),
-UsesUnderscores(UsesUnderscores) {}
+  : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+HasMinor(true), Subminor(Subminor), HasSubminor(true), Build(0),
+HasBuild(false) {}

   explicit VersionTuple(unsigned Major, unsigned Minor, unsigned Subminor,
 unsigned Build, bool UsesUnderscores = false)
-  : Major(Major), Minor(Minor), Subminor(Subminor), Build(Build),
-HasMinor(true), HasSubminor(true), HasBuild(true),
-UsesUnderscores(UsesUnderscores) {}
+  : Major(Major), UsesUnderscores(UsesUnderscores), Minor(Minor),
+HasMinor(true), Subminor(Subminor), HasSubminor(true), Build(Build),
+HasBuild(true) {}

   /// \brief Determine whether this version information is empty
   /// (e.g., all version components are zero).


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


RE: r269411 - [mips] Consult triple's vendor field before using musl's interpreter.

2016-05-16 Thread Vasileios Kalintiris via cfe-commits
Thanks for pointing that out. Test Added in r269651.

- Vasileios

From: Daniel Sanders
Sent: 13 May 2016 17:33
To: Vasileios Kalintiris; cfe-commits@lists.llvm.org
Subject: RE: r269411 - [mips] Consult triple's vendor field before using musl's 
interpreter.

Hi,

This change makes sense but it needs a test case.

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Vasileios Kalintiris via cfe-commits
> Sent: 13 May 2016 13:13
> To: cfe-commits@lists.llvm.org
> Subject: r269411 - [mips] Consult triple's vendor field before using musl's
> interpreter.
>
> Author: vkalintiris
> Date: Fri May 13 07:13:13 2016
> New Revision: 269411
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269411&view=rev
> Log:
> [mips] Consult triple's vendor field before using musl's interpreter.
>
> This should affect only the mips-mti-linux toolchain.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=269411&r1=269410&r2=269411&
> view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:13:13 2016
> @@ -8991,7 +8991,9 @@ static std::string getLinuxDynamicLinker
>  bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
>  if (mips::isUCLibc(Args))
>LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
> -else if (!ToolChain.getTriple().hasEnvironment()) {
> +else if (!ToolChain.getTriple().hasEnvironment() &&
> + ToolChain.getTriple().getVendor() ==
> + llvm::Triple::VendorType::MipsTechnologies) {
>bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
>  (ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
>LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r269651 - [mips] Add test for the dynamic linker when using the mips64el-fedora-linux triple.

2016-05-16 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon May 16 06:53:51 2016
New Revision: 269651

URL: http://llvm.org/viewvc/llvm-project?rev=269651&view=rev
Log:
[mips] Add test for the dynamic linker when using the mips64el-fedora-linux 
triple.

We should use the musl linker only when there's no environment specified and
the vendor is MTI. The new test verifies this behaviour and is a follow-up to
the r269411 commit that added the vendor field check.

Modified:
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/test/Driver/linux-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=269651&r1=269650&r2=269651&view=diff
==
--- cfe/trunk/test/Driver/linux-ld.c (original)
+++ cfe/trunk/test/Driver/linux-ld.c Mon May 16 06:53:51 2016
@@ -762,6 +762,14 @@
 // CHECK-MIPS64EL-N32-NAN2008: "-dynamic-linker" 
"{{.*}}/lib32/ld-linux-mipsn8.so.1"
 // CHECK-MIPS64EL-N32-NAN2008-NOT: "--hash-style={{gnu|both}}"
 //
+// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-redhat-linux \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS64EL-REDHAT %s
+// CHECK-MIPS64EL-REDHAT: "{{.*}}ld{{(.exe)?}}"
+// CHECK-MIPS64EL-REDHAT: "-m" "elf64ltsmip"
+// CHECK-MIPS64EL-REDHAT: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
+// CHECK-MIPS64EL-REDHAT-NOT: "-dynamic-linker" 
"{{.*}}/lib64/ld-musl-mipsel.so.1"
+// CHECK-MIPS64EL-REDHAT-NOT: "--hash-style={{gnu|both}}"
+//
 // RUN: %clang %s -### -o %t.o 2>&1 \
 // RUN: --target=sparc-unknown-linux-gnu \
 // RUN:   | FileCheck --check-prefix=CHECK-SPARCV8 %s


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


r269412 - Simplify getLinuxDynamicLinker() by using a common variable for the triple. NFC.

2016-05-13 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Fri May 13 07:34:14 2016
New Revision: 269412

URL: http://llvm.org/viewvc/llvm-project?rev=269412&view=rev
Log:
Simplify getLinuxDynamicLinker() by using a common variable for the triple. NFC.

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=269412&r1=269411&r2=269412&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:34:14 2016
@@ -8957,9 +8957,10 @@ static void AddLibgcc(const llvm::Triple
 static std::string getLinuxDynamicLinker(const ArgList &Args,
  const toolchains::Linux &ToolChain) {
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
+  const llvm::Triple &Triple = ToolChain.getTriple();
 
-  if (ToolChain.getTriple().isAndroid()) {
-if (ToolChain.getTriple().isArch64Bit())
+  if (Triple.isAndroid()) {
+if (Triple.isArch64Bit())
   return "/system/bin/linker64";
 else
   return "/system/bin/linker";
@@ -8971,31 +8972,29 @@ static std::string getLinuxDynamicLinker
   else if (Arch == llvm::Triple::aarch64_be)
 return "/lib/ld-linux-aarch64_be.so.1";
   else if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
-if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
+if (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
 arm::getARMFloatABI(ToolChain, Args) == arm::FloatABI::Hard)
   return "/lib/ld-linux-armhf.so.3";
 else
   return "/lib/ld-linux.so.3";
   } else if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb) {
 // TODO: check which dynamic linker name.
-if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
+if (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
 arm::getARMFloatABI(ToolChain, Args) == arm::FloatABI::Hard)
   return "/lib/ld-linux-armhf.so.3";
 else
   return "/lib/ld-linux.so.3";
   } else if (Arch == llvm::Triple::mips || Arch == llvm::Triple::mipsel ||
  Arch == llvm::Triple::mips64 || Arch == llvm::Triple::mips64el) {
-std::string LibDir =
-"/lib" + mips::getMipsABILibSuffix(Args, ToolChain.getTriple());
+std::string LibDir = "/lib" + mips::getMipsABILibSuffix(Args, Triple);
 StringRef LibName;
-bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
+bool IsNaN2008 = mips::isNaN2008(Args, Triple);
 if (mips::isUCLibc(Args))
   LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
-else if (!ToolChain.getTriple().hasEnvironment() &&
- ToolChain.getTriple().getVendor() ==
- llvm::Triple::VendorType::MipsTechnologies) {
-  bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
-(ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
+else if (!Triple.hasEnvironment() &&
+ Triple.getVendor() == llvm::Triple::VendorType::MipsTechnologies) 
{
+  bool LE = (Triple.getArch() == llvm::Triple::mipsel) ||
+(Triple.getArch() == llvm::Triple::mips64el);
   LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";
 } else
   LibName = IsNaN2008 ? "ld-linux-mipsn8.so.1" : "ld.so.1";
@@ -9016,7 +9015,7 @@ static std::string getLinuxDynamicLinker
   else if (Arch == llvm::Triple::sparcv9)
 return "/lib64/ld-linux.so.2";
   else if (Arch == llvm::Triple::x86_64 &&
-   ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32)
+   Triple.getEnvironment() == llvm::Triple::GNUX32)
 return "/libx32/ld-linux-x32.so.2";
   else
 return "/lib64/ld-linux-x86-64.so.2";


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


r269411 - [mips] Consult triple's vendor field before using musl's interpreter.

2016-05-13 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Fri May 13 07:13:13 2016
New Revision: 269411

URL: http://llvm.org/viewvc/llvm-project?rev=269411&view=rev
Log:
[mips] Consult triple's vendor field before using musl's interpreter.

This should affect only the mips-mti-linux toolchain.

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=269411&r1=269410&r2=269411&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri May 13 07:13:13 2016
@@ -8991,7 +8991,9 @@ static std::string getLinuxDynamicLinker
 bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple());
 if (mips::isUCLibc(Args))
   LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0";
-else if (!ToolChain.getTriple().hasEnvironment()) {
+else if (!ToolChain.getTriple().hasEnvironment() &&
+ ToolChain.getTriple().getVendor() ==
+ llvm::Triple::VendorType::MipsTechnologies) {
   bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) ||
 (ToolChain.getTriple().getArch() == llvm::Triple::mips64el);
   LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1";


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


Re: [PATCH] D18761: [mips] Enable IAS by default for 32-bit MIPS targets (O32).

2016-04-07 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.

LGTM.


http://reviews.llvm.org/D18761



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


r264035 - Fix warning about extra semicolon. NFC.

2016-03-22 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Tue Mar 22 05:41:20 2016
New Revision: 264035

URL: http://llvm.org/viewvc/llvm-project?rev=264035&view=rev
Log:
Fix warning about extra semicolon. NFC.

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=264035&r1=264034&r2=264035&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Tue Mar 22 05:41:20 2016
@@ -92,7 +92,7 @@ CGOpenMPRuntimeNVPTX::WorkerFunctionStat
 CodeGenModule &CGM)
 : WorkerFn(nullptr), CGFI(nullptr) {
   createWorkerFunction(CGM);
-};
+}
 
 void CGOpenMPRuntimeNVPTX::WorkerFunctionState::createWorkerFunction(
 CodeGenModule &CGM) {


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


Re: [PATCH] D16139: [MIPS] initFeatureMap() to handle empty string argument

2016-02-17 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.

LGTM. However, I'm curious to learn which case triggered this behaviour.


Repository:
  rL LLVM

http://reviews.llvm.org/D16139



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


RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-16 Thread Vasileios Kalintiris via cfe-commits
Hi Ben,

> FYI, this change and the LLVM version have each broken my libcxx
> builds.  I cross compile from Linux x64 to Hexagon, and my host machine
> doesn't have .  The LLVM change was particularly offensive
> because I wasn't planning on building LLVM itself.

There's no change on the LLVM side, ie. I abandoned the review request you have 
in mind after discussion with the reviewers.

> I have since worked around the issue by making my cmake invocation longer.
>
> I'm not sure what you can do for the LLVM check, but if you can use the
> libcxx headers directly for the  check, while still using all
> the custom flags and tools that I pass on the command line, then I
> should be able to remove the explicit setting of
> "LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB" in the future.

You shouldn't have any problems with the latest commit (r260961):  "Issue a 
warning instead of fatal errors when checks for libatomic fail."  I suppose 
that you aren't using the latest trunk, right?

- Vasileios

 

From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Craig, Ben 
via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 16 February 2016 21:09
To: cfe-commits@lists.llvm.org
Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

FYI, this change and the LLVM version have each broken my libcxx
builds.  I cross compile from Linux x64 to Hexagon, and my host machine
doesn't have .  The LLVM change was particularly offensive
because I wasn't planning on building LLVM itself.

I have since worked around the issue by making my cmake invocation longer.

I'm not sure what you can do for the LLVM check, but if you can use the
libcxx headers directly for the  check, while still using all
the custom flags and tools that I pass on the command line, then I
should be able to remove the explicit setting of
"LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB" in the future.

On 2/16/2016 2:09 PM, Vasileios Kalintiris via cfe-commits wrote:
> Hi Hans,
>
>> Or is this comment on PR26059 all that needs to be done for 3.8?
> That's correct. I wrote that comment in order to clarify which bits we should 
> merge in 3.8.
>
> The latest commit:
>
> - [libcxx] r260961 - Issue a warning instead of fatal errors when checks for 
> libatomic fail."
>
> makes sure that my changes don't break older configurations that used to work 
> previously, by emitting a warning message instead of a fatal error.
>
> I had to turn the error to warning because there are cases where the host 
> compiler doesn't provide the  and  headers when 
> bootstrapping llvm.
>
> The correct solution would be to use the headers provided from libc++ itself. 
> However, I wanted to take the safe route for the 3.8 branch and provide the 
> elegant solution on the trunk after having the proper discussion with the 
> libc++ devs.
>
> Thanks,
> Vasileios
>
> 
> From: hwennb...@google.com [hwennb...@google.com] on behalf of Hans Wennborg 
> [h...@chromium.org]
> Sent: 16 February 2016 19:53
> To: Vasileios Kalintiris
> Cc: Eric Fiselier; Daniel Sanders; mclow.li...@gmail.com; 
> cfe-commits@lists.llvm.org
> Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out 
> whether we need to link with libatomic.
>
> Or is this comment on PR26059 all that needs to be done for 3.8?
>
> "Bug 26369, which has been fixed with r260961, requires the following
> commits to get merged on the release branch:
>
> - [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out
> whether we need to link with libatomic."
> - [libcxx] r260524 - Fix r260515 - Correct typos in CMake changes
> - [libcxx] r260531 - Rename CheckLibcxxAtomic.cmake variable result
> names so they don't clash with LLVM
> - [libcxx] r260961 - Issue a warning instead of fatal errors when
> checks for libatomic fail."
>
> Thanks,
> Hans
>
> On Tue, Feb 16, 2016 at 11:47 AM, Hans Wennborg  wrote:
>> Do I understand correctly that there are still issues here's that are not 
>> fixed?
>>
>> (I'm trying to understand if there is something here to merge for 3.8,
>> but I'm having trouble following these commits.)
>>
>> On Tue, Feb 16, 2016 at 6:44 AM, Vasileios Kalintiris
>>  wrote:
>>> I changed the type of message from fatal_error to warning in r260961. While
>>> the test for atomics works fine in most cases, it fails because we include
>>>  and , and the user's host compiler might not provide them
>>> during a bootstrap (see PR26631 and PR26622).
>>>
>>>

RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-16 Thread Vasileios Kalintiris via cfe-commits
system's default gcc installation does not
>>> provide libatomic. We have to check LIBCXX_GCC_TOOLCHAIN in our test. I'll
>>> create a patch tomorrow and I'll let you know when it's okay to merge them.
>>> In the meantime, I reverted it in r260323.
>>>
>>> - Vasileios
>>> 
>>> From: Vasileios Kalintiris
>>> Sent: 09 February 2016 18:56
>>> To: h...@chromium.org
>>> Cc: cfe-commits@lists.llvm.org; Daniel Sanders; mclow.li...@gmail.com
>>> Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out
>>> whether we need to link with libatomic.
>>>
>>> Hi Hans,
>>>
>>> Can we merge this on the 3.8 release branch? It fixes libcxx builds on
>>> MIPS by linking with libatomic when needed. Also, all the x86_64 and ARM
>>> buildbots for libcxx look good.
>>>
>>> Thanks,
>>> Vasileios
>>>
>>> 
>>> From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of
>>> Vasileios Kalintiris via cfe-commits [cfe-commits@lists.llvm.org]
>>> Sent: 09 February 2016 17:00
>>> To: cfe-commits@lists.llvm.org
>>> Subject: [libcxx] r260235 - Introduce a cmake module to figure out whether
>>> we need to link with libatomic.
>>>
>>> Author: vkalintiris
>>> Date: Tue Feb  9 11:00:38 2016
>>> New Revision: 260235
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
>>> Log:
>>> Introduce a cmake module to figure out whether we need to link with
>>> libatomic.
>>>
>>> Summary:
>>> This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
>>> 8-byte atomic operations call into the libatomic library.
>>>
>>> Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg
>>>
>>> Subscribers: cfe-commits
>>>
>>> Differential Revision: http://reviews.llvm.org/D16613
>>>
>>> Added:
>>> libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
>>> Modified:
>>> libcxx/trunk/cmake/config-ix.cmake
>>> libcxx/trunk/lib/CMakeLists.txt
>>> libcxx/trunk/test/CMakeLists.txt
>>> libcxx/trunk/test/libcxx/test/target_info.py
>>> libcxx/trunk/test/lit.site.cfg.in
>>>
>>> Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
>>>
>>> ==
>>> --- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
>>> +++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38
>>> 2016
>>> @@ -0,0 +1,38 @@
>>> +INCLUDE(CheckCXXSourceCompiles)
>>> +
>>> +# Sometimes linking against libatomic is required for atomic ops, if
>>> +# the platform doesn't support lock-free atomics.
>>> +#
>>> +# We could modify LLVM's CheckAtomic module and have it check for 64-bit
>>> +# atomics instead. However, we would like to avoid careless uses of
>>> 64-bit
>>> +# atomics inside LLVM over time on 32-bit platforms.
>>> +
>>> +function(check_cxx_atomics varname)
>>> +  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
>>> +  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
>>> +  check_cxx_source_compiles("
>>> +#include 
>>> +#include 
>>> +std::atomic x;
>>> +std::atomic y;
>>> +int main() {
>>> +  return x + y;
>>> +}
>>> +" ${varname})
>>> +  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
>>> +endfunction(check_cxx_atomics)
>>> +
>>> +check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
>>> +# If not, check if the library exists, and atomics work with it.
>>> +if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
>>> +  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
>>> +  if(HAVE_LIBATOMIC)
>>> +list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
>>> +check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
>>> +if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
>>> +  message(FATAL_ERROR "Host compiler must support std::atomic!")
>>> +endif()
>>> +  else()
>>> +message(FATAL_ERROR "Host compiler appears to require lib

RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-16 Thread Vasileios Kalintiris via cfe-commits
I changed the type of message from fatal_error to warning in r260961. While the 
test for atomics works fine in most cases, it fails because we include 
 and , and the user's host compiler might not provide them 
during a bootstrap (see PR26631 and PR26622).

Does anyone have any idea how to tackle this problem? As suggested by the bug 
reports, we could include the headers provided by libc++. However, I'm not sure 
whether we are supposed to do that during configuration time.

- Vasileios


<http://llvm.org/viewvc/llvm-project/?view=rev&revision=260961>

From: Eric Fiselier [e...@efcs.ca]
Sent: 11 February 2016 16:08
To: Daniel Sanders
Cc: Vasileios Kalintiris; h...@chromium.org; mclow.li...@gmail.com; 
cfe-commits@lists.llvm.org
Subject: Re: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

>  we need to rename HAVE_CXX_ATOMICS_WITH_LIB to something like 
> LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB.

Fixed in r260531.

I think we will eventually want to merge the following commits, assuming they 
don't regress the build, especially with the -gcc-toolchain option.

- [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out whether 
we need to link with libatomic."
- [libcxx] r260524 - Fix r260515 - Correct typos in CMake changes
- [libcxx] r260531 - Rename CheckLibcxxAtomic.cmake variable result names so 
they don't clash with LLVM

@Marshall Any objections?

On Thu, Feb 11, 2016 at 2:18 AM, Daniel Sanders via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Hi,

In my latests rc2+patches build I've also found that we need to rename 
HAVE_CXX_ATOMICS_WITH_LIB to something like LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB. 
It's currently re-using the result of LLVM's check which doesn't include 64-bit 
atomics.

From: Vasileios Kalintiris
Sent: 09 February 2016 23:50
To: h...@chromium.org<mailto:h...@chromium.org>
Cc: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>; Daniel 
Sanders; mclow.li...@gmail.com<mailto:mclow.li...@gmail.com>
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Please wait before merging this as it breaks LLVM bootstraps when using the 
-gcc-toolchain option and the system's default gcc installation does not 
provide libatomic. We have to check LIBCXX_GCC_TOOLCHAIN in our test. I'll 
create a patch tomorrow and I'll let you know when it's okay to merge them. In 
the meantime, I reverted it in r260323.

- Vasileios

From: Vasileios Kalintiris
Sent: 09 February 2016 18:56
To: h...@chromium.org<mailto:h...@chromium.org>
Cc: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>; Daniel 
Sanders; mclow.li...@gmail.com<mailto:mclow.li...@gmail.com>
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Can we merge this on the 3.8 release branch? It fixes libcxx builds on MIPS by 
linking with libatomic when needed. Also, all the x86_64 and ARM buildbots for 
libcxx look good.

Thanks,
Vasileios

____
From: cfe-commits 
[cfe-commits-boun...@lists.llvm.org<mailto:cfe-commits-boun...@lists.llvm.org>] 
on behalf of Vasileios Kalintiris via cfe-commits 
[cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>]
Sent: 09 February 2016 17:00
To: cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>
Subject: [libcxx] r260235 - Introduce a cmake module to figure out whether we 
need to link with libatomic.

Author: vkalintiris
Date: Tue Feb  9 11:00:38 2016
New Revision: 260235

URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
Log:
Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16613

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in<http://lit.site.cfg.in>

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38 2016
@@ 

[libcxx] r260961 - Issue a warning instead of fatal errors when checks for libatomic fail.

2016-02-16 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Tue Feb 16 08:15:27 2016
New Revision: 260961

URL: http://llvm.org/viewvc/llvm-project?rev=260961&view=rev
Log:
Issue a warning instead of fatal errors when checks for libatomic fail.

This should fix PR26631, PR26622 and has the nice property that the addition
of the CheckLibcxxAtomic.cmake module acts as an NFC on the platforms of the
reporters (at least for the time being).

As these bug reports explain, CMake fails the atomic check because the
include headers might not exist in the host environment. We could
potentially point to the headers provided by libcxx itself.

Modified:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake

Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260961&r1=260960&r2=260961&view=diff
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb 16 08:15:27 2016
@@ -33,9 +33,9 @@ if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_L
 list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
 check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
 if (NOT LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
-  message(FATAL_ERROR "Host compiler must support std::atomic!")
+  message(WARNING "Host compiler must support std::atomic!")
 endif()
   else()
-message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+message(WARNING "Host compiler appears to require libatomic, but cannot 
find it.")
   endif()
 endif()


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


RE: [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out whether we need to link with libatomic."

2016-02-11 Thread Vasileios Kalintiris via cfe-commits
Hi Eric,

Your changes work fine for me. Out of curiosity, the correctness issue you 
mentioned was about the lines you removed from config-ix.cmake, right?

- Vasileios

From: Eric Fiselier [e...@efcs.ca]
Sent: 11 February 2016 15:11
To: Vasileios Kalintiris
Cc: cfe-commits
Subject: Re: [libcxx] r260515 - Re-commit "Introduce a cmake module to figure 
out whether we need to link with libatomic."

Hi Vasileios,

This patch doesn't quite work correctly. I've committed a follow up fix to it 
as r260524.

Let me know if you have any issues.

/Eric

On Thu, Feb 11, 2016 at 5:43 AM, Vasileios Kalintiris via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: vkalintiris
Date: Thu Feb 11 06:43:04 2016
New Revision: 260515

URL: http://llvm.org/viewvc/llvm-project?rev=260515&view=rev
Log:
Re-commit "Introduce a cmake module to figure out whether we need to link with 
libatomic."

This re-applies commit r260235. However, this time we add -gcc-toolchain
to the compiler's flags when the user has specified the LIBCXX_GCC_TOOLCHAIN
variable.

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in<http://lit.site.cfg.in>

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260515&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Thu Feb 11 06:43:04 2016
@@ -0,0 +1,41 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  if (${LIBCXX_GCC_TOOLCHAIN})
+set(CMAKE_REQUIRED_FLAGS "-std=c++11 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
+  endif()
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu Feb 11 06:43:04 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)

 # Check compiler flags

@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu Feb 11 06:43:04 2016
@@ -79,6 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)

 # Setup flags.
 add_flags_if_supported(-fPIC)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/

RE: [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out whether we need to link with libatomic."

2016-02-11 Thread Vasileios Kalintiris via cfe-commits
Hi Hans,

Can we merge this on the release branch? It's a re-commit of D16613's patch 
with the an additional option (-gcc-toolchain) to the default flags, that we 
use in order to test support for atomics, when the user doesn't want to use the 
default/system GCC installation. Buildbots look good with this.

Thanks,
Vasileios


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Vasileios 
Kalintiris via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 11 February 2016 12:43
To: cfe-commits@lists.llvm.org
Subject: [libcxx] r260515 - Re-commit "Introduce a cmake module to figure out 
whether we need to link with libatomic."

Author: vkalintiris
Date: Thu Feb 11 06:43:04 2016
New Revision: 260515

URL: http://llvm.org/viewvc/llvm-project?rev=260515&view=rev
Log:
Re-commit "Introduce a cmake module to figure out whether we need to link with 
libatomic."

This re-applies commit r260235. However, this time we add -gcc-toolchain
to the compiler's flags when the user has specified the LIBCXX_GCC_TOOLCHAIN
variable.

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260515&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Thu Feb 11 06:43:04 2016
@@ -0,0 +1,41 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  if (${LIBCXX_GCC_TOOLCHAIN})
+set(CMAKE_REQUIRED_FLAGS "-std=c++11 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
+  endif()
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu Feb 11 06:43:04 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)

 # Check compiler flags

@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu Feb 11 06:43:04 2016
@@ -79,6 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)

 # Setup flags.
 add_flags_if_supported(-fPIC)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=260515&a

[libcxx] r260515 - Re-commit "Introduce a cmake module to figure out whether we need to link with libatomic."

2016-02-11 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Thu Feb 11 06:43:04 2016
New Revision: 260515

URL: http://llvm.org/viewvc/llvm-project?rev=260515&view=rev
Log:
Re-commit "Introduce a cmake module to figure out whether we need to link with 
libatomic."

This re-applies commit r260235. However, this time we add -gcc-toolchain
to the compiler's flags when the user has specified the LIBCXX_GCC_TOOLCHAIN
variable.

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260515&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Thu Feb 11 06:43:04 2016
@@ -0,0 +1,41 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  if (${LIBCXX_GCC_TOOLCHAIN})
+set(CMAKE_REQUIRED_FLAGS "-std=c++11 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
+  endif()
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu Feb 11 06:43:04 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu Feb 11 06:43:04 2016
@@ -79,6 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Thu Feb 11 06:43:04 2016
@@ -15,6 +15,7 @@ pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.

Modified: libcxx/trunk/test/libcxx/test/target_info.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/target_info.py?rev=260515&r1=260514&r2=260515&view=diff
==
--- libcxx/trunk/test/libcxx/test/target_info.py (orig

RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-09 Thread Vasileios Kalintiris via cfe-commits
Hi Hans,

Please wait before merging this as it breaks LLVM bootstraps when using the 
-gcc-toolchain option and the system's default gcc installation does not 
provide libatomic. We have to check LIBCXX_GCC_TOOLCHAIN in our test. I'll 
create a patch tomorrow and I'll let you know when it's okay to merge them. In 
the meantime, I reverted it in r260323.

- Vasileios

From: Vasileios Kalintiris
Sent: 09 February 2016 18:56
To: h...@chromium.org
Cc: cfe-commits@lists.llvm.org; Daniel Sanders; mclow.li...@gmail.com
Subject: RE: [libcxx] r260235 - Introduce a cmake module to figure out whether 
we need to link with libatomic.

Hi Hans,

Can we merge this on the 3.8 release branch? It fixes libcxx builds on MIPS by 
linking with libatomic when needed. Also, all the x86_64 and ARM buildbots for 
libcxx look good.

Thanks,
Vasileios


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Vasileios 
Kalintiris via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 09 February 2016 17:00
To: cfe-commits@lists.llvm.org
Subject: [libcxx] r260235 - Introduce a cmake module to figure out whether we 
need to link with libatomic.

Author: vkalintiris
Date: Tue Feb  9 11:00:38 2016
New Revision: 260235

URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
Log:
Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16613

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38 2016
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Tue Feb  9 11:00:38 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)

 # Check compiler flags

@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original

[libcxx] r260323 - Revert "Introduce a cmake module to figure out whether we need to link with libatomic."

2016-02-09 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Tue Feb  9 17:38:28 2016
New Revision: 260323

URL: http://llvm.org/viewvc/llvm-project?rev=260323&view=rev
Log:
Revert "Introduce a cmake module to figure out whether we need to link with 
libatomic."

This reverts commit r260235. It breaks LLVM's bootstrap when building
with a -gcc-toolchain and the system's gcc installation does not provide
the libatomic library and its headers. We should check whether
LIBCXX_GCC_TOOLCHAIN is set and adjust the flags accordingly.

Removed:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Removed: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260322&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (removed)
@@ -1,38 +0,0 @@
-INCLUDE(CheckCXXSourceCompiles)
-
-# Sometimes linking against libatomic is required for atomic ops, if
-# the platform doesn't support lock-free atomics.
-#
-# We could modify LLVM's CheckAtomic module and have it check for 64-bit
-# atomics instead. However, we would like to avoid careless uses of 64-bit
-# atomics inside LLVM over time on 32-bit platforms.
-
-function(check_cxx_atomics varname)
-  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
-  check_cxx_source_compiles("
-#include 
-#include 
-std::atomic x;
-std::atomic y;
-int main() {
-  return x + y;
-}
-" ${varname})
-  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
-endfunction(check_cxx_atomics)
-
-check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
-# If not, check if the library exists, and atomics work with it.
-if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
-  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
-  if(HAVE_LIBATOMIC)
-list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
-check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
-if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
-  message(FATAL_ERROR "Host compiler must support std::atomic!")
-endif()
-  else()
-message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
-  endif()
-endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260323&r1=260322&r2=260323&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Tue Feb  9 17:38:28 2016
@@ -1,6 +1,5 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
-include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
@@ -18,7 +17,3 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
-
-if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
-  set(LIBCXX_HAS_ATOMIC_LIB True)
-endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260323&r1=260322&r2=260323&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Tue Feb  9 17:38:28 2016
@@ -79,7 +79,6 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
-add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=260323&r1=260322&r2=260323&view=diff
==
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Tue Feb  9 17:38:28 2016
@@ -15,7 +15,6 @@ pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
-pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.

Modified: libcxx/trunk/test/libcxx/test/target_info.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/target_info.py?rev=260323&r1=260322&r2=260323&view=diff
==
--- libcxx/trunk/test/libcxx/test/target_info.py (original)
+++ libcxx/trunk/test/libcxx/test

RE: [libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-09 Thread Vasileios Kalintiris via cfe-commits
Hi Hans,

Can we merge this on the 3.8 release branch? It fixes libcxx builds on MIPS by 
linking with libatomic when needed. Also, all the x86_64 and ARM buildbots for 
libcxx look good.

Thanks,
Vasileios


From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of Vasileios 
Kalintiris via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 09 February 2016 17:00
To: cfe-commits@lists.llvm.org
Subject: [libcxx] r260235 - Introduce a cmake module to figure out whether we 
need to link with libatomic.

Author: vkalintiris
Date: Tue Feb  9 11:00:38 2016
New Revision: 260235

URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
Log:
Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16613

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38 2016
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Tue Feb  9 11:00:38 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)

 # Check compiler flags

@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Tue Feb  9 11:00:38 2016
@@ -79,6 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)

 # Setup flags.
 add_flags_if_supported(-fPIC)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Tue 

Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-09 Thread Vasileios Kalintiris via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL260235: Introduce a cmake module to figure out whether we 
need to link with libatomic. (authored by vkalintiris).

Changed prior to commit:
  http://reviews.llvm.org/D16613?vs=46286&id=47329#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16613

Files:
  libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
  libcxx/trunk/cmake/config-ix.cmake
  libcxx/trunk/lib/CMakeLists.txt
  libcxx/trunk/test/CMakeLists.txt
  libcxx/trunk/test/libcxx/test/target_info.py
  libcxx/trunk/test/lit.site.cfg.in

Index: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
===
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
+  endif()
+endif()
Index: libcxx/trunk/cmake/config-ix.cmake
===
--- libcxx/trunk/cmake/config-ix.cmake
+++ libcxx/trunk/cmake/config-ix.cmake
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
@@ -17,3 +18,7 @@
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()
Index: libcxx/trunk/test/lit.site.cfg.in
===
--- libcxx/trunk/test/lit.site.cfg.in
+++ libcxx/trunk/test/lit.site.cfg.in
@@ -20,6 +20,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
+config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
Index: libcxx/trunk/test/CMakeLists.txt
===
--- libcxx/trunk/test/CMakeLists.txt
+++ libcxx/trunk/test/CMakeLists.txt
@@ -15,6 +15,7 @@
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
Index: libcxx/trunk/test/libcxx/test/target_info.py
===
--- libcxx/trunk/test/libcxx/test/target_info.py
+++ libcxx/trunk/test/libcxx/test/target_info.py
@@ -172,6 +172,9 @@
 flags += ['-lunwind', '-ldl']
 else:
 flags += ['-lgcc_s', '-lgcc']
+use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
+if use_libatomic:
+flags += ['-latomic']
 san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
 if san:
 # The libraries and their order are taken from the
Index: libcxx/trunk/lib/CMakeLists.txt
===
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -79,6 +79,7 @@
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.

[libcxx] r260235 - Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-09 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Tue Feb  9 11:00:38 2016
New Revision: 260235

URL: http://llvm.org/viewvc/llvm-project?rev=260235&view=rev
Log:
Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16613

Added:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/lib/CMakeLists.txt
libcxx/trunk/test/CMakeLists.txt
libcxx/trunk/test/libcxx/test/target_info.py
libcxx/trunk/test/lit.site.cfg.in

Added: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=260235&view=auto
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (added)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Tue Feb  9 11:00:38 2016
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but 
cannot find it.")
+  endif()
+endif()

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Tue Feb  9 11:00:38 2016
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
@@ -17,3 +18,7 @@ check_library_exists(c fopen "" LIBCXX_H
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Tue Feb  9 11:00:38 2016
@@ -79,6 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)

Modified: libcxx/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/test/CMakeLists.txt (original)
+++ libcxx/trunk/test/CMakeLists.txt Tue Feb  9 11:00:38 2016
@@ -15,6 +15,7 @@ pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.

Modified: libcxx/trunk/test/libcxx/test/target_info.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/target_info.py?rev=260235&r1=260234&r2=260235&view=diff
==
--- libcxx/trunk/test/libcxx/test/target_info.py (original)
+++ libcxx/trunk/test/libc

Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-02-05 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

Sorry for the early pings. In case it's not clear from Daniel's comment, 
without this patch libc++ will be broken for 32-bit MIPS CPUs. The relevant bug 
report has been nominated as a release block but we'd like to have it committed 
before the next RC.


http://reviews.llvm.org/D16613



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


Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-01-29 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

Is this okay to commit with the updated changes?


http://reviews.llvm.org/D16613



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


Re: [PATCH] D16613: Introduce a cmake module to figure out whether we need to link with libatomic.

2016-01-28 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 46286.
vkalintiris added a comment.

Check for atomcis on uintmax_t/uintptr_t instead of long long int.


http://reviews.llvm.org/D16613

Files:
  cmake/Modules/CheckLibcxxAtomic.cmake
  cmake/config-ix.cmake
  lib/CMakeLists.txt
  test/CMakeLists.txt
  test/libcxx/test/target_info.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -20,6 +20,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
+config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -172,6 +172,9 @@
 flags += ['-lunwind', '-ldl']
 else:
 flags += ['-lgcc_s', '-lgcc']
+use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
+if use_libatomic:
+flags += ['-latomic']
 san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
 if san:
 # The libraries and their order are taken from the
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -15,6 +15,7 @@
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -79,6 +79,7 @@
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)
Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
@@ -17,3 +18,7 @@
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()
Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- /dev/null
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -0,0 +1,38 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+#include 
+std::atomic x;
+std::atomic y;
+int main() {
+  return x + y;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
+  endif()
+endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16613: Use LLVM's CheckAtomic cmake module to figure out whether we need to link with libatomic.

2016-01-28 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 46272.
vkalintiris added a comment.

Don't use LLVM's CheckAtomic cmake module. Instead, use a libcxx-specific one
that allows checking for 64-bit atomics too.


http://reviews.llvm.org/D16613

Files:
  cmake/Modules/CheckLibcxxAtomic.cmake
  cmake/config-ix.cmake
  lib/CMakeLists.txt
  test/CMakeLists.txt
  test/libcxx/test/target_info.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -20,6 +20,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
+config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -172,6 +172,9 @@
 flags += ['-lunwind', '-ldl']
 else:
 flags += ['-lgcc_s', '-lgcc']
+use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
+if use_libatomic:
+flags += ['-latomic']
 san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
 if san:
 # The libraries and their order are taken from the
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -15,6 +15,7 @@
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -79,6 +79,7 @@
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)
Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckLibcxxAtomic)
 
 # Check compiler flags
 
@@ -17,3 +18,7 @@
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()
Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- /dev/null
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -0,0 +1,36 @@
+INCLUDE(CheckCXXSourceCompiles)
+
+# Sometimes linking against libatomic is required for atomic ops, if
+# the platform doesn't support lock-free atomics.
+#
+# We could modify LLVM's CheckAtomic module and have it check for 64-bit
+# atomics instead. However, we would like to avoid careless uses of 64-bit
+# atomics inside LLVM over time on 32-bit platforms.
+
+function(check_cxx_atomics varname)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS "-std=c++11")
+  check_cxx_source_compiles("
+#include 
+std::atomic x;
+int main() {
+  return x;
+}
+" ${varname})
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+endfunction(check_cxx_atomics)
+
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
+# If not, check if the library exists, and atomics work with it.
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
+  if(HAVE_LIBATOMIC)
+list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
+check_cxx_atomics(HAVE_CXX_ATOMICS_WITH_LIB)
+if (NOT HAVE_CXX_ATOMICS_WITH_LIB)
+  message(FATAL_ERROR "Host compiler must support std::atomic!")
+endif()
+  else()
+message(FATAL_ERROR "Host compiler appears to require libatomic, but cannot find it.")
+  endif()
+endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D16613: Use LLVM's CheckAtomic cmake module to figure out whether we need to link with libatomic.

2016-01-26 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added reviewers: dsanders, mclow.lists, EricWF, jroelofs.
vkalintiris added a subscriber: cfe-commits.

This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

http://reviews.llvm.org/D16613

Files:
  cmake/config-ix.cmake
  lib/CMakeLists.txt
  test/CMakeLists.txt
  test/libcxx/test/target_info.py
  test/lit.site.cfg.in

Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -20,6 +20,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
+config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -172,6 +172,9 @@
 flags += ['-lunwind', '-ldl']
 else:
 flags += ['-lgcc_s', '-lgcc']
+use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
+if use_libatomic:
+flags += ['-latomic']
 san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
 if san:
 # The libraries and their order are taken from the
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -15,6 +15,7 @@
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -79,6 +79,7 @@
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)
Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,6 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+include(CheckAtomic)
 
 # Check compiler flags
 
@@ -17,3 +18,7 @@
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
 check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+
+if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
+  set(LIBCXX_HAS_ATOMIC_LIB True)
+endif()


Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -20,6 +20,7 @@
 config.target_info  = "@LIBCXX_TARGET_INFO@"
 config.executor = "@LIBCXX_EXECUTOR@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
+config.use_libatomic= "@LIBCXX_HAS_ATOMIC_LIB@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -172,6 +172,9 @@
 flags += ['-lunwind', '-ldl']
 else:
 flags += ['-lgcc_s', '-lgcc']
+use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
+if use_libatomic:
+flags += ['-latomic']
 san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
 if san:
 # The libraries and their order are taken from the
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -15,6 +15,7 @@
 pythonize_bool(LIBCXX_BUILD_32_BITS)
 pythonize_bool(LIBCXX_GENERATE_COVERAGE)
 pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
+pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
 
 # The tests shouldn't link to any ABI library when it has been linked into
 # libc++ statically or via a linker script.
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -79,6 +79,7 @@
 add_library_flags_if(LIBCXX_HAS_M_LIB m)
 add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
 add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
+add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
 
 # Setup flags.
 add_flags_if_supported(-fPIC)
Index: cmake/config-ix.cmake
===

[PATCH] D15145: Add expressions to ignore vim swap files in .gitinore.

2015-12-02 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added a subscriber: cfe-commits.

http://reviews.llvm.org/D15145

Files:
  .gitignore

Index: .gitignore
===
--- .gitignore
+++ .gitignore
@@ -52,3 +52,7 @@
 
 # PyBuilder
 target/
+
+# vim swap files
+.*.sw?
+.sw?


Index: .gitignore
===
--- .gitignore
+++ .gitignore
@@ -52,3 +52,7 @@
 
 # PyBuilder
 target/
+
+# vim swap files
+.*.sw?
+.sw?
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15130: Fix the clang driver when "-nostdlib" is present

2015-12-02 Thread Vasileios Kalintiris via cfe-commits
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.

LGTM. Thank you for working on this.


http://reviews.llvm.org/D15130



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


Re: [PATCH] D14926: Use libcxx's default rune table with the Musl C library.

2015-11-24 Thread Vasileios Kalintiris via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253972: Use libcxx's default rune table with the Musl C 
library. (authored by vkalintiris).

Changed prior to commit:
  http://reviews.llvm.org/D14926?vs=40926&id=41016#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14926

Files:
  libcxx/trunk/include/__config
  libcxx/trunk/include/__locale
  libcxx/trunk/src/locale.cpp

Index: libcxx/trunk/src/locale.cpp
===
--- libcxx/trunk/src/locale.cpp
+++ libcxx/trunk/src/locale.cpp
@@ -813,7 +813,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -827,7 +827,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -842,7 +842,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -856,7 +856,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -925,7 +925,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
@@ -942,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -959,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -975,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1016,7 +1016,7 @@
 return low;
 }
 
-#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#if defined(__EMSCRIPTEN__)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1118,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__EMSCRIPTEN__)
 return *__ctype_b_loc();
 #elif defined(_NEWLIB_VERSION)
 // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
@@ -1161,7 +1161,7 @@
 return _C_toupper_tab_ + 1;
 }
 
-#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__EMSCRIPTEN__)
 const int*
 ctype::__cla

[libcxx] r253972 - Use libcxx's default rune table with the Musl C library.

2015-11-24 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Tue Nov 24 04:24:54 2015
New Revision: 253972

URL: http://llvm.org/viewvc/llvm-project?rev=253972&view=rev
Log:
Use libcxx's default rune table with the Musl C library.

Summary:
Also, there are no exported character type tables from Musl so we have to
Fallback to the standard functions. This reduces the number of libcxx's
test-suite failures down to ~130 for MIPS. Most of the remaining failures
come from the atomics (due to the lack of 8-byte atomic-ops in MIPS32) and
thread tests.

Reviewers: mclow.lists, EricWF, dalias, jroelofs

Subscribers: tberghammer, danalbert, srhines, cfe-commits

Differential Revision: http://reviews.llvm.org/D14926

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/__locale
libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=253972&r1=253971&r2=253972&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Nov 24 04:24:54 2015
@@ -804,7 +804,7 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_NO_STDOUT
 #endif
 
-#if defined(__ANDROID__) || defined(__CloudABI__)
+#if defined(__ANDROID__) || defined(__CloudABI__) || 
defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #endif
 

Modified: libcxx/trunk/include/__locale
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=253972&r1=253971&r2=253972&view=diff
==
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Tue Nov 24 04:24:54 2015
@@ -361,7 +361,7 @@ public:
 typedef __uint32_t mask;
 # elif defined(__FreeBSD__)
 typedef unsigned long mask;
-# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__) || 
defined(_LIBCPP_HAS_MUSL_LIBC)
+# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
 typedef unsigned short mask;
 # endif
 static const mask space  = _CTYPE_S;
@@ -408,11 +408,7 @@ public:
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
 # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
 #else
-#if defined(_LIBCPP_HAS_MUSL_LIBC)
-typedef unsigned short mask;
-#else
 typedef unsigned long mask;
-#endif
 static const mask space  = 1<<0;
 static const mask print  = 1<<1;
 static const mask cntrl  = 1<<2;
@@ -634,7 +630,7 @@ public:
 #endif
 _LIBCPP_ALWAYS_INLINE const mask* table() const  _NOEXCEPT {return __tab_;}
 static const mask* classic_table()  _NOEXCEPT;
-#if defined(__GLIBC__) || defined(__EMSCRIPTEN__) || 
defined(_LIBCPP_HAS_MUSL_LIBC)
+#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 static const int* __classic_upper_table() _NOEXCEPT;
 static const int* __classic_lower_table() _NOEXCEPT;
 #endif

Modified: libcxx/trunk/src/locale.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=253972&r1=253971&r2=253972&view=diff
==
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Tue Nov 24 04:24:54 2015
@@ -813,7 +813,7 @@ ctype::do_toupper(char_type c)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : 
c;
@@ -827,7 +827,7 @@ ctype::do_toupper(char_type* lo
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -842,7 +842,7 @@ ctype::do_tolower(char_type c)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -856,7 +856,7 @@ ctype::do_tolower(char_type* lo
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -925,7 +9

Re: [PATCH] D14926: Use libcxx's default rune table with the Musl C library.

2015-11-23 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

@dalias: Can you take a correctness-look at this patch?



Comment at: include/__locale:411-415
@@ -410,7 +410,3 @@
 #else
-#if defined(_LIBCPP_HAS_MUSL_LIBC)
-typedef unsigned short mask;
-#else
 typedef unsigned long mask;
-#endif
 static const mask space  = 1<<0;

Which typedef should we choose for mask?


http://reviews.llvm.org/D14926



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


[PATCH] D14926: Use libcxx's default rune table with the Musl C library.

2015-11-23 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added reviewers: mclow.lists, jroelofs, EricWF, dalias.
vkalintiris added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Also, there are no exported character type tables from Musl so we have to
Fallback to the standard functions. This reduces the number of libcxx's
test-suite failures down to ~130 for MIPS. Most of the remaining failures
come from the atomics (due to the lack of 8-byte atomic-ops in MIPS32) and
thread tests.

http://reviews.llvm.org/D14926

Files:
  include/__config
  include/__locale
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -813,7 +813,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -827,7 +827,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -842,7 +842,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -856,7 +856,7 @@
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
 #elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
-  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+  defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -925,7 +925,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
@@ -942,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -959,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -975,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1016,7 +1016,7 @@
 return low;
 }
 
-#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#if defined(__EMSCRIPTEN__)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1118,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#elif defined(__EMSCRIPTEN__)
 return *__ctype_b_loc();
 #elif defined(_NEWLIB_VERSION)
 // Newlib has a 257-entry table in ctype_.c, where (char)0 starts at [1].
@@ -1161,7 +1161,7 @@
 retur

r253214 - [mips] Do not add arch name in the compiler-rt's components.

2015-11-16 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon Nov 16 09:41:30 2015
New Revision: 253214

URL: http://llvm.org/viewvc/llvm-project?rev=253214&view=rev
Log:
[mips] Do not add arch name in the compiler-rt's components.

Instead, use the constant "mips" since the libraries are already
placed under the multilib's OS suffix.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=253214&r1=253213&r2=253214&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Nov 16 09:41:30 2015
@@ -2517,8 +2517,7 @@ std::string MipsLLVMToolChain::getCompil
   llvm::sys::path::append(Path, SelectedMultilib.osSuffix(), "lib" + LibSuffix,
   getOS());
   llvm::sys::path::append(Path, Twine("libclang_rt." + Component + "-" +
-  getTriple().getArchName() +
-  (Shared ? ".so" : ".a")));
+  "mips" + (Shared ? ".so" : ".a")));
   return Path.str();
 }
 

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253214&r1=253213&r2=253214&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Mon Nov 16 09:41:30 2015
@@ -37,6 +37,6 @@
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
-// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mips.a"
 // CHECK-LE-HF-32R2-SAME: "-lc"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crtn.o"


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


RE: r253011 - clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish paths.

2015-11-13 Thread Vasileios Kalintiris via cfe-commits
Thank you for making this run on win buildbots!

- Vasileios

From: cfe-commits [cfe-commits-boun...@lists.llvm.org] on behalf of NAKAMURA 
Takumi via cfe-commits [cfe-commits@lists.llvm.org]
Sent: 13 November 2015 04:44
To: cfe-commits@lists.llvm.org
Subject: r253011 - clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish 
paths.

Author: chapuni
Date: Thu Nov 12 22:44:51 2015
New Revision: 253011

URL: http://llvm.org/viewvc/llvm-project?rev=253011&view=rev
Log:
clang/test/Driver/mips-mti-linux.c: Tweak to match DOSish paths.

Modified:
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253011&r1=253010&r2=253011&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Thu Nov 12 22:44:51 2015
@@ -5,8 +5,6 @@
 //Ideally, we'd like to have an --llvm-toolchain option similar to
 //the --gcc-toolchain one.

-// REQUIRES: shell
-
 // = Big-endian, mips32r2, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
@@ -21,7 +19,7 @@
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
-// CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mips.a"
 // CHECK-BE-HF-32R2-SAME: "-lc"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crtn.o"

@@ -39,6 +37,6 @@
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
-// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl{{/|}}lib{{/|}}linux{{/|}}libclang_rt.builtins-mipsel.a"
 // CHECK-LE-HF-32R2-SAME: "-lc"
 // CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crtn.o"


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


r252901 - Re-recommit: Add support for the new mips-mti-linux toolchain.

2015-11-12 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Thu Nov 12 09:26:54 2015
New Revision: 252901

URL: http://llvm.org/viewvc/llvm-project?rev=252901&view=rev
Log:
Re-recommit: Add support for the new mips-mti-linux toolchain.

Last time, this caused two Windows buildbots and a single ARM buildbot to fail.
I XFAIL'd the failing test on win32,win64 machines in order to see if the ARM
buildbot complains again.

Added:
cfe/trunk/test/Driver/Inputs/mips_mti_linux/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=252901&r1=252900&r2=252901&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Nov 12 09:26:54 2015
@@ -2154,6 +2154,11 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
+
+  // Allow the discovery of tools prefixed with LLVM's default target triple.
+  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
+  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
+Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2251,6 +2256,9 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
+   !Target.hasEnvironment())
+TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=252901&r1=252900&r2=252901&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Nov 12 09:26:54 2015
@@ -333,7 +333,6 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
-
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cf

Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-11-09 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

Thanks for the review!

Everything seems fine from the buildbots except for a single test that failed:

  
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-debian/builds/730

The next build (731) of that buildbot was green. Is 
libc++::try_lock_shared_for.pass.cpp a known flakey test?


Repository:
  rL LLVM

http://reviews.llvm.org/D13673



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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-11-09 Thread Vasileios Kalintiris via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL252457: Add initial support for the MUSL C library. 
(authored by vkalintiris).

Changed prior to commit:
  http://reviews.llvm.org/D13673?vs=38788&id=39673#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13673

Files:
  libcxx/trunk/CMakeLists.txt
  libcxx/trunk/include/__config
  libcxx/trunk/include/__config_site.in
  libcxx/trunk/include/__locale
  libcxx/trunk/include/support/musl/xlocale.h
  libcxx/trunk/src/locale.cpp

Index: libcxx/trunk/src/locale.cpp
===
--- libcxx/trunk/src/locale.cpp
+++ libcxx/trunk/src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1114,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsen

[libcxx] r252457 - Add initial support for the MUSL C library.

2015-11-09 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon Nov  9 04:21:04 2015
New Revision: 252457

URL: http://llvm.org/viewvc/llvm-project?rev=252457&view=rev
Log:
Add initial support for the MUSL C library.

Summary:
This patch adds the LIBCXX_LIBC_IS_MUSL cmake option to allow the
building of libcxx with the Musl C library. The option is necessary as
Musl does not provide any predefined macro in order to test for its
presence, like GLIBC. Most of the changes specify the correct path to
choose through the various #if/#else constructs in the locale code.

Depends on D13407.

Reviewers: mclow.lists, jroelofs, EricWF

Subscribers: jfb, tberghammer, danalbert, srhines, cfe-commits

Differential Revision: http://reviews.llvm.org/D13673

Added:
libcxx/trunk/include/support/musl/
libcxx/trunk/include/support/musl/xlocale.h
Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/include/__config
libcxx/trunk/include/__config_site.in
libcxx/trunk/include/__locale
libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=252457&r1=252456&r2=252457&view=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Mon Nov  9 04:21:04 2015
@@ -121,6 +121,7 @@ option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUN
 option(LIBCXX_ENABLE_MONOTONIC_CLOCK
   "Build libc++ with support for a monotonic clock.
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
+option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" 
OFF)
 
 # Misc options 
 # FIXME: Turn -pedantic back ON. It is currently off because it warns
@@ -200,6 +201,11 @@ if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY AND
 LIBCXX_ENABLE_ABI_LINKER_SCRIPT")
 endif()
 
+if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
+  message(FATAL_ERROR "LIBCXX_INSTALL_SUPPORT_HEADERS can not be turned off"
+  "when building for Musl with LIBCXX_HAS_MUSL_LIBC.")
+endif()
+
 
#===
 # Configure System
 
#===
@@ -364,6 +370,8 @@ config_define_if_not(LIBCXX_ENABLE_THREA
 config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK 
_LIBCPP_HAS_NO_MONOTONIC_CLOCK)
 config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS 
_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
 
+config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
+
 if (LIBCXX_NEEDS_SITE_CONFIG)
   configure_file(
 include/__config_site.in

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=252457&r1=252456&r2=252457&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Nov  9 04:21:04 2015
@@ -386,14 +386,19 @@ typedef __char32_t char32_t;
 #elif defined(__ANDROID__)
 #define _LIBCPP_HAS_QUICK_EXIT
 #elif defined(__linux__)
-#include 
+#if !defined(_LIBCPP_HAS_MUSL_LIBC)
+# include 
 #if __GLIBC_PREREQ(2, 15)
 #define _LIBCPP_HAS_QUICK_EXIT
 #endif
 #if __GLIBC_PREREQ(2, 17)
 #define _LIBCPP_HAS_C11_FEATURES
 #endif
+#else // defined(_LIBCPP_HAS_MUSL_LIBC)
+#define _LIBCPP_HAS_QUICK_EXIT
+#define _LIBCPP_HAS_C11_FEATURES
 #endif
+#endif // __linux__
 #endif
 
 #if (__has_feature(cxx_noexcept))

Modified: libcxx/trunk/include/__config_site.in
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config_site.in?rev=252457&r1=252456&r2=252457&view=diff
==
--- libcxx/trunk/include/__config_site.in (original)
+++ libcxx/trunk/include/__config_site.in Mon Nov  9 04:21:04 2015
@@ -18,5 +18,6 @@
 #cmakedefine _LIBCPP_HAS_NO_THREADS
 #cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
 #cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+#cmakedefine _LIBCPP_HAS_MUSL_LIBC
 
-#endif
+#endif // _LIBCPP_CONFIG_SITE

Modified: libcxx/trunk/include/__locale
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=252457&r1=252456&r2=252457&view=diff
==
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Mon Nov  9 04:21:04 2015
@@ -37,6 +37,8 @@
 #elif (defined(__GLIBC__) || defined(__APPLE__)  || defined(__FreeBSD__) \
 || defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
 # include 
+#elif defined(_LIBCPP_HAS_MUSL_LIBC)
+# include 
 #endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ 
|| __IBMCPP__
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -329,7 +331,7 @@ locale::operator()(const basic_string<_C
 class _LIBCPP_TYPE_VIS ctype_base
 {
 public:
-#ifdef __GLIBC__

Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-11-06 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

Ping.


http://reviews.llvm.org/D13673



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


RE: [PATCH] D14239: mips-mti-linux TC + debug log

2015-11-02 Thread Vasileios Kalintiris via cfe-commits
Hi Renato,

Thanks for testing this. The /tmp/mips-mti-linux.log file contains log messages 
from the driver. It wasn't my intention to match anything meaningful from the 
mips-mti-linux.c test. 

I'll try to investigate what's going wrong tomorrow.

Thanks,
Vasileios

From: Renato Golin [renato.go...@linaro.org]
Sent: 02 November 2015 18:56
To: Clang Commits
Cc: Vasileios Kalintiris; JF Bastien; Derek Schuff
Subject: Re: [PATCH] D14239: mips-mti-linux TC + debug log

On 2 November 2015 at 16:35, Vasileios Kalintiris
 wrote:
> Can you apply this
> patch, build LLVM+Clang and run with llvm-lit the mips-mti-linux.c test?

Hi Vasileios,

I just built once and the test already fails with FileCheck reporting
empty output. Logs attached.

You seem to be sending the BE stderr to /tmp/mips-mti-linux.log, which
is not standard practice. You should either use the %t (for temp file)
or parse it together with stdout, as you do on the second line (LE).

If I put both to stdout, I still get FileCheck errors. Logs also attached.

cheers,
--renato
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r251695 - Try to run and investigate the mips-mti-linux.c test failure on ARM buildbots.

2015-10-30 Thread Vasileios Kalintiris via cfe-commits
Hi Renato,

> Please, don't do this. If you need investigation, you can ask the bot owner 
> (me) to help you.

I'm sorry for any inconvenience I might have caused. I was waiting to commit 
this early in the morning, near the end of the week, when the commit activity 
is low.

> For now, if you haven't fixed the issue yet, please revert this and your 
> previous commit.

I reverted the previous commit. I'd appreciate your help with this issue, I'll 
send you an email later to explain the problem and I'll try to come up with a 
patch that prints as many debug info as possible.

Thanks,
Vasileios
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r251698 - Revert "[mips] Add support for the new mips-mti-linux toolchain."

2015-10-30 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Fri Oct 30 06:28:39 2015
New Revision: 251698

URL: http://llvm.org/viewvc/llvm-project?rev=251698&view=rev
Log:
Revert "[mips] Add support for the new mips-mti-linux toolchain."

This reverts commits r251633. I'll investigate the test failure off trunk in
order to keep the buildbots clean.

Removed:

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=251698&r1=251697&r2=251698&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 30 06:28:39 2015
@@ -2153,11 +2153,6 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
-
-  // Allow the discovery of tools prefixed with LLVM's default target triple.
-  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
-  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
-Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2253,9 +2248,6 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
-  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
-   !Target.hasEnvironment())
-TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=251698&r1=251697&r2=251698&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct 30 06:28:39 2015
@@ -333,6 +333,7 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
+
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=251698&r1=251697&r2=251698&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct 30 06:28:39 2015
@@ -1294,9 +1294,8 @@ bool Generic_GCC::GCCInstallationDetecto
   "i586-linux-gnu"};
 
   static const char *const MIPSLibDirs[] = {"/lib"};
-  static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
-"mips-mti-linux-gnu",
-"mips-img-linux-gnu"};
+  static const char *const MIPSTriples[] = {
+  "mips-linux-gnu", "mips-mti-linux-gnu", "mips-img-linux-gnu"};
   static const char *const MIPSELLibDirs[] = {"/lib"};
   static const char *const MIPSELTriples[] = {
   "mipsel-linux-gnu", "mipsel-linux-android", "mips-img-linux-gnu"};
@@ -1687,32 +1686,6 @@ static bool findMIPSMultilibs(const Driv
 });
   }
 
-  // Check for Musl toolchain multilibs
-  MultilibSet MuslMipsMultilibs;
-  {
-auto MArchMipsR2 = makeMultilib("")
-   .osSuffix("/mips-r2-hard-musl")
-   .flag("+EB")
-   .flag("-EL")
-   

r251695 - Try to run and investigate the mips-mti-linux.c test failure on ARM buildbots.

2015-10-30 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Fri Oct 30 05:35:38 2015
New Revision: 251695

URL: http://llvm.org/viewvc/llvm-project?rev=251695&view=rev
Log:
Try to run and investigate the mips-mti-linux.c test failure on ARM buildbots.

This should be a NFC for every toolchain other than mips-mti-linux (where we
print the list of directories searched for crt files). It will soon be
reverted once we hit the clang-cmake-armv7-a15-selfhost-neon buildbot.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=251695&r1=251694&r2=251695&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 30 05:35:38 2015
@@ -8469,6 +8469,19 @@ void gnutools::Linker::ConstructJob(Comp
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
 
   CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
+
+  if (ToolChain.getTriple().getVendor() == llvm::Triple::MipsTechnologies 
&&
+  !ToolChain.getTriple().hasEnvironment()) {
+// Print look-up paths for crt files.
+llvm::errs() << "Looked for crti.o in: ";
+llvm::errs() << " PrefixDirs  - ";
+for (const std::string &Dir : D.PrefixDirs)
+  llvm::errs() << "Dir: " << Dir << ", ";
+llvm::errs() << " TC.getFilePaths()  - ";
+for (const std::string &Dir : ToolChain.getFilePaths())
+  llvm::errs() << "Dir: " << Dir << ",";
+llvm::errs() << "\n";
+  }
 }
 
 const char *crtbegin;

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=251695&r1=251694&r2=251695&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Fri Oct 30 05:35:38 2015
@@ -5,14 +5,15 @@
 //Ideally, we'd like to have an --llvm-toolchain option similar to
 //the --gcc-toolchain one.
 
-// RUN: false
-// XFAIL: *
+// XFAIL: i386, i686, x86_64, win32, win64, powerpc64, s390x, r600, xcore, 
hexagon, sparc, darwin, asan, msan
 
 // = Big-endian, mips32r2, hard float
-// R!N: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// R!N: --target=mips-mti-linux -mips32r2 -mhard-float \
-// R!N: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
-// R!N:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
+//
+// CHECK-BE-HF-32R2: Looked for crt1.o
 //
 // CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" 
"mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"


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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-30 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 38788.
vkalintiris added a comment.

s/__NetBSD_\)/__NetBSD__\)/


http://reviews.llvm.org/D13673

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__locale
  include/support/musl/xlocale.h
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1114,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__)
+#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return *__ctype_b_loc();
 #elif defined(_NEWLIB_VERSION)
 // Newlib has a 257-entry table in ctype_.c, wher

r251633 - [mips] Add support for the new mips-mti-linux toolchain.

2015-10-29 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Thu Oct 29 10:33:53 2015
New Revision: 251633

URL: http://llvm.org/viewvc/llvm-project?rev=251633&view=rev
Log:
[mips] Add support for the new mips-mti-linux toolchain.

The original commit in r249137 added the mips-mti-linux toolchain. However,
the newly added tests of that commit failed in few buildbots. This commit
re-applies the original changes but XFAILs the test file which caused
the buildbot failures. This will allow us to examine what's going wrong
without having to commit/revert large changes.

Added:

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=251633&r1=251632&r2=251633&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Oct 29 10:33:53 2015
@@ -2153,6 +2153,11 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
+
+  // Allow the discovery of tools prefixed with LLVM's default target triple.
+  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
+  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
+Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2248,6 +2253,9 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
+   !Target.hasEnvironment())
+TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=251633&r1=251632&r2=251633&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Oct 29 10:33:53 2015
@@ -333,7 +333,6 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
-
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=251633&r1=251632&r2=251633&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 29 10:33:53 2015
@@ -1294,8 +1294,9 @@ bool Generic_GCC::GCCInstallationDetecto
   "i586-linux-gnu"};
 
   static const char *const MIPSLibDirs[] = {"/lib"};
-  static const char *const MIPSTriples[] = {
-  "mips-linux-gnu", "mips-mti-linux-gnu", "mips-img-linux-gnu"};
+  static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
+"mips-mti-linux-gnu",
+"mips-img-linux-gnu"};
   static const char *const MIPSELLibDirs[] = {"/lib"};
   static const char *const MIPSELTriples[] = {
   "mipsel-linux-gnu", "mipsel-linux-android", "mips-img-linux-gnu"};
@@ -1686,6 +1687,32 @@ static bool findMIPSMultilibs(const Driv
 });
   }
 
+  // Check for Musl toolchain multilibs
+  MultilibSet MuslMip

Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-29 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

In http://reviews.llvm.org/D13673#271518, @EricWF wrote:

> Thanks for the update, I think this should be good to go. I'll give it a 
> final once over tonight.


Ping.


http://reviews.llvm.org/D13673



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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added inline comments.


Comment at: src/locale.cpp:958
@@ -957,3 +961,3 @@
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
 return isascii(c) ?

EricWF wrote:
> Where did the `__NetBSD__` case go?
It's in the previous #line directive, check line 956. 


http://reviews.llvm.org/D13673



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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-20 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 37850.
vkalintiris marked 6 inline comments as done.
vkalintiris added a comment.

Sorry for the delay.

Addressed reviewer comments and modifed CMake to check that
LIBCXX_INSTALL_SUPPORT_HEADERS is not turned off when LIBCXX_LIBC_IS_MUSL is ON.


http://reviews.llvm.org/D13673

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__locale
  include/support/musl/xlocale.h
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD_) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1114,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__)
+

Re: [PATCH] D13739: [libcxx] Make libc++.so a linker script by default on most platforms.

2015-10-16 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a subscriber: vkalintiris.


Comment at: cmake/Modules/HandleOutOfTreeLLVM.cmake:123-133
@@ +122,13 @@
+  else(WIN32)
+if(UNIX)
+  set(LLVM_ON_WIN32 0)
+  set(LLVM_ON_UNIX 1)
+  if(APPLE)
+set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
+  else(APPLE)
+set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
+  endif(APPLE)
+else(UNIX)
+  MESSAGE(SEND_ERROR "Unable to determine platform")
+endif(UNIX)
+  endif(WIN32)

I've created the review request D13025, that checks whether version scripts are 
supported in non-APPLE Unix platforms. As far as I know, LLD doesn't support 
version scripts at the moment. Would it make sense to check this in a similar 
fashion for out of tree LLVM?


http://reviews.llvm.org/D13739



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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-14 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added inline comments.


Comment at: CMakeLists.txt:309
@@ -307,1 +308,3 @@
 
+config_define_if(LIBCXX_LIBC_IS_MUSL _LIBCXX_LIBC_IS_MUSL)
+

EricWF wrote:
> Please name the macro "_LIBCPP_HAS_MUSL_LIBC" for consistency. 
Should I rename the corresponding cmake option too?


http://reviews.llvm.org/D13673



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


Re: [PATCH] D13673: Add initial support for the MUSL C library.

2015-10-14 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 37335.
vkalintiris added a comment.

Address reviewers' comments.


http://reviews.llvm.org/D13673

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__locale
  include/support/musl/xlocale.h
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD_) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1114,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EMSCRIPTEN__)
+#elif defined(__EMSCRIPTEN__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 return *__ctype_b_loc();
 #elif defined(_NEWLIB_VERSION)
 // Newlib has a 257-entry table in ctype_.c, wher

[PATCH] D13673: Add initial support for the MUSL C library.

2015-10-12 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added reviewers: mclow.lists, jroelofs, EricWF.
vkalintiris added a subscriber: cfe-commits.
vkalintiris added a dependency: D13407: [libcxx] Capture configuration 
information when installing the libc++ headers.
Herald added subscribers: srhines, danalbert, tberghammer, jfb.

This patch adds the LIBCXX_LIBC_IS_MUSL cmake option to allow the
building of libcxx with the Musl C library. The option is necessary as
Musl does not provide any predefined macro in order to test for its
presence, like GLIBC. Most of the changes specify the correct path to
choose through the various #if/#else constructs in the locale code.

Depends on D13407.

http://reviews.llvm.org/D13673

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__locale
  include/support/musl/xlocale.h
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCXX_LIBC_IS_MUSL)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCXX_LIBC_IS_MUSL)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD_) || defined(_LIBCXX_LIBC_IS_MUSL)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__NetBSD__) || defined(_LIBCXX_LIBC_IS_MUSL)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCXX_LIBC_IS_MUSL)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCXX_LIBC_IS_MUSL)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCXX_LIBC_IS_MUSL)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(_LIBCXX_LIBC_IS_MUSL)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if defined(__EMSCRIPTEN__) || defined(_LIBCXX_LIBC_IS_MUSL)
 extern "

Re: [PATCH] D13557: Make locale code compile on Linux without GLIBC.

2015-10-08 Thread Vasileios Kalintiris via cfe-commits
vkalintiris abandoned this revision.
vkalintiris added a comment.

In http://reviews.llvm.org/D13557#262801, @jroelofs wrote:

> Unfortunately, Musl intentionally doesn't provide that sort of macro [1], so 
> to provide support for Musl in libc++, we need to make note of it at 
> configure-time via something like a _LIBCXX_LIBC_IS_MUSL macro via 
> http://reviews.llvm.org/D13407.


Agreed. That would be much more elegant. I had to write another patch to test 
for the existence of *each* extended locale functions during 
configuration-time. It was generic but an ugly hack. Offering a 
_LIBCXX_LIBC_IS_MUSL option/macro would make things quite simpler. I'll abandon 
this review request and I'll wait until http://reviews.llvm.org/D13407 is 
committed.


http://reviews.llvm.org/D13557



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


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-08 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a subscriber: vkalintiris.


Comment at: include/CMakeLists.txt:9
@@ -7,2 +8,3 @@
   PATTERN ".svn" EXCLUDE
+  PATTERN "__config_site.in" EXCLUDE
   ${LIBCXX_SUPPORT_HEADER_PATTERN}

Kind of silly but I believe that the files used for auto-generated config 
headers in LLVM have the extesions `.cmake` and `.in`, for cmake and autoconf, 
respectively.


http://reviews.llvm.org/D13407



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


[PATCH] D13557: Make locale code compile on Linux without GLIBC.

2015-10-08 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added a reviewer: mclow.lists.
vkalintiris added a subscriber: cfe-commits.

Most of the #ifdefs in the locale code would check for the existence of
GLIBC or for operating systems other than Linux. This patch considers the
case where GLIBC isn't available on Linux, and allows the libcxx
library to build successfully when using the musl C library (with a
small patch for the extended locale functions strtoll_l() and
strtoull_l()).

http://reviews.llvm.org/D13557

Files:
  include/__locale
  src/locale.cpp

Index: src/locale.cpp
===
--- src/locale.cpp
+++ src/locale.cpp
@@ -812,7 +812,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__linux__) || defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_upper_table()[c] : c;
 #else
 return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@@ -825,7 +826,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__linux__) || defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_upper_table()[*low]
  : *low;
 #else
@@ -839,7 +841,8 @@
 {
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__linux__) || defined(__NetBSD__)
 return isascii(c) ? ctype::__classic_lower_table()[c] : c;
 #else
 return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@@ -852,7 +855,8 @@
 for (; low != high; ++low)
 #ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
 *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
+  defined(__linux__) || defined(__NetBSD__)
 *low = isascii(*low) ? ctype::__classic_lower_table()[*low]
  : *low;
 #else
@@ -921,8 +925,8 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_upper_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
-return isascii(c) ? 
+#elif defined(__GLIBC__) || defined(__linux__) || defined(__EMSCRIPTEN__)
+return isascii(c) ?
   static_cast(__classic_upper_table()[static_cast(c)]) : c;
 #else
 return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@@ -938,7 +942,7 @@
   static_cast(_DefaultRuneLocale.__mapupper[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_upper_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__linux__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ?
   static_cast(__classic_upper_table()[static_cast(*low)]) : *low;
 #else
@@ -955,7 +959,7 @@
   static_cast(_DefaultRuneLocale.__maplower[static_cast(c)]) : c;
 #elif defined(__NetBSD__)
 return static_cast(__classic_lower_table()[static_cast(c)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+#elif defined(__GLIBC__) || defined(__linux__) || defined(__EMSCRIPTEN__)
 return isascii(c) ?
   static_cast(__classic_lower_table()[static_cast(c)]) : c;
 #else
@@ -971,7 +975,7 @@
 *low = isascii(*low) ? static_cast(_DefaultRuneLocale.__maplower[static_cast(*low)]) : *low;
 #elif defined(__NetBSD__)
 *low = static_cast(__classic_lower_table()[static_cast(*low)]);
-#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
+#elif defined(__GLIBC__) || defined(__linux__) || defined(__EMSCRIPTEN__)
 *low = isascii(*low) ? static_cast(__classic_lower_table()[static_cast(*low)]) : *low;
 #else
 *low = (isascii(*low) && isupper_l(*low, _LIBCPP_GET_C_LOCALE)) ? *low-'A'+'a' : *low;
@@ -1012,7 +1016,7 @@
 return low;
 }
 
-#ifdef __EMSCRIPTEN__
+#if !defined(__GLIBC__) && (defined(__linux__) || defined(__EMSCRIPTEN__))
 extern "C" const unsigned short ** __ctype_b_loc();
 extern "C" const int ** __ctype_tolower_loc();
 extern "C" const int ** __ctype_toupper_loc();
@@ -1114,7 +1118,7 @@
 return _ctype+1; // internal ctype mask table defined in msvcrt.dll
 // This is assumed to be safe, which is a nonsense assumption because we're
 // going to end up dereferencing it later...
-#elif defined(__EM

r249298 - Remove support for the mips-mti-linux toolchain.

2015-10-05 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon Oct  5 05:34:46 2015
New Revision: 249298

URL: http://llvm.org/viewvc/llvm-project?rev=249298&view=rev
Log:
Remove support for the mips-mti-linux toolchain.

There are two remaining buildbot failures that we'll have to
investigate before submitting this again.

Removed:

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=249298&r1=249297&r2=249298&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Oct  5 05:34:46 2015
@@ -2122,11 +2122,6 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
-
-  // Allow the discovery of tools prefixed with LLVM's default target triple.
-  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
-  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
-Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -,9 +2217,6 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
-  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
-   !Target.hasEnvironment())
-TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=249298&r1=249297&r2=249298&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Oct  5 05:34:46 2015
@@ -315,6 +315,7 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
+
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249298&r1=249297&r2=249298&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct  5 05:34:46 2015
@@ -1301,9 +1301,8 @@ bool Generic_GCC::GCCInstallationDetecto
   "i586-linux-gnu"};
 
   static const char *const MIPSLibDirs[] = {"/lib"};
-  static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
-"mips-mti-linux-gnu",
-"mips-img-linux-gnu"};
+  static const char *const MIPSTriples[] = {
+  "mips-linux-gnu", "mips-mti-linux-gnu", "mips-img-linux-gnu"};
   static const char *const MIPSELLibDirs[] = {"/lib"};
   static const char *const MIPSELTriples[] = {
   "mipsel-linux-gnu", "mipsel-linux-android", "mips-img-linux-gnu"};
@@ -1692,32 +1691,6 @@ static bool findMIPSMultilibs(const llvm
 });
   }
 
-  // Check for Musl toolchain multilibs
-  MultilibSet MuslMipsMultilibs;
-  {
-auto MArchMipsR2 = makeMultilib("")
-   .osSuffix("/mips-r2-hard-musl")
-   .flag("+EB")
-   .flag("-EL")
-   .flag("+march=

r249296 - Fix test failure on Windows buildbots for the mips-mti-linux toolchain.

2015-10-05 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon Oct  5 04:55:50 2015
New Revision: 249296

URL: http://llvm.org/viewvc/llvm-project?rev=249296&view=rev
Log:
Fix test failure on Windows buildbots for the mips-mti-linux toolchain.

Try to make the Windows buildbots happy by fixing the regexes that match the
paths to CRT files.

Modified:
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=249296&r1=249295&r2=249296&view=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Mon Oct  5 04:55:50 2015
@@ -16,12 +16,12 @@
 // CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
 // CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "gnu" "-target" 
"mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} 
"-dynamic-linker" "/lib/ld-musl-mips.so.1"
-// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crt1.o"
-// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crti.o"
+// CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crt1.o"
+// CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
 // CHECK-BE-HF-32R2-SAME: 
"{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
 // CHECK-BE-HF-32R2-SAME: "-lc"
-// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crtn.o"
+// CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crtn.o"
 
 // = Little-endian, mips32r2, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
@@ -34,9 +34,9 @@
 // CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
 // CHECK-LE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "gnu" "-target" 
"mipsel-mti-linux"
 // CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} 
"-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
-// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crt1.o"
-// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crti.o"
+// CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crt1.o"
+// CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crti.o"
 // CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
 // CHECK-LE-HF-32R2-SAME: 
"{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
 // CHECK-LE-HF-32R2-SAME: "-lc"
-// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crtn.o"
+// CHECK-LE-HF-32R2-SAME: 
"[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib{{/|}}crtn.o"


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


r249294 - Re-commit "Add support for the new mips-mti-linux toolchain."

2015-10-05 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Mon Oct  5 04:12:36 2015
New Revision: 249294

URL: http://llvm.org/viewvc/llvm-project?rev=249294&view=rev
Log:
Re-commit "Add support for the new mips-mti-linux toolchain."

r249137 added support for the new mips-mti-linux toolchain. However,
the new tests of that commit, broke some buildbots because they didn't use
the correct regular expressions to capture the filename of Clang & LLD.

This commit re-applies the changes of r249137 and fixes the tests in
r249137 in order to match the filenames of the Clang and LLD executable.

Added:

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=249294&r1=249293&r2=249294&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Oct  5 04:12:36 2015
@@ -2122,6 +2122,11 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
+
+  // Allow the discovery of tools prefixed with LLVM's default target triple.
+  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
+  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
+Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2217,6 +,9 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
+   !Target.hasEnvironment())
+TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=249294&r1=249293&r2=249294&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Oct  5 04:12:36 2015
@@ -315,7 +315,6 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
-
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249294&r1=249293&r2=249294&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct  5 04:12:36 2015
@@ -1301,8 +1301,9 @@ bool Generic_GCC::GCCInstallationDetecto
   "i586-linux-gnu"};
 
   static const char *const MIPSLibDirs[] = {"/lib"};
-  static const char *const MIPSTriples[] = {
-  "mips-linux-gnu", "mips-mti-linux-gnu", "mips-img-linux-gnu"};
+  static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
+"mips-mti-linux-gnu",
+"mips-img-linux-gnu"};
   static const char *const MIPSELLibDirs[] = {"/lib"};
   static const char *const MIPSELTriples[] = {
   "mipsel-linux-gnu", "mipsel-linux-android", "mips-img-linux-gnu"};
@@ -1691,6 +1692,32 @@ static bool findMIPSMultilibs(const llvm
 });
   }
 
+  // Check for Musl toolchain multili

RE: r249141 - Revert "Add support for the new mips-mti-linux toolchain."

2015-10-02 Thread Vasileios Kalintiris via cfe-commits
Thanks Yaron. I'll to figure out what's going wrong with
the Linux buildbot and I'll re-commit the fixed patch tomorrow.

- Vasileios


From: Yaron Keren [yaron.ke...@gmail.com]
Sent: 02 October 2015 17:46
To: Vasileios Kalintiris
Cc: cfe-commits
Subject: Re: r249141 - Revert "Add support for the new mips-mti-linux 
toolchain."

The regular expression should match match clang.exe on Windows.



2015-10-02 18:00 GMT+03:00 Vasileios Kalintiris via cfe-commits 
mailto:cfe-commits@lists.llvm.org>>:
Author: vkalintiris
Date: Fri Oct  2 10:00:55 2015
New Revision: 249141

URL: http://llvm.org/viewvc/llvm-project?rev=249141&view=rev
Log:
Revert "Add support for the new mips-mti-linux toolchain."

This reverts commit r249137 because it broke the Windows buildbots and
a Linux buildbot for LLD.

Removed:

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so<http://libclang_rt.builtins-mips.so>

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so<http://libclang_rt.builtins-mipsel.so>

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=249141&r1=249140&r2=249141&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  2 10:00:55 2015
@@ -2122,11 +2122,6 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
-
-  // Allow the discovery of tools prefixed with LLVM's default target triple.
-  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
-  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
-Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }

 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -,9 +2217,6 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
-  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
-   !Target.hasEnvironment())
-TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=249141&r1=249140&r2=249141&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct  2 10:00:55 2015
@@ -315,6 +315,7 @@ Tool *ToolChain::SelectTool(const JobAct

 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
+
 }

 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249141&r1=249140&r2=249141&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct  2 10:00:55 2015
@@ -1301,9 +1301,8 @@ bool Generic_GCC::GCCInstallationDetecto
   "i586-linux-gnu"};

   static const char *const MIPSLibDirs[] = {"/lib"};
-  static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
-  

r249141 - Revert "Add support for the new mips-mti-linux toolchain."

2015-10-02 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Fri Oct  2 10:00:55 2015
New Revision: 249141

URL: http://llvm.org/viewvc/llvm-project?rev=249141&view=rev
Log:
Revert "Add support for the new mips-mti-linux toolchain."

This reverts commit r249137 because it broke the Windows buildbots and
a Linux buildbot for LLD.

Removed:

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=249141&r1=249140&r2=249141&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  2 10:00:55 2015
@@ -2122,11 +2122,6 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
-
-  // Allow the discovery of tools prefixed with LLVM's default target triple.
-  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
-  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
-Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -,9 +2217,6 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
-  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
-   !Target.hasEnvironment())
-TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=249141&r1=249140&r2=249141&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct  2 10:00:55 2015
@@ -315,6 +315,7 @@ Tool *ToolChain::SelectTool(const JobAct
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
+
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249141&r1=249140&r2=249141&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct  2 10:00:55 2015
@@ -1301,9 +1301,8 @@ bool Generic_GCC::GCCInstallationDetecto
   "i586-linux-gnu"};
 
   static const char *const MIPSLibDirs[] = {"/lib"};
-  static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux",
-"mips-mti-linux-gnu",
-"mips-img-linux-gnu"};
+  static const char *const MIPSTriples[] = {
+  "mips-linux-gnu", "mips-mti-linux-gnu", "mips-img-linux-gnu"};
   static const char *const MIPSELLibDirs[] = {"/lib"};
   static const char *const MIPSELTriples[] = {
   "mipsel-linux-gnu", "mipsel-linux-android", "mips-img-linux-gnu"};
@@ -1692,32 +1691,6 @@ static bool findMIPSMultilibs(const llvm
 });
   }
 
-  // Check for Musl toolchain multilibs
-  MultilibSet MuslMipsMultilibs;
-  {
-auto MArchMipsR2 = makeMultilib("")
-   .osSuffix("/mips-r2-hard-musl")
-   .flag("+EB")
-   .flag("-EL")
-   .flag("+ma

Re: [PATCH] D13340: Add support for the new mips-mti-linux toolchain.

2015-10-02 Thread Vasileios Kalintiris via cfe-commits
This revision was automatically updated to reflect the committed changes.
vkalintiris marked an inline comment as done.
Closed by commit rL249137: Add support for the new mips-mti-linux toolchain. 
(authored by vkalintiris).

Changed prior to commit:
  http://reviews.llvm.org/D13340?vs=36344&id=36365#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13340

Files:
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Driver/Tools.h
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o
  
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
  cfe/trunk/test/Driver/mips-mti-linux.c

Index: cfe/trunk/test/Driver/mips-mti-linux.c
===
--- cfe/trunk/test/Driver/mips-mti-linux.c
+++ cfe/trunk/test/Driver/mips-mti-linux.c
@@ -0,0 +1,42 @@
+// Check frontend and linker invocations on GPL-free MIPS toolchain.
+//
+// FIXME: Using --sysroot with this toolchain/triple isn't supported. We use
+//it here to test that we are producing the correct paths/flags.
+//Ideally, we'd like to have an --llvm-toolchain option similar to
+//the --gcc-toolchain one.
+
+// = Big-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
+//
+// CHECK-BE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-BE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mips.so.1"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crti.o"
+// CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
+// CHECK-BE-HF-32R2-SAME: "{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: "-lc"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crtn.o"
+
+// = Little-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s
+//
+// CHECK-LE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-LE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crti.o"
+// CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
+// CHECK-LE-HF-32R2-SAME: "{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: "-lc"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crtn.o"
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -315,7 +315,6 @@
 
 std::string ToolChain::GetFilePath(const char *Name) const {
   return D.GetFilePath(Name, *this);
-
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {
Index: cfe/trunk/lib/Driver/ToolChains.h
===
--- cfe/trunk/lib/Driver/ToolChains.h
+++ cfe/trunk/lib/Driver/ToolChains.h
@@ -724,6 +724,7 @@
  

r249137 - Add support for the new mips-mti-linux toolchain.

2015-10-02 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Fri Oct  2 09:38:23 2015
New Revision: 249137

URL: http://llvm.org/viewvc/llvm-project?rev=249137&view=rev
Log:
Add support for the new mips-mti-linux toolchain.

Summary:
This new toolchain uses primarily LLVM-based tools, eg. compiler-rt, lld,
libcxx, etc. Because of this, it doesn't require neither an existing GCC
installation nor a GNU environment. Ideally, in a follow-up patch we
would like to add a new --{llvm|clang}-toolchain option (similar to
--gcc-toolchain) in order to allow the use of this toolchain with
independent Clang builds. For the time being, we use the --sysroot
option just to test the correctness of the paths generated by the
driver.

Reviewers: atanasyan, dsanders, rsmith

Subscribers: jfb, tberghammer, danalbert, srhines, dschuff, cfe-commits

Differential Revision: http://reviews.llvm.org/D13340

Added:
cfe/trunk/test/Driver/Inputs/mips_mti_linux/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a

cfe/trunk/test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/
cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o

cfe/trunk/test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
cfe/trunk/test/Driver/mips-mti-linux.c
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=249137&r1=249136&r2=249137&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct  2 09:38:23 2015
@@ -2122,6 +2122,11 @@ void Driver::generatePrefixedToolNames(
   // FIXME: Needs a better variable than DefaultTargetTriple
   Names.emplace_back(DefaultTargetTriple + "-" + Tool);
   Names.emplace_back(Tool);
+
+  // Allow the discovery of tools prefixed with LLVM's default target triple.
+  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
+  if (LLVMDefaultTargetTriple != DefaultTargetTriple)
+Names.emplace_back(LLVMDefaultTargetTriple + "-" + Tool);
 }
 
 static bool ScanDirForExecutable(SmallString<128> &Dir,
@@ -2217,6 +,9 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Linux:
   if (Target.getArch() == llvm::Triple::hexagon)
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
+   !Target.hasEnvironment())
+TC = new toolchains::MipsLLVMToolChain(*this, Target, Args);
   else
 TC = new toolchains::Linux(*this, Target, Args);
   break;

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=249137&

Re: [PATCH] D13340: Add support for the new mips-mti-linux toolchain.

2015-10-02 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 36344.
vkalintiris added a comment.

1. s/MipsToolChain/MipsLLVMToolChain/
2. Change to the new getCompilerRT() return type
3. clang-format


http://reviews.llvm.org/D13340

Files:
  lib/Driver/Driver.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
  test/Driver/mips-mti-linux.c

Index: test/Driver/mips-mti-linux.c
===
--- /dev/null
+++ test/Driver/mips-mti-linux.c
@@ -0,0 +1,42 @@
+// Check frontend and linker invocations on GPL-free MIPS toolchain.
+//
+// FIXME: Using --sysroot with this toolchain/triple isn't supported. We use
+//it here to test that we are producing the correct paths/flags.
+//Ideally, we'd like to have an --llvm-toolchain option similar to
+//the --gcc-toolchain one.
+
+// = Big-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
+//
+// CHECK-BE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-BE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mips.so.1"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crti.o"
+// CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
+// CHECK-BE-HF-32R2-SAME: "{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: "-lc"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crtn.o"
+
+// = Little-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s
+//
+// CHECK-LE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-LE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crti.o"
+// CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
+// CHECK-LE-HF-32R2-SAME: "{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: "-lc"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crtn.o"
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -267,6 +267,8 @@
 void getMipsCPUAndABI(const llvm::opt::ArgList &Args,
   const llvm::Triple &Triple, StringRef &CPUName,
   StringRef &ABIName);
+std::string getMipsABILibSuffix(const llvm::opt::ArgList &Args,
+const llvm::Triple &Triple);
 bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
 bool isUCLibc(const llvm::opt::ArgList &Args);
 bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1077,6 +1077,16 @@
   // FIXME: Warn on inconsistent use of -march and -mabi.
 }
 
+std::string mips::getMipsABILibSuffix(const ArgList &Args,
+

Re: [PATCH] D13340: Add support for the new mips-mti-linux toolchain.

2015-10-02 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added inline comments.


Comment at: lib/Driver/Driver.cpp:2225
@@ -2219,1 +2224,3 @@
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if ((Target.getVendor() == llvm::Triple::MipsTechnologies) &&
+   !Target.hasEnvironment())

atanasyan wrote:
> Now I try to redesign Codescape toolchain support in the Clang driver. I 
> consider to use a separate toolchain class like your `MipsToolChain` and I 
> name it `CodeScapeMtiToolChain`. If I be able to join support for both MIT 
> and IMG toolchains in the single class, I will rename it to 
> `CodeScapeToolChain`.
> 
> Will this non-GNU toolchain have a personal name like CodeScape? If not I am 
> okay with `MipsNonGNUToolChain`.
I thought about this and I don't believe that `MipsNonGNUToolChain` is a very 
good name. The main reason is that the last component of the entries under the 
sysroot, contain the name of the C library (or empty for GLIBC). We could 
easily have a toolchain with `mips-r2-hard{,-uClibc}` installed for 
`mips-mti-linux`.

What are your thoughts about the names: `MipsGCCToolChain`, 
`Mips{Clang,LLVM}ToolChain`, or `CodescapeGCCToolChain` and 
`CodescapeLLVMToolChain`?

Personally, I'd prefer the first pair of names. The reason is that with this 
choice we will be consistent in the naming of our classes. Also, it's clear 
that these are MIPS TCs and we have to consider that the Codescape name could 
change in the future (improbable but not impossible).

The `Mips{GCC,Clang/LLVM}Toolchain` name would specify whether we are going to 
use the files generated from a GCC or Clang installation. This way we could 
keep the existing functionality of the `Linux` class for older toolchains that 
will be deprecated/unused over time.


http://reviews.llvm.org/D13340



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


Re: [PATCH] D13339: Allow a ToolChain to compute the path of a compiler-rt's component.

2015-10-01 Thread Vasileios Kalintiris via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL249030: Allow a ToolChain to compute the path of a 
compiler-rt's component. (authored by vkalintiris).

Changed prior to commit:
  http://reviews.llvm.org/D13339?vs=36225&id=36265#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13339

Files:
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/SanitizerArgs.cpp
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/Tools.cpp

Index: cfe/trunk/lib/Driver/SanitizerArgs.cpp
===
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp
@@ -609,13 +609,11 @@
   if (TC.getTriple().isOSWindows() && needsUbsanRt()) {
 // Instruct the code generator to embed linker directives in the object file
 // that cause the required runtime libraries to be linked.
-CmdArgs.push_back(
-Args.MakeArgString("--dependent-lib=" +
-   tools::getCompilerRT(TC, Args, "ubsan_standalone")));
+CmdArgs.push_back(Args.MakeArgString(
+"--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone")));
 if (types::isCXX(InputType))
   CmdArgs.push_back(Args.MakeArgString(
-  "--dependent-lib=" +
-  tools::getCompilerRT(TC, Args, "ubsan_standalone_cxx")));
+  "--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone_cxx")));
   }
 }
 
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -23,7 +23,9 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+
 using namespace clang::driver;
+using namespace clang::driver::tools;
 using namespace clang;
 using namespace llvm::opt;
 
@@ -265,6 +267,43 @@
   llvm_unreachable("Invalid tool kind.");
 }
 
+static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
+ const ArgList &Args) {
+  const llvm::Triple &Triple = TC.getTriple();
+  bool IsWindows = Triple.isOSWindows();
+
+  if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
+return "i386";
+
+  if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
+return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
+   ? "armhf"
+   : "arm";
+
+  return TC.getArchName();
+}
+
+std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
+ bool Shared) const {
+  const llvm::Triple &TT = getTriple();
+  const char *Env =
+  (TT.getEnvironment() == llvm::Triple::Android) ? "-android" : "";
+  bool IsITANMSVCWindows =
+  TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
+
+  StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
+  const char *Prefix = IsITANMSVCWindows ? "" : "lib";
+  const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
+  : (IsITANMSVCWindows ? ".lib" : ".a");
+
+  SmallString<128> Path(getDriver().ResourceDir);
+  StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS();
+  llvm::sys::path::append(Path, "lib", OSLibName);
+  llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
+Arch + Env + Suffix);
+  return Path.str();
+}
+
 Tool *ToolChain::SelectTool(const JobAction &JA) const {
   if (getDriver().ShouldUseClangCompiler(JA))
 return getClang();
@@ -306,7 +345,6 @@
   return GetProgramPath("ld");
 }
 
-
 types::ID ToolChain::LookupTypeForExtension(const char *Ext) const {
   return types::lookupTypeForExtension(Ext);
 }
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2402,60 +2402,11 @@
   }
 }
 
-// Until ARM libraries are build separately, we have them all in one library
-static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
- const ArgList &Args) {
-  const llvm::Triple &Triple = TC.getTriple();
-  bool IsWindows = Triple.isOSWindows();
-
-  if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
-return "i386";
-
-  if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
-return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
-   ? "armhf"
-   : "arm";
-
-  return TC.getArchName();
-}
-
-static SmallString<128> getCompilerRTLibDir(const ToolChain &TC) {
-  // The runtimes are located in the OS-specific resource directory.
-  SmallString<128> Res(TC.getDriver().ResourceDir);
-  const llvm::Triple &Triple = TC.getTriple();
-  // TC.getOS() yield "freebsd10.0" wh

r249030 - Allow a ToolChain to compute the path of a compiler-rt's component.

2015-10-01 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Thu Oct  1 11:54:58 2015
New Revision: 249030

URL: http://llvm.org/viewvc/llvm-project?rev=249030&view=rev
Log:
Allow a ToolChain to compute the path of a compiler-rt's component.

Summary:
This patch moves getCompilerRT() from the clang::driver::tools namespace to
the ToolChain class. This is needed for multilib toolchains that need to
place their libraries in Clang's resource directory with a layout that is
different from the default one.

Reviewers: atanasyan, rsmith

Subscribers: tberghammer, danalbert, srhines, cfe-commits

Differential Revision: http://reviews.llvm.org/D13339

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=249030&r1=249029&r2=249030&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Thu Oct  1 11:54:58 2015
@@ -250,6 +250,10 @@ public:
 return ToolChain::RLT_Libgcc;
   }
 
+  virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
+StringRef Component,
+bool Shared = false) const;
+
   /// IsUnwindTablesDefault - Does this tool chain use -funwind-tables
   /// by default.
   virtual bool IsUnwindTablesDefault() const;

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=249030&r1=249029&r2=249030&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Thu Oct  1 11:54:58 2015
@@ -609,13 +609,11 @@ void SanitizerArgs::addArgs(const ToolCh
   if (TC.getTriple().isOSWindows() && needsUbsanRt()) {
 // Instruct the code generator to embed linker directives in the object 
file
 // that cause the required runtime libraries to be linked.
-CmdArgs.push_back(
-Args.MakeArgString("--dependent-lib=" +
-   tools::getCompilerRT(TC, Args, 
"ubsan_standalone")));
+CmdArgs.push_back(Args.MakeArgString(
+"--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone")));
 if (types::isCXX(InputType))
   CmdArgs.push_back(Args.MakeArgString(
-  "--dependent-lib=" +
-  tools::getCompilerRT(TC, Args, "ubsan_standalone_cxx")));
+  "--dependent-lib=" + TC.getCompilerRT(Args, 
"ubsan_standalone_cxx")));
   }
 }
 

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=249030&r1=249029&r2=249030&view=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Thu Oct  1 11:54:58 2015
@@ -23,7 +23,9 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+
 using namespace clang::driver;
+using namespace clang::driver::tools;
 using namespace clang;
 using namespace llvm::opt;
 
@@ -265,6 +267,43 @@ Tool *ToolChain::getTool(Action::ActionC
   llvm_unreachable("Invalid tool kind.");
 }
 
+static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
+ const ArgList &Args) {
+  const llvm::Triple &Triple = TC.getTriple();
+  bool IsWindows = Triple.isOSWindows();
+
+  if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
+return "i386";
+
+  if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
+return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
+   ? "armhf"
+   : "arm";
+
+  return TC.getArchName();
+}
+
+std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
+ bool Shared) const {
+  const llvm::Triple &TT = getTriple();
+  const char *Env =
+  (TT.getEnvironment() == llvm::Triple::Android) ? "-android" : "";
+  bool IsITANMSVCWindows =
+  TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
+
+  StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
+  const char *Prefix = IsITANMSVCWindows ? "" : "lib";
+  const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
+  : (IsITANMSVCWindows ? ".lib" : ".a");
+
+  SmallString<128> Path(getDriver().ResourceDir);
+  StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS();
+  llvm::sys::path::append(Path, "lib", OSLibName);
+  llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
+   

Re: [PATCH] D13340: Add support for the new mips-mti-linux toolchain.

2015-10-01 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added inline comments.


Comment at: include/clang/Driver/ToolChain.h:147
@@ -145,1 +146,3 @@
 
+  const Multilib &getSelectedMultilib() const { return SelectedMultilib; }
+

atanasyan wrote:
> Do you need public access to this member function?
I discarded this member function after the move of `SelectedMultilib` to the 
`MipsToolChain` class.


Comment at: lib/Driver/Driver.cpp:2127
@@ +2126,3 @@
+  // Allow the discovery of tools prefixed with LLVM's default target triple.
+  std::string LLVMDefaultTargetTriple = llvm::sys::getDefaultTargetTriple();
+  if (LLVMDefaultTargetTriple != DefaultTargetTriple)

atanasyan wrote:
> Just curious when is DefaultTargetTriple not equal to LLVMDefaultTargetTriple?
In this case, `DefaultTargetTriple` is the triple specified with `--target=`. 
LLVMDefaultTargetTriple is the value specified with the CMake variable 
`-DLLVM_DEFAULT_TARGET_TRIPLE=` during configuration time. For example, using 
`--target=mips64el-mti-linux` will search for files prefixed with either 
`mips64el-mti-linux-{as,ld}` and `mips-mti-linux-{as,ld}` in our toolchain 
where we specify `-DLLVM_DEFAULT_TARGET_TRIPLE=mips-mti-linux.`


Comment at: lib/Driver/Driver.cpp:2225
@@ -2219,1 +2224,3 @@
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
+  else if (Target.getVendor() == llvm::Triple::MipsTechnologies)
+TC = new toolchains::MipsToolChain(*this, Target, Args);

atanasyan wrote:
> The `mips-mti-linux-gnu` triple is used by Codescape toolchain too. After 
> this change if user provides `-target mips-mti-linux-gnu` command line 
> option, the `MipsToolChain` will be used. As far as I understand you have to 
> put `GCCInstallation.isValid()` checking to the `MipsToolChain` class methods 
> to allow working with both GNU and non-GNU toolchains. IMHO it does not make 
> the code clear. Maybe use the `MipsToolChain` class for the non-GNU toolchain 
> only.
Shall we change the `MipsToolChain` class name to reflect these changes? Maybe 
`MipsNonGNUToolChain`? It would be strange to keep the same name, because most 
of the MIPS toolchains wouldn't be instantiated by `MipsToolChain`.


Comment at: lib/Driver/ToolChains.cpp:2231
@@ +2230,3 @@
+  // If we did find a valid GCC installation, we don't have anything else to 
do.
+  if (GCCInstallation.isValid())
+return;

atanasyan wrote:
> When is GCCInstallation invalid in case of using this toolchain?
I changed that, according to your comments earlier. Now we instantiate this 
class only for triples that don't have an environment.


http://reviews.llvm.org/D13340



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


Re: [PATCH] D13340: Add support for the new mips-mti-linux toolchain.

2015-10-01 Thread Vasileios Kalintiris via cfe-commits
vkalintiris updated this revision to Diff 36257.
vkalintiris marked 8 inline comments as done.
vkalintiris added a comment.

Thanks. The review comments are addressed in this update.


http://reviews.llvm.org/D13340

Files:
  lib/Driver/Driver.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
  test/Driver/mips-mti-linux.c

Index: test/Driver/mips-mti-linux.c
===
--- /dev/null
+++ test/Driver/mips-mti-linux.c
@@ -0,0 +1,42 @@
+// Check frontend and linker invocations on GPL-free MIPS toolchain.
+//
+// FIXME: Using --sysroot with this toolchain/triple isn't supported. We use
+//it here to test that we are producing the correct paths/flags.
+//Ideally, we'd like to have an --llvm-toolchain option similar to
+//the --gcc-toolchain one.
+
+// = Big-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
+//
+// CHECK-BE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-BE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mips.so.1"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crti.o"
+// CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
+// CHECK-BE-HF-32R2-SAME: "{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: "-lc"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crtn.o"
+
+// = Little-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s
+//
+// CHECK-LE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-LE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crti.o"
+// CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
+// CHECK-LE-HF-32R2-SAME: "{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: "-lc"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crtn.o"
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -267,6 +267,8 @@
 void getMipsCPUAndABI(const llvm::opt::ArgList &Args,
   const llvm::Triple &Triple, StringRef &CPUName,
   StringRef &ABIName);
+std::string getMipsABILibSuffix(const llvm::opt::ArgList &Args,
+const llvm::Triple &Triple);
 bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value);
 bool isUCLibc(const llvm::opt::ArgList &Args);
 bool isNaN2008(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1077,6 +1077,16 @@
   // FIXME: Warn on inconsistent use of -march and -mabi.
 }
 
+std::string mips::getMipsABILibSuffix(const ArgList &Args,
+   

[PATCH] D13340: Add support for the new mips-mti-linux toolchain.

2015-10-01 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added reviewers: atanasyan, dsanders, rsmith.
vkalintiris added a subscriber: cfe-commits.
Herald added subscribers: dschuff, srhines, danalbert, tberghammer, jfb.

This new toolchain uses primarily LLVM-based tools, eg. compiler-rt, lld,
libcxx, etc. Because of this, it doesn't require neither an existing GCC
installation nor a GNU environment. Ideally, in a follow-up patch we
would like to add a new --{llvm|clang}-toolchain option (similar to
--gcc-toolchain) in order to allow the use of this toolchain with
independent Clang builds. For the time being, we use the --sysroot
option just to test the correctness of the paths generated by the
driver.

http://reviews.llvm.org/D13340

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/Driver.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.so
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a
  
test/Driver/Inputs/mips_mti_linux/lib/clang/3.8.0/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.so
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crt1.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crti.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mips-r2-hard-musl/usr/lib/crtn.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crt1.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crti.o
  test/Driver/Inputs/mips_mti_linux/sysroot/mipsel-r2-hard-musl/usr/lib/crtn.o
  test/Driver/mips-mti-linux.c

Index: test/Driver/mips-mti-linux.c
===
--- /dev/null
+++ test/Driver/mips-mti-linux.c
@@ -0,0 +1,42 @@
+// Check frontend and linker invocations on GPL-free MIPS toolchain.
+//
+// FIXME: Using --sysroot with this toolchain/triple isn't supported. We use
+//it here to test that we are producing the correct paths/flags.
+//Ideally, we'd like to have an --llvm-toolchain option similar to
+//the --gcc-toolchain one.
+
+// = Big-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
+//
+// CHECK-BE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-BE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mips-mti-linux"
+// CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mips.so.1"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crti.o"
+// CHECK-BE-HF-32R2-SAME: "-L[[SYSROOT]]/mips-r2-hard-musl/usr/lib"
+// CHECK-BE-HF-32R2-SAME: "{{[^"]+}}/mips-r2-hard-musl/lib/linux/libclang_rt.builtins-mips.a"
+// CHECK-BE-HF-32R2-SAME: "-lc"
+// CHECK-BE-HF-32R2-SAME: "[[SYSROOT]]/mips-r2-hard-musl/usr/lib/crtn.o"
+
+// = Little-endian, mips32r2, hard float
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=mips-mti-linux -mips32r2 -EL -mhard-float \
+// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s
+//
+// CHECK-LE-HF-32R2: "{{.*}}clang" {{.*}} "-triple" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
+// CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
+// CHECK-LE-HF-32R2: "lld" "-flavor" "gnu" "-target" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} "-dynamic-linker" "/lib/ld-musl-mipsel.so.1"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crt1.o"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crti.o"
+// CHECK-LE-HF-32R2-SAME: "-L[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib"
+// CHECK-LE-HF-32R2-SAME: "{{[^"]+}}/mipsel-r2-hard-musl/lib/linux/libclang_rt.builtins-mipsel.a"
+// CHECK-LE-HF-32R2-SAME: "-lc"
+// CHECK-LE-HF-32R2-SAME: "[[SYSROOT]]/mipsel-r2-hard-musl/usr/lib/crtn.o"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4559,12 +4559,16 @@
   }
 
   // -fuse-cxa-atexit is default.
-  if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,
-options::OPT_fno_use_cxa_atexit,
-!IsWindowsCygnus && !IsWindowsGNU &&
-getToolChain().getTriple().getOS()

[PATCH] D13339: Allow a ToolChain to compute the path of a compiler-rt's component.

2015-10-01 Thread Vasileios Kalintiris via cfe-commits
vkalintiris created this revision.
vkalintiris added reviewers: atanasyan, rsmith.
vkalintiris added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

This patch moves getCompilerRT() from the clang::driver::tools namespace to
the ToolChain class. This is needed for multilib toolchains that need to
place their libraries in Clang's resource directory with a layout that is
different from the default one.

http://reviews.llvm.org/D13339

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/SanitizerArgs.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2402,60 +2402,11 @@
   }
 }
 
-// Until ARM libraries are build separately, we have them all in one library
-static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
- const ArgList &Args) {
-  const llvm::Triple &Triple = TC.getTriple();
-  bool IsWindows = Triple.isOSWindows();
-
-  if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
-return "i386";
-
-  if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
-return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
-   ? "armhf"
-   : "arm";
-
-  return TC.getArchName();
-}
-
-static SmallString<128> getCompilerRTLibDir(const ToolChain &TC) {
-  // The runtimes are located in the OS-specific resource directory.
-  SmallString<128> Res(TC.getDriver().ResourceDir);
-  const llvm::Triple &Triple = TC.getTriple();
-  // TC.getOS() yield "freebsd10.0" whereas "freebsd" is expected.
-  StringRef OSLibName =
-  (Triple.getOS() == llvm::Triple::FreeBSD) ? "freebsd" : TC.getOS();
-  llvm::sys::path::append(Res, "lib", OSLibName);
-  return Res;
-}
-
-SmallString<128> tools::getCompilerRT(const ToolChain &TC, const ArgList &Args,
-  StringRef Component, bool Shared) {
-  const char *Env = TC.getTriple().getEnvironment() == llvm::Triple::Android
-? "-android"
-: "";
-
-  bool IsOSWindows = TC.getTriple().isOSWindows();
-  bool IsITANMSVCWindows = TC.getTriple().isWindowsMSVCEnvironment() ||
-   TC.getTriple().isWindowsItaniumEnvironment();
-  StringRef Arch = getArchNameForCompilerRTLib(TC, Args);
-  const char *Prefix = IsITANMSVCWindows ? "" : "lib";
-  const char *Suffix =
-  Shared ? (IsOSWindows ? ".dll" : ".so") : (IsITANMSVCWindows ? ".lib" : ".a");
-
-  SmallString<128> Path = getCompilerRTLibDir(TC);
-  llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
-Arch + Env + Suffix);
-
-  return Path;
-}
-
 static const char *getCompilerRTArgString(const ToolChain &TC,
   const llvm::opt::ArgList &Args,
   StringRef Component,
   bool Shared = false) {
-  return Args.MakeArgString(getCompilerRT(TC, Args, Component, Shared));
+  return Args.MakeArgString(TC.getCompilerRT(Args, Component, Shared));
 }
 
 // This adds the static libclang_rt.builtins-arch.a directly to the command line
@@ -2569,7 +2520,7 @@
 static bool addSanitizerDynamicList(const ToolChain &TC, const ArgList &Args,
 ArgStringList &CmdArgs,
 StringRef Sanitizer) {
-  SmallString<128> SanRT = getCompilerRT(TC, Args, Sanitizer);
+  SmallString<128> SanRT = TC.getCompilerRT(Args, Sanitizer);
   if (llvm::sys::fs::exists(SanRT + ".syms")) {
 CmdArgs.push_back(Args.MakeArgString("--dynamic-list=" + SanRT + ".syms"));
 return true;
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -23,7 +23,9 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/TargetRegistry.h"
+
 using namespace clang::driver;
+using namespace clang::driver::tools;
 using namespace clang;
 using namespace llvm::opt;
 
@@ -265,6 +267,44 @@
   llvm_unreachable("Invalid tool kind.");
 }
 
+static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
+ const ArgList &Args) {
+  const llvm::Triple &Triple = TC.getTriple();
+  bool IsWindows = Triple.isOSWindows();
+
+  if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
+return "i386";
+
+  if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
+return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
+   ? "armhf"
+   : "arm";
+
+  return TC.getArchName();
+}
+
+SmallString<128> ToolChain::getCompilerRT(const ArgList &Args,
+ 

[libunwind] r248673 - unwind: Allow the building of libunwind for MIPS.

2015-09-26 Thread Vasileios Kalintiris via cfe-commits
Author: vkalintiris
Date: Sat Sep 26 13:26:01 2015
New Revision: 248673

URL: http://llvm.org/viewvc/llvm-project?rev=248673&view=rev
Log:
unwind: Allow the building of libunwind for MIPS.

Summary:
Currently, libunwind doesn't support MIPS. However, with this patch
we do allow the library to build, and we warn the user about the lack of
support for MIPS. Also, the dummy unw_getcontext() implementation for MIPS just
traps on function entry in order to avoid any confusion with silent/weird
failures at runtime.

This allows us to test an LLVM-based toolchain without the dependency on a
GCC toolchain. Of course, C++ exception handling and other things that depend
on stack unwinding will not work until we add a proper implementation of the
stub functions.

Reviewers: compnerd, logan

Subscribers: dsanders, llvm-commits

Differential Revision: http://reviews.llvm.org/D13160

Modified:
libunwind/trunk/src/UnwindRegistersSave.S
libunwind/trunk/src/config.h
libunwind/trunk/src/libunwind.cpp

Modified: libunwind/trunk/src/UnwindRegistersSave.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=248673&r1=248672&r2=248673&view=diff
==
--- libunwind/trunk/src/UnwindRegistersSave.S (original)
+++ libunwind/trunk/src/UnwindRegistersSave.S Sat Sep 26 13:26:01 2015
@@ -87,6 +87,15 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext
   xorl  %eax, %eax# return UNW_ESUCCESS
   ret
 
+# elif defined(__mips__)
+
+#
+# extern int unw_getcontext(unw_context_t* thread_state)
+#
+# Just trap for the time being.
+DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
+  teq $0, $0
+
 #elif defined(__ppc__)
 
 ;

Modified: libunwind/trunk/src/config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=248673&r1=248672&r2=248673&view=diff
==
--- libunwind/trunk/src/config.h (original)
+++ libunwind/trunk/src/config.h Sat Sep 26 13:26:01 2015
@@ -41,7 +41,8 @@
 
   #define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \
defined(__x86_64__) || \
-   defined(__arm64__))
+   defined(__arm64__) || \
+   defined(__mips__))
   #define _LIBUNWIND_BUILD_SJLJ_APIS  defined(__arm__)
   #define _LIBUNWIND_SUPPORT_FRAME_APIS   (defined(__i386__) || \
defined(__x86_64__))

Modified: libunwind/trunk/src/libunwind.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind.cpp?rev=248673&r1=248672&r2=248673&view=diff
==
--- libunwind/trunk/src/libunwind.cpp (original)
+++ libunwind/trunk/src/libunwind.cpp Sat Sep 26 13:26:01 2015
@@ -64,6 +64,8 @@ _LIBUNWIND_EXPORT int unw_init_local(unw
 #elif defined(__or1k__)
   new ((void *)cursor) UnwindCursor(
  context, 
LocalAddressSpace::sThisAddressSpace);
+#elif defined(__mips__)
+#warning The MIPS architecture is not supported.
 #else
 #error Architecture not supported
 #endif


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


Re: [PATCH] D11815: Pass subtarget feature "force-align-stack"

2015-09-02 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a comment.

In http://reviews.llvm.org/D11815#237541, @ahatanak wrote:

> In http://reviews.llvm.org/D11815#236368, @vkalintiris wrote:
>
> > In http://reviews.llvm.org/D11815#235394, @ahatanak wrote:
> >
> > >
> >
>
>
>
>
> > For example, on a Mips target, where the O32 ABI requires either way an 
> > 8-byte alignment, we would generate redundant code for realigning the stack 
> > to a 4-byte alignment if a function contains objects with maximum alignment 
> > of 4-bytes (see attached files to get an idea).
>
>
> I wonder if there is a target or a use case that requires or prefers 
> realigning the stack to an alignment that is smaller than the default stack 
> alignment.  If there is no such target or use case, I think we can just using 
> the existing attribute StackAlignment (with value 0) rather than adding a new 
> function attribute "stackrealign", which will ensure the stack is at least 
> aligned to the default value and force realigning the stack.


I was thinking something similar. I'm not quite sure but the only case I can 
think of, where we might get away with an alignment smaller than the default, 
is when we emit code for the fast calling convention. Other than that, I 
believe that we should duplicate the functionality of 
X86FrameLowering::calculateMaxStackAlign() (or override it in each target 
accordingly).

> The purpose of this patch is to make sure -mstackrealign works when doing LTO


Out of curiosity, I was wondering why dynamic stack realignment isn't enough 
for LTO. I would guess that the alignment of the data types used under SSE 
might have a smaller alignment than the one required by the ABI.


http://reviews.llvm.org/D11815



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


Re: [PATCH] D11815: Pass subtarget feature "force-align-stack"

2015-08-31 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a subscriber: vkalintiris.
vkalintiris added a comment.

In http://reviews.llvm.org/D11815#235394, @ahatanak wrote:

> The cc1 option "-mstackrealign" now means "force stack realignment" rather 
> than "allow stack realignment" and causes function attribute "stackrealign" 
> to be attached to the functions in the IR.


Please, correct me if I'm wrong but I believe that the -force-align-stack 
option. which was removed in http://reviews.llvm.org/D11814, was x86-specific 
(in the sense that it was only really tested in X86) and almost always 
accompanied by a -stack-alignment value that was equal or greater than the 
requirements of the ABI.

With this change the -mstackrealign option will attach the "stackrealign" 
attribute on every function definition (and declaration) without specifying a 
valid -stack-alignment value.

I suspect that this option will be broken for every Target that relies only on 
the maximum alignment provided by MachineFrameInfo (see 
X86FrameLowering::calculateMaxStackAlign() for the correct way to handle this).

Is this the intended behaviour here? I'm a little bit cautious because this 
option would be exposed from the Clang frontend and our users would generate 
bad code if they were to try this option.

For example, on a Mips target, where the O32 ABI requires either way an 8-byte 
alignment, we would generate redundant code for realigning the stack to a 
4-byte alignment if a function contains objects with maximum alignment of 
4-bytes (see attached files to get an idea).

F803573: main.s 

F803574: main.c 

F803575: main.ll 


http://reviews.llvm.org/D11815



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