r306239 - Add support for Ananas platform

2017-06-25 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sun Jun 25 01:29:09 2017
New Revision: 306239

URL: http://llvm.org/viewvc/llvm-project?rev=306239&view=rev
Log:
Add support for Ananas platform

Ananas is a home-brew operating system, mainly for amd64 machines. After
using GCC for quite some time, it has switched to clang and never looked
back - yet, having to manually patch things is annoying, so it'd be much
nicer if this was in the official tree.

More information:

https://github.com/zhmu/ananas/
https://rink.nu/projects/ananas.html

Submitted by:   Rink Springer
Differential Revision:  https://reviews.llvm.org/D32936

Added:
cfe/trunk/lib/Driver/ToolChains/Ananas.cpp
cfe/trunk/lib/Driver/ToolChains/Ananas.h
cfe/trunk/test/Driver/ananas.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=306239&r1=306238&r2=306239&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Jun 25 01:29:09 2017
@@ -111,6 +111,21 @@ public:
   : OSTargetInfo(Triple, Opts) {}
 };
 
+// Ananas target
+template
+class AnanasTargetInfo : public OSTargetInfo {
+protected:
+  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
+MacroBuilder &Builder) const override {
+// Ananas defines
+Builder.defineMacro("__Ananas__");
+Builder.defineMacro("__ELF__");
+  }
+public:
+  AnanasTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
+  : OSTargetInfo(Triple, Opts) {}
+};
+
 static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
  const llvm::Triple &Triple,
  StringRef &PlatformName,
@@ -9530,6 +9545,8 @@ static TargetInfo *AllocateTarget(const
   return new DarwinI386TargetInfo(Triple, Opts);
 
 switch (os) {
+case llvm::Triple::Ananas:
+  return new AnanasTargetInfo(Triple, Opts);
 case llvm::Triple::CloudABI:
   return new CloudABITargetInfo(Triple, Opts);
 case llvm::Triple::Linux: {
@@ -9585,6 +9602,8 @@ static TargetInfo *AllocateTarget(const
   return new DarwinX86_64TargetInfo(Triple, Opts);
 
 switch (os) {
+case llvm::Triple::Ananas:
+  return new AnanasTargetInfo(Triple, Opts);
 case llvm::Triple::CloudABI:
   return new CloudABITargetInfo(Triple, Opts);
 case llvm::Triple::Linux: {

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=306239&r1=306238&r2=306239&view=diff
==
--- cfe/trunk/lib/Driver/CMakeLists.txt (original)
+++ cfe/trunk/lib/Driver/CMakeLists.txt Sun Jun 25 01:29:09 2017
@@ -28,6 +28,7 @@ add_clang_library(clangDriver
   ToolChains/Arch/Sparc.cpp
   ToolChains/Arch/SystemZ.cpp
   ToolChains/Arch/X86.cpp
+  ToolChains/Ananas.cpp
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp
   ToolChains/Bitrig.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=306239&r1=306238&r2=306239&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sun Jun 25 01:29:09 2017
@@ -11,6 +11,7 @@
 #include "InputInfo.h"
 #include "ToolChains/AMDGPU.h"
 #include "ToolChains/AVR.h"
+#include "ToolChains/Ananas.h"
 #include "ToolChains/Bitrig.h"
 #include "ToolChains/Clang.h"
 #include "ToolChains/CloudABI.h"
@@ -3749,6 +3750,9 @@ const ToolChain &Driver::getToolChain(co
 case llvm::Triple::Haiku:
   TC = llvm::make_unique(*this, Target, Args);
   break;
+case llvm::Triple::Ananas:
+  TC = llvm::make_unique(*this, Target, Args);
+  break;
 case llvm::Triple::CloudABI:
   TC = llvm::make_unique(*this, Target, Args);
   break;

Added: cfe/trunk/lib/Driver/ToolChains/Ananas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Ananas.cpp?rev=306239&view=auto
==
--- cfe/trunk/lib/Driver/ToolChains/Ananas.cpp (added)
+++ cfe/trunk/lib/Driver/ToolChains/Ananas.cpp Sun Jun 25 01:29:09 2017
@@ -0,0 +1,120 @@
+//===--- Ananas.cpp - Ananas ToolChain Implementations --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Ananas.h"
+#include "InputInfo.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"

r322064 - ananas: Add shared library support

2018-01-09 Thread Ed Schouten via cfe-commits
Author: ed
Date: Tue Jan  9 01:18:14 2018
New Revision: 322064

URL: http://llvm.org/viewvc/llvm-project?rev=322064&view=rev
Log:
ananas: Add shared library support

The Ananas Operating System (https://github.com/zhmu/ananas) has shared
library support as of commit 57739c0b6ece56dd4872aedf30264ed4b9412c77.

This change adds the necessary settings to clang so that shared
executables and libraries can be build correctly.

Submitted by:   Rink Springer
Differential Revision:  https://reviews.llvm.org/D41500

Modified:
cfe/trunk/lib/Driver/ToolChains/Ananas.cpp
cfe/trunk/test/Driver/ananas.c

Modified: cfe/trunk/lib/Driver/ToolChains/Ananas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Ananas.cpp?rev=322064&r1=322063&r2=322064&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Ananas.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Ananas.cpp Tue Jan  9 01:18:14 2018
@@ -64,8 +64,19 @@ void ananas::Linker::ConstructJob(Compil
   if (!D.SysRoot.empty())
 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
-  // Ananas only supports static linkage for now.
-  CmdArgs.push_back("-Bstatic");
+  if (Args.hasArg(options::OPT_static)) {
+CmdArgs.push_back("-Bstatic");
+  } else {
+if (Args.hasArg(options::OPT_rdynamic))
+  CmdArgs.push_back("-export-dynamic");
+if (Args.hasArg(options::OPT_shared)) {
+  CmdArgs.push_back("-Bshareable");
+} else {
+  Args.AddAllArgs(CmdArgs, options::OPT_pie);
+  CmdArgs.push_back("-dynamic-linker");
+  CmdArgs.push_back("/lib/ld-ananas.so");
+}
+  }
 
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");
@@ -75,9 +86,15 @@ void ananas::Linker::ConstructJob(Compil
   }
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
-CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
+if (!Args.hasArg(options::OPT_shared)) {
+  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
+}
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
-CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbegin.o")));
+if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) {
+  
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbeginS.o")));
+} else {
+  
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbegin.o")));
+}
   }
 
   Args.AddAllArgs(CmdArgs, options::OPT_L);
@@ -97,7 +114,10 @@ void ananas::Linker::ConstructJob(Compil
 CmdArgs.push_back("-lc");
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
-CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
+if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
+  
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
+else
+  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
   }
 

Modified: cfe/trunk/test/Driver/ananas.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ananas.c?rev=322064&r1=322063&r2=322064&view=diff
==
--- cfe/trunk/test/Driver/ananas.c (original)
+++ cfe/trunk/test/Driver/ananas.c Tue Jan  9 01:18:14 2018
@@ -7,3 +7,11 @@
 // CHECK-STATIC: crtbegin.o
 // CHECK-STATIC: crtend.o
 // CHECK-STATIC: crtn.o
+
+// RUN: %clang -no-canonical-prefixes -target x86_64-unknown-ananas -shared %s 
\
+// RUN:   --sysroot=%S/Inputs/ananas-tree -### 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-SHARED %s
+// CHECK-SHARED: crti.o
+// CHECK-SHARED: crtbeginS.o
+// CHECK-SHARED: crtendS.o
+// CHECK-SHARED: crtn.o


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


[libunwind] r282589 - Also use the proper register numbers on CloudABI.

2016-09-28 Thread Ed Schouten via cfe-commits
Author: ed
Date: Wed Sep 28 08:51:23 2016
New Revision: 282589

URL: http://llvm.org/viewvc/llvm-project?rev=282589&view=rev
Log:
Also use the proper register numbers on CloudABI.

Without this change applied, unw_step() fails to obtain the next frame
properly.

Modified:
libunwind/trunk/include/libunwind.h

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=282589&r1=282588&r2=282589&view=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Wed Sep 28 08:51:23 2016
@@ -151,7 +151,7 @@ enum {
   UNW_X86_ECX = 1,
   UNW_X86_EDX = 2,
   UNW_X86_EBX = 3,
-#ifdef __FreeBSD__
+#if defined(__CloudABI__) || defined(__FreeBSD__)
   UNW_X86_ESP = 4,
   UNW_X86_EBP = 5,
 #else


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


r319746 - Add __WINT_MAX__.

2017-12-05 Thread Ed Schouten via cfe-commits
Author: ed
Date: Tue Dec  5 01:13:18 2017
New Revision: 319746

URL: http://llvm.org/viewvc/llvm-project?rev=319746&view=rev
Log:
Add __WINT_MAX__.

This definition is similar to __WCHAR_MAX__, except that it applies to
wint_t. It's also documented as being supported by GCC 4.5 and later.

Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=319746&r1=319745&r2=319746&view=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Tue Dec  5 01:13:18 2017
@@ -751,6 +751,7 @@ static void InitializePredefinedMacros(c
   DefineTypeSize("__LONG_MAX__", TargetInfo::SignedLong, TI, Builder);
   DefineTypeSize("__LONG_LONG_MAX__", TargetInfo::SignedLongLong, TI, Builder);
   DefineTypeSize("__WCHAR_MAX__", TI.getWCharType(), TI, Builder);
+  DefineTypeSize("__WINT_MAX__", TI.getWIntType(), TI, Builder);
   DefineTypeSize("__INTMAX_MAX__", TI.getIntMaxType(), TI, Builder);
   DefineTypeSize("__SIZE_MAX__", TI.getSizeType(), TI, Builder);
 

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=319746&r1=319745&r2=319746&view=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Dec  5 01:13:18 2017
@@ -1243,6 +1243,7 @@
 // AARCH64-FREEBSD:#define __WCHAR_TYPE__ unsigned int
 // AARCH64-FREEBSD:#define __WCHAR_UNSIGNED__ 1
 // AARCH64-FREEBSD:#define __WCHAR_WIDTH__ 32
+// AARCH64-FREEBSD:#define __WINT_MAX__ 2147483647
 // AARCH64-FREEBSD:#define __WINT_TYPE__ int
 // AARCH64-FREEBSD:#define __WINT_WIDTH__ 32
 // AARCH64-FREEBSD:#define __aarch64__ 1
@@ -8440,6 +8441,7 @@
 // X86_64-CLOUDABI:#define __WCHAR_MAX__ 2147483647
 // X86_64-CLOUDABI:#define __WCHAR_TYPE__ int
 // X86_64-CLOUDABI:#define __WCHAR_WIDTH__ 32
+// X86_64-CLOUDABI:#define __WINT_MAX__ 2147483647
 // X86_64-CLOUDABI:#define __WINT_TYPE__ int
 // X86_64-CLOUDABI:#define __WINT_WIDTH__ 32
 // X86_64-CLOUDABI:#define __amd64 1
@@ -9364,6 +9366,7 @@
 // WEBASSEMBLY32-NEXT:#define __WCHAR_TYPE__ int
 // WEBASSEMBLY32-NOT:#define __WCHAR_UNSIGNED__
 // WEBASSEMBLY32-NEXT:#define __WCHAR_WIDTH__ 32
+// WEBASSEMBLY32-NEXT:#define __WINT_MAX__ 2147483647
 // WEBASSEMBLY32-NEXT:#define __WINT_TYPE__ int
 // WEBASSEMBLY32-NOT:#define __WINT_UNSIGNED__
 // WEBASSEMBLY32-NEXT:#define __WINT_WIDTH__ 32
@@ -9695,6 +9698,7 @@
 // WEBASSEMBLY64-NEXT:#define __WCHAR_TYPE__ int
 // WEBASSEMBLY64-NOT:#define __WCHAR_UNSIGNED__
 // WEBASSEMBLY64-NEXT:#define __WCHAR_WIDTH__ 32
+// WEBASSEMBLY64-NEXT:#define __WINT_MAX__ 2147483647
 // WEBASSEMBLY64-NEXT:#define __WINT_TYPE__ int
 // WEBASSEMBLY64-NOT:#define __WINT_UNSIGNED__
 // WEBASSEMBLY64-NEXT:#define __WINT_WIDTH__ 32


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


r290443 - Extend the tests for -Wmissing-variable-declarations.

2016-12-23 Thread Ed Schouten via cfe-commits
Author: ed
Date: Fri Dec 23 13:20:07 2016
New Revision: 290443

URL: http://llvm.org/viewvc/llvm-project?rev=290443&view=rev
Log:
Extend the tests for -Wmissing-variable-declarations.

We shouldn't throw a warning when the static keyword is not present in
an anonymous namespace, just like we do for -Wmissing-prototypes.

Modified:
cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp

Modified: cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp?rev=290443&r1=290442&r2=290443&view=diff
==
--- cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-missing-variable-declarations.cpp Fri Dec 23 
13:20:07 2016
@@ -47,3 +47,8 @@ class C {
 static int x = 0; // no-warn
   }
 };
+
+// There is also no need to use static in anonymous namespaces.
+namespace {
+  int vgood4;
+}


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


[libcxx] r290748 - Remove mblen(), mbtowc() and wctomb() from the thread-unsafe functions.

2016-12-30 Thread Ed Schouten via cfe-commits
Author: ed
Date: Fri Dec 30 04:44:00 2016
New Revision: 290748

URL: http://llvm.org/viewvc/llvm-project?rev=290748&view=rev
Log:
Remove mblen(), mbtowc() and wctomb() from the thread-unsafe functions.

Back in r240527 I added a knob to prevent thread-unsafe functions from
being exposed. mblen(), mbtowc() and wctomb() were also added to this
list, as the latest issue of POSIX doesn't require these functions to be
thread-safe.

It turns out that the only circumstance in which these functions are not
thread-safe is in case they are used in combination with state-dependent
character sets (e.g., Shift-JIS). According to Austin Group Bug 708,
these character sets "[...] are mostly a relic of the past and which
were never supported on most POSIX systems".

Though in many cases the use of these functions can be prevented by
using the reentrant counterparts, they are the only functions that allow
you to query whether the locale's character set is state-dependent. This
means that omitting these functions removes actual functionality.

Let's be a bit less pedantic and drop the guards around these functions.

Links:
http://austingroupbugs.net/view.php?id=708
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2037.htm

Reviewed by:ericwf
Differential Revision:  https://reviews.llvm.org/D21436

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/cstdlib
libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=290748&r1=290747&r2=290748&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Dec 30 04:44:00 2016
@@ -917,7 +917,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #endif
 
-// Thread-unsafe functions such as strtok(), mbtowc() and localtime()
+// Thread-unsafe functions such as strtok() and localtime()
 // are not available.
 #ifdef __CloudABI__
 #define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS

Modified: libcxx/trunk/include/cstdlib
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cstdlib?rev=290748&r1=290747&r2=290748&view=diff
==
--- libcxx/trunk/include/cstdlib (original)
+++ libcxx/trunk/include/cstdlib Fri Dec 30 04:44:00 2016
@@ -144,11 +144,9 @@ using ::ldiv;
 #ifndef _LIBCPP_HAS_NO_LONG_LONG
 using ::lldiv;
 #endif // _LIBCPP_HAS_NO_LONG_LONG
-#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 using ::mblen;
 using ::mbtowc;
 using ::wctomb;
-#endif
 using ::mbstowcs;
 using ::wcstombs;
 #ifdef _LIBCPP_HAS_QUICK_EXIT

Modified: libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp?rev=290748&r1=290747&r2=290748&view=diff
==
--- libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/stdlib_h.pass.cpp Fri Dec 30 
04:44:00 2016
@@ -104,11 +104,9 @@ int main()
 wchar_t* pw = 0;
 const wchar_t* pwc = 0;
 char* pc = 0;
-#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
-#endif
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), 
"");
 }

Modified: 
libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp?rev=290748&r1=290747&r2=290748&view=diff
==
--- libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp 
(original)
+++ libcxx/trunk/test/std/language.support/support.runtime/cstdlib.pass.cpp Fri 
Dec 30 04:44:00 2016
@@ -96,11 +96,9 @@ int main()
 wchar_t* pw = 0;
 const wchar_t* pwc = 0;
 char* pc = 0;
-#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), 
"");
 static_assert((std::is_same::value), 
"");
-#endif
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 }


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


r280672 - Add support for targeting armv6-unknown-cloudabi-eabihf.

2016-09-05 Thread Ed Schouten via cfe-commits
Author: ed
Date: Mon Sep  5 13:38:34 2016
New Revision: 280672

URL: http://llvm.org/viewvc/llvm-project?rev=280672&view=rev
Log:
Add support for targeting armv6-unknown-cloudabi-eabihf.

I'm in the progress of adding ARMv6 support to CloudABI. On the compiler
side, everything seems to work properly with this tiny change applied.


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=280672&r1=280671&r2=280672&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Sep  5 13:38:34 2016
@@ -8261,6 +8261,8 @@ static TargetInfo *AllocateTarget(const
   return new DarwinARMTargetInfo(Triple, Opts);
 
 switch (os) {
+case llvm::Triple::CloudABI:
+  return new CloudABITargetInfo(Triple, Opts);
 case llvm::Triple::Linux:
   return new LinuxTargetInfo(Triple, Opts);
 case llvm::Triple::FreeBSD:

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=280672&r1=280671&r2=280672&view=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Mon Sep  5 13:38:34 2016
@@ -1975,6 +1975,11 @@
 // ARMEABIHARDFP:#define __arm 1
 // ARMEABIHARDFP:#define __arm__ 1
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=armv6-unknown-cloudabi-eabihf 
< /dev/null | FileCheck -match-full-lines -check-prefix ARMV6-CLOUDABI %s
+//
+// ARMV6-CLOUDABI:#define __CloudABI__ 1
+// ARMV6-CLOUDABI:#define __arm__ 1
+
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-netbsd-eabi < /dev/null | 
FileCheck -match-full-lines -check-prefix ARM-NETBSD %s
 //
 // ARM-NETBSD-NOT:#define _LP64


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


r297956 - Make table cells referring to Clang 4 green, as Clang 4 has been released.

2017-03-16 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Mar 16 09:21:00 2017
New Revision: 297956

URL: http://llvm.org/viewvc/llvm-project?rev=297956&view=rev
Log:
Make table cells referring to Clang 4 green, as Clang 4 has been released.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=297956&r1=297955&r2=297956&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Thu Mar 16 09:21:00 2017
@@ -612,7 +612,7 @@ as the draft C++1z standard evolves.
 
   Make exception specifications part of the type system
   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html";>P0012R1
-  Clang 4
+  Clang 4
 
 
   __has_include in preprocessor conditionals
@@ -679,7 +679,7 @@ as the draft C++1z standard evolves.
 
   Dynamic memory allocation for over-aligned data
   http://wg21.link/p0035r4";>P0035R4
-  Clang 4
+  Clang 4
 
 
   Template argument deduction for class templates
@@ -692,17 +692,17 @@ as the draft C++1z standard evolves.
 
   Non-type template parameters with auto type
   http://wg21.link/p0127r2";>P0127R2
-  Clang 4
+  Clang 4
 
 
   Guaranteed copy elision
   http://wg21.link/p0135r1";>P0135R1
-  Clang 4
+  Clang 4
 
 
   Stricter expression evaluation order
   http://wg21.link/p0145r3";>P0145R3
-  Clang 4 (10)
+  Clang 4 (10)
 
 
   http://wg21.link/p0400r0";>P0400R0
@@ -725,7 +725,7 @@ as the draft C++1z standard evolves.
 
   Structured bindings
   http://wg21.link/p0217r3";>P0217R3
-  Clang 4
+  Clang 4
 
 
   Separate variable and condition for if and 
switch
@@ -741,12 +741,12 @@ as the draft C++1z standard evolves.
 
   Removing deprecated dynamic exception specifications
   http://wg21.link/p0003r5";>P0003R5
-  Clang 4
+  Clang 4
 
 
   Pack expansions in using-declarations
   http://wg21.link/p0195r2";>P0195R2
-  Clang 4
+  Clang 4
 
 
 


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


[libcxx] r294832 - Fix the build of thread.cpp on CloudABI.

2017-02-11 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sat Feb 11 02:30:18 2017
New Revision: 294832

URL: http://llvm.org/viewvc/llvm-project?rev=294832&view=rev
Log:
Fix the build of thread.cpp on CloudABI.

CloudABI does provide unistd.h, but doesn't define __unix__. We need to
include this header file to make hardware_concurrency work.

Modified:
libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/src/thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=294832&r1=294831&r2=294832&view=diff
==
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Sat Feb 11 02:30:18 2017
@@ -24,9 +24,9 @@
 # endif // defined(BSD)
 #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
 
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || 
defined(__CloudABI__)
 # include 
-#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || 
defined(__CloudABI__)
 
 #if defined(__NetBSD__)
 #pragma weak pthread_create // Do not create libpthread dependency


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


[libcxx] r294833 - Remove a now unneeded __CloudABI__ check.

2017-02-11 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sat Feb 11 02:33:16 2017
New Revision: 294833

URL: http://llvm.org/viewvc/llvm-project?rev=294833&view=rev
Log:
Remove a now unneeded __CloudABI__ check.

CloudABI has gained the setlocale() function in the meantime, meaning
there is no longer a need to conditionalize this.


Modified:
libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/src/locale.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=294833&r1=294832&r2=294833&view=diff
==
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Sat Feb 11 02:33:16 2017
@@ -579,10 +579,8 @@ locale::global(const locale& loc)
 locale& g = __global();
 locale r = g;
 g = loc;
-#ifndef __CloudABI__
 if (g.name() != "*")
 setlocale(LC_ALL, g.name().c_str());
-#endif
 return r;
 }
 


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


[libunwind] r295944 - Drop the dependency on dl_unwind_find_exidx().

2017-02-23 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Feb 23 02:05:58 2017
New Revision: 295944

URL: http://llvm.org/viewvc/llvm-project?rev=295944&view=rev
Log:
Drop the dependency on dl_unwind_find_exidx().

While porting libunwind over to CloudABI for ARMv6, I observed that this
source file doesn't build, as it depends on dl_unwind_find_exidx(),
which CloudABI's C library was lacking. After I added that function,
I still needed to patch up libunwind to define _Unwind_Ptr.

Taking a step back, I wonder why we need to make use of this function
anyway. The unwinder already has some nice code to use dl_iterate_phdr()
to scan for a PT_GNU_EH_FRAME header. The dl_unwind_find_exidx() does
the same thing, except matching PT_ARM_EXIDX instead. We could also do
that ourselves.

This change gets rid of the dl_unwind_find_exidx() call and extends the
dl_iterate_phdr() loop. In addition to making the code a bit shorter, it
has the advantage of getting rid of some of those OS-specific #ifdefs.

This now means that if an operating system only provides
dl_iterate_phdr(), it gets support for unwinding on all architectures.
There is no need to add more stuff, just to get ARMv6 support.

Differential Revision:  https://reviews.llvm.org/D28082

Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=295944&r1=295943&r2=295944&view=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Thu Feb 23 02:05:58 2017
@@ -35,29 +35,17 @@ namespace libunwind {
 #include "Registers.hpp"
 
 #if _LIBUNWIND_ARM_EHABI
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
-
-typedef void *_Unwind_Ptr;
-
-#elif defined(__linux__)
-
-typedef long unsigned int *_Unwind_Ptr;
-extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr addr, int *len);
-
-// Emulate the BSD dl_unwind_find_exidx API when on a GNU libdl system.
-#define dl_unwind_find_exidx __gnu_Unwind_Find_exidx
-
-#elif !defined(_LIBUNWIND_IS_BAREMETAL)
-#include 
-#else // !defined(_LIBUNWIND_IS_BAREMETAL)
-// When statically linked on bare-metal, the symbols for the EH table are 
looked
-// up without going through the dynamic loader.
 struct EHTEntry {
   uint32_t functionOffset;
   uint32_t unwindOpcodes;
 };
+#if defined(_LIBUNWIND_IS_BAREMETAL)
+// When statically linked on bare-metal, the symbols for the EH table are 
looked
+// up without going through the dynamic loader.
 extern EHTEntry __exidx_start;
 extern EHTEntry __exidx_end;
+#else
+#include 
 #endif // !defined(_LIBUNWIND_IS_BAREMETAL)
 #endif // _LIBUNWIND_ARM_EHABI
 
@@ -368,23 +356,15 @@ inline bool LocalAddressSpace::findUnwin
 info.compact_unwind_section_length = 
dyldInfo.compact_unwind_section_length;
 return true;
   }
-#elif _LIBUNWIND_ARM_EHABI
- #ifdef _LIBUNWIND_IS_BAREMETAL
+#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL)
   // Bare metal is statically linked, so no need to ask the dynamic loader
   info.arm_section =(uintptr_t)(&__exidx_start);
   info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start);
- #else
-  int length = 0;
-  info.arm_section = (uintptr_t) dl_unwind_find_exidx(
-  (_Unwind_Ptr) targetAddr, &length);
-  info.arm_section_length = (uintptr_t)length;
- #endif
   _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
  info.arm_section, info.arm_section_length);
   if (info.arm_section && info.arm_section_length)
 return true;
-#elif _LIBUNWIND_SUPPORT_DWARF_UNWIND
-#if _LIBUNWIND_SUPPORT_DWARF_INDEX
+#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND
   struct dl_iterate_cb_data {
 LocalAddressSpace *addressSpace;
 UnwindInfoSections *sects;
@@ -395,9 +375,6 @@ inline bool LocalAddressSpace::findUnwin
   int found = dl_iterate_phdr(
   [](struct dl_phdr_info *pinfo, size_t, void *data) -> int {
 auto cbdata = static_cast(data);
-size_t object_length;
-bool found_obj = false;
-bool found_hdr = false;
 
 assert(cbdata);
 assert(cbdata->sects);
@@ -413,6 +390,14 @@ inline bool LocalAddressSpace::findUnwin
 typedef ElfW(Phdr) Elf_Phdr;
 #endif
 
+ #if _LIBUNWIND_SUPPORT_DWARF_UNWIND
+  #if !_LIBUNWIND_SUPPORT_DWARF_INDEX
+   #error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires 
_LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
+  #endif
+size_t object_length;
+bool found_obj = false;
+bool found_hdr = false;
+
 for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
   const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i];
   if (phdr->p_type == PT_LOAD) {
@@ -442,12 +427,22 @@ inline bool LocalAddressSpace::findUnwin
 } else {
   return false;
 }
+ #else // _LIBUNWIND_ARM_EHABI
+for (Elf_Half i = 0; i < pinfo->dlpi_ph

[libunwind] r295948 - Revert r295944.

2017-02-23 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Feb 23 03:13:22 2017
New Revision: 295948

URL: http://llvm.org/viewvc/llvm-project?rev=295948&view=rev
Log:
Revert r295944.

Even though the change works perfectly fine on CloudABI, it fails to
work on the libcxx-libcxxabi-libunwind-arm-linux-noexceptions build bot.
Looking at the code, this may be attributed to the fact that the code
doesn't take the PT_LOAD addresses into consideration.

I will rework this change to fix that and send out an updated version
for review in the nearby future.

Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=295948&r1=295947&r2=295948&view=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Thu Feb 23 03:13:22 2017
@@ -35,17 +35,29 @@ namespace libunwind {
 #include "Registers.hpp"
 
 #if _LIBUNWIND_ARM_EHABI
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+
+typedef void *_Unwind_Ptr;
+
+#elif defined(__linux__)
+
+typedef long unsigned int *_Unwind_Ptr;
+extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr addr, int *len);
+
+// Emulate the BSD dl_unwind_find_exidx API when on a GNU libdl system.
+#define dl_unwind_find_exidx __gnu_Unwind_Find_exidx
+
+#elif !defined(_LIBUNWIND_IS_BAREMETAL)
+#include 
+#else // !defined(_LIBUNWIND_IS_BAREMETAL)
+// When statically linked on bare-metal, the symbols for the EH table are 
looked
+// up without going through the dynamic loader.
 struct EHTEntry {
   uint32_t functionOffset;
   uint32_t unwindOpcodes;
 };
-#if defined(_LIBUNWIND_IS_BAREMETAL)
-// When statically linked on bare-metal, the symbols for the EH table are 
looked
-// up without going through the dynamic loader.
 extern EHTEntry __exidx_start;
 extern EHTEntry __exidx_end;
-#else
-#include 
 #endif // !defined(_LIBUNWIND_IS_BAREMETAL)
 #endif // _LIBUNWIND_ARM_EHABI
 
@@ -356,15 +368,23 @@ inline bool LocalAddressSpace::findUnwin
 info.compact_unwind_section_length = 
dyldInfo.compact_unwind_section_length;
 return true;
   }
-#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL)
+#elif _LIBUNWIND_ARM_EHABI
+ #ifdef _LIBUNWIND_IS_BAREMETAL
   // Bare metal is statically linked, so no need to ask the dynamic loader
   info.arm_section =(uintptr_t)(&__exidx_start);
   info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start);
+ #else
+  int length = 0;
+  info.arm_section = (uintptr_t) dl_unwind_find_exidx(
+  (_Unwind_Ptr) targetAddr, &length);
+  info.arm_section_length = (uintptr_t)length;
+ #endif
   _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
  info.arm_section, info.arm_section_length);
   if (info.arm_section && info.arm_section_length)
 return true;
-#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND
+#elif _LIBUNWIND_SUPPORT_DWARF_UNWIND
+#if _LIBUNWIND_SUPPORT_DWARF_INDEX
   struct dl_iterate_cb_data {
 LocalAddressSpace *addressSpace;
 UnwindInfoSections *sects;
@@ -375,6 +395,9 @@ inline bool LocalAddressSpace::findUnwin
   int found = dl_iterate_phdr(
   [](struct dl_phdr_info *pinfo, size_t, void *data) -> int {
 auto cbdata = static_cast(data);
+size_t object_length;
+bool found_obj = false;
+bool found_hdr = false;
 
 assert(cbdata);
 assert(cbdata->sects);
@@ -390,14 +413,6 @@ inline bool LocalAddressSpace::findUnwin
 typedef ElfW(Phdr) Elf_Phdr;
 #endif
 
- #if _LIBUNWIND_SUPPORT_DWARF_UNWIND
-  #if !_LIBUNWIND_SUPPORT_DWARF_INDEX
-   #error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires 
_LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
-  #endif
-size_t object_length;
-bool found_obj = false;
-bool found_hdr = false;
-
 for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
   const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i];
   if (phdr->p_type == PT_LOAD) {
@@ -427,22 +442,12 @@ inline bool LocalAddressSpace::findUnwin
 } else {
   return false;
 }
- #else // _LIBUNWIND_ARM_EHABI
-for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
-  const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i];
-  if (phdr->p_type == PT_ARM_EXIDX) {
-uintptr_t exidx_start = pinfo->dlpi_addr + phdr->p_vaddr;
-cbdata->sects->arm_section = exidx_start;
-cbdata->sects->arm_section_length = phdr->p_memsz /
-sizeof(EHTEntry);
-return true;
-  }
-}
-return false;
- #endif
   },
   &cb_data);
   return static_cast(found);
+#else
+#error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires 
_LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
+#endif
 #endif
 
   return false;


___

Re: [libunwind] r295948 - Revert r295944.

2017-02-23 Thread Ed Schouten via cfe-commits
Hi there,

2017-02-23 10:37 GMT+01:00 Asiri Rathnayake :
> I have a feeling that the no-exceptions builders are missing a few
> configuration bits.
>
> "No-exceptions" libraries should not require libunwind...
>
> Looking at the cmake configs:
> http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-arm-linux-noexceptions/builds/430/steps/cmake/logs/stdio
>
> I see that it's missing the -DLIBCXXABI_ENALBE_EXCEPTIONS=OFF flag and the
> -DLIBCXX_USE_LLVM_UNWINDER=ON should also be dropped I think.
>
> I'll upload a patch to fix this soon, and ask Galina to restart the
> build-master. You will be able to continue with your work afterward.
>
> Sorry about the trouble.

No problem whatsoever! It looks like the change I made doesn't just
break the *-noexceptions builders; it breaks ARM in general:

http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-arm-linux/builds/396

Still good that we uncovered a potential misconfiguration in the
builders as a result.

Best regards,
-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r296991 - Drop the dependency on dl_unwind_find_exidx().

2017-03-05 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sun Mar  5 13:11:24 2017
New Revision: 296991

URL: http://llvm.org/viewvc/llvm-project?rev=296991&view=rev
Log:
Drop the dependency on dl_unwind_find_exidx().

While porting libunwind over to CloudABI for ARMv6, I observed that this
source file doesn't build, as it depends on dl_unwind_find_exidx(),
which CloudABI's C library was lacking. After I added that function, I
still needed to patch up libunwind to define _Unwind_Ptr.

Taking a step back, I wonder why we need to make use of this function
anyway. The unwinder already has some nice code to use dl_iterate_phdr()
to scan for a PT_GNU_EH_FRAME header. The dl_unwind_find_exidx() does
the same thing, except matching PT_ARM_EXIDX instead. We could also do
that ourselves.

This change gets rid of the dl_unwind_find_exidx() call and extends the
dl_iterate_phdr() loop. This approach has the advantage of getting rid
of some of those OS-specific #ifdefs. This now means that if an
operating system only provides dl_iterate_phdr(), it gets support for
unwinding on all architectures. There is no need to add more stuff, just
to get ARMv6 support.

This change is identical to r295944, except that it now adds the
necessary code to do bounds checking on PT_LOAD. The previous version of
this change lacked this, which didn't cause any problems on CloudABI,
but did break the Linux build bots. This is why I reverted it in
r295948.

Differential Revision:  https://reviews.llvm.org/D30306

Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=296991&r1=296990&r2=296991&view=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Sun Mar  5 13:11:24 2017
@@ -35,29 +35,17 @@ namespace libunwind {
 #include "Registers.hpp"
 
 #if _LIBUNWIND_ARM_EHABI
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
-
-typedef void *_Unwind_Ptr;
-
-#elif defined(__linux__)
-
-typedef long unsigned int *_Unwind_Ptr;
-extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr addr, int *len);
-
-// Emulate the BSD dl_unwind_find_exidx API when on a GNU libdl system.
-#define dl_unwind_find_exidx __gnu_Unwind_Find_exidx
-
-#elif !defined(_LIBUNWIND_IS_BAREMETAL)
-#include 
-#else // !defined(_LIBUNWIND_IS_BAREMETAL)
-// When statically linked on bare-metal, the symbols for the EH table are 
looked
-// up without going through the dynamic loader.
 struct EHTEntry {
   uint32_t functionOffset;
   uint32_t unwindOpcodes;
 };
+#if defined(_LIBUNWIND_IS_BAREMETAL)
+// When statically linked on bare-metal, the symbols for the EH table are 
looked
+// up without going through the dynamic loader.
 extern EHTEntry __exidx_start;
 extern EHTEntry __exidx_end;
+#else
+#include 
 #endif // !defined(_LIBUNWIND_IS_BAREMETAL)
 #endif // _LIBUNWIND_ARM_EHABI
 
@@ -368,23 +356,15 @@ inline bool LocalAddressSpace::findUnwin
 info.compact_unwind_section_length = 
dyldInfo.compact_unwind_section_length;
 return true;
   }
-#elif _LIBUNWIND_ARM_EHABI
- #ifdef _LIBUNWIND_IS_BAREMETAL
+#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL)
   // Bare metal is statically linked, so no need to ask the dynamic loader
   info.arm_section =(uintptr_t)(&__exidx_start);
   info.arm_section_length = (uintptr_t)(&__exidx_end - &__exidx_start);
- #else
-  int length = 0;
-  info.arm_section = (uintptr_t) dl_unwind_find_exidx(
-  (_Unwind_Ptr) targetAddr, &length);
-  info.arm_section_length = (uintptr_t)length;
- #endif
   _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: section %X length %x",
  info.arm_section, info.arm_section_length);
   if (info.arm_section && info.arm_section_length)
 return true;
-#elif _LIBUNWIND_SUPPORT_DWARF_UNWIND
-#if _LIBUNWIND_SUPPORT_DWARF_INDEX
+#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND
   struct dl_iterate_cb_data {
 LocalAddressSpace *addressSpace;
 UnwindInfoSections *sects;
@@ -395,7 +375,6 @@ inline bool LocalAddressSpace::findUnwin
   int found = dl_iterate_phdr(
   [](struct dl_phdr_info *pinfo, size_t, void *data) -> int {
 auto cbdata = static_cast(data);
-size_t object_length;
 bool found_obj = false;
 bool found_hdr = false;
 
@@ -413,6 +392,11 @@ inline bool LocalAddressSpace::findUnwin
 typedef ElfW(Phdr) Elf_Phdr;
 #endif
 
+ #if _LIBUNWIND_SUPPORT_DWARF_UNWIND
+  #if !_LIBUNWIND_SUPPORT_DWARF_INDEX
+   #error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires 
_LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
+  #endif
+size_t object_length;
 for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
   const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i];
   if (phdr->p_type == PT_LOAD) {
@@ -442,12 +426,27 @@ inline bool LocalAddressSpace::findUnwin
 } e

[libunwind] r297149 - Let arm_section_length store the number of bytes.

2017-03-07 Thread Ed Schouten via cfe-commits
Author: ed
Date: Tue Mar  7 09:21:57 2017
New Revision: 297149

URL: http://llvm.org/viewvc/llvm-project?rev=297149&view=rev
Log:
Let arm_section_length store the number of bytes.

Exception section data that we extract for DWARF gets stored as the
offset and the number of bytes. For ARM exception info, we seem to
deviate from this by storing the number of entries. Attempt to make this
more consistent.

By storing the number of bytes, we can get rid of the EHTEntry structure
declared in AddressSpace.hpp. In UnwindCursor.hpp we already have
another structure declared for the same purpose.

Reviewed by:Keith Walker
Differential Revision:  https://reviews.llvm.org/D30681

Modified:
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/UnwindCursor.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=297149&r1=297148&r2=297149&view=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Tue Mar  7 09:21:57 2017
@@ -35,15 +35,11 @@ namespace libunwind {
 #include "Registers.hpp"
 
 #if _LIBUNWIND_ARM_EHABI
-struct EHTEntry {
-  uint32_t functionOffset;
-  uint32_t unwindOpcodes;
-};
 #if defined(_LIBUNWIND_IS_BAREMETAL)
 // When statically linked on bare-metal, the symbols for the EH table are 
looked
 // up without going through the dynamic loader.
-extern EHTEntry __exidx_start;
-extern EHTEntry __exidx_end;
+extern char __exidx_start;
+extern char __exidx_end;
 #else
 #include 
 #endif // !defined(_LIBUNWIND_IS_BAREMETAL)
@@ -437,8 +433,7 @@ inline bool LocalAddressSpace::findUnwin
   } else if (phdr->p_type == PT_ARM_EXIDX) {
 uintptr_t exidx_start = pinfo->dlpi_addr + phdr->p_vaddr;
 cbdata->sects->arm_section = exidx_start;
-cbdata->sects->arm_section_length = phdr->p_memsz /
-sizeof(EHTEntry);
+cbdata->sects->arm_section_length = phdr->p_memsz;
 found_hdr = true;
   }
 }

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=297149&r1=297148&r2=297149&view=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Tue Mar  7 09:21:57 2017
@@ -693,7 +693,8 @@ struct EHABISectionIterator {
 return _Self(addressSpace, sects, 0);
   }
   static _Self end(A& addressSpace, const UnwindInfoSections& sects) {
-return _Self(addressSpace, sects, sects.arm_section_length);
+return _Self(addressSpace, sects,
+ sects.arm_section_length / sizeof(EHABIIndexEntry));
   }
 
   EHABISectionIterator(A& addressSpace, const UnwindInfoSections& sects, 
size_t i)


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


[libunwind] r297174 - Improve readability and correctness of the OS specific libunwind bits.

2017-03-07 Thread Ed Schouten via cfe-commits
Author: ed
Date: Tue Mar  7 12:15:52 2017
New Revision: 297174

URL: http://llvm.org/viewvc/llvm-project?rev=297174&view=rev
Log:
Improve readability and correctness of the OS specific libunwind bits.

All of the access to __exidx_*, dl_iterate_phdr(), etc. is specific to
the findUnwindSections() function. Right now all of the includes and
declarations related to them are scattered throughout the source file.
For example, for , we have a full list of operating systems
guarding the #include, even though the code that uses dl_iterate_phdr()
miraculously doesn't use the same list.

Change the code so that findUnwindSections() is preceded by a block of
#ifdefs that share the same structure as the function itself. First
comes all of the macOS specific bits, followed by bare-metal ARM,
followed by ELF EHABI + DWARF.

This actually allows us to build a copy of libunwind without any
specific ifdefs for NetBSD, CloudABI, etc. It likely also unbreaks the
build of libunwind on FreeBSD/armv6, though I can't confirm.

Reviewed by:compnerd
Differential Revision:  https://reviews.llvm.org/D30696

Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=297174&r1=297173&r2=297174&view=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Tue Mar  7 12:15:52 2017
@@ -34,32 +34,6 @@ namespace libunwind {
 #include "dwarf2.h"
 #include "Registers.hpp"
 
-#if _LIBUNWIND_ARM_EHABI
-#if defined(_LIBUNWIND_IS_BAREMETAL)
-// When statically linked on bare-metal, the symbols for the EH table are 
looked
-// up without going through the dynamic loader.
-extern char __exidx_start;
-extern char __exidx_end;
-#else
-#include 
-#endif // !defined(_LIBUNWIND_IS_BAREMETAL)
-#endif // _LIBUNWIND_ARM_EHABI
-
-#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__Fuchsia__) ||  \
-defined(__linux__) || defined(__NetBSD__)
-#if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX
-#include 
-// Macro for machine-independent access to the ELF program headers. This
-// macro is not available on some systems (e.g., FreeBSD). On these
-// systems the data structures are just called Elf_XXX. Define ElfW()
-// locally.
-#if !defined(ElfW)
-#define ElfW(type) Elf_##type
-#endif
-#include "EHHeaderParser.hpp"
-#endif
-#endif
-
 namespace libunwind {
 
 /// Used by findUnwindSections() to return info about needed sections.
@@ -291,6 +265,7 @@ LocalAddressSpace::getEncodedP(pint_t &a
 }
 
 #ifdef __APPLE__ 
+
   struct dyld_unwind_sections
   {
 const struct mach_header*   mh;
@@ -336,6 +311,30 @@ LocalAddressSpace::getEncodedP(pint_t &a
   return true;
 }
   #endif
+
+#elif _LIBUNWIND_ARM_EHABI && defined(_LIBUNWIND_IS_BAREMETAL)
+
+// When statically linked on bare-metal, the symbols for the EH table are 
looked
+// up without going through the dynamic loader.
+extern char __exidx_start;
+extern char __exidx_end;
+
+#elif _LIBUNWIND_ARM_EHABI || _LIBUNWIND_SUPPORT_DWARF_UNWIND
+
+// ELF-based systems may use dl_iterate_phdr() to access sections
+// containing unwinding information. The ElfW() macro for pointer-size
+// independent ELF header traversal is not provided by  on some
+// systems (e.g., FreeBSD). On these systems the data structures are
+// just called Elf_XXX. Define ElfW() locally.
+#include 
+#if !defined(ElfW)
+#define ElfW(type) Elf_##type
+#endif
+
+#if _LIBUNWIND_SUPPORT_DWARF_UNWIND
+#include "EHHeaderParser.hpp"
+#endif
+
 #endif
 
 inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,


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


[libunwind] r297175 - Tidy up the way we include EHHeaderParser.hpp.

2017-03-07 Thread Ed Schouten via cfe-commits
Author: ed
Date: Tue Mar  7 12:21:51 2017
New Revision: 297175

URL: http://llvm.org/viewvc/llvm-project?rev=297175&view=rev
Log:
Tidy up the way we include EHHeaderParser.hpp.

Other source files in the source tree tend to include this header file
unconditionally. It also parses perfectly fine on ARM EHABI systems.


Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=297175&r1=297174&r2=297175&view=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Tue Mar  7 12:21:51 2017
@@ -32,6 +32,7 @@ namespace libunwind {
 #include "libunwind.h"
 #include "config.h"
 #include "dwarf2.h"
+#include "EHHeaderParser.hpp"
 #include "Registers.hpp"
 
 namespace libunwind {
@@ -331,10 +332,6 @@ extern char __exidx_end;
 #define ElfW(type) Elf_##type
 #endif
 
-#if _LIBUNWIND_SUPPORT_DWARF_UNWIND
-#include "EHHeaderParser.hpp"
-#endif
-
 #endif
 
 inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,


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


Re: [libunwind] r297175 - Tidy up the way we include EHHeaderParser.hpp.

2017-03-08 Thread Ed Schouten via cfe-commits
Hi Marshall,

2017-03-08 15:47 GMT+01:00 Marshall Clow :
> I'm having trouble building libunwind this morning (on a Mac).

Ah, thanks for reporting. I only tested this on FreeBSD and CloudABI.
On those systems we don't build Unwind_AppleExtras.cpp.

> /Sources/LLVM/llvm/projects/libunwind/src/EHHeaderParser.hpp:44:32: error:
> expected a qualified name after 'typename'
>   typename CFI_Parser::FDE_Info *fdeInfo,
>^

Looking at the sources, I think this change introduced the cyclic
dependency on #includes: AddressSpace.hpp -> EHHeaderParser.hpp ->
DwarfParser.hpp -> AddressSpace.hpp.

Though EHHeaderParser.hpp and DwarfParser.hpp both declare class
templates that can take LocalAddressSpace as an argument, they don't
have any actual source-level dependency on that class. We can
therefore remove the #include to AddressSpace.hpp and only do that in
Unwind_AppleExtras.cpp.

What are your thoughts on the attached patch?

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
Index: src/DwarfParser.hpp
===
--- src/DwarfParser.hpp (revision 297278)
+++ src/DwarfParser.hpp (working copy)
@@ -21,7 +21,6 @@
 #include "libunwind.h"
 #include "dwarf2.h"
 
-#include "AddressSpace.hpp"
 #include "config.h"
 
 namespace libunwind {
Index: src/EHHeaderParser.hpp
===
--- src/EHHeaderParser.hpp  (revision 297278)
+++ src/EHHeaderParser.hpp  (working copy)
@@ -15,7 +15,6 @@
 
 #include "libunwind.h"
 
-#include "AddressSpace.hpp"
 #include "DwarfParser.hpp"
 
 namespace libunwind {
Index: src/Unwind_AppleExtras.cpp
===
--- src/Unwind_AppleExtras.cpp  (revision 297278)
+++ src/Unwind_AppleExtras.cpp  (working copy)
@@ -9,6 +9,7 @@
 
//===--===//
 
 #include "config.h"
+#include "AddressSpace.hpp"
 #include "DwarfParser.hpp"
 #include "unwind_ext.h"
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libunwind] r297174 - Improve readability and correctness of the OS specific libunwind bits.

2017-03-08 Thread Ed Schouten via cfe-commits
Hi Asiri,

2017-03-07 20:42 GMT+01:00 Asiri Rathnayake :
> Could you please always include cfe-commits as a subscriber in you phab
> reviews?
>
> We would like to be aware of these changes in advance before they land.

Sure thing! I'll try to do that from now on.

That said, if the policy is to add cfe-commits@ to all
Clang/libunwind-related code reviews, would it make sense to configure
Phabricator's Herald to set this up for us automatically? Looking at
https://reviews.llvm.org/herald/new/, I suspect that can only be
configured with admin rights.

Regards,
-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r297364 - Fix up the places where AddressSpace.hpp is included.

2017-03-09 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Mar  9 02:04:07 2017
New Revision: 297364

URL: http://llvm.org/viewvc/llvm-project?rev=297364&view=rev
Log:
Fix up the places where AddressSpace.hpp is included.

The AddressSpace.hpp header declares two classes: LocalAddressSpace and
RemoteAddressSpace. These classes are only used in a very small number
of source files, but passed in as template arguments to many other
classes.

Let's go ahead and only include AddressSpace.hpp in source files where
at least one of these two classes is mentioned. This gets rid of a
cyclic header dependency that was already present, but only caused
breakage on macOS until recently.

Reported by:Marshall Clow

Modified:
libunwind/trunk/src/CompactUnwinder.hpp
libunwind/trunk/src/DwarfInstructions.hpp
libunwind/trunk/src/DwarfParser.hpp
libunwind/trunk/src/EHHeaderParser.hpp
libunwind/trunk/src/Unwind_AppleExtras.cpp
libunwind/trunk/src/libunwind.cpp

Modified: libunwind/trunk/src/CompactUnwinder.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CompactUnwinder.hpp?rev=297364&r1=297363&r2=297364&view=diff
==
--- libunwind/trunk/src/CompactUnwinder.hpp (original)
+++ libunwind/trunk/src/CompactUnwinder.hpp Thu Mar  9 02:04:07 2017
@@ -19,7 +19,6 @@
 #include 
 #include 
 
-#include "AddressSpace.hpp"
 #include "Registers.hpp"
 
 #define EXTRACT_BITS(value, mask)  
\

Modified: libunwind/trunk/src/DwarfInstructions.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=297364&r1=297363&r2=297364&view=diff
==
--- libunwind/trunk/src/DwarfInstructions.hpp (original)
+++ libunwind/trunk/src/DwarfInstructions.hpp Thu Mar  9 02:04:07 2017
@@ -18,7 +18,6 @@
 #include 
 
 #include "dwarf2.h"
-#include "AddressSpace.hpp"
 #include "Registers.hpp"
 #include "DwarfParser.hpp"
 #include "config.h"

Modified: libunwind/trunk/src/DwarfParser.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfParser.hpp?rev=297364&r1=297363&r2=297364&view=diff
==
--- libunwind/trunk/src/DwarfParser.hpp (original)
+++ libunwind/trunk/src/DwarfParser.hpp Thu Mar  9 02:04:07 2017
@@ -21,7 +21,6 @@
 #include "libunwind.h"
 #include "dwarf2.h"
 
-#include "AddressSpace.hpp"
 #include "config.h"
 
 namespace libunwind {

Modified: libunwind/trunk/src/EHHeaderParser.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/EHHeaderParser.hpp?rev=297364&r1=297363&r2=297364&view=diff
==
--- libunwind/trunk/src/EHHeaderParser.hpp (original)
+++ libunwind/trunk/src/EHHeaderParser.hpp Thu Mar  9 02:04:07 2017
@@ -15,7 +15,6 @@
 
 #include "libunwind.h"
 
-#include "AddressSpace.hpp"
 #include "DwarfParser.hpp"
 
 namespace libunwind {

Modified: libunwind/trunk/src/Unwind_AppleExtras.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind_AppleExtras.cpp?rev=297364&r1=297363&r2=297364&view=diff
==
--- libunwind/trunk/src/Unwind_AppleExtras.cpp (original)
+++ libunwind/trunk/src/Unwind_AppleExtras.cpp Thu Mar  9 02:04:07 2017
@@ -9,6 +9,7 @@
 
//===--===//
 
 #include "config.h"
+#include "AddressSpace.hpp"
 #include "DwarfParser.hpp"
 #include "unwind_ext.h"
 

Modified: libunwind/trunk/src/libunwind.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind.cpp?rev=297364&r1=297363&r2=297364&view=diff
==
--- libunwind/trunk/src/libunwind.cpp (original)
+++ libunwind/trunk/src/libunwind.cpp Thu Mar  9 02:04:07 2017
@@ -24,6 +24,7 @@
 #include 
 
 
+#include "AddressSpace.hpp"
 #include "UnwindCursor.hpp"
 
 using namespace libunwind;


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


r246857 - Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.

2015-09-04 Thread Ed Schouten via cfe-commits
Author: ed
Date: Fri Sep  4 11:07:39 2015
New Revision: 246857

URL: http://llvm.org/viewvc/llvm-project?rev=246857&view=rev
Log:
Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.

If we build with -Werror=implicit-function-declaration, only implicit
function declarations of non-library functions throw compiler errors.
For library functions, we only produce a warning. There is no way to
promote both of these cases to an error without promoting other
warnings.

It makes little sense to introduce an additional compiler flag just to
control this specific warning. In my opinion it should just be part of
the same group.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Driver/implicit-function-as-error.c
cfe/trunk/test/Misc/warning-flags.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=246857&r1=246856&r2=246857&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Sep  4 11:07:39 
2015
@@ -416,7 +416,8 @@ def note_unreachable_silence : Note<
 
 /// Built-in functions.
 def ext_implicit_lib_function_decl : ExtWarn<
-  "implicitly declaring library function '%0' with type %1">;
+  "implicitly declaring library function '%0' with type %1">,
+  InGroup;
 def note_include_header_or_declare : Note<
   "include the header <%0> or explicitly provide a declaration for '%1'">;
 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;

Modified: cfe/trunk/test/Driver/implicit-function-as-error.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/implicit-function-as-error.c?rev=246857&r1=246856&r2=246857&view=diff
==
--- cfe/trunk/test/Driver/implicit-function-as-error.c (original)
+++ cfe/trunk/test/Driver/implicit-function-as-error.c Fri Sep  4 11:07:39 2015
@@ -5,5 +5,6 @@
 // to an error.
 
 void radar_10894044() {
+  printf("Hi\n"); // expected-error {{implicitly declaring library function 
'printf' with type 'int (const char *, ...)'}} expected-note {{include the 
header  or explicitly provide a declaration for 'printf'}}
   radar_10894044_not_declared(); // expected-error {{implicit declaration of 
function 'radar_10894044_not_declared' is invalid in C99}}
 }

Modified: cfe/trunk/test/Misc/warning-flags.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=246857&r1=246856&r2=246857&view=diff
==
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Fri Sep  4 11:07:39 2015
@@ -18,12 +18,11 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (93):
+CHECK: Warnings without flags (92):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
-CHECK-NEXT:   ext_implicit_lib_function_decl
 CHECK-NEXT:   ext_initializer_string_for_char_array_too_long
 CHECK-NEXT:   ext_missing_declspec
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name


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


r250416 - Add support for CloudABI/aarch64.

2015-10-15 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Oct 15 10:07:07 2015
New Revision: 250416

URL: http://llvm.org/viewvc/llvm-project?rev=250416&view=rev
Log:
Add support for CloudABI/aarch64.

The core C library has already been ported over to aarch64 successfully,
meaning there is no reason to hold this change back.

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=250416&r1=250415&r2=250416&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Oct 15 10:07:07 2015
@@ -7364,6 +7364,8 @@ static TargetInfo *AllocateTarget(const
   return new DarwinAArch64TargetInfo(Triple);
 
 switch (os) {
+case llvm::Triple::CloudABI:
+  return new CloudABITargetInfo(Triple);
 case llvm::Triple::FreeBSD:
   return new FreeBSDTargetInfo(Triple);
 case llvm::Triple::Linux:


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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2015-08-10 Thread Ed Schouten via cfe-commits
ed added a subscriber: ed.


Comment at: include/__config:742
@@ +741,3 @@
+#ifndef _LIBCPP_HAS_NO_THREADS
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) || 
defined(__APPLE__)
+#  define _LIBCPP_THREAD_API _LIBCPP_PTHREAD

espositofulvio wrote:
> theraven wrote:
> > #ifdef unix will catch most of these (for some reason, not OS X, even 
> > though it's the only one that actually is certified as UNIX...)
> I didn't know that and I'm not sure I've included all the supported platforms 
> (in include/__config there are definitions for __ sun __ and __ CloudABI __ 
> which I know very little about). Is there somewhere a list of supported 
> platforms?
CloudABI has pthreads, but it does not have `unix` defined. Both FreeBSD and 
CloudABI also support C11 ``.

If you're going to stick to the code you have right now, be sure to add 
`defined(__CloudABI__)` to that list of operating systems.

The POSIX way of testing whether pthreads is available is:

#include 
#if _POSIX_THREADS > 0
...
#endif

See: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


Re: [PATCH] D11781: Refactored pthread usage in libcxx

2015-08-10 Thread Ed Schouten via cfe-commits
ed added a comment.

A general note I have regarding this change:

Now that we're introducing separate implementations for mutexes and condition 
variables, could we also consider letting `shared_mutex` and friends simply use 
`pthread_rwlock_*()`? We currently have it implemented as a wrapper on top of 
mutexes and condition variables, but the downside of this approach is that it 
potentially has more overhead, but also works around priority inheritance if 
supported by the implementation.


Repository:
  rL LLVM

http://reviews.llvm.org/D11781



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


r278393 - Pass in frame pointer omitting compiler flags for CloudABI as well.

2016-08-11 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Aug 11 14:23:30 2016
New Revision: 278393

URL: http://llvm.org/viewvc/llvm-project?rev=278393&view=rev
Log:
Pass in frame pointer omitting compiler flags for CloudABI as well.

On Linux we pass in -fomit-frame-pointer flags (and similar)
automatically if optimization is enabled. Let's do the same thing on
CloudABI. Without this, Clang seems to run out of registers quite
quickly while trying to build code with inline assembly.


Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/frame-pointer-elim.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=278393&r1=278392&r2=278393&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 11 14:23:30 2016
@@ -3242,7 +3242,7 @@ static bool shouldUseFramePointerForTarg
 break;
   }
 
-  if (Triple.isOSLinux()) {
+  if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) {
 switch (Triple.getArch()) {
 // Don't use a frame pointer on linux if optimizing for certain targets.
 case llvm::Triple::mips64:

Modified: cfe/trunk/test/Driver/frame-pointer-elim.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/frame-pointer-elim.c?rev=278393&r1=278392&r2=278393&view=diff
==
--- cfe/trunk/test/Driver/frame-pointer-elim.c (original)
+++ cfe/trunk/test/Driver/frame-pointer-elim.c Thu Aug 11 14:23:30 2016
@@ -8,6 +8,15 @@
 // RUN:   FileCheck --check-prefix=LINUX %s
 // LINUX-NOT: "-momit-leaf-frame-pointer"
 
+// CloudABI follows the same rules as Linux.
+// RUN: %clang -### -target x86_64-unknown-cloudabi -S -O1 %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CLOUDABI-OPT %s
+// CLOUDABI-OPT: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -target x86_64-unknown-cloudabi -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CLOUDABI %s
+// CLOUDABI-NOT: "-momit-leaf-frame-pointer"
+
 // Darwin disables omitting the leaf frame pointer even under optimization
 // unless the command lines are given.
 // RUN: %clang -### -target i386-apple-darwin -S %s 2>&1 | \


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


r278395 - Don't enable PIE on i686-unknown-cloudabi.

2016-08-11 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Aug 11 15:03:22 2016
New Revision: 278395

URL: http://llvm.org/viewvc/llvm-project?rev=278395&view=rev
Log:
Don't enable PIE on i686-unknown-cloudabi.

We're only going to provide support for using PIE on architectures that
provide PC-relative addressing. i686 is not one of those, so add the
necessary bits for only passing in -pie -zrelro conditionally.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cloudabi.c
cfe/trunk/test/Driver/cloudabi.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=278395&r1=278394&r2=278395&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Aug 11 15:03:22 2016
@@ -3344,6 +3344,19 @@ Tool *CloudABI::buildLinker() const {
   return new tools::cloudabi::Linker(*this);
 }
 
+bool CloudABI::isPIEDefault() const {
+  // Only enable PIE on architectures that support PC-relative
+  // addressing. PC-relative addressing is required, as the process
+  // startup code must be able to relocate itself.
+  switch (getTriple().getArch()) {
+  case llvm::Triple::aarch64:
+  case llvm::Triple::x86_64:
+return true;
+  default:
+return false;
+  }
+}
+
 SanitizerMask CloudABI::getSupportedSanitizers() const {
   SanitizerMask Res = ToolChain::getSupportedSanitizers();
   Res |= SanitizerKind::SafeStack;

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=278395&r1=278394&r2=278395&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Thu Aug 11 15:03:22 2016
@@ -632,8 +632,7 @@ public:
   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
 
-  bool isPIEDefault() const override { return true; }
-
+  bool isPIEDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   SanitizerMask getDefaultSanitizers() const override;
 

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=278395&r1=278394&r2=278395&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 11 15:03:22 2016
@@ -7523,11 +7523,13 @@ void cloudabi::Linker::ConstructJob(Comp
 
   // CloudABI only supports static linkage.
   CmdArgs.push_back("-Bstatic");
-
-  // CloudABI uses Position Independent Executables exclusively.
-  CmdArgs.push_back("-pie");
   CmdArgs.push_back("--no-dynamic-linker");
-  CmdArgs.push_back("-zrelro");
+
+  // Provide PIE linker flags in case PIE is default for the architecture.
+  if (ToolChain.isPIEDefault()) {
+CmdArgs.push_back("-pie");
+CmdArgs.push_back("-zrelro");
+  }
 
   CmdArgs.push_back("--eh-frame-hdr");
   CmdArgs.push_back("--gc-sections");

Modified: cfe/trunk/test/Driver/cloudabi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cloudabi.c?rev=278395&r1=278394&r2=278395&view=diff
==
--- cfe/trunk/test/Driver/cloudabi.c (original)
+++ cfe/trunk/test/Driver/cloudabi.c Thu Aug 11 15:03:22 2016
@@ -1,8 +1,14 @@
 // RUN: %clang %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s 
-check-prefix=SAFESTACK
 // SAFESTACK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections" {{.*}} "-fsanitize=safe-stack"
-// SAFESTACK: "-Bstatic" "-pie" "--no-dynamic-linker" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" 
"{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+// SAFESTACK: "-Bstatic" "--no-dynamic-linker" "-pie" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" 
"{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
 
 // RUN: %clang %s -### -target x86_64-unknown-cloudabi 
-fno-sanitize=safe-stack 2>&1 | FileCheck %s -check-prefix=NOSAFESTACK
 // NOSAFESTACK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections"
 // NOSAFESTACK-NOT: "-fsanitize=safe-stack"
-// NOSAFESTACK: "-Bstatic" "-pie" "--no-dynamic-linker" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" 
"{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+// NOSAFESTACK: "-Bstatic" "--no-dynamic-linker" "-pie" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" 
"{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+
+// PIE shouldn't be enabled on i686. Just on architectures that provide
+// PC-relative addressing.
+// RUN: %cla

r261135 - Enable SafeStack for CloudABI.

2016-02-17 Thread Ed Schouten via cfe-commits
Author: ed
Date: Wed Feb 17 12:56:20 2016
New Revision: 261135

URL: http://llvm.org/viewvc/llvm-project?rev=261135&view=rev
Log:
Enable SafeStack for CloudABI.

Summary:
I've got a patchset in my home directory to integrate support for
SafeStack into CloudABI's C library. All of the CloudABI unit tests
still seem to pass. Pretty sweet!

This change adds the necessary changes to Clang to make
-fsanitize=safe-stack work on CloudABI. Without it, passing this command
line flag throws an error.

Reviewers: eugenis, samsonov

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

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=261135&r1=261134&r2=261135&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Feb 17 12:56:20 2016
@@ -3000,6 +3000,12 @@ Tool *CloudABI::buildLinker() const {
   return new tools::cloudabi::Linker(*this);
 }
 
+SanitizerMask CloudABI::getSupportedSanitizers() const {
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  Res |= SanitizerKind::SafeStack;
+  return Res;
+}
+
 /// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
 
 OpenBSD::OpenBSD(const Driver &D, const llvm::Triple &Triple,

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=261135&r1=261134&r2=261135&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Wed Feb 17 12:56:20 2016
@@ -617,6 +617,8 @@ public:
 
   bool isPIEDefault() const override { return false; }
 
+  SanitizerMask getSupportedSanitizers() const override;
+
 protected:
   Tool *buildLinker() const override;
 };

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=261135&r1=261134&r2=261135&view=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Wed Feb 17 12:56:20 2016
@@ -311,6 +311,10 @@
 // RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 
2>&1 | FileCheck %s -check-prefix=CHECK-SANM
 // CHECK-SANM: "-fsanitize=memory"
 
+// RUN: %clang -target aarch64-unknown-cloudabi -fsanitize=safe-stack %s -### 
2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI
+// RUN: %clang -target x86_64-unknown-cloudabi -fsanitize=safe-stack %s -### 
2>&1 | FileCheck %s -check-prefix=SAFESTACK-CLOUDABI
+// SAFESTACK-CLOUDABI: "-fsanitize=safe-stack"
+
 // RUN: %clang -target x86_64-scei-ps4 -fsanitize=function 
-fsanitize=undefined %s -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-FSAN-UBSAN-PS4
 // CHECK-FSAN-UBSAN-PS4: unsupported option '-fsanitize=function' for target 
'x86_64-scei-ps4'
 // RUN: %clang -target x86_64-scei-ps4 -fsanitize=function %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-FSAN-PS4


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


r264787 - Enable the SafeStack sanitizer on CloudABI by default.

2016-03-29 Thread Ed Schouten via cfe-commits
Author: ed
Date: Tue Mar 29 16:13:53 2016
New Revision: 264787

URL: http://llvm.org/viewvc/llvm-project?rev=264787&view=rev
Log:
Enable the SafeStack sanitizer on CloudABI by default.

Over the last month we've been testing SafeStack extensively. As far as
we know, it works perfectly fine. That why I'd like to see us having
this enabled by default for CloudABI.

This change introduces a getDefaultSanitizers() function that toolchains
can use to specify which sanitizers are enabled by default. Once all
flags are processed, only flags that had no -fno-sanitize overrides are
enabled.

Extend the thests for CloudABI to test both the default case and the
case in which we want to explicitly disable SafeStack.

Reviewed by:eugenis, pcc
Differential Revision:  http://reviews.llvm.org/D18505

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/cloudabi.c
cfe/trunk/test/Driver/cloudabi.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=264787&r1=264786&r2=264787&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Mar 29 16:13:53 2016
@@ -419,6 +419,9 @@ public:
 
   /// \brief Return sanitizers which are available in this toolchain.
   virtual SanitizerMask getSupportedSanitizers() const;
+
+  /// \brief Return sanitizers which are enabled by default.
+  virtual SanitizerMask getDefaultSanitizers() const { return 0; }
 };
 
 } // end namespace driver

Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=264787&r1=264786&r2=264787&view=diff
==
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Tue Mar 29 16:13:53 2016
@@ -268,6 +268,9 @@ SanitizerArgs::SanitizerArgs(const ToolC
 }
   }
 
+  // Enable toolchain specific default sanitizers if not explicitly disabled.
+  Kinds |= TC.getDefaultSanitizers() & ~AllRemove;
+
   // We disable the vptr sanitizer if it was enabled by group expansion but 
RTTI
   // is disabled.
   if ((Kinds & Vptr) &&

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=264787&r1=264786&r2=264787&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Mar 29 16:13:53 2016
@@ -2988,6 +2988,10 @@ SanitizerMask CloudABI::getSupportedSani
   return Res;
 }
 
+SanitizerMask CloudABI::getDefaultSanitizers() const {
+  return SanitizerKind::SafeStack;
+}
+
 /// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
 
 OpenBSD::OpenBSD(const Driver &D, const llvm::Triple &Triple,

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=264787&r1=264786&r2=264787&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue Mar 29 16:13:53 2016
@@ -620,6 +620,7 @@ public:
   bool isPIEDefault() const override { return false; }
 
   SanitizerMask getSupportedSanitizers() const override;
+  SanitizerMask getDefaultSanitizers() const override;
 
 protected:
   Tool *buildLinker() const override;

Modified: cfe/trunk/test/Driver/cloudabi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cloudabi.c?rev=264787&r1=264786&r2=264787&view=diff
==
--- cfe/trunk/test/Driver/cloudabi.c (original)
+++ cfe/trunk/test/Driver/cloudabi.c Tue Mar 29 16:13:53 2016
@@ -1,3 +1,8 @@
-// RUN: %clang %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s
-// CHECK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections"
-// CHECK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" 
"crtbegin.o" "{{.*}}" "{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+// RUN: %clang %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s 
-check-prefix=SAFESTACK
+// SAFESTACK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections" {{.*}} "-fsanitize=safe-stack"
+// SAFESTACK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" 
"crt0.o" "crtbegin.o" "{{.*}}" "{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+
+// RUN: %clang %s -### -target x86_64-unknown-cloudabi 
-fno-sanitize=safe-stack 2>&1 | FileCheck %s -check-prefix=NOSAFESTACK
+// NOSAFESTACK: "-cc1" "-triple" "x86

r265546 - Enable PIE for CloudABI.

2016-04-06 Thread Ed Schouten via cfe-commits
Author: ed
Date: Wed Apr  6 10:37:06 2016
New Revision: 265546

URL: http://llvm.org/viewvc/llvm-project?rev=265546&view=rev
Log:
Enable PIE for CloudABI.

As we're currently working on making CloudABI executables easier to
emulate in userspace (e.g., on OS X and Windows), it makes a whole lot
of sense to build these using PIE. By using PIE, they can simply be
loaded into the existing process address space without clashes.

PIE support got added to CloudABI's C library and seems to work pretty
well. CloudABI does not make use of an ld.so, so the binary's _start()
has all the logic in it to do the relocations.

Now that all but one bug in LLD relating to PIE support have been
squashed (and a patch for that is already in code review), I'd like to
go ahead and force the use of PIE for Clang 3.9. When released, we'll
also switch over to using LLD exclusively.

Modified:
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cloudabi.c
cfe/trunk/test/Driver/cloudabi.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=265546&r1=265545&r2=265546&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Wed Apr  6 10:37:06 2016
@@ -617,7 +617,7 @@ public:
   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
 
-  bool isPIEDefault() const override { return false; }
+  bool isPIEDefault() const override { return true; }
 
   SanitizerMask getSupportedSanitizers() const override;
   SanitizerMask getDefaultSanitizers() const override;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=265546&r1=265545&r2=265546&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Apr  6 10:37:06 2016
@@ -7110,6 +7110,12 @@ void cloudabi::Linker::ConstructJob(Comp
 
   // CloudABI only supports static linkage.
   CmdArgs.push_back("-Bstatic");
+
+  // CloudABI uses Position Independent Executables exclusively.
+  CmdArgs.push_back("-pie");
+  CmdArgs.push_back("--no-dynamic-linker");
+  CmdArgs.push_back("-zrelro");
+
   CmdArgs.push_back("--eh-frame-hdr");
   CmdArgs.push_back("--gc-sections");
 

Modified: cfe/trunk/test/Driver/cloudabi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cloudabi.c?rev=265546&r1=265545&r2=265546&view=diff
==
--- cfe/trunk/test/Driver/cloudabi.c (original)
+++ cfe/trunk/test/Driver/cloudabi.c Wed Apr  6 10:37:06 2016
@@ -1,8 +1,8 @@
 // RUN: %clang %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s 
-check-prefix=SAFESTACK
 // SAFESTACK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections" {{.*}} "-fsanitize=safe-stack"
-// SAFESTACK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" 
"crt0.o" "crtbegin.o" "{{.*}}" "{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+// SAFESTACK: "-Bstatic" "-pie" "--no-dynamic-linker" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" 
"{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
 
 // RUN: %clang %s -### -target x86_64-unknown-cloudabi 
-fno-sanitize=safe-stack 2>&1 | FileCheck %s -check-prefix=NOSAFESTACK
 // NOSAFESTACK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections"
 // NOSAFESTACK-NOT: "-fsanitize=safe-stack"
-// NOSAFESTACK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" 
"crt0.o" "crtbegin.o" "{{.*}}" "{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"
+// NOSAFESTACK: "-Bstatic" "-pie" "--no-dynamic-linker" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" 
"{{.*}}" "-lc" "-lcompiler_rt" "crtend.o"

Modified: cfe/trunk/test/Driver/cloudabi.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cloudabi.cpp?rev=265546&r1=265545&r2=265546&view=diff
==
--- cfe/trunk/test/Driver/cloudabi.cpp (original)
+++ cfe/trunk/test/Driver/cloudabi.cpp Wed Apr  6 10:37:06 2016
@@ -1,8 +1,8 @@
 // RUN: %clangxx %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s 
-check-prefix=SAFESTACK
 // SAFESTACK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} 
"-ffunction-sections" "-fdata-sections" {{.*}} "-fsanitize=safe-stack"
-// SAFESTACK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" 
"crt0.o" "crtbegin.o" "{{.*}}" "{{.*}}" "-lc++" "-lc++abi" "-lunwind" "-lc" 
"-lcompiler_rt" "crtend.o"
+// SAFESTACK: "-Bstatic" "-pie" "--no-dynamic-linker" "-zrelro" 
"--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o"

[libcxx] r272886 - Remove CloudABI specific workaround.

2016-06-16 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Jun 16 06:53:11 2016
New Revision: 272886

URL: http://llvm.org/viewvc/llvm-project?rev=272886&view=rev
Log:
Remove CloudABI specific workaround.

CloudABI has gained the mblen_l() function in the meantime that does
properly return whether the character set has shift-states (read:
never).

Modified:
libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/src/locale.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=272886&r1=272885&r2=272886&view=diff
==
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Thu Jun 16 06:53:11 2016
@@ -1660,10 +1660,8 @@ codecvt::do_un
 int
 codecvt::do_encoding() const  _NOEXCEPT
 {
-#ifndef __CloudABI__
 if (__libcpp_mbtowc_l(nullptr, nullptr, MB_LEN_MAX, __l) != 0)
 return -1;
-#endif
 
 // stateless encoding
 if (__l == 0 || __libcpp_mb_cur_max_l(__l) == 1)  // there are no known 
constant length encodings


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


Re: [PATCH] D16639: [libcxx] Limit catopen usage to unix-like OSes

2016-01-27 Thread Ed Schouten via cfe-commits
ed added a comment.

I'm usually not a big fan of using definitions such as `__unix__`, because it 
is pretty vague and defined inconsistently. That said, if you're going to use 
this definition, then there is some good news: CloudABI doesn't define it, 
meaning that you could just remove it from this list.


http://reviews.llvm.org/D16639



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