Re: [clang] c149ff3 - [Driver] Link Flang runtime on FreeBSD, NetBSD, OpenBSD, DragonFly and Haiku (#69817)

2023-10-27 Thread Joerg Sonnenberger via cfe-commits
On Friday, October 27, 2023 10:43:23 AM CEST via cfe-commits wrote:
> Author: Brad Smith
> Date: 2023-10-27T04:43:19-04:00
> New Revision: c149ff3d372a70e7d9de838a1ff0357394b8d017
> 
> URL:
> https://github.com/llvm/llvm-project/commit/c149ff3d372a70e7d9de838a1ff0357
> 394b8d017 DIFF:
> https://github.com/llvm/llvm-project/commit/c149ff3d372a70e7d9de838a1ff0357
> 394b8d017.diff
> 
> LOG: [Driver] Link Flang runtime on FreeBSD, NetBSD, OpenBSD, DragonFly and
> Haiku (#69817)
> 
> Added:
> 
> 
> Modified:
> clang/lib/Driver/ToolChains/DragonFly.cpp
> clang/lib/Driver/ToolChains/FreeBSD.cpp
> clang/lib/Driver/ToolChains/Haiku.cpp
> clang/lib/Driver/ToolChains/NetBSD.cpp
> clang/lib/Driver/ToolChains/OpenBSD.cpp
> flang/test/Driver/linker-flags.f90
> 
> Removed:
> 
> 
> 
> 
>  diff  --git a/clang/lib/Driver/ToolChains/DragonFly.cpp
> b/clang/lib/Driver/ToolChains/DragonFly.cpp index
> 9dc8d9d4363bd71..500dd98665075b1 100644
> --- a/clang/lib/Driver/ToolChains/DragonFly.cpp
> +++ b/clang/lib/Driver/ToolChains/DragonFly.cpp
> @@ -144,6 +144,16 @@ void dragonfly::Linker::ConstructJob(Compilation ,
> const JobAction , CmdArgs.push_back("-lm");
>  }
> 
> +// Additional linker set-up and flags for Fortran. This is required in
> order +// to generate executables. As Fortran runtime depends on the C
> runtime, +// these dependencies need to be listed before the C runtime
> below (i.e. +// AddRuntTimeLibs).
> +if (D.IsFlangMode()) {
> +  addFortranRuntimeLibraryPath(ToolChain, Args, CmdArgs);
> +  addFortranRuntimeLibs(ToolChain, CmdArgs);
> +  CmdArgs.push_back("-lm");
> +}
> +
>  if (Args.hasArg(options::OPT_pthread))
>CmdArgs.push_back("-lpthread");
> 
> 

Shouldn't that be "AddRunTimeLibs" without the extra t?

Joerg


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


[libunwind] [libunwind] Pass -Wl,--export-dynamic on all supported platforms (PR #67205)

2023-09-25 Thread Joerg Sonnenberger via cfe-commits

jsonn wrote:

Can you as a small follow-up just update the comment to include that part? E.g.
```
# On ELF platforms, link tests with -Wl,--export-dynamic if supported by the 
linker.
```

Side note: the much older way for doing this is actually `-rdynamic`.

https://github.com/llvm/llvm-project/pull/67205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind] Pass -Wl,--export-dynamic on all supported platforms (PR #67205)

2023-09-25 Thread Joerg Sonnenberger via cfe-commits

jsonn wrote:

Is this really desirable? It can actually break applications as it changes ELF 
semantics.

https://github.com/llvm/llvm-project/pull/67205
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: How can Autoconf help with the transition to stricter compilation defaults?

2022-11-17 Thread Joerg Sonnenberger via cfe-commits
Am Thu, Nov 17, 2022 at 10:58:52AM -0800 schrieb Paul Eggert via cfe-commits:
> On 2022-11-16 10:59, Zack Weinberg wrote:
> > I'm generally in agreement with Rich Felker's argument 
> > (inhttps://ewontfix.com/13/) that AC_CHECK_FUNC*should not*  just probe for 
> > linkability of a symbol
> 
> So am I. I'm not saying Autoconf should never change here, only that the
> change would not be trivial. It would require changing many configure.ac
> scripts scattered over many software projects, because Autoconf cannot be
> expected to know every signature of every function in every library.

For all practical purpose, it can't change as there is enough legacy
software out in the wild that will never be updated accordingly.

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


Re: [clang] e6629be - [AIX] Define __STDC_NO_ATOMICS__ and __STDC_NO_THREADS__ predefined macros

2021-06-08 Thread Joerg Sonnenberger via cfe-commits
On Mon, Jun 07, 2021 at 07:04:36PM -0700, via cfe-commits wrote:
> 
> Author: =Jake Egan
> Date: 2021-06-07T22:04:18-04:00
> New Revision: e6629be31e67190f0a524f009752d73410894560
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/e6629be31e67190f0a524f009752d73410894560
> DIFF: 
> https://github.com/llvm/llvm-project/commit/e6629be31e67190f0a524f009752d73410894560.diff
> 
> LOG: [AIX] Define __STDC_NO_ATOMICS__ and __STDC_NO_THREADS__ predefined 
> macros

I find the justification for this a bit strange. Neither one has to be
implemented in libc. compiler-rt implements the former with the mixing
caveats applied and there are portable implementations of the latter
based on pthread. I would expect them to work well enough on AIX, too.
So this seems to do more harm than good?

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


[clang] 2628e91 - [NetBSD] Use cortex-a8 as default CPU for ARMv7

2021-02-17 Thread Joerg Sonnenberger via cfe-commits

Author: Joerg Sonnenberger
Date: 2021-02-18T01:53:04+01:00
New Revision: 2628e9146120507b2cf025f5c4ccc857cc3724c4

URL: 
https://github.com/llvm/llvm-project/commit/2628e9146120507b2cf025f5c4ccc857cc3724c4
DIFF: 
https://github.com/llvm/llvm-project/commit/2628e9146120507b2cf025f5c4ccc857cc3724c4.diff

LOG: [NetBSD] Use cortex-a8 as default CPU for ARMv7

This matches the platform default for GCC. It primarily matters when the
integrated assembler is not used as there is no default CPU defined for
ARMv7-A and GNU as is upset with -mcpu=generic.

Added: 


Modified: 
clang/test/Driver/netbsd.c
llvm/lib/Support/Triple.cpp

Removed: 




diff  --git a/clang/test/Driver/netbsd.c b/clang/test/Driver/netbsd.c
index 83486c73d281..812889309a0f 100644
--- a/clang/test/Driver/netbsd.c
+++ b/clang/test/Driver/netbsd.c
@@ -236,6 +236,7 @@
 // ARMEB: "{{.*}}/usr/lib{{/|}}eabi{{/|}}crti.o"
 // ARMEB: "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // ARMEB: "{{.*}}/usr/lib{{/|}}crtend.o" "{{.*}}/usr/lib{{/|}}crtn.o"
+// ARMV7EB: as{{.*}}" "-mcpu=cortex-a8"
 // ARMV7EB: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
 // ARMV7EB: "--be8" "-m" "armelfb_nbsd_eabi"
 

diff  --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 40c4f3db8b53..2ec123fcca73 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -1699,6 +1699,8 @@ StringRef Triple::getARMCPUForArch(StringRef MArch) const 
{
   case llvm::Triple::NetBSD:
 if (!MArch.empty() && MArch == "v6")
   return "arm1176jzf-s";
+if (!MArch.empty() && MArch == "v7")
+  return "cortex-a8";
 break;
   case llvm::Triple::Win32:
 // FIXME: this is invalid for WindowsCE



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


[clang] 9d2d6e7 - Emit Objective-C constructors as writable

2020-04-14 Thread Joerg Sonnenberger via cfe-commits

Author: Joerg Sonnenberger
Date: 2020-04-14T22:32:34+02:00
New Revision: 9d2d6e71f096ad43b178c576adf94fc922034c73

URL: 
https://github.com/llvm/llvm-project/commit/9d2d6e71f096ad43b178c576adf94fc922034c73
DIFF: 
https://github.com/llvm/llvm-project/commit/9d2d6e71f096ad43b178c576adf94fc922034c73.diff

LOG: Emit Objective-C constructors as writable

They end up as .init_array sections and those need to be writable,
otherwise bad merging will happen.

Added: 


Modified: 
clang/lib/CodeGen/CGObjCGNU.cpp
clang/test/CodeGenObjC/gnu-init.m

Removed: 




diff  --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 35b926808492..3dbb3be5a5e0 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1564,7 +1564,7 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
 // We have to do this by hand, rather than with @llvm.ctors, so that the
 // linker can remove the duplicate invocations.
 auto *InitVar = new llvm::GlobalVariable(TheModule, 
LoadFunction->getType(),
-/*isConstant*/true, llvm::GlobalValue::LinkOnceAnyLinkage,
+/*isConstant*/false, llvm::GlobalValue::LinkOnceAnyLinkage,
 LoadFunction, ".objc_ctor");
 // Check that this hasn't been renamed.  This shouldn't happen, because
 // this function should be called precisely once.

diff  --git a/clang/test/CodeGenObjC/gnu-init.m 
b/clang/test/CodeGenObjC/gnu-init.m
index 076e08112d81..6be999b6d64a 100644
--- a/clang/test/CodeGenObjC/gnu-init.m
+++ b/clang/test/CodeGenObjC/gnu-init.m
@@ -39,8 +39,8 @@ @implementation X @end
 // CHECK-NEW: @.objc_init = linkonce_odr hidden global { i64, i8**, i8**, 
i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, i8**, 
i8** } { i64 0, i8** @__start___objc_selectors, i8** @__stop___objc_selectors, 
i8** @__start___objc_classes, i8** @__stop___objc_classes, i8** 
@__start___objc_class_refs, i8** @__stop___objc_class_refs, i8** 
@__start___objc_cats, i8** @__stop___objc_cats, i8** @__start___objc_protocols, 
i8** @__stop___objc_protocols, i8** @__start___objc_protocol_refs, i8** 
@__stop___objc_protocol_refs, i8** @__start___objc_class_aliases, i8** 
@__stop___objc_class_aliases, i8** @__start___objc_constant_string, i8** 
@__stop___objc_constant_string }, comdat, align 8
 
 // Check that the load function is manually inserted into .ctors.
-// CHECK-NEW: @.objc_ctor = linkonce hidden constant void ()* 
@.objcv2_load_function, section ".ctors", comdat
-// CHECK-INIT_ARRAY: @.objc_ctor = linkonce hidden constant void ()* 
@.objcv2_load_function, section ".init_array", comdat
+// CHECK-NEW: @.objc_ctor = linkonce hidden global void ()* 
@.objcv2_load_function, section ".ctors", comdat
+// CHECK-INIT_ARRAY: @.objc_ctor = linkonce hidden global void ()* 
@.objcv2_load_function, section ".init_array", comdat
 
 
 // Make sure that we provide null versions of everything so the __start /
@@ -91,7 +91,7 @@ @implementation X @end
 // CHECK-WIN-DAG: @.objc_init = linkonce_odr hidden global { i64, 
%.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, 
%.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, 
%.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, 
%.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, 
%.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, 
%.objc_section_sentinel* } { i64 0, %.objc_section_sentinel* 
@"__start_.objcrt$SEL", %.objc_section_sentinel* @"__stop.objcrt$SEL", 
%.objc_section_sentinel* @"__start_.objcrt$CLS", %.objc_section_sentinel* 
@"__stop.objcrt$CLS", %.objc_section_sentinel* @"__start_.objcrt$CLR", 
%.objc_section_sentinel* @"__stop.objcrt$CLR", %.objc_section_sentinel* 
@"__start_.objcrt$CAT", %.objc_section_sentinel* @"__stop.objcrt$CAT", 
%.objc_section_sentinel* @"__start_.objcrt$PCL", %.objc_section_sentinel* 
@"__stop.objcrt$PCL", %.objc_section_sentinel* @"__start_.objcrt$PCR", 
%.objc_section_sentinel* @"__stop.objcrt$PCR", %.objc_section_sentinel* 
@"__start_.objcrt$CAL", %.objc_section_sentinel* @"__stop.objcrt$CAL", 
%.objc_section_sentinel* @"__start_.objcrt$STR", %.objc_section_sentinel* 
@"__stop.objcrt$STR" }, comdat, align 8
 
 // Make sure our init variable is in the correct section for late library init.
-// CHECK-WIN: @.objc_ctor = linkonce hidden constant void ()* 
@.objcv2_load_function, section ".CRT$XCLz", comdat
+// CHECK-WIN: @.objc_ctor = linkonce hidden global void ()* 
@.objcv2_load_function, section ".CRT$XCLz", comdat
 
 // We shouldn't have emitted any null placeholders on Windows.
 // CHECK-WIN: @llvm.used = appending global [2 x i8*] [i8* bitcast ({ { i8*, 
i8*, i8*, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i32, i8* 
}*, i8*, i8*, i32, i32, i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i32, 
i8* }** 

Re: [clang] 246398e - [clang][Parse] properly parse asm-qualifiers, asm inline

2020-04-12 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 12, 2020 at 03:25:49PM -0700, Nick Desaulniers via cfe-commits 
wrote:
> 
> Author: Nick Desaulniers
> Date: 2020-03-12T15:13:59-07:00
> New Revision: 246398ece7115b57a02dbe7876d86ae8e72406ef
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/246398ece7115b57a02dbe7876d86ae8e72406ef
> DIFF: 
> https://github.com/llvm/llvm-project/commit/246398ece7115b57a02dbe7876d86ae8e72406ef.diff
> 
> LOG: [clang][Parse] properly parse asm-qualifiers, asm inline
> 
> Summary:
> The parsing of GNU C extended asm statements was a little brittle and
> had a few issues:

I find it very questionable that this change drops a warning flag making
IMO benign code differences like marking a global asm as volatile an
unconditional error. This strongly seems to be something that we
shouldn't blindly follow GCC on.

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


Re: [clang] b670ab7 - recommit 1b978ddba05c [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese

2020-04-05 Thread Joerg Sonnenberger via cfe-commits
On Mon, Mar 23, 2020 at 09:09:31AM -0700, Yaxun Liu via cfe-commits wrote:
> 
> Author: Yaxun (Sam) Liu
> Date: 2020-03-23T12:09:07-04:00
> New Revision: b670ab7b6b3d2f26179213be1da1d4ba376f50a3
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/b670ab7b6b3d2f26179213be1da1d4ba376f50a3
> DIFF: 
> https://github.com/llvm/llvm-project/commit/b670ab7b6b3d2f26179213be1da1d4ba376f50a3.diff
> 
> LOG: recommit 1b978ddba05c [CUDA][HIP][OpenMP] Emit deferred diagnostics by a 
> post-parsing AST travese

This change is responsible for a significant performance regression.
Somewhat reduced example is attached. With -fopenmp, it needs ~5s,
without 0.02s.

Joerg
   ;
;
namespace std {
   inline namespace __1 {
  template struct char_traits;
  template  class basic_ostream;
  typedef basic_ostream ostream;
  template basic_ostream<_Traits>& 
operator<<(basic_ostream<_Traits>& __os, const char* __str) ;
  extern ostream cerr;
  }
   ;
   }
template class flet {
   public: flet(T , const T )  ;
   };
;
   template class _scoped_numeral {
   typedef typename Manager::numeral numeral;
   public: _scoped_numeral(Manager ) ;
 operator numeral&() ;


   };
template class 
buffer {
   public: ;
 unsigned size() const ;
 ;
  ;
 T & operator[](unsigned idxT ) ;
 };
template class buffer ;
template class sbuffer : public 
buffer {
   };
class mpz {
public: mpz(int v) ;
   };
  template class mpz_manager {
   public:  ;
 typedef mpz numeral;




  void mul2k(mpz , 
unsigned k, mpz r) ;
  };
typedef mpz_manager unsynch_mpz_manager;
typedef _scoped_numeral scoped_mpz;
class mpq {
};
  template class mpq_manager : public mpz_manager {
public: typedef mpq numeral;
  bool is_zero;
 void mul( mpq b, mpq ) ;



   void set(mpq 
, mpq source) ;



   };
typedef mpq_manager unsynch_mpq_manager;
typedef _scoped_numeral scoped_mpq;
;
template class interval_manager {
   public: ;
   typedef typename C::interval interval;

   bool is_P(interval n) const ;
  void set(interval , interval s);
  void neg(interval 
a, interval );
 void add(interval a, interval b, interval );
   void 
mul(interval a, interval b, interval );

 };
template class _scoped_interval {
   typedef typename Manager::interval interval;
   public: _scoped_interval(Manager ) ;
 operator interval&() ;
   };
namespace realclosure {
   class num;
   ;
   class manager {
  struct imp;
  typedef num numeral;






};
   struct value;
   class num {
  friend class 

[clang] 09d4021 - Fix compatibility for __builtin_stdarg_start

2020-03-28 Thread Joerg Sonnenberger via cfe-commits

Author: Joerg Sonnenberger
Date: 2020-03-28T23:24:13+01:00
New Revision: 09d402185394fdbf1f60233a7f42a4a1108c2cd3

URL: 
https://github.com/llvm/llvm-project/commit/09d402185394fdbf1f60233a7f42a4a1108c2cd3
DIFF: 
https://github.com/llvm/llvm-project/commit/09d402185394fdbf1f60233a7f42a4a1108c2cd3.diff

LOG: Fix compatibility for __builtin_stdarg_start

The __builtin_stdarg_start is the legacy spelling of __builtin_va_start.
It should behave exactly the same, but for the last 9 years it would
behave subtly different for diagnostics. Follow the change from
29ad95b23217 to require custom type checking.

Added: 


Modified: 
clang/include/clang/Basic/Builtins.def
clang/test/SemaCXX/vararg-non-pod.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 85f775a7cad8..9613f312d52d 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -472,7 +472,7 @@ BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", 
"nc")
 BUILTIN(__builtin_va_start, "vA.", "nt")
 BUILTIN(__builtin_va_end, "vA", "n")
 BUILTIN(__builtin_va_copy, "vAA", "n")
-BUILTIN(__builtin_stdarg_start, "vA.", "n")
+BUILTIN(__builtin_stdarg_start, "vA.", "nt")
 BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc")
 BUILTIN(__builtin_bcmp, "ivC*vC*z", "Fn")
 BUILTIN(__builtin_bcopy, "vv*v*z", "n")

diff  --git a/clang/test/SemaCXX/vararg-non-pod.cpp 
b/clang/test/SemaCXX/vararg-non-pod.cpp
index 1b7f3b68dc97..a1bbe748d12d 100644
--- a/clang/test/SemaCXX/vararg-non-pod.cpp
+++ b/clang/test/SemaCXX/vararg-non-pod.cpp
@@ -164,6 +164,13 @@ void t6(Foo somearg, ... ) {
   __builtin_va_start(list, somearg);
 }
 
+// __builtin_stdarg_start is a compatibility alias for __builtin_va_start,
+// it should behave the same
+void t6b(Foo somearg, ... ) {
+  __builtin_va_list list;
+  __builtin_stdarg_start(list, somearg); // second argument to 'va_start' is 
not the last named parameter [-Wvarargs]
+}
+
 void t7(int n, ...) {
   __builtin_va_list list;
   __builtin_va_start(list, n);



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


[clang] eb812ef - Explicitly include when using assert

2020-03-02 Thread Joerg Sonnenberger via cfe-commits

Author: Joerg Sonnenberger
Date: 2020-03-02T22:45:28+01:00
New Revision: eb812efa12fb82ca338794fa18b610ca9581aef5

URL: 
https://github.com/llvm/llvm-project/commit/eb812efa12fb82ca338794fa18b610ca9581aef5
DIFF: 
https://github.com/llvm/llvm-project/commit/eb812efa12fb82ca338794fa18b610ca9581aef5.diff

LOG: Explicitly include  when using assert

Depending on the OS used, a module-enabled build can fail due to the
special handling  gets as textual header.

Added: 


Modified: 
clang/lib/AST/CommentCommandTraits.cpp
llvm/lib/Support/APSInt.cpp
llvm/lib/Support/FormatVariadic.cpp
llvm/lib/Support/IntEqClasses.cpp
llvm/lib/Support/IntervalMap.cpp
llvm/lib/Support/KnownBits.cpp
llvm/lib/Support/PrettyStackTrace.cpp
llvm/lib/Support/Regex.cpp
llvm/lib/Support/StringPool.cpp
llvm/lib/Support/Triple.cpp
llvm/lib/Support/VersionTuple.cpp
llvm/lib/TableGen/TableGenBackend.cpp
llvm/lib/Target/AArch64/AArch64StackOffset.h
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp
llvm/utils/TableGen/CodeGenHwModes.h
llvm/utils/TableGen/CodeGenInstruction.h

Removed: 




diff  --git a/clang/lib/AST/CommentCommandTraits.cpp 
b/clang/lib/AST/CommentCommandTraits.cpp
index b306fcbb154f..bdc0dd47fb7d 100644
--- a/clang/lib/AST/CommentCommandTraits.cpp
+++ b/clang/lib/AST/CommentCommandTraits.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/AST/CommentCommandTraits.h"
 #include "llvm/ADT/STLExtras.h"
+#include 
 
 namespace clang {
 namespace comments {

diff  --git a/llvm/lib/Support/APSInt.cpp b/llvm/lib/Support/APSInt.cpp
index 7c48880f96ea..6805e06df333 100644
--- a/llvm/lib/Support/APSInt.cpp
+++ b/llvm/lib/Support/APSInt.cpp
@@ -14,6 +14,7 @@
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/StringRef.h"
+#include 
 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/FormatVariadic.cpp 
b/llvm/lib/Support/FormatVariadic.cpp
index f9e89f69b528..0d61fae22323 100644
--- a/llvm/lib/Support/FormatVariadic.cpp
+++ b/llvm/lib/Support/FormatVariadic.cpp
@@ -6,6 +6,7 @@
 
//===--===//
 
 #include "llvm/Support/FormatVariadic.h"
+#include 
 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/IntEqClasses.cpp 
b/llvm/lib/Support/IntEqClasses.cpp
index 4a976dcefc65..ebb02e6c01e5 100644
--- a/llvm/lib/Support/IntEqClasses.cpp
+++ b/llvm/lib/Support/IntEqClasses.cpp
@@ -18,6 +18,7 @@
 
//===--===//
 
 #include "llvm/ADT/IntEqClasses.h"
+#include 
 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/IntervalMap.cpp 
b/llvm/lib/Support/IntervalMap.cpp
index f15c7c9403c3..674e0f962fa1 100644
--- a/llvm/lib/Support/IntervalMap.cpp
+++ b/llvm/lib/Support/IntervalMap.cpp
@@ -11,6 +11,7 @@
 
//===--===//
 
 #include "llvm/ADT/IntervalMap.h"
+#include 
 
 namespace llvm {
 namespace IntervalMapImpl {

diff  --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index 8f3f4aa8caea..2f1cff7914bc 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -12,6 +12,7 @@
 
//===--===//
 
 #include "llvm/Support/KnownBits.h"
+#include 
 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/PrettyStackTrace.cpp 
b/llvm/lib/Support/PrettyStackTrace.cpp
index bfb238cc8539..30a12f65966a 100644
--- a/llvm/lib/Support/PrettyStackTrace.cpp
+++ b/llvm/lib/Support/PrettyStackTrace.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 

diff  --git a/llvm/lib/Support/Regex.cpp b/llvm/lib/Support/Regex.cpp
index 615e48a5df7e..f065adadc62b 100644
--- a/llvm/lib/Support/Regex.cpp
+++ b/llvm/lib/Support/Regex.cpp
@@ -14,6 +14,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include 
 #include 
 
 // Important this comes last because it defines "_REGEX_H_". At least on

diff  --git a/llvm/lib/Support/StringPool.cpp b/llvm/lib/Support/StringPool.cpp
index 82351017b8cc..27465389 100644
--- a/llvm/lib/Support/StringPool.cpp
+++ b/llvm/lib/Support/StringPool.cpp
@@ -12,6 +12,7 @@
 
 #include "llvm/Support/StringPool.h"
 #include "llvm/ADT/StringRef.h"
+#include 
 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index e09abd24eb5b..79f31efefb78 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/SwapByteOrder.h"
 #include "llvm/Support/TargetParser.h"
+#include 
 #include 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/VersionTuple.cpp 
b/llvm/lib/Support/VersionTuple.cpp
index 

r375468 - Fix -fuse-init-array decision logic on NetBSD

2019-10-21 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Mon Oct 21 16:35:33 2019
New Revision: 375468

URL: http://llvm.org/viewvc/llvm-project?rev=375468=rev
Log:
Fix -fuse-init-array decision logic on NetBSD

For NetBSD 9 and later, it is the default. On older versions, only ARM
and AArch64 use it by default.

Modified:
cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
cfe/trunk/test/Driver/netbsd.c

Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=375468=375467=375468=diff
==
--- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Mon Oct 21 16:35:33 2019
@@ -489,10 +489,23 @@ SanitizerMask NetBSD::getSupportedSaniti
   return Res;
 }
 
-void NetBSD::addClangTargetOptions(const ArgList &,
+void NetBSD::addClangTargetOptions(const ArgList ,
ArgStringList ,
Action::OffloadKind) const {
   const SanitizerArgs  = getSanitizerArgs();
   if (SanArgs.hasAnySanitizer())
 CC1Args.push_back("-D_REENTRANT");
+
+  unsigned Major, Minor, Micro;
+  getTriple().getOSVersion(Major, Minor, Micro);
+  bool UseInitArrayDefault =
+Major >= 9 || Major == 0 ||
+getTriple().getArch() == llvm::Triple::aarch64 ||
+getTriple().getArch() == llvm::Triple::aarch64_be ||
+getTriple().getArch() == llvm::Triple::arm ||
+getTriple().getArch() == llvm::Triple::armeb;
+
+  if (DriverArgs.hasFlag(options::OPT_fuse_init_array,
+ options::OPT_fno_use_init_array, UseInitArrayDefault))
+CC1Args.push_back("-fuse-init-array");
 }

Modified: cfe/trunk/test/Driver/netbsd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/netbsd.c?rev=375468=375467=375468=diff
==
--- cfe/trunk/test/Driver/netbsd.c (original)
+++ cfe/trunk/test/Driver/netbsd.c Mon Oct 21 16:35:33 2019
@@ -169,12 +169,14 @@
 // PIE: "{{.*}}/usr/lib{{/|}}crtn.o"
 
 // X86_64: clang{{.*}}" "-cc1" "-triple" "x86_64-unknown-netbsd"
+// X86_64: "-fuse-init-array"
 // X86_64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
 // X86_64: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
 // X86_64: "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // X86_64: "{{.*}}/usr/lib{{/|}}crtend.o" "{{.*}}/usr/lib{{/|}}crtn.o"
 
 // X86_64-7: clang{{.*}}" "-cc1" "-triple" "x86_64-unknown-netbsd7.0.0"
+// X86_64-7-NOT: "-fuse-init-array"
 // X86_64-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
 // X86_64-7: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
 // X86_64-7:  "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
@@ -187,30 +189,35 @@
 // X86_64-6: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
 
 // AARCH64: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd"
+// AARCH64: "-fuse-init-array"
 // AARCH64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
 // AARCH64: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
 // AARCH64: "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // AARCH64: "{{.*}}/usr/lib{{/|}}crtend.o" "{{.*}}/usr/lib{{/|}}crtn.o"
 
 // AARCH64-7: clang{{.*}}" "-cc1" "-triple" "aarch64-unknown-netbsd7.0.0"
+// AARCH64-7: "-fuse-init-array"
 // AARCH64-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
 // AARCH64-7: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
 // AARCH64-7:  "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // AARCH64-7: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
 
 // AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be-unknown-netbsd"
+// AARCH64_BE: "-fuse-init-array"
 // AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" 
"/libexec/ld.elf_so"
 // AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
 // AARCH64_BE: "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // AARCH64_BE: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
 
 // AARCH64_BE-7: clang{{.*}}" "-cc1" "-triple" "aarch64_be-unknown-netbsd7.0.0"
+// AARCH64_BE-7: "-fuse-init-array"
 // AARCH64_BE-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" 
"/libexec/ld.elf_so"
 // AARCH64_BE-7: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
 // AARCH64_BE-7:  "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // AARCH64_BE-7: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
 
 // ARM: clang{{.*}}" "-cc1" "-triple" "armv5e-unknown-netbsd-eabi"
+// ARM: "-fuse-init-array"
 // ARM: as{{.*}}" "-mcpu=arm926ej-s" "-o"
 // ARM: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
 // ARM: "-m" 

r374742 - Improve __builtin_constant_p lowering

2019-10-13 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Sun Oct 13 15:33:46 2019
New Revision: 374742

URL: http://llvm.org/viewvc/llvm-project?rev=374742=rev
Log:
Improve __builtin_constant_p lowering

__builtin_constant_p used to be short-cut evaluated to false when
building with -O0. This is undesirable as it means that constant folding
in the front-end can give different results than folding in the back-end.
It can also create conditional branches on constant conditions that don't
get folded away. With the pending improvements to the llvm.is.constant
handling on the LLVM side, the short-cut is no longer useful.

Adjust various codegen tests to not depend on the short-cut or the
backend optimisations.

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

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtin-constant-p.c
cfe/trunk/test/CodeGen/ppc-emmintrin.c
cfe/trunk/test/CodeGen/ppc-tmmintrin.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=374742=374741=374742=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sun Oct 13 15:33:46 2019
@@ -2101,10 +2101,6 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 
   case Builtin::BI__builtin_constant_p: {
 llvm::Type *ResultType = ConvertType(E->getType());
-if (CGM.getCodeGenOpts().OptimizationLevel == 0)
-  // At -O0, we don't perform inlining, so we don't need to delay the
-  // processing.
-  return RValue::get(ConstantInt::get(ResultType, 0));
 
 const Expr *Arg = E->getArg(0);
 QualType ArgType = Arg->getType();

Modified: cfe/trunk/test/CodeGen/builtin-constant-p.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-constant-p.c?rev=374742=374741=374742=diff
==
--- cfe/trunk/test/CodeGen/builtin-constant-p.c (original)
+++ cfe/trunk/test/CodeGen/builtin-constant-p.c Sun Oct 13 15:33:46 2019
@@ -1,12 +1,8 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -O2 | 
FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -O0 | 
FileCheck --check-prefix=O0 %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm 
-disable-llvm-optzns -o - %s -O2 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm 
-disable-llvm-optzns -o - %s -O0 | FileCheck %s
 
 int a = 42;
 
-inline int bcp(int x) {
-  return __builtin_constant_p(x);
-}
-
 /* --- Compound literals */
 
 struct foo { int x, y; };
@@ -15,85 +11,56 @@ int y;
 struct foo f = (struct foo){ __builtin_constant_p(y), 42 };
 
 struct foo test0(int expr) {
-  // CHECK: define i64 @test0(i32 %expr)
-  // CHECK: call i1 @llvm.is.constant.i32(i32 %expr)
+  // CHECK-LABEL: test0
+  // CHECK: call i1 @llvm.is.constant.i32
   struct foo f = (struct foo){ __builtin_constant_p(expr), 42 };
   return f;
 }
 
 /* --- Pointer types */
 
-inline int test1_i(int *x) {
-  return *x;
-}
-
 int test1() {
-  // CHECK: define i32 @test1
-  // CHECK: add nsw i32 %0, -13
-  // CHECK-NEXT: call i1 @llvm.is.constant.i32(i32 %sub)
-  return bcp(test1_i() - 13);
-}
-
-int test2() {
-  // CHECK: define i32 @test2
+  // CHECK-LABEL: test1
   // CHECK: ret i32 0
   return __builtin_constant_p( - 13);
 }
 
-inline int test3_i(int *x) {
-  return 42;
-}
-
-int test3() {
-  // CHECK: define i32 @test3
-  // CHECK: ret i32 1
-  return bcp(test3_i() - 13);
-}
-
 /* --- Aggregate types */
 
 int b[] = {1, 2, 3};
 
-int test4() {
-  // CHECK: define i32 @test4
+int test2() {
+  // CHECK-LABEL: test2
   // CHECK: ret i32 0
   return __builtin_constant_p(b);
 }
 
-const char test5_c[] = {1, 2, 3, 0};
+const char test3_c[] = {1, 2, 3, 0};
 
-int test5() {
-  // CHECK: define i32 @test5
+int test3() {
+  // CHECK-LABEL: test3
   // CHECK: ret i32 0
-  return __builtin_constant_p(test5_c);
+  return __builtin_constant_p(test3_c);
 }
 
-inline char test6_i(const char *x) {
+inline char test4_i(const char *x) {
   return x[1];
 }
 
-int test6() {
-  // CHECK: define i32 @test6
+int test4() {
+  // CHECK: define i32 @test4
   // CHECK: ret i32 0
-  return __builtin_constant_p(test6_i(test5_c));
-}
-
-/* --- Non-constant global variables */
-
-int test7() {
-  // CHECK: define i32 @test7
-  // CHECK: call i1 @llvm.is.constant.i32(i32 %0)
-  return bcp(a);
+  return __builtin_constant_p(test4_i(test3_c));
 }
 
 /* --- Constant global variables */
 
 const int c = 42;
 
-int test8() {
-  // CHECK: define i32 @test8
+int test5() {
+  // CHECK-LABEL: test5
   // CHECK: ret i32 1
-  return bcp(c);
+  return __builtin_constant_p(c);
 }
 
 /* --- Array types */
@@ -101,34 +68,34 @@ int test8() {
 int arr[] = { 1, 2, 3 };
 const int c_arr[] = { 1, 2, 3 };
 
-int test9() {
-  // CHECK: define i32 @test9
-  // CHECK: call i1 @llvm.is.constant.i32(i32 %0)
+int 

Re: r371437 - [Driver] Add -static-openmp driver option

2019-09-09 Thread Joerg Sonnenberger via cfe-commits
On Mon, Sep 09, 2019 at 06:31:41PM -, Pirama Arumuga Nainar via cfe-commits 
wrote:
> Author: pirama
> Date: Mon Sep  9 11:31:41 2019
> New Revision: 371437
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=371437=rev
> Log:
> [Driver] Add -static-openmp driver option

This still needs testing for the interaction with -static.

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


Re: [PATCH] D67200: Add -static-openmp driver option

2019-09-06 Thread Joerg Sonnenberger via cfe-commits
On Wed, Sep 04, 2019 at 11:28:34PM +, Pirama Arumuga Nainar via Phabricator 
via cfe-commits wrote:
> pirama created this revision.
> pirama added reviewers: Hahnfeld, danalbert, srhines, joerg.
> Herald added a subscriber: guansong.
> Herald added a reviewer: jdoerfert.
> Herald added a project: clang.
> 
> This option forces linking with the static OpenMP host runtime (similar
> to -static-libgcc and -static-libstdcxx).
> 
> Android's NDK will start the shared OpenMP runtime in addition to the static
> libomp.  In this scenario, the linker will prefer to use the shared library by
> default.  Add this option to enable linking with the static libomp.

Needs testing for the -static interaction?

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


Re: [PATCH] D66361: Improve behavior in the case of stack exhaustion.

2019-09-03 Thread Joerg Sonnenberger via cfe-commits
On Tue, Sep 03, 2019 at 06:02:28PM +, Richard Smith - zygoloid via 
Phabricator via cfe-commits wrote:
> rsmith added a comment.
> 
> In D66361#1655903 , @krytarowski 
> wrote:
> 
> > This change broke on NetBSD.
> >
> > http://lab.llvm.org:8011/builders/netbsd-amd64/builds/22003/steps/run%20unit%20tests/logs/FAIL%3A%20Clang%3A%3Astack-exhaustion.cpp
> 
> 
> Test disabled for NetBSD in r370801. If you're interested in investigating 
> why this isn't working there, feel free, but this is only a best-effort 
> mitigation for the case where things have already gone wrong, so there are 
> limits to how much effort it makes sense to resolve this.
> 
> Does NetBSD set a hard stack rlimit of less than 8MB by any chance?

4MB soft limit by default, hard limit depends on the architecture, e.g.
128MB on amd64.

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


Re: [PATCH] D60728: [clang] [test] Add a (xfailing) test for PR41027

2019-04-17 Thread Joerg Sonnenberger via cfe-commits
On Wed, Apr 17, 2019 at 05:34:04PM +, Kamil Rytarowski via Phabricator 
wrote:
> Right now this blocks upgrades on NetBSD as a number of CPUs is affected (but 
> not x86, so it was overlooked before 8.0 by others than @joerg).

Note that this is not about anything really specific to NetBSD, the kind
of conditional asm statements are pretty popular.

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


r355058 - Ensure that set constrained asm operands are not affected by truncation.

2019-02-27 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Wed Feb 27 16:55:09 2019
New Revision: 355058

URL: http://llvm.org/viewvc/llvm-project?rev=355058=rev
Log:
Ensure that set constrained asm operands are not affected by truncation.

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/test/Sema/inline-asm-validate-x86.c

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=355058=355057=355058=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Wed Feb 27 16:55:09 2019
@@ -857,8 +857,10 @@ public:
 }
 bool isValidAsmImmediate(const llvm::APInt ) const {
   if (!ImmSet.empty())
-return ImmSet.count(Value.getZExtValue()) != 0;
-  return !ImmRange.isConstrained || (Value.sge(ImmRange.Min) && 
Value.sle(ImmRange.Max));
+return Value.isSignedIntN(32) &&
+   ImmSet.count(Value.getZExtValue()) != 0;
+  return !ImmRange.isConstrained ||
+ (Value.sge(ImmRange.Min) && Value.sle(ImmRange.Max));
 }
 
 void setIsReadWrite() { Flags |= CI_ReadWrite; }

Modified: cfe/trunk/test/Sema/inline-asm-validate-x86.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/inline-asm-validate-x86.c?rev=355058=355057=355058=diff
==
--- cfe/trunk/test/Sema/inline-asm-validate-x86.c (original)
+++ cfe/trunk/test/Sema/inline-asm-validate-x86.c Wed Feb 27 16:55:09 2019
@@ -56,6 +56,7 @@ void L(int i, int j) {
   static const int Invalid1 = 1;
   static const int Invalid2 = 42;
   static const int Invalid3 = 0;
+  static const long long Invalid4 = 0x100ff;
   static const int Valid1 = 0xff;
   static const int Valid2 = 0x;
   static const int Valid3 = 0x;
@@ -73,6 +74,9 @@ void L(int i, int j) {
   : "0"(i), "L"(Invalid3)); // expected-error{{value '0' out of range 
for constraint 'L'}}
   __asm__("xorl %0,%2"
   : "=r"(i)
+  : "0"(i), "L"(Invalid4)); // expected-error{{value '4294967551' out 
of range for constraint 'L'}}
+  __asm__("xorl %0,%2"
+  : "=r"(i)
   : "0"(i), "L"(Valid1)); // expected-no-error
   __asm__("xorl %0,%2"
   : "=r"(i)


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


r355033 - Use Secure PLT as default on NetBSD/PowerPC.

2019-02-27 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Wed Feb 27 13:46:01 2019
New Revision: 355033

URL: http://llvm.org/viewvc/llvm-project?rev=355033=rev
Log:
Use Secure PLT as default on NetBSD/PowerPC.

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
cfe/trunk/test/Driver/netbsd.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp?rev=355033=355032=355033=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp Wed Feb 27 13:46:01 2019
@@ -115,7 +115,7 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPt
   const ArgList ) {
   if (Args.getLastArg(options::OPT_msecure_plt))
 return ppc::ReadGOTPtrMode::SecurePlt;
-  if (Triple.isOSOpenBSD())
+  if (Triple.isOSNetBSD() || Triple.isOSOpenBSD())
 return ppc::ReadGOTPtrMode::SecurePlt;
   else
 return ppc::ReadGOTPtrMode::Bss;

Modified: cfe/trunk/test/Driver/netbsd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/netbsd.c?rev=355033=355032=355033=diff
==
--- cfe/trunk/test/Driver/netbsd.c (original)
+++ cfe/trunk/test/Driver/netbsd.c Wed Feb 27 13:46:01 2019
@@ -446,3 +446,8 @@
 // PTHREAD-NOT: _POSIX_THREADS
 // PTHREAD: _REENTRANT
 // PTHREAD-NOT: _POSIX_THREADS
+
+// Check PowerPC for Secure PLT
+// RUN: %clang -target powerpc-unknown-netbsd -### -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=POWERPC-SECUREPLT %s
+// POWERPC-SECUREPLT: "-target-feature" "+secure-plt"


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


r354937 - Fix inline assembler constraint validation

2019-02-26 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Feb 26 16:40:59 2019
New Revision: 354937

URL: http://llvm.org/viewvc/llvm-project?rev=354937=rev
Log:
Fix inline assembler constraint validation

The current constraint logic is both too lax and too strict. It fails
for input outside the [INT_MIN..INT_MAX] range, but it also implicitly
accepts 0 as value when it should not. Adjust logic to handle both
correctly.

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

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/test/Sema/inline-asm-validate-x86.c

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=354937=354936=354937=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Feb 26 16:40:59 2019
@@ -816,6 +816,7 @@ public:
 struct {
   int Min;
   int Max;
+  bool isConstrained;
 } ImmRange;
 llvm::SmallSet ImmSet;
 
@@ -826,6 +827,7 @@ public:
 : Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
   Name(Name.str()) {
   ImmRange.Min = ImmRange.Max = 0;
+  ImmRange.isConstrained = false;
 }
 
 const std::string () const { return ConstraintStr; }
@@ -854,8 +856,9 @@ public:
   return (Flags & CI_ImmediateConstant) != 0;
 }
 bool isValidAsmImmediate(const llvm::APInt ) const {
-  return (Value.sge(ImmRange.Min) && Value.sle(ImmRange.Max)) ||
- ImmSet.count(Value.getZExtValue()) != 0;
+  if (!ImmSet.empty())
+return ImmSet.count(Value.getZExtValue()) != 0;
+  return !ImmRange.isConstrained || (Value.sge(ImmRange.Min) && 
Value.sle(ImmRange.Max));
 }
 
 void setIsReadWrite() { Flags |= CI_ReadWrite; }
@@ -867,6 +870,7 @@ public:
   Flags |= CI_ImmediateConstant;
   ImmRange.Min = Min;
   ImmRange.Max = Max;
+  ImmRange.isConstrained = true;
 }
 void setRequiresImmediate(llvm::ArrayRef Exacts) {
   Flags |= CI_ImmediateConstant;
@@ -879,8 +883,6 @@ public:
 }
 void setRequiresImmediate() {
   Flags |= CI_ImmediateConstant;
-  ImmRange.Min = INT_MIN;
-  ImmRange.Max = INT_MAX;
 }
 
 /// Indicate that this is an input operand that is tied to

Modified: cfe/trunk/test/Sema/inline-asm-validate-x86.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/inline-asm-validate-x86.c?rev=354937=354936=354937=diff
==
--- cfe/trunk/test/Sema/inline-asm-validate-x86.c (original)
+++ cfe/trunk/test/Sema/inline-asm-validate-x86.c Tue Feb 26 16:40:59 2019
@@ -55,6 +55,7 @@ void K(int i, int j) {
 void L(int i, int j) {
   static const int Invalid1 = 1;
   static const int Invalid2 = 42;
+  static const int Invalid3 = 0;
   static const int Valid1 = 0xff;
   static const int Valid2 = 0x;
   static const int Valid3 = 0x;
@@ -69,6 +70,9 @@ void L(int i, int j) {
   : "0"(i), "L"(Invalid2)); // expected-error{{value '42' out of range 
for constraint 'L'}}
   __asm__("xorl %0,%2"
   : "=r"(i)
+  : "0"(i), "L"(Invalid3)); // expected-error{{value '0' out of range 
for constraint 'L'}}
+  __asm__("xorl %0,%2"
+  : "=r"(i)
   : "0"(i), "L"(Valid1)); // expected-no-error
   __asm__("xorl %0,%2"
   : "=r"(i)


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


Re: r350776 - [Sema] Mark target of __attribute__((alias("target"))) used for C

2019-01-11 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 10, 2019 at 09:58:39AM -0800, Nick Desaulniers via cfe-commits 
wrote:
> On Thu, Jan 10, 2019 at 7:26 AM Nico Weber  wrote:
> >
> > Aren't C names sometimes slightly mangled too? For example, on macOS 
> > they're prefixed by a _, doesn't that have to be undone there?
> 
> Sure, but short of instantiating a demangler in Sema or rewriting how
> Clang checks for unused variables, this quickly cuts down on tens of
> false negatives when building the Linux kernel with various driver
> configurations enabled.  The code review points out this is
> suboptimal.

Can't you build a map of mangled names to function instances instead?
That should be pretty cheap to do any avoids the whole unmangling dance.
It would also fix cases like functions explicitly being renamed.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-08 Thread Joerg Sonnenberger via cfe-commits
On Wed, Jan 09, 2019 at 12:20:06AM +, Kamil Rytarowski via Phabricator via 
llvm-commits wrote:
> krytarowski added inline comments.
> 
> 
> 
> Comment at: ELF/Driver.cpp:781
> +  }
> +}
> +
> 
> There is need to add a fallback for a native triple.

Not really. That's what the default target is.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-08 Thread Joerg Sonnenberger via cfe-commits
On Tue, Jan 08, 2019 at 10:58:37PM +, Alexander Richardson via Phabricator 
via cfe-commits wrote:
> arichardson added inline comments.
> 
> 
> 
> Comment at: ELF/Driver.cpp:770
> +  // Start with a default initial triple
> +  Config->TargetTriple = llvm::Triple(getDefaultTargetTriple());
> +
> 
> If I invoke an unprefixed ld.lld on NetBSD but want to target a
> different operating system, this will cause all the NetBSD defaults to
> apply to that binary and will possibly cause it to crash at runtime.

...which no different from clang.

> I think any config changes based on a triple would need to use an
> explicit --target= flag instead. As @ruiu says, LLD's behaviour should
> not change depending on the host OS/default LLVM triple. Given the same
> input files and command line options the resulting binary should be
> identical on any host.

That boils down to either "lld is unusable out of the box" or "your
system must look similar enough to a GNU/Linux environment for lld to
work". I don't consider that useful behavior at all.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-04 Thread Joerg Sonnenberger via cfe-commits
On Fri, Jan 04, 2019 at 02:48:35PM +, Alexander Richardson via Phabricator 
wrote:
> Or if you really need to call the linker directly without specifying
> search paths you could also install a shell script as /usr/bin/ld that
> passes the appropriate flags to /usr/bin/ld.lld?

That's not a honest suggestion, is it?

> I don't think ifdefs in the source code are a good idea. Cross linking
> should just work as expected. But you could look at the OS field in the
> first input ELF file to choose default config options/a different
> emulation for NetBSD.

No, #if is certainly wrong. Using the OS field doesn't work though,
because it is typically not set. I think only FreeBSD ever did.

> The approach we are using in CheriBSD to differentiate between MIPS and
> CHERI pure-capability to either pass an explicitly
> `-m elf_btsmip_cheri_fbsd`/ `-m elf_btsmip_fbsd` or infer whether it is
> CHERI or MIPS based on the e_flags field of the first input file.

Yeah, but introducing new emulation names goes back to having to modify
things, which would defeat the purpose just as well.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-04 Thread Joerg Sonnenberger via cfe-commits
On Fri, Jan 04, 2019 at 05:52:46AM +, Michał Górny via Phabricator via 
llvm-commits wrote:
> mgorny added a comment.
> 
> For the record, another option is to actually fix other software not to call 
> LD directly.

See thousand monkeys. It doesn't really scale.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 10:26:38PM +, Rui Ueyama via Phabricator via 
cfe-commits wrote:
> I see there are pros and cons to not have host-specific config in ld.
> That said, if other operating systems can live without host-specific
> config in lld, why can't NetBSD do? I really don't like to be in a
> situation where only one operating system have a host-specific config
> while others don't.

They might not care because they use the thousand monkey approach to
software patching. At least for NetBSD, that's certainly man power
that's better spend elsewhere. They might simply have ignored lld so far
for any of the more interesting cases (like supporting multi-abi).
Lots of possible reasons :)

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 09:38:49PM +, Kamil Rytarowski via Phabricator via 
cfe-commits wrote:
> I think that this place is not the right place to bash GNU ld for performance 
> issues.

I didn't.

> I will refer just to slides and paper from Ian Lance Taylor to get overview 
> why it is unacceptably slow:
> 
> https://www.airs.com/ian/gold-slides.pdf
> https://ai.google/research/pubs/pub34417.pdf

We all know that gold and lld are faster. It's a huge step from
"somewhat faster" to "unacceptably slow". But that's again a completely
separate topic.

> I will add that (unless nothing changed recently) ignoring lack of
> features (like thinlto) GNU ld cannot produce >=4GB executables and
> this makes it even more unusable.

That sounds seriously like a troll. I already mentioned DWARF fission
for the one reasonable case for > 100MB binaries and that's in short
"don't touch most of the data"...

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 08:31:53PM +, Kamil Rytarowski via Phabricator via 
cfe-commits wrote:
> krytarowski added a comment.
> 
> On 03.01.2019 21:19, Joerg Sonnenberger wrote:
> 
> > On Thu, Jan 03, 2019 at 06:34:22PM +, Kamil Rytarowski via Phabricator 
> > via cfe-commits wrote:
> > 
> >> krytarowski added a comment.
> >> 
> >> Actually I find it frustrating and unfair as GNU ld doesn't have builtin
> >>  knowledge either.. it's passed with gross 'super hack' comments from 
> >> build scripts... but we are forced to push it to lld in order to move on.
> > 
> > I'm puzzled. Seriously, when was the last time you actually checked how
> >  much customization contains on a per-OS base in GNU ld? Yes, I'm
> >  including the various build scripts because GNU ld is generally build by
> >  a mix of hard-coded logic in the tool itself and various adjustments in
> >  the linker scripts it is shipped with. But they are all a builtin part
> >  of GNU ld as far as the end user is concerned. It is pretty much
> >  irrelevant from a point of functionality where that logic is, but
> >  skipping is a serious usability issue.
> > 
> > Joerg
> 
> I'm referring to code '/usr/src/external/gpl3/binutils/usr.bin/ld/Makefile':

I think that's a left over from old times before the emulparams/* logic
was done properly. But that's more a case of GNU ld's build system being
gross than anything else.

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


Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 05:01:00PM +, Ximin Luo via cfe-commits wrote:
> My patch that Roman quoted in the email below was an additional
> mechanism to set -fmacro-prefix-map and -fdebug-prefix-map via an
> environment variable. This was not accepted into GCC because they are
> (in summary) allergic against using environment variables to set anything.

The main problem here is that GCC insists on leaking the full command
line into the output and that makes it difficult to impossible to
actually provide sane mappings without using the environment.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 06:58:41PM +, Kamil Rytarowski via Phabricator 
wrote:
> But the result is that we don't have GNU gold either and are stuck with
> 40min linking times of LLVM. It's destructive to productivity and
> damages any LLVM related development.

The reason noone cared much about GNU gold is that it supports only a
limited set of platforms and forces a lot of modern GNU "innovations"
without any chance of fixing them. To a degree, both concerns apply to
lld as well, but reasonable well integrated LTO support with Clang
provides at least something in return. I have no idea about your link
times, the only situation where linking is taking a really significant
chunk of time is for full debug builds and the general solution for that
is DWARF fission.

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


Re: [PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 06:34:22PM +, Kamil Rytarowski via Phabricator via 
cfe-commits wrote:
> krytarowski added a comment.
> 
> Actually I find it frustrating and unfair as GNU ld doesn't have builtin
> knowledge either.. it's passed with gross 'super hack' comments from build 
> scripts... but we are forced to push it to lld in order to move on.

I'm puzzled. Seriously, when was the last time you actually checked how
much customization contains on a per-OS base in GNU ld? Yes, I'm
including the various build scripts because GNU ld is generally build by
a mix of hard-coded logic in the tool itself and various adjustments in
the linker scripts it is shipped with. But they are all a builtin part
of GNU ld as far as the end user is concerned. It is pretty much
irrelevant from a point of functionality where that logic is, but
skipping is a serious usability issue.

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


Re: [PATCH] D56044: [Driver] Support object files in addition to static and shared libraries in compiler-rt

2019-01-01 Thread Joerg Sonnenberger via cfe-commits
On Sat, Dec 22, 2018 at 03:22:11AM +, Petr Hosek via Phabricator via 
cfe-commits wrote:
> phosek created this revision.
> phosek added a reviewer: echristo.
> Herald added subscribers: cfe-commits, atanasyan, jrtc27, dberris, sdardis.
> 
> This change introduces support for object files in addition to static
> and shared libraries which were already supported which requires
> changing the type of the argument from boolean to an enum.

Not really a fan of this at all. Why isn't the normal -B path lookup
enough?

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


Re: r349752 - Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]

2018-12-20 Thread Joerg Sonnenberger via cfe-commits
On Thu, Dec 20, 2018 at 01:09:30PM -, Michal Gorny via cfe-commits wrote:
> Author: mgorny
> Date: Thu Dec 20 05:09:30 2018
> New Revision: 349752
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=349752=rev
> Log:
> Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]
> 
> Replace multiple comparisons of getOS() value with FreeBSD, NetBSD,
> OpenBSD and DragonFly with matching isOS*BSD() methods.  This should
> improve the consistency of coding style without changing the behavior.
> Direct getOS() comparisons were left whenever used in switch or switch-
> like context.

Personally, I consider this a step backwards and I hugely dislike the
pointless proliferation of isOS* methods.

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


Re: [PATCH] D55828: [clang] [Driver] Disable -faddrsig by default on NetBSD

2018-12-19 Thread Joerg Sonnenberger via cfe-commits
On Tue, Dec 18, 2018 at 04:35:54PM +, Michał Górny via Phabricator via 
cfe-commits wrote:
> mgorny created this revision.
> mgorny added reviewers: krytarowski, pcc.
> 
> Avoid passing -faddrsig by default on NetBSD.  This platform is still
> using old GNU binutils that crashes on executables containing those
> sections.

I find that a strange claim, given that many Linux distributions in the
wild have much older GNU binutils.

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


Re: [PATCH] D53922: [clangd] fix non linux build

2018-11-02 Thread Joerg Sonnenberger via cfe-commits
On Wed, Oct 31, 2018 at 08:53:03AM +, Sam McCall via Phabricator via 
cfe-commits wrote:
> sammccall accepted this revision.
> sammccall added a comment.
> This revision is now accepted and ready to land.
> 
> Thanks!
> We should work out what to do on BSD+Mac (and windows at some point), but 
> no-op is good for now.

Is this really a good idea in general? It means that on a busy system,
the thread will never run...

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


Re: r341475 - Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89

2018-09-05 Thread Joerg Sonnenberger via cfe-commits
On Wed, Sep 05, 2018 at 02:56:21PM -, Diogo N. Sampaio via cfe-commits 
wrote:
> Author: dnsampaio
> Date: Wed Sep  5 07:56:21 2018
> New Revision: 341475
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=341475=rev
> Log:
> Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89

As I wrote on the differential, this is just wrong. __inline is *not* a
keyword.

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


[libunwind] r337312 - The semantics of DW_CFA_GNU_args_size have changed subtile over the

2018-07-17 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Jul 17 12:00:51 2018
New Revision: 337312

URL: http://llvm.org/viewvc/llvm-project?rev=337312=rev
Log:
The semantics of DW_CFA_GNU_args_size have changed subtile over the
years. Adopt the new convention that it is call-site specific and that
it should be applied before moving the IP by personality routines, but
not during normal unwinding.

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

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

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=337312=337311=337312=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Tue Jul 17 12:00:51 2018
@@ -1411,8 +1411,6 @@ int UnwindCursor::step() {
 this->setInfoBasedOnIPRegister(true);
 if (_unwindInfoMissing)
   return UNW_STEP_END;
-if (_info.gp)
-  setReg(UNW_REG_SP, getReg(UNW_REG_SP) + _info.gp);
   }
 
   return result;

Modified: libunwind/trunk/src/libunwind.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind.cpp?rev=337312=337311=337312=diff
==
--- libunwind/trunk/src/libunwind.cpp (original)
+++ libunwind/trunk/src/libunwind.cpp Tue Jul 17 12:00:51 2018
@@ -188,8 +188,20 @@ _LIBUNWIND_EXPORT int unw_set_reg(unw_cu
 co->setReg(regNum, (pint_t)value);
 // specical case altering IP to re-find info (being called by personality
 // function)
-if (regNum == UNW_REG_IP)
+if (regNum == UNW_REG_IP) {
+  unw_proc_info_t info;
+  // First, get the FDE for the old location and then update it.
+  co->getInfo();
   co->setInfoBasedOnIPRegister(false);
+  // If the original call expects stack adjustment, perform this now.
+  // Normal frame unwinding would have included the offset already in the
+  // CFA computation.
+  // Note: for PA-RISC and other platforms where the stack grows up,
+  // this should actually be - info.gp. LLVM doesn't currently support
+  // any such platforms and Clang doesn't export a macro for them.
+  if (info.gp)
+co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + info.gp);
+}
 return UNW_ESUCCESS;
   }
   return UNW_EBADREG;


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


r337277 - Always use __mcount on NetBSD. Some platforms don't provide _mcount.

2018-07-17 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Jul 17 06:13:34 2018
New Revision: 337277

URL: http://llvm.org/viewvc/llvm-project?rev=337277=rev
Log:
Always use __mcount on NetBSD. Some platforms don't provide _mcount.

Modified:
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/test/CodeGen/mcount.c
cfe/trunk/test/Frontend/gnu-mcount.c

Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=337277=337276=337277=diff
==
--- cfe/trunk/lib/Basic/Targets/OSTargets.h (original)
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h Tue Jul 17 06:13:34 2018
@@ -369,7 +369,7 @@ protected:
 public:
   NetBSDTargetInfo(const llvm::Triple , const TargetOptions )
   : OSTargetInfo(Triple, Opts) {
-this->MCountName = "_mcount";
+this->MCountName = "__mcount";
   }
 };
 

Modified: cfe/trunk/test/CodeGen/mcount.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mcount.c?rev=337277=337276=337277=diff
==
--- cfe/trunk/test/CodeGen/mcount.c (original)
+++ cfe/trunk/test/CodeGen/mcount.c Tue Jul 17 06:13:34 2018
@@ -3,20 +3,20 @@
 // RUN: %clang_cc1 -pg -triple powerpc-unknown-gnu-linux -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -pg -triple powerpc64-unknown-gnu-linux -emit-llvm -o - %s 
| FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -pg -triple powerpc64le-unknown-gnu-linux -emit-llvm -o - 
%s | FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple i386-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple x86_64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple arm-netbsd-eabi -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple aarch64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple mips-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple i386-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple x86_64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple arm-netbsd-eabi -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple aarch64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple mips-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -pg -triple mips-unknown-gnu-linux -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -pg -triple mipsel-unknown-gnu-linux -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -pg -triple mips64-unknown-gnu-linux -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -pg -triple mips64el-unknown-gnu-linux -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple powerpc-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple powerpc64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple powerpc64le-netbsd -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple sparc-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
-// RUN: %clang_cc1 -pg -triple sparc64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple powerpc-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple powerpc64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple powerpc64le-netbsd -emit-llvm -o - %s | 
FileCheck -check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple sparc-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
+// RUN: %clang_cc1 -pg -triple sparc64-netbsd -emit-llvm -o - %s | FileCheck 
-check-prefixes=CHECK-DOUBLE-PREFIXED,NO-MCOUNT1 %s
 // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=NO-MCOUNT
 
 int bar(void) {
@@ -39,5 +39,7 @@ int main(void) {
 // CHECK: attributes #1 = { {{.*}} }
 // CHECK-PREFIXED: attributes #0 = { 

r337274 - For NetBSD, unwind data is emitted by default, so also enable frame

2018-07-17 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Jul 17 05:38:57 2018
New Revision: 337274

URL: http://llvm.org/viewvc/llvm-project?rev=337274=rev
Log:
For NetBSD, unwind data is emitted by default, so also enable frame
pointer optimisation by default when using optimisation.

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

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=337274=337273=337274=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Jul 17 05:38:57 2018
@@ -524,6 +524,10 @@ static bool useFramePointerForTargetByDe
 break;
   }
 
+  if (Triple.getOS() == llvm::Triple::NetBSD) {
+return !areOptimizationsEnabled(Args);
+  }
+
   if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) {
 switch (Triple.getArch()) {
 // Don't use a frame pointer on linux if optimizing for certain targets.

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=337274=337273=337274=diff
==
--- cfe/trunk/test/Driver/frame-pointer-elim.c (original)
+++ cfe/trunk/test/Driver/frame-pointer-elim.c Tue Jul 17 05:38:57 2018
@@ -17,6 +17,15 @@
 // RUN:   FileCheck --check-prefix=CLOUDABI %s
 // CLOUDABI-NOT: "-momit-leaf-frame-pointer"
 
+// NetBSD follows the same rules as Linux.
+// RUN: %clang -### -target x86_64-unknown-netbsd -S -O1 %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=NETBSD-OPT %s
+// NETBSD-OPT: "-momit-leaf-frame-pointer"
+
+// RUN: %clang -### -target x86_64-unknown-netbsd -S %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=NETBSD %s
+// NETBSD-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


r337271 - By popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64

2018-07-17 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Jul 17 05:33:19 2018
New Revision: 337271

URL: http://llvm.org/viewvc/llvm-project?rev=337271=rev
Log:
By popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64
to long for consistency with other 64bit platforms.

Modified:
cfe/trunk/lib/Basic/Targets/AArch64.cpp
cfe/trunk/lib/Basic/Targets/PPC.h
cfe/trunk/test/Preprocessor/init.c
cfe/trunk/test/Preprocessor/stdint.c

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=337271=337270=337271=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Tue Jul 17 05:33:19 2018
@@ -35,14 +35,11 @@ const Builtin::Info AArch64TargetInfo::B
 AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple ,
  const TargetOptions )
 : TargetInfo(Triple), ABI("aapcs") {
-  if (getTriple().getOS() == llvm::Triple::NetBSD ||
-  getTriple().getOS() == llvm::Triple::OpenBSD) {
-// NetBSD apparently prefers consistency across ARM targets to
-// consistency across 64-bit targets.
+  if (getTriple().getOS() == llvm::Triple::OpenBSD) {
 Int64Type = SignedLongLong;
 IntMaxType = SignedLongLong;
   } else {
-if (!getTriple().isOSDarwin())
+if (!getTriple().isOSDarwin() && getTriple().getOS() != 
llvm::Triple::NetBSD)
   WCharType = UnsignedInt;
 
 Int64Type = SignedLong;

Modified: cfe/trunk/lib/Basic/Targets/PPC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/PPC.h?rev=337271=337270=337271=diff
==
--- cfe/trunk/lib/Basic/Targets/PPC.h (original)
+++ cfe/trunk/lib/Basic/Targets/PPC.h Tue Jul 17 05:33:19 2018
@@ -366,10 +366,6 @@ public:
   LongDoubleWidth = LongDoubleAlign = 64;
   LongDoubleFormat = ::APFloat::IEEEdouble();
   break;
-case llvm::Triple::NetBSD:
-  IntMaxType = SignedLongLong;
-  Int64Type = SignedLongLong;
-  break;
 default:
   break;
 }

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=337271=337270=337271=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Jul 17 05:33:19 2018
@@ -724,21 +724,21 @@
 // AARCH64-NETBSD:#define __INT32_FMTi__ "i"
 // AARCH64-NETBSD:#define __INT32_MAX__ 2147483647
 // AARCH64-NETBSD:#define __INT32_TYPE__ int
-// AARCH64-NETBSD:#define __INT64_C_SUFFIX__ LL
-// AARCH64-NETBSD:#define __INT64_FMTd__ "lld"
-// AARCH64-NETBSD:#define __INT64_FMTi__ "lli"
-// AARCH64-NETBSD:#define __INT64_MAX__ 9223372036854775807LL
-// AARCH64-NETBSD:#define __INT64_TYPE__ long long int
+// AARCH64-NETBSD:#define __INT64_C_SUFFIX__ L
+// AARCH64-NETBSD:#define __INT64_FMTd__ "ld"
+// AARCH64-NETBSD:#define __INT64_FMTi__ "li"
+// AARCH64-NETBSD:#define __INT64_MAX__ 9223372036854775807L
+// AARCH64-NETBSD:#define __INT64_TYPE__ long int
 // AARCH64-NETBSD:#define __INT8_C_SUFFIX__
 // AARCH64-NETBSD:#define __INT8_FMTd__ "hhd"
 // AARCH64-NETBSD:#define __INT8_FMTi__ "hhi"
 // AARCH64-NETBSD:#define __INT8_MAX__ 127
 // AARCH64-NETBSD:#define __INT8_TYPE__ signed char
-// AARCH64-NETBSD:#define __INTMAX_C_SUFFIX__ LL
-// AARCH64-NETBSD:#define __INTMAX_FMTd__ "lld"
-// AARCH64-NETBSD:#define __INTMAX_FMTi__ "lli"
-// AARCH64-NETBSD:#define __INTMAX_MAX__ 9223372036854775807LL
-// AARCH64-NETBSD:#define __INTMAX_TYPE__ long long int
+// AARCH64-NETBSD:#define __INTMAX_C_SUFFIX__ L
+// AARCH64-NETBSD:#define __INTMAX_FMTd__ "ld"
+// AARCH64-NETBSD:#define __INTMAX_FMTi__ "li"
+// AARCH64-NETBSD:#define __INTMAX_MAX__ 9223372036854775807L
+// AARCH64-NETBSD:#define __INTMAX_TYPE__ long int
 // AARCH64-NETBSD:#define __INTMAX_WIDTH__ 64
 // AARCH64-NETBSD:#define __INTPTR_FMTd__ "ld"
 // AARCH64-NETBSD:#define __INTPTR_FMTi__ "li"
@@ -824,15 +824,15 @@
 // AARCH64-NETBSD:#define __UINT32_C_SUFFIX__ U
 // AARCH64-NETBSD:#define __UINT32_MAX__ 4294967295U
 // AARCH64-NETBSD:#define __UINT32_TYPE__ unsigned int
-// AARCH64-NETBSD:#define __UINT64_C_SUFFIX__ ULL
-// AARCH64-NETBSD:#define __UINT64_MAX__ 18446744073709551615ULL
-// AARCH64-NETBSD:#define __UINT64_TYPE__ long long unsigned int
+// AARCH64-NETBSD:#define __UINT64_C_SUFFIX__ UL
+// AARCH64-NETBSD:#define __UINT64_MAX__ 18446744073709551615UL
+// AARCH64-NETBSD:#define __UINT64_TYPE__ long unsigned int
 // AARCH64-NETBSD:#define __UINT8_C_SUFFIX__
 // AARCH64-NETBSD:#define __UINT8_MAX__ 255
 // AARCH64-NETBSD:#define __UINT8_TYPE__ unsigned char
-// AARCH64-NETBSD:#define __UINTMAX_C_SUFFIX__ ULL
-// AARCH64-NETBSD:#define __UINTMAX_MAX__ 18446744073709551615ULL
-// AARCH64-NETBSD:#define __UINTMAX_TYPE__ long long unsigned int

r336947 - Support linking static PIE binaries on NetBSD

2018-07-12 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Thu Jul 12 14:21:29 2018
New Revision: 336947

URL: http://llvm.org/viewvc/llvm-project?rev=336947=rev
Log:
Support linking static PIE binaries on NetBSD

Modified:
cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
cfe/trunk/test/Driver/netbsd.c

Modified: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp?rev=336947=336946=336947=diff
==
--- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp Thu Jul 12 14:21:29 2018
@@ -122,6 +122,10 @@ void netbsd::Linker::ConstructJob(Compil
   CmdArgs.push_back("--eh-frame-hdr");
   if (Args.hasArg(options::OPT_static)) {
 CmdArgs.push_back("-Bstatic");
+if (Args.hasArg(options::OPT_pie)) {
+  Args.AddAllArgs(CmdArgs, options::OPT_pie);
+  CmdArgs.push_back("--no-dynamic-linker");
+}
   } else {
 if (Args.hasArg(options::OPT_rdynamic))
   CmdArgs.push_back("-export-dynamic");

Modified: cfe/trunk/test/Driver/netbsd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/netbsd.c?rev=336947=336946=336947=diff
==
--- cfe/trunk/test/Driver/netbsd.c (original)
+++ cfe/trunk/test/Driver/netbsd.c Thu Jul 12 14:21:29 2018
@@ -5,6 +5,9 @@
 // RUN: -pie --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=PIE %s
 // RUN: %clang -no-canonical-prefixes -target x86_64--netbsd \
+// RUN: -static -pie --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=STATIC-PIE %s
+// RUN: %clang -no-canonical-prefixes -target x86_64--netbsd \
 // RUN: -shared --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=SHARED %s
 
@@ -139,6 +142,16 @@
 // STATIC: "{{.*}}/usr/lib{{/|}}crti.o" 
"{{.*}}/usr/lib{{/|}}crtbegin.o"
 // STATIC: "{{.*}}/usr/lib{{/|}}crtend.o" "{{.*}}/usr/lib{{/|}}crtn.o"
 
+// STATIC-PIE: ld{{.*}}" "--eh-frame-hdr"
+// STATIC-PIE-NOT: "-dynamic-linker" "/libexec/ld.elf_so"
+// STATIC-PIE-NOT: "-Bshareable"
+// STATIC-PIE: "-pie"
+// STATIC-PIE-NOT: "-dynamic-linker" "/libexec/ld.elf_so"
+// STATIC-PIE-NOT: "-Bshareable"
+// STATIC-PIE: "{{.*}}/usr/lib{{/|}}crt0.o"
+// STATIC-PIE: "{{.*}}/usr/lib{{/|}}crti.o" 
"{{.*}}/usr/lib{{/|}}crtbeginS.o"
+// STATIC-PIE: "{{.*}}/usr/lib{{/|}}crtendS.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
+
 // SHARED: ld{{.*}}" "--eh-frame-hdr"
 // SHARED-NOT: "-pie"
 // SHARED-NOT: "-dynamic-linker"


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


Re: r328040 - Set dso_local on string literals.

2018-03-22 Thread Joerg Sonnenberger via cfe-commits
On Tue, Mar 20, 2018 at 05:01:24PM -0700, Rafael Avila de Espindola wrote:
> Joerg Sonnenberger via cfe-commits <cfe-commits@lists.llvm.org> writes:
> 
> > On Tue, Mar 20, 2018 at 08:42:55PM -, Rafael Espindola via cfe-commits 
> > wrote:
> >> Author: rafael
> >> Date: Tue Mar 20 13:42:55 2018
> >> New Revision: 328040
> >> 
> >> URL: http://llvm.org/viewvc/llvm-project?rev=328040=rev
> >> Log:
> >> Set dso_local on string literals.
> >
> > I wonder if unnamed_addr shouldn't imply that in general?
> 
> I don't think so. For example, a language where functions cannot be
> compared for equality could mark all functions unnamed_addr. It could
> still support interposition, which requires that they are not dso_local.

I don't think that argument makes sense. The address is not named, that
strongly implies that can't be interpositioned either.

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


Re: r328040 - Set dso_local on string literals.

2018-03-20 Thread Joerg Sonnenberger via cfe-commits
On Tue, Mar 20, 2018 at 08:42:55PM -, Rafael Espindola via cfe-commits 
wrote:
> Author: rafael
> Date: Tue Mar 20 13:42:55 2018
> New Revision: 328040
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=328040=rev
> Log:
> Set dso_local on string literals.

I wonder if unnamed_addr shouldn't imply that in general?

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


Re: [PATCH] D43203: [Driver] Generate .eh_frame_hdr for static executables too.

2018-02-12 Thread Joerg Sonnenberger via cfe-commits
On Mon, Feb 12, 2018 at 08:54:56PM +, Stephen Hines via Phabricator via 
cfe-commits wrote:
> srhines added a comment.
> 
> LGTM, but we should make sure that there are no objections, especially since 
> there is no rationale for why this was present to begin with.

Older versions of the GNU unwinder couldn't use it.

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


Re: r316046 - Basic: fix __{,U}INTPTR_TYPE__ on ARM

2017-10-18 Thread Joerg Sonnenberger via cfe-commits
On Wed, Oct 18, 2017 at 12:00:51AM -, Saleem Abdulrasool via cfe-commits 
wrote:
> Author: compnerd
> Date: Tue Oct 17 17:00:50 2017
> New Revision: 316046
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=316046=rev
> Log:
> Basic: fix __{,U}INTPTR_TYPE__ on ARM
> 
> Darwin and OpenBSD are the only platforms which use `long int` for
> `__INTPTR_TYPE__`.  The other platforms use `int` in 32-bit, and `long
> int` on 64-bit (except for VMS and Windows which are LLP64).  Adjust the
> type definitions to match the platform definitions.  We now generate the
> same definition as GCC on all the targets.

This is false as the test changes show.

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


Re: [PATCH] D34158: For Linux/gnu compatibility, preinclude if the file is available

2017-09-12 Thread Joerg Sonnenberger via cfe-commits
On Tue, Sep 12, 2017 at 08:12:26PM +, Blower, Melanie via cfe-commits wrote:
> How is platform opt-in accomplished, is it part of the configure step?

It is part of the Linux toolchain, other platforms interested in this or
equivalent functionality would have to duplicate the hook.

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


Re: r312595 - [Darwin] Enable -fstack-protector (back) by default with -ffreestanding

2017-09-05 Thread Joerg Sonnenberger via cfe-commits
On Tue, Sep 05, 2017 at 11:50:58PM -, Bruno Cardoso Lopes via cfe-commits 
wrote:
> Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=312595=312594=312595=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Sep  5 16:50:58 2017
> @@ -2302,11 +2302,6 @@ static void RenderSSPOptions(const ToolC
>  else if (A->getOption().matches(options::OPT_fstack_protector_all))
>StackProtectorLevel = LangOptions::SSPReq;
>} else {
> -// Only use a default stack protector on Darwin in case -ffreestanding is
> -// not specified.
> -if (EffectiveTriple.isOSDarwin() && !IsHosted)
> -  StackProtectorLevel = 0;
> -else
>StackProtectorLevel = DefaultStackProtectorLevel;
>}

Indentation?

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


[libcxx] r311156 - Spelling

2017-08-18 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Fri Aug 18 05:57:36 2017
New Revision: 311156

URL: http://llvm.org/viewvc/llvm-project?rev=311156=rev
Log:
Spelling

Modified:
libcxx/trunk/include/__tree

Modified: libcxx/trunk/include/__tree
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=311156=311155=311156=diff
==
--- libcxx/trunk/include/__tree (original)
+++ libcxx/trunk/include/__tree Fri Aug 18 05:57:36 2017
@@ -84,7 +84,7 @@ __tree_is_left_child(_NodePtr __x) _NOEX
 return __x == __x->__parent_->__left_;
 }
 
-// Determintes if the subtree rooted at __x is a proper red black subtree.  If
+// Determines if the subtree rooted at __x is a proper red black subtree.  If
 //__x is a proper subtree, returns the black height (null counts as 1).  If
 //__x is an improper subtree, returns 0.
 template 
@@ -119,7 +119,7 @@ __tree_sub_invariant(_NodePtr __x)
 return __h + __x->__is_black_;  // return black height of this node
 }
 
-// Determintes if the red black tree rooted at __root is a proper red black 
tree.
+// Determines if the red black tree rooted at __root is a proper red black 
tree.
 //__root == nullptr is a proper tree.  Returns true is __root is a proper
 //red black tree, else returns false.
 template 


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


Re: r309940 - [mips] Implement -muninit-const-in-rodata

2017-08-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Aug 03, 2017 at 02:01:17PM -, Simon Dardis via cfe-commits wrote:
> Author: sdardis
> Date: Thu Aug  3 07:01:17 2017
> New Revision: 309940
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=309940=rev
> Log:
> [mips] Implement -muninit-const-in-rodata
> 
> This option when combined with -mgpopt and -membedded-data places all
> uninitialized constant variables in the read-only section.

I don't get it. Why is this preferable to just forbidding the use of
common variables in first placce?

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


Re: [PATCH] D35780: Introduce -nostdlib++ flag to disable linking the C++ standard library.

2017-07-25 Thread Joerg Sonnenberger via cfe-commits
On Tue, Jul 25, 2017 at 03:09:00PM -0400, Nico Weber via cfe-commits wrote:
> On Tue, Jul 25, 2017 at 2:53 PM, Joerg Sonnenberger  wrote:
> 
> > On Sun, Jul 23, 2017 at 07:06:25PM -0400, Nico Weber via cfe-commits wrote:
> > > If you need this behavior for something, that sounds like something a
> > > -nodefaultlibs++ could do. -nostdlib++ is really meant to disable the c++
> > > stdlib and nothing else.
> >
> > But the -lm is only there because -lc++ alone (or -lstdc++ for that
> > matter) wouldn't really work.
> >
> 
> Do you have a reference for that? Several toolchains link in -lm in C mode
> even.

UNIX history?

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


Re: [PATCH] D35780: Introduce -nostdlib++ flag to disable linking the C++ standard library.

2017-07-25 Thread Joerg Sonnenberger via cfe-commits
On Sun, Jul 23, 2017 at 07:06:25PM -0400, Nico Weber via cfe-commits wrote:
> If you need this behavior for something, that sounds like something a
> -nodefaultlibs++ could do. -nostdlib++ is really meant to disable the c++
> stdlib and nothing else.

But the -lm is only there because -lc++ alone (or -lstdc++ for that
matter) wouldn't really work.

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


Re: [PATCH] D35780: Introduce -nostdlib++ flag to disable linking the C++ standard library.

2017-07-23 Thread Joerg Sonnenberger via cfe-commits
On Sun, Jul 23, 2017 at 03:17:32PM -0400, Nico Weber via cfe-commits wrote:
> On Sun, Jul 23, 2017 at 3:08 PM, Joerg Sonnenberger via Phabricator via
> cfe-commits  wrote:
> 
> > joerg added a comment.
> >
> > I don't really like this.
> 
> That's cool, you don't need to use the flag.

I'm not talking about the flag, but the implementation.

> > The reason why -lm is added explicitly on many targets is because the C++
> > STL typically depends on it and that means for static linking and broken
> > ELF linkers, it will be necessary to link against it explicitly.
> >
> 
> The driver adds -lm at the end, so it'll work if you add your static libc++
> flag in user flags, and then -lm gets added at the end. But from what I
> understand, -lm is also there as a usability thing to make c++ a bit more
> accessible than c in this regard, not just for the c++ standard library.
> (Also, if you're trying to statically link your c++ lib, it's possible you
> have some influence on your linker as well.)

I don't think so, it strongly seems to be an implementation detail of
the STL interaction.

> > There is also the question on whether any platform we have currently uses
> > separate STL and ABI libraries and it is not clear whether the flag should
> > handle both.
> >
> 
> Yes, it should handle both.

If you update the comments and documentation accordingly and stop the
current passing of -lm, it is fine with me. I don't think the libmath
handling should be forced on other STL implementations.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D34440: [Clang] Expand response files before loading compilation database

2017-07-14 Thread Joerg Sonnenberger via cfe-commits
On Fri, Jul 14, 2017 at 02:40:25PM +, Manuel Klimek via Phabricator via 
cfe-commits wrote:
> klimek added a comment.
> 
> In https://reviews.llvm.org/D34440#809581, @vladimir.plyashkun wrote:
> 
> > > Are there any concerns using the alternative?
> >
> > I can't say that it's a big problems, but i think that:
> >  //CompilationDatabase.json// is more //CMake //specific format. 
> >  It can be generated automatically by //CMake//, while other build systems 
> > may not do it.
> >  So we need to generate it on the fly (by tool or by hand), which also can 
> > lead to hidden problems due to different formats, different escaping rules, 
> > etc.
> >  I think it's always good to have one unified format.
> 
> 
> The compilation database is most certainly not cmake specific. We
> designed it in clang, and then implemented it in cmake as an example,
> because that's the most widely used C++ build system we were aware of
> (aside from autotools, which we didn't want to touch :).  There are
> ways to create it from other build systems (ninja has support, and
> there are tools that provide generic support to intercept compiles).

Don't use interceptors, just use -MJ. It should be very easy to hook up
into any build system that can also use -MM etc.

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


r307665 - NetBSD uses soft-float by default, unless the environment is EABIHF or

2017-07-11 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Jul 11 08:50:48 2017
New Revision: 307665

URL: http://llvm.org/viewvc/llvm-project?rev=307665=rev
Log:
NetBSD uses soft-float by default, unless the environment is EABIHF or
GNUEABIHF.

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=307665=307664=307665=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp Tue Jul 11 08:50:48 2017
@@ -179,6 +179,18 @@ arm::FloatABI arm::getARMFloatABI(const
   ABI = FloatABI::Hard;
   break;
 
+case llvm::Triple::NetBSD:
+  switch (Triple.getEnvironment()) {
+  case llvm::Triple::EABIHF:
+  case llvm::Triple::GNUEABIHF:
+ABI = FloatABI::Hard;
+break;
+  default:
+ABI = FloatABI::Soft;
+break;
+  }
+  break;
+
 case llvm::Triple::FreeBSD:
   switch (Triple.getEnvironment()) {
   case llvm::Triple::GNUEABIHF:

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=307665=307664=307665=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Jul 11 08:50:48 2017
@@ -2333,6 +2333,7 @@
 // ARM-NETBSD:#define __SIZE_MAX__ 4294967295UL
 // ARM-NETBSD:#define __SIZE_TYPE__ long unsigned int
 // ARM-NETBSD:#define __SIZE_WIDTH__ 32
+// ARM-NETBSD:#define __SOFTFP__ 1
 // ARM-NETBSD:#define __UINT16_C_SUFFIX__
 // ARM-NETBSD:#define __UINT16_MAX__ 65535
 // ARM-NETBSD:#define __UINT16_TYPE__ unsigned short
@@ -2377,6 +2378,11 @@
 // ARM-NETBSD:#define __arm 1
 // ARM-NETBSD:#define __arm__ 1
 
+// RUN: %clang -E -dM -ffreestanding -target arm-netbsd-eabihf %s -o - | 
FileCheck -match-full-lines -check-prefix ARMHF-NETBSD %s
+// ARMHF-NETBSD:#define __SIZE_WIDTH__ 32
+// ARMHF-NETBSD-NOT:#define __SOFTFP__ 1
+// ARMHF-NETBSD:#define __UINT16_C_SUFFIX__
+
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabi < /dev/null | 
FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-none-eabihf < /dev/null | 
FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-none-eabi < /dev/null 
| FileCheck -match-full-lines -check-prefix ARM-NONE-EABI %s


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


r307664 - Run the preprocessor test as frontend test for NetBSD, since CC1 mode

2017-07-11 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Jul 11 08:49:45 2017
New Revision: 307664

URL: http://llvm.org/viewvc/llvm-project?rev=307664=rev
Log:
Run the preprocessor test as frontend test for NetBSD, since CC1 mode
doesn't get flags like the default target CPU. Update for test to
reflect the difference.

Modified:
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=307664=307663=307664=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Jul 11 08:49:45 2017
@@ -2185,13 +2185,13 @@
 // 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
-//
+// RUN: %clang -E -dM -ffreestanding -target arm-netbsd-eabi %s -o - | 
FileCheck -match-full-lines -check-prefix ARM-NETBSD %s
+
 // ARM-NETBSD-NOT:#define _LP64
 // ARM-NETBSD:#define __APCS_32__ 1
 // ARM-NETBSD-NOT:#define __ARMEB__ 1
 // ARM-NETBSD:#define __ARMEL__ 1
-// ARM-NETBSD:#define __ARM_ARCH_4T__ 1
+// ARM-NETBSD:#define __ARM_ARCH_5TE__ 1
 // ARM-NETBSD:#define __ARM_DWARF_EH__ 1
 // ARM-NETBSD:#define __ARM_EABI__ 1
 // ARM-NETBSD-NOT:#define __ARM_BIG_ENDIAN 1


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


Re: r307104 - Enable LLVM asan support for NetBSD/amd64

2017-07-06 Thread Joerg Sonnenberger via cfe-commits
On Tue, Jul 04, 2017 at 07:55:56PM -, Kamil Rytarowski via cfe-commits 
wrote:
> Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=307104=307103=307104=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Tue Jul  4 12:55:56 2017
> @@ -524,6 +524,7 @@ void tools::linkSanitizerRuntimeDeps(con
>CmdArgs.push_back("-lm");
>// There's no libdl on FreeBSD or RTEMS.
>if (TC.getTriple().getOS() != llvm::Triple::FreeBSD &&
> +  TC.getTriple().getOS() != llvm::Triple::NetBSD &&
>TC.getTriple().getOS() != llvm::Triple::RTEMS)
>  CmdArgs.push_back("-ldl");
>  }

I'd really prefer if we switched to a positive list here, i.e. only link
libdl on platforms that actually need it. I'm not sure who does, beside
Linux.

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


r306965 - Add an option group for deprecated warnings. Add the removed

2017-07-01 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Sat Jul  1 14:36:21 2017
New Revision: 306965

URL: http://llvm.org/viewvc/llvm-project?rev=306965=rev
Log:
Add an option group for deprecated warnings. Add the removed
-fslp-vectorize-aggressive and -fno-slp-vectorize-aggressive flags back
under this group and test for the warning. Document the future removal
in the ReleaseNotes.

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

Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=306965=306964=306965=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Sat Jul  1 14:36:21 2017
@@ -60,6 +60,16 @@ New Compiler Flags
 
 The option 
 
+Deprecated Compiler Flags
+-
+
+The following options are deprecated and ignored. They will be removed in
+future versions of Clang.
+
+- -fslp-vectorize-aggressive used to enable the BB vectorizing pass. They have 
been superseeded
+  by the normal SLP vectorizer.
+- -fno-slp-vectorize-aggressive used to be the default behavior of clang.
+
 New Pragmas in Clang
 ---
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=306965=306964=306965=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Sat Jul  1 14:36:21 
2017
@@ -178,6 +178,8 @@ def warn_drv_optimization_value : Warnin
   InGroup;
 def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not 
supported">,
   InGroup;
+def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and 
will be ignored">,
+  InGroup;
 def warn_drv_unsupported_opt_for_target : Warning<
   "optimization flag '%0' is not supported for target '%1'">,
   InGroup;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=306965=306964=306965=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Sat Jul  1 14:36:21 2017
@@ -194,6 +194,16 @@ def clang_ignored_f_Group : OptionGroup<
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Group for clang options in the process of deprecation.
+// Please include the version that deprecated the flag as comment to allow
+// easier garbage collection.
+def clang_ignored_legacy_options_Group : OptionGroup<"">,
+  Group, Flags<[Ignored]>;
+
+// Retired with clang-5.0
+def : Flag<["-"], "fslp-vectorize-aggressive">, 
Group;
+def : Flag<["-"], "fno-slp-vectorize-aggressive">, 
Group;
+
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "">, Group, 
Flags<[Ignored]>;

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=306965=306964=306965=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sat Jul  1 14:36:21 2017
@@ -2974,6 +2974,12 @@ void Clang::ConstructJob(Compilation ,
 A->claim();
   }
 
+  for (const Arg *A :
+   Args.filtered(options::OPT_clang_ignored_legacy_options_Group)) {
+D.Diag(diag::warn_ignored_clang_option) << A->getAsString(Args);
+A->claim();
+  }
+
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=306965=306964=306965=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Sat Jul  1 14:36:21 2017
@@ -356,6 +356,8 @@
 // RUN: -ftree-vrp\
 // RUN: -fno-devirtualize \
 // RUN: -fno-devirtualize-speculatively   \
+// RUN: -fslp-vectorize-aggressive\
+// RUN: -fno-slp-vectorize-aggressive \
 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
 // CHECK-WARNING-DAG: optimization flag 

Re: r297702 - [CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded

2017-06-22 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jun 22, 2017 at 11:09:48AM -0700, Akira Hatanaka wrote:
> Do you want the same encoding for the bitfield “int : 1” you saw before 
> r297792, which is just “i"?
> 
> The encoding for bitfield is normally bN where N is the number of bits,
> but the comment in function EncodeBitField says GNU runtime encodes it 
> differently.

Sorry, can't answer that. I primarily care about a new clang crash that
didn't exist before, cut I can't answer what the correct behavior should
be.

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


Re: r297702 - [CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded

2017-06-22 Thread Joerg Sonnenberger via cfe-commits
On Mon, Jun 12, 2017 at 09:03:10PM +0200, Joerg Sonnenberger wrote:
> On Thu, Jun 01, 2017 at 05:58:41PM -0700, Akira Hatanaka wrote:
> > It crashes when there is an anonymous ivar of a bitfield type.
> > 
> > @interface FormatScanner {
> >   int : 1;
> > }
> > @end
> > 
> > @implementation FormatScanner
> > @end
> > 
> > I'm not sure if the code above is valid or not, but out of curiosity,
> > why would you want an anonymous bitfield variable?
> 
> It's a reduced test case. The original test case has a variable name in
> it.

Ping?

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


Re: r305600 - [Driver] Do a PATH lookup if needed when using -no-canonical-prefixes

2017-06-16 Thread Joerg Sonnenberger via cfe-commits
On Fri, Jun 16, 2017 at 10:40:18PM -, Petr Hosek via cfe-commits wrote:
> @@ -53,8 +53,15 @@ using namespace clang::driver;
>  using namespace llvm::opt;
>  
>  std::string GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) {
> -  if (!CanonicalPrefixes)
> -return Argv0;
> +  if (!CanonicalPrefixes) {
> +SmallString<128> ExecutablePath(Argv0);
> +// Do a PATH lookup if Argv0 isn't a valid path.
> +if (!llvm::sys::fs::exists(ExecutablePath))
> +  if (llvm::ErrorOr P =
> +  llvm::sys::findProgramByName(ExecutablePath))
> +ExecutablePath = *P;
> +return ExecutablePath.str();
> +  }
>  
>// This just needs to be some symbol in the binary; C++ doesn't
>// allow taking the address of ::main however.

This will fail if the current directory contains a file with the name of
the program, won't it? I think the correct order here would be to check
if ExecutablePath contains a path separator and if it doesn't, call
findProgramByName.

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


Re: r297702 - [CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded

2017-06-12 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jun 01, 2017 at 05:58:41PM -0700, Akira Hatanaka wrote:
> It crashes when there is an anonymous ivar of a bitfield type.
> 
> @interface FormatScanner {
>   int : 1;
> }
> @end
> 
> @implementation FormatScanner
> @end
> 
> I'm not sure if the code above is valid or not, but out of curiosity,
> why would you want an anonymous bitfield variable?

It's a reduced test case. The original test case has a variable name in
it.

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


Re: r303317 - The constant expression evaluator should examine function arguments for non-constexpr function calls unless the EvalInfo says to stop.

2017-06-10 Thread Joerg Sonnenberger via cfe-commits
On Tue, May 30, 2017 at 07:01:22PM -0700, Nick Lewycky wrote:
> Joerg Sonnenberger wrote:
> > On Wed, May 17, 2017 at 11:56:55PM -, Nick Lewycky via cfe-commits 
> > wrote:
> > > Author: nicholas
> > > Date: Wed May 17 18:56:54 2017
> > > New Revision: 303317
> > > 
> > > URL: http://llvm.org/viewvc/llvm-project?rev=303317=rev
> > > Log:
> > > The constant expression evaluator should examine function arguments for 
> > > non-constexpr function calls unless the EvalInfo says to stop.
> > 
> > Crashes with -std=c++11 on:
> > 
> > enum SizeHint { MinimumSize, MaximumSize };
> > class QSizeF {
> > public:
> >constexpr QSizeF();
> >QSizeF m_fn1(QSizeF);
> >double wd;
> >double ht;
> > };
> > constexpr QSizeF::QSizeF() : wd(), ht() {}
> > class A {
> >void m_fn2();
> >QSizeF m_fn3(SizeHint, const QSizeF&  = QSizeF());
> > };
> > void A::m_fn2() { m_fn3(MinimumSize).m_fn1(m_fn3(MaximumSize)); }
> 
> Did you run this with assertions disabled? This looks like another testcase
> for PR33140, but it should hit an assertion first.

Right, same problem as the second test case. This is somewhat
high-profile for me as it affects Qt5.

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


Re: r297702 - [CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded

2017-06-01 Thread Joerg Sonnenberger via cfe-commits
On Tue, Mar 14, 2017 at 04:00:53AM -, Akira Hatanaka via cfe-commits wrote:
> Author: ahatanak
> Date: Mon Mar 13 23:00:52 2017
> New Revision: 297702
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=297702=rev
> Log:
> [CodeGen][ObjC] Fix a bug where the type of an ivar wasn't encoded
> correctly.

This results in asserts on the attached test case. Can you have a look,
please?

Joerg
typedef BOOL;
@interface FormatScanner {
  BOOL : 1;
}
@end
@implementation FormatScanner
@end
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r303317 - The constant expression evaluator should examine function arguments for non-constexpr function calls unless the EvalInfo says to stop.

2017-05-30 Thread Joerg Sonnenberger via cfe-commits
On Wed, May 17, 2017 at 11:56:55PM -, Nick Lewycky via cfe-commits wrote:
> Author: nicholas
> Date: Wed May 17 18:56:54 2017
> New Revision: 303317
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=303317=rev
> Log:
> The constant expression evaluator should examine function arguments for 
> non-constexpr function calls unless the EvalInfo says to stop.

Crashes with -std=c++11 on:

enum SizeHint { MinimumSize, MaximumSize };
class QSizeF {
public:
  constexpr QSizeF();
  QSizeF m_fn1(QSizeF);
  double wd;
  double ht;
};
constexpr QSizeF::QSizeF() : wd(), ht() {}
class A {
  void m_fn2();
  QSizeF m_fn3(SizeHint, const QSizeF & = QSizeF());
};
void A::m_fn2() { m_fn3(MinimumSize).m_fn1(m_fn3(MaximumSize)); }

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


Re: [PATCH] D30700: [Driver] Always add arch-specific-subdir to -rpath

2017-03-14 Thread Joerg Sonnenberger via cfe-commits
On Mon, Mar 13, 2017 at 10:37:41PM +, Reid Kleckner via Phabricator via 
cfe-commits wrote:
> I don't agree. If we want to be good citizens on Linux, what's supposed
> to happen is that we install our shared libraries into
> /usr/lib/${distro_target}, which is what GCC does with its shared
> compiler runtime libraries. GCC does not add system-specific absolute
> rpaths to the binaries it produces.

That only applies if you install into /usr directly. There are many use
cases for which this is not the case. GCC generally handles them abysmal
and I'd prefer if we didn't go that way. In short: if you can reasonably
expect the rtlib path to be part of the system default, no rpath is
necessary. Otherwise, the driver should add it and make it easy for
clang builds to provide them. A compile-time flag is fine that though.

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


Re: [PATCH] D30538: Add documentation for -fno-strict-aliasing

2017-03-02 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 02, 2017 at 04:20:47PM +, Simon Byrne via Phabricator via 
cfe-commits wrote:
> simonbyrne created this revision.
> 
> This is probably good to document, as the behaviour of `-fstrict-aliasing` 
> differs from gcc in a quite important way (see 
> https://bugs.llvm.org//show_bug.cgi?id=31928) .

While it is reasonable to document the bug, it should not be seen as
desirable behavior. The change seems to imply that it is intentional.
More importantly, it should be documented as regression.

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


[libcxx] r294585 - Use protected name for the prototype arguments.

2017-02-09 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Thu Feb  9 08:12:29 2017
New Revision: 294585

URL: http://llvm.org/viewvc/llvm-project?rev=294585=rev
Log:
Use protected name for the prototype arguments.

Modified:
libcxx/trunk/include/__threading_support
libcxx/trunk/include/thread

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=294585=294584=294585=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu Feb  9 08:12:29 2017
@@ -184,7 +184,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY
 void __libcpp_thread_yield();
 
 _LIBCPP_THREAD_ABI_VISIBILITY
-void __libcpp_thread_sleep_for(const chrono::nanoseconds& ns);
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
 
 // Thread local storage
 _LIBCPP_THREAD_ABI_VISIBILITY

Modified: libcxx/trunk/include/thread
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=294585=294584=294585=diff
==
--- libcxx/trunk/include/thread (original)
+++ libcxx/trunk/include/thread Thu Feb  9 08:12:29 2017
@@ -424,7 +424,7 @@ void swap(thread& __x, thread& __y) _NOE
 namespace this_thread
 {
 
-_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
+_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
 
 template 
 void


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


r291814 - Add entry for -MJ.

2017-01-12 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Thu Jan 12 15:11:55 2017
New Revision: 291814

URL: http://llvm.org/viewvc/llvm-project?rev=291814=rev
Log:
Add entry for -MJ.

Modified:
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=291814=291813=291814=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Thu Jan 12 15:11:55 2017
@@ -65,6 +65,8 @@ The option -Og has been added to optimiz
 For now, this option is exactly the same as -O1. However, in the future,
 some other optimizations might be enabled or disabled.
 
+The option -MJ has been added to simplify adding JSON compilation
+database output into existing build systems.
 
 The option 
 


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


r291437 - Use the same ABI logic for AArch64 Big Endian as in other places

2017-01-09 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Mon Jan  9 05:40:41 2017
New Revision: 291437

URL: http://llvm.org/viewvc/llvm-project?rev=291437=rev
Log:
Use the same ABI logic for AArch64 Big Endian as in other places
covering polys.

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=291437=291436=291437=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Jan  9 05:40:41 2017
@@ -1242,7 +1242,8 @@ bool Sema::CheckNeonBuiltinFunctionCall(
 QualType RHSTy = RHS.get()->getType();
 
 llvm::Triple::ArchType Arch = 
Context.getTargetInfo().getTriple().getArch();
-bool IsPolyUnsigned = Arch == llvm::Triple::aarch64;
+bool IsPolyUnsigned = Arch == llvm::Triple::aarch64 ||
+  Arch == llvm::Triple::aarch64_be;
 bool IsInt64Long =
 Context.getTargetInfo().getInt64Type() == TargetInfo::SignedLong;
 QualType EltTy =


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


r291436 - Extend NetBSD/AArch64 to cover Big Endian as well.

2017-01-09 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Mon Jan  9 05:22:14 2017
New Revision: 291436

URL: http://llvm.org/viewvc/llvm-project?rev=291436=rev
Log:
Extend NetBSD/AArch64 to cover Big Endian as well.

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

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=291436=291435=291436=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Jan  9 05:22:14 2017
@@ -3812,6 +3812,7 @@ ToolChain::CXXStdlibType NetBSD::GetDefa
   if (Major >= 7 || Major == 0) {
 switch (getArch()) {
 case llvm::Triple::aarch64:
+case llvm::Triple::aarch64_be:
 case llvm::Triple::arm:
 case llvm::Triple::armeb:
 case llvm::Triple::thumb:

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=291436=291435=291436=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jan  9 05:22:14 2017
@@ -9644,6 +9644,7 @@ void netbsd::Linker::ConstructJob(Compil
   if (Major >= 7 || Major == 0) {
 switch (getToolChain().getArch()) {
 case llvm::Triple::aarch64:
+case llvm::Triple::aarch64_be:
 case llvm::Triple::arm:
 case llvm::Triple::armeb:
 case llvm::Triple::thumb:

Modified: cfe/trunk/test/Driver/netbsd.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/netbsd.c?rev=291436=291435=291436=diff
==
--- cfe/trunk/test/Driver/netbsd.c (original)
+++ cfe/trunk/test/Driver/netbsd.c Mon Jan  9 05:22:14 2017
@@ -23,6 +23,12 @@
 // RUN: %clang -no-canonical-prefixes -target aarch64--netbsd7.0.0 \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=AARCH64-7 %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=AARCH64_BE %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd7.0.0 \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=AARCH64_BE-7 %s
 // RUN: %clang -no-canonical-prefixes -target arm--netbsd-eabi \
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=ARM %s
@@ -84,6 +90,12 @@
 // RUN: %clang -no-canonical-prefixes -target aarch64--netbsd7.0.0 -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=S-AARCH64-7 %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd -static \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=S-AARCH64_BE %s
+// RUN: %clang -no-canonical-prefixes -target aarch64_be--netbsd7.0.0 -static \
+// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=S-AARCH64_BE-7 %s
 // RUN: %clang -no-canonical-prefixes -target arm--netbsd-eabi -static \
 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=S-ARM %s
@@ -171,6 +183,18 @@
 // AARCH64-7:  "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // AARCH64-7: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
 
+// AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd"
+// AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" 
"/libexec/ld.elf_so"
+// AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
+// AARCH64_BE: "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
+// AARCH64_BE: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
+
+// AARCH64_BE-7: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd7.0.0"
+// AARCH64_BE-7: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" 
"/libexec/ld.elf_so"
+// AARCH64_BE-7: "-o" "a.out" "{{.*}}/usr/lib{{/|}}crt0.o" 
"{{.*}}/usr/lib{{/|}}crti.o"
+// AARCH64_BE-7:  "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
+// AARCH64_BE-7: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
+
 // ARM: clang{{.*}}" "-cc1" "-triple" "armv5e--netbsd-eabi"
 // ARM: as{{.*}}" "-mcpu=arm926ej-s" "-o"
 // ARM: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
@@ -311,6 +335,18 @@
 // S-AARCH64-7: "{{.*}}/usr/lib{{/|}}crtbegin.o" "{{.*}}.o" "-lc"
 // S-AARCH64-7: "{{.*}}/usr/lib{{/|}}crtend.o" 
"{{.*}}/usr/lib{{/|}}crtn.o"
 
+// S-AARCH64_BE: clang{{.*}}" "-cc1" "-triple" "aarch64_be--netbsd"
+// S-AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
+// S-AARCH64_BE: "-o" "a.out" 

r291148 - Typo

2017-01-05 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Thu Jan  5 11:59:44 2017
New Revision: 291148

URL: http://llvm.org/viewvc/llvm-project?rev=291148=rev
Log:
Typo

Modified:
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=291148=291147=291148=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Thu Jan  5 11:59:44 2017
@@ -541,8 +541,8 @@ TEST_F(FormatTestJS, FunctionLiterals) {
"  foo();\n"
"  bar();\n"
"},\n"
-   "this, arg1IsReallyLongAndNeeedsLineBreaks,\n"
-   "arg3IsReallyLongAndNeeedsLineBreaks);");
+   "this, arg1IsReallyLongAndNeedsLineBreaks,\n"
+   "arg3IsReallyLongAndNeedsLineBreaks);");
   verifyFormat("var closure = goog.bind(function() {  // comment\n"
"  foo();\n"
"  bar();\n"


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


Re: r290533 - Driver: warn on -fPIC/-fpic/-fPIE/-fpie on Windows

2016-12-27 Thread Joerg Sonnenberger via cfe-commits
On Tue, Dec 27, 2016 at 12:41:08PM -0800, Saleem Abdulrasool wrote:
> Id really rather not change the behavior.  We would generate ELF style PIC,
> which obviously doesn't work.

That's not what I mean. I simply say that we should ignore
-fPIC/-fpic/-fPIE/-fpie on Windows, silently. The relality is that the
majority of the code triggering the warning wants to created PIC, which
is the default. So creating a warning for that seems silly at best.

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


Re: r290533 - Driver: warn on -fPIC/-fpic/-fPIE/-fpie on Windows

2016-12-27 Thread Joerg Sonnenberger via cfe-commits
On Mon, Dec 26, 2016 at 03:35:25AM -, Saleem Abdulrasool via cfe-commits 
wrote:
> Driver: warn on -fPIC/-fpic/-fPIE/-fpie on Windows

Can we please invert this behavior? Complain if the effective PIC mode
is not level 2 and silently ignore it otherwise? I find the MinGW
warnings to be highly annoying and verbose.

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


r289744 - Use PIC relocation mode by default for PowerPC64 ELF

2016-12-14 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Wed Dec 14 18:02:57 2016
New Revision: 289744

URL: http://llvm.org/viewvc/llvm-project?rev=289744=rev
Log:
Use PIC relocation mode by default for PowerPC64 ELF

Most of the PowerPC64 code generation already creates PIC access. This
changes to a full PIC default, similar to what GCC is doing.

Overall, a monolithic clang binary shrinks by 600KB (about 1%). This can
be a slight regression for TLS access and will use the TOC more
aggressively instead of synthesizing immediates. It is expected to be
performance neutral.

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

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/test/Driver/ppc-abi.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=289744=289743=289744=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Dec 14 18:02:57 2016
@@ -2879,7 +2879,15 @@ bool Generic_GCC::IsUnwindTablesDefault(
 }
 
 bool Generic_GCC::isPICDefault() const {
-  return getArch() == llvm::Triple::x86_64 && getTriple().isOSWindows();
+  switch (getArch()) {
+  case llvm::Triple::x86_64:
+return getTriple().isOSWindows();
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
+return !getTriple().isOSBinFormatMachO() && !getTriple().isMacOSX();
+  default:
+return false;
+  }
 }
 
 bool Generic_GCC::isPIEDefault() const { return false; }

Modified: cfe/trunk/test/Driver/ppc-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-abi.c?rev=289744=289743=289744=diff
==
--- cfe/trunk/test/Driver/ppc-abi.c (original)
+++ cfe/trunk/test/Driver/ppc-abi.c Wed Dec 14 18:02:57 2016
@@ -24,7 +24,10 @@
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
 // RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
 
+// CHECK-ELFv1: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1: "-target-abi" "elfv1"
+// CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv2: "-target-abi" "elfv2"
 


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


r288828 - Fix FileCheck pattern.

2016-12-06 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Dec  6 11:06:33 2016
New Revision: 288828

URL: http://llvm.org/viewvc/llvm-project?rev=288828=rev
Log:
Fix FileCheck pattern.

Modified:
cfe/trunk/test/Driver/compilation_database.c

Modified: cfe/trunk/test/Driver/compilation_database.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compilation_database.c?rev=288828=288827=288828=diff
==
--- cfe/trunk/test/Driver/compilation_database.c (original)
+++ cfe/trunk/test/Driver/compilation_database.c Tue Dec  6 11:06:33 2016
@@ -1,8 +1,8 @@
 // RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - 
2>&1 | FileCheck %s
 // RUN: not %clang -c -x c %s -MJ %s/non-existant 2>&1 | FileCheck 
--check-prefix=ERROR %s
 
-// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",.* "--target={{[^"]+}}"]},
-// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",.* "--target={{[^"]+}}"]},
+// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
+// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",{{.*}} "--target={{[^"]+}}"]},
 // ERROR: error: compilation database '{{.*}}/non-existant' could not be 
opened:
 
 int main(void) {


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


r288827 - Allow additional output since e.g. OSX appends flags like

2016-12-06 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Dec  6 11:02:41 2016
New Revision: 288827

URL: http://llvm.org/viewvc/llvm-project?rev=288827=rev
Log:
Allow additional output since e.g. OSX appends flags like
"-mlinker-version=264.3.102" automatically. Wiring down a target on the
other hand is problematic as this actually needs to run codegen and
doesn't work with -###.

Modified:
cfe/trunk/test/Driver/compilation_database.c

Modified: cfe/trunk/test/Driver/compilation_database.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compilation_database.c?rev=288827=288826=288827=diff
==
--- cfe/trunk/test/Driver/compilation_database.c (original)
+++ cfe/trunk/test/Driver/compilation_database.c Tue Dec  6 11:02:41 2016
@@ -1,8 +1,8 @@
 // RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - 
2>&1 | FileCheck %s
 // RUN: not %clang -c -x c %s -MJ %s/non-existant 2>&1 | FileCheck 
--check-prefix=ERROR %s
 
-// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall", "--target={{[^"]+}}"]},
-// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall", "--target={{[^"]+}}"]},
+// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",.* "--target={{[^"]+}}"]},
+// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall",.* "--target={{[^"]+}}"]},
 // ERROR: error: compilation database '{{.*}}/non-existant' could not be 
opened:
 
 int main(void) {


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


r288823 - Make test case slightly more robust by explicitly passing --sysroot.

2016-12-06 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Dec  6 10:47:00 2016
New Revision: 288823

URL: http://llvm.org/viewvc/llvm-project?rev=288823=rev
Log:
Make test case slightly more robust by explicitly passing --sysroot.
Otherwise it would change when DEFAULT_SYSROOT is provided.

Modified:
cfe/trunk/test/Driver/compilation_database.c

Modified: cfe/trunk/test/Driver/compilation_database.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compilation_database.c?rev=288823=288822=288823=diff
==
--- cfe/trunk/test/Driver/compilation_database.c (original)
+++ cfe/trunk/test/Driver/compilation_database.c Tue Dec  6 10:47:00 2016
@@ -1,8 +1,8 @@
-// RUN: %clang -MD -MP -c -x c %s -xc++ %s -Wall -MJ - 2>&1 | FileCheck %s
+// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - 
2>&1 | FileCheck %s
 // RUN: not %clang -c -x c %s -MJ %s/non-existant 2>&1 | FileCheck 
--check-prefix=ERROR %s
 
-// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "-c", "-Wall", "--target={{[^"]+}}"]},
-// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "-c", "-Wall", "--target={{[^"]+}}"]},
+// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall", "--target={{[^"]+}}"]},
+// CHECK: { "directory": "[[CWD:[^"]+]]",  "file": 
"[[SRC:[^"]+[/|\\]compilation_database.c]]", "output": 
"compilation_database.o", "arguments": ["{{[^"]*}}clang{{[^"]*}}", "-xc++", 
"[[SRC]]", "--sysroot=somewhere", "-c", "-Wall", "--target={{[^"]+}}"]},
 // ERROR: error: compilation database '{{.*}}/non-existant' could not be 
opened:
 
 int main(void) {


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


r288822 - If clang was configured for a DEFAULT_SYSROOT and no --sysroot argument

2016-12-06 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Dec  6 10:40:57 2016
New Revision: 288822

URL: http://llvm.org/viewvc/llvm-project?rev=288822=rev
Log:
If clang was configured for a DEFAULT_SYSROOT and no --sysroot argument
is seen, record one with the implicit default.

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=288822=288821=288822=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Dec  6 10:40:57 2016
@@ -4061,6 +4061,11 @@ void Clang::DumpCompilationDatabase(Comp
   Buf = "-x";
   Buf += types::getTypeName(Input.getType());
   CDB << ", \"" << escape(Buf) << "\"";
+  if (!D.SysRoot.empty() && !Args.hasArg(options::OPT__sysroot_EQ)) {
+Buf = "--sysroot=";
+Buf += D.SysRoot;
+CDB << ", \"" << escape(Buf) << "\"";
+  }
   CDB << ", \"" << escape(Input.getFilename()) << "\"";
   for (auto : Args) {
 auto  = A->getOption();


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


r288821 - Allow clang to write compilation database records.

2016-12-06 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Tue Dec  6 10:33:22 2016
New Revision: 288821

URL: http://llvm.org/viewvc/llvm-project?rev=288821=rev
Log:
Allow clang to write compilation database records.

When integrating compilation database output into existing build
systems, two approaches dominate so far. Ad-hoc implementation of the
JSON output rules or using compiler wrappers. This patch adds a new
option "-MJ foo.json" which gives a slightly cleaned up compilation
record. The output is a fragment, i.e. you still need to add the array
markers, but it allows multiple files to be easy merged.

This way the only change in a build system is adding the option with
potentially a per-target output file and merging the files with
something like
  (echo '['; cat *.o.json; echo ']' > compilation_database.json
or some additional filtering to remove the trailing comma for strict
JSON compliance.

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

Added:
cfe/trunk/test/Driver/compilation_database.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=288821=288820=288821=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Dec  6 10:33:22 
2016
@@ -87,6 +87,8 @@ def err_drv_clang_unsupported_opt_cxx_da
   "the clang compiler does not support '%0' for C++ on Darwin/i386">;
 def err_drv_command_failed : Error<
   "%0 command failed with exit code %1 (use -v to see invocation)">;
+def err_drv_compilationdatabase : Error<
+  "compilation database '%0' could not be opened: %1">;
 def err_drv_command_signalled : Error<
   "%0 command failed due to signal (use -v to see invocation)">;
 def err_drv_force_crash : Error<

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=288821=288820=288821=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Dec  6 10:33:22 2016
@@ -266,6 +266,8 @@ def MF : JoinedOrSeparate<["-"], "MF">,
 MetaVarName<"">;
 def MG : Flag<["-"], "MG">, Group, Flags<[CC1Option]>,
 HelpText<"Add missing headers to depfile">;
+def MJ : JoinedOrSeparate<["-"], "MJ">, Group,
+HelpText<"Write a compilation database entry per input">;
 def MP : Flag<["-"], "MP">, Group, Flags<[CC1Option]>,
 HelpText<"Create phony target for each dependency (other than main file)">;
 def MQ : JoinedOrSeparate<["-"], "MQ">, Group, Flags<[CC1Option]>,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=288821=288820=288821=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Dec  6 10:33:22 2016
@@ -40,9 +40,9 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Program.h"
-#include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/TargetParser.h"
+#include "llvm/Support/YAMLParser.h"
 
 #ifdef LLVM_ON_UNIX
 #include  // For getuid().
@@ -4030,6 +4030,60 @@ static void AddAssemblerKPIC(const ToolC
 CmdArgs.push_back("-KPIC");
 }
 
+void Clang::DumpCompilationDatabase(Compilation , StringRef Filename,
+StringRef Target, const InputInfo ,
+const InputInfo , const ArgList 
) const {
+  // If this is a dry run, do not create the compilation database file.
+  if (C.getArgs().hasArg(options::OPT__HASH_HASH_HASH))
+return;
+
+  using llvm::yaml::escape;
+  const Driver  = getToolChain().getDriver();
+
+  if (!CompilationDatabase) {
+std::error_code EC;
+auto File = llvm::make_unique(Filename, EC, 
llvm::sys::fs::F_Text);
+if (EC) {
+  D.Diag(clang::diag::err_drv_compilationdatabase) << Filename
+   << EC.message();
+  return;
+}
+CompilationDatabase = std::move(File);
+  }
+  auto  = *CompilationDatabase;
+  SmallString<128> Buf;
+  if (llvm::sys::fs::current_path(Buf))
+Buf = ".";
+  CDB << "{ \"directory\": \"" << escape(Buf) << "\"";
+  CDB << ", \"file\": \"" << escape(Input.getFilename()) << "\"";
+  CDB << ", \"output\": \"" << escape(Output.getFilename()) << "\"";
+  CDB << ", \"arguments\": [\"" << escape(D.ClangExecutable) << "\"";
+  Buf = "-x";
+  Buf += types::getTypeName(Input.getType());
+  CDB << ", \"" << escape(Buf) << 

r288436 - Extend CompilationDatabase by a field for the output filename

2016-12-01 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Thu Dec  1 17:37:45 2016
New Revision: 288436

URL: http://llvm.org/viewvc/llvm-project?rev=288436=rev
Log:
Extend CompilationDatabase by a field for the output filename

In bigger projects like an Operating System, the same source code is
often compiled in slightly different ways. This could be the difference
between PIC and non-PIC code for static vs dynamic libraries, it could
also be the difference between size optimised versions of tools for
ramdisk images. At the moment, the compilation database has no way to
distinguish such cases. As first step, add a field in the JSON format
for it and process it accordingly.

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

Modified:
cfe/trunk/docs/JSONCompilationDatabase.rst
cfe/trunk/include/clang/Tooling/CompilationDatabase.h
cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h
cfe/trunk/lib/Tooling/CompilationDatabase.cpp
cfe/trunk/lib/Tooling/JSONCompilationDatabase.cpp
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp

Modified: cfe/trunk/docs/JSONCompilationDatabase.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/JSONCompilationDatabase.rst?rev=288436=288435=288436=diff
==
--- cfe/trunk/docs/JSONCompilationDatabase.rst (original)
+++ cfe/trunk/docs/JSONCompilationDatabase.rst Thu Dec  1 17:37:45 2016
@@ -80,6 +80,9 @@ The contracts for each field in the comm
supported.
 -  **arguments:** The compile command executed as list of strings.
Either **arguments** or **command** is required.
+-  **output:** The name of the output created by this compilation step.
+   This field is optional. It can be used to distinguish different processing
+   modes of the same input file.
 
 Build System Integration
 

Modified: cfe/trunk/include/clang/Tooling/CompilationDatabase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/CompilationDatabase.h?rev=288436=288435=288436=diff
==
--- cfe/trunk/include/clang/Tooling/CompilationDatabase.h (original)
+++ cfe/trunk/include/clang/Tooling/CompilationDatabase.h Thu Dec  1 17:37:45 
2016
@@ -43,10 +43,11 @@ namespace tooling {
 struct CompileCommand {
   CompileCommand() {}
   CompileCommand(Twine Directory, Twine Filename,
- std::vector CommandLine)
+ std::vector CommandLine, Twine Output)
   : Directory(Directory.str()),
 Filename(Filename.str()),
-CommandLine(std::move(CommandLine)) {}
+CommandLine(std::move(CommandLine)),
+Output(Output.str()){}
 
   /// \brief The working directory the command was executed from.
   std::string Directory;
@@ -57,6 +58,9 @@ struct CompileCommand {
   /// \brief The command line that was executed.
   std::vector CommandLine;
 
+  /// The output file associated with the command.
+  std::string Output;
+
   /// \brief An optional mapping from each file's path to its content for all
   /// files needed for the compilation that are not available via the file
   /// system.

Modified: cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h?rev=288436=288435=288436=diff
==
--- cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h (original)
+++ cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h Thu Dec  1 
17:37:45 2016
@@ -103,15 +103,17 @@ private:
   /// failed.
   bool parse(std::string );
 
-  // Tuple (directory, filename, commandline) where 'commandline' points to the
-  // corresponding scalar nodes in the YAML stream.
+  // Tuple (directory, filename, commandline, output) where 'commandline'
+  // points to the corresponding scalar nodes in the YAML stream.
   // If the command line contains a single argument, it is a shell-escaped
   // command line.
   // Otherwise, each entry in the command line vector is a literal
   // argument to the compiler.
+  // The output field may be a nullptr.
   typedef std::tuple> CompileCommandRef;
+ std::vector,
+ llvm::yaml::ScalarNode *> CompileCommandRef;
 
   /// \brief Converts the given array of CompileCommandRefs to CompileCommands.
   void getCommands(ArrayRef CommandsRef,

Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=288436=288435=288436=diff
==
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Thu Dec  1 17:37:45 2016
@@ -300,7 +300,8 @@ FixedCompilationDatabase(Twine Directory
   ToolCommandLine.insert(ToolCommandLine.end(),

r287947 - Typo.

2016-11-25 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Fri Nov 25 14:15:57 2016
New Revision: 287947

URL: http://llvm.org/viewvc/llvm-project?rev=287947=rev
Log:
Typo.

Modified:
cfe/trunk/lib/Tooling/ArgumentsAdjusters.cpp

Modified: cfe/trunk/lib/Tooling/ArgumentsAdjusters.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ArgumentsAdjusters.cpp?rev=287947=287946=287947=diff
==
--- cfe/trunk/lib/Tooling/ArgumentsAdjusters.cpp (original)
+++ cfe/trunk/lib/Tooling/ArgumentsAdjusters.cpp Fri Nov 25 14:15:57 2016
@@ -17,7 +17,7 @@
 namespace clang {
 namespace tooling {
 
-/// Add -fsyntax-only option to the commnand line arguments.
+/// Add -fsyntax-only option to the command line arguments.
 ArgumentsAdjuster getClangSyntaxOnlyAdjuster() {
   return [](const CommandLineArguments , StringRef /*unused*/) {
 CommandLineArguments AdjustedArgs;


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


r287926 - Document the arguments form of commands.

2016-11-25 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Fri Nov 25 08:14:43 2016
New Revision: 287926

URL: http://llvm.org/viewvc/llvm-project?rev=287926=rev
Log:
Document the arguments form of commands.

Modified:
cfe/trunk/docs/JSONCompilationDatabase.rst

Modified: cfe/trunk/docs/JSONCompilationDatabase.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/JSONCompilationDatabase.rst?rev=287926=287925=287926=diff
==
--- cfe/trunk/docs/JSONCompilationDatabase.rst (original)
+++ cfe/trunk/docs/JSONCompilationDatabase.rst Fri Nov 25 08:14:43 2016
@@ -78,6 +78,8 @@ The contracts for each field in the comm
Parameters use shell quoting and shell escaping of quotes, with '``"``'
and '``\``' being the only special characters. Shell expansion is not
supported.
+-  **arguments:** The compile command executed as list of strings.
+   Either **arguments** or **command** is required.
 
 Build System Integration
 


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


r287847 - Spelling.

2016-11-23 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Wed Nov 23 19:24:38 2016
New Revision: 287847

URL: http://llvm.org/viewvc/llvm-project?rev=287847=rev
Log:
Spelling.

Modified:
cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h

Modified: cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h?rev=287847=287846=287847=diff
==
--- cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h (original)
+++ cfe/trunk/include/clang/Tooling/JSONCompilationDatabase.h Wed Nov 23 
19:24:38 2016
@@ -73,7 +73,7 @@ public:
   loadFromBuffer(StringRef DatabaseString, std::string ,
  JSONCommandLineSyntax Syntax);
 
-  /// \brief Returns all compile comamnds in which the specified file was
+  /// \brief Returns all compile commands in which the specified file was
   /// compiled.
   ///
   /// FIXME: Currently FilePath must be an absolute path inside the


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


[PATCH] D26636: patch for llvm/clang bug 25965, suppress warning diagnostic on float-to-bool conversion when in condition context

2016-11-18 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

Besides "it triggers on SPEC", why should the warning be disabled here? I think 
it is perfectly sensible to have a warning for all six conditional contexts 
here.


https://reviews.llvm.org/D26636



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


[PATCH] D26564: Use PIC relocation mode by default for PowerPC64 ELF

2016-11-11 Thread Joerg Sonnenberger via cfe-commits
joerg created this revision.
joerg added a reviewer: hfinkel.
joerg added a subscriber: cfe-commits.
Herald added a subscriber: nemanjai.

Most of the PowerPC64 code generation already creates PIC access. This changes 
to a full PIC default, similar to what GCC is doing.

Overall, a monolithic clang binary shrinks by 600KB (about 1%). This can be a 
slight regression for TLS access and will use the TOC more aggressively instead 
of synthesizing immediates. It is expected to be performance neutral.


https://reviews.llvm.org/D26564

Files:
  lib/Driver/ToolChains.cpp
  test/Driver/ppc-abi.c


Index: test/Driver/ppc-abi.c
===
--- test/Driver/ppc-abi.c
+++ test/Driver/ppc-abi.c
@@ -24,7 +24,10 @@
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
 // RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
 
+// CHECK-ELFv1: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1: "-target-abi" "elfv1"
+// CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv2: "-target-abi" "elfv2"
 
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2796,7 +2796,15 @@
 }
 
 bool Generic_GCC::isPICDefault() const {
-  return getArch() == llvm::Triple::x86_64 && getTriple().isOSWindows();
+  switch (getArch()) {
+  case llvm::Triple::x86_64:
+return getTriple().isOSWindows();
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
+return !getTriple().isOSBinFormatMachO() && !getTriple().isMacOSX();
+  default:
+return false;
+  }
 }
 
 bool Generic_GCC::isPIEDefault() const { return false; }


Index: test/Driver/ppc-abi.c
===
--- test/Driver/ppc-abi.c
+++ test/Driver/ppc-abi.c
@@ -24,7 +24,10 @@
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
 // RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
 
+// CHECK-ELFv1: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1: "-target-abi" "elfv1"
+// CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv2: "-target-abi" "elfv2"
 
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2796,7 +2796,15 @@
 }
 
 bool Generic_GCC::isPICDefault() const {
-  return getArch() == llvm::Triple::x86_64 && getTriple().isOSWindows();
+  switch (getArch()) {
+  case llvm::Triple::x86_64:
+return getTriple().isOSWindows();
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
+return !getTriple().isOSBinFormatMachO() && !getTriple().isMacOSX();
+  default:
+return false;
+  }
 }
 
 bool Generic_GCC::isPIEDefault() const { return false; }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r286376 - [Sparc] LLONG is not lock-free atomic on v8

2016-11-09 Thread Joerg Sonnenberger via cfe-commits
On Wed, Nov 09, 2016 at 03:43:52PM -, Douglas Katzman via cfe-commits wrote:
> Author: dougk
> Date: Wed Nov  9 09:43:51 2016
> New Revision: 286376
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=286376=rev
> Log:
> [Sparc] LLONG is not lock-free atomic on v8

Technically, even 32bit is lying for true V8.

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


[PATCH] D23657: Remove some false positives when taking the address of packed members

2016-11-03 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

It works for me with the mentioned TODO item. But I'm not the right one to give 
a full OK.


https://reviews.llvm.org/D23657



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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-31 Thread Joerg Sonnenberger via cfe-commits
On Mon, Oct 31, 2016 at 01:25:19PM -0700, Richard Smith wrote:
> We could alternatively control the language features based only on the
> selected language mode, and only use version detection to power a warning
> for the (currently fairly common, but becoming less so) case where the
> selected runtime library isn't new enough to implement the requested
> features. That would cause a bunch of scenarios to break when upgrading to
> clang 4.0, but at least the fix would be pretty clear.

Let's split this slightly. Ultimately, we need to have codegen flags to
control individual features that require support from the ABI
implementation or even just from the STL implementation. I can think of
three different ways to provide the default values:
(1) Language mode selection
(2) Driver logic based on the target
(3) Source controls like #pragma

The third option would serve mostly the same purpose as feature
detection based on some magic __version file, but it also would allow
non-libc++ implementations or -nostdinc use cases to get the same
behavior.

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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-31 Thread Joerg Sonnenberger via cfe-commits
On Mon, Oct 31, 2016 at 10:45:05AM -0700, Richard Smith via cfe-commits wrote:
> On Sun, Oct 30, 2016 at 12:32 PM, Joerg Sonnenberger  wrote:
> 
> > On Sun, Oct 30, 2016 at 12:54:28PM -0600, Eric Fiselier wrote:
> > > Richard requested this change. Take a look at
> > > https://reviews.llvm.org/D26044 for more rational.
> >
> > I don't see much rational and in fact, I disagree with some of the
> > mentioned items. E.g. presence of libc++ won't tell you if you can use
> > sized deallocation as that's a ABI library issue.
> 
> 
> The real situation is a lot more subtle than that. Every one of libc++abi,
> libcxxrt, libc++, libsupc++, and libstdc++ provides definitions of global
> operator new and operator delete. It's obviously not part of the Itanium
> C++ ABI, so it's not the responsibility of a pure "ABI library" to provide
> it, but the boundary between the ABI library and the standard library has
> never been formally defined.

That doesn't actually invalidate anything I said. But the make the
argument even more explicit: any detection based on magic files in the
include directories are breaking important properties. A preprocessed
file is now no longer independent of the build system.

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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-30 Thread Joerg Sonnenberger via cfe-commits
On Sun, Oct 30, 2016 at 01:49:53PM -0600, Eric Fiselier via cfe-commits wrote:
> >  E.g. presence of libc++ won't tell you if you can use sized deallocation
> > as that's a ABI library issue.
> 
>  The value of __libcpp_version could easily be updated by vendors to store
> the version of the system dylib,
> so I don't see why this wouldn't work.

As I said, this is not a decision based on the libc++ version. When we
start adding random extra flags to the version file, it makes the point
I'm raising even bigger: we are duplicating data and clang should not be
magically changing its behavior like that anyway.

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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-30 Thread Joerg Sonnenberger via cfe-commits
On Sun, Oct 30, 2016 at 12:54:28PM -0600, Eric Fiselier wrote:
> Richard requested this change. Take a look at
> https://reviews.llvm.org/D26044 for more rational.

I don't see much rational and in fact, I disagree with some of the
mentioned items. E.g. presence of libc++ won't tell you if you can use
sized deallocation as that's a ABI library issue. So, why again should
clang care about the libc++ version in advance?

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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-29 Thread Joerg Sonnenberger via cfe-commits
On Fri, Oct 28, 2016 at 06:06:50AM -, Eric Fiselier via cfe-commits wrote:
> Author: ericwf
> Date: Fri Oct 28 01:06:50 2016
> New Revision: 285382
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=285382=rev
> Log:
> Add __libcpp_version file and __libcpp_library_version function.

I really don't see why this is preferable over just checking __config or
the classic approach of including  and checking the macros.

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


[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-27 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

The __ namespace is shared between all parts of the implementation, not just 
the compiler. The convention in the past was that compiler keywords will end in 
a __ as well, but calling conventions and Objective C broke that convention. I 
still think it is something that should be avoided when possible.


https://reviews.llvm.org/D25204



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


[PATCH] D25204: Register Calling Convention, Clang changes

2016-10-26 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

Can we please avoid adding more (pseudo) keywords in the double-underscore name 
space? Those tend to be used a lot by existing libc implementations and 
existing attribute cases like __strong and __weak have created enough trouble.


https://reviews.llvm.org/D25204



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


[PATCH] D25008: [cmake] Split linked libraries into private & public, for linker script

2016-10-24 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

So the historical reason for the libgcc_s dance for glibc was the use of 
unwinding for thread cancellation. With all the glibc versions I can find, 
going back to SLES11 SP1, this is no longer the case. To check for yourself, 
look for _Unwind* symbols in libc.so and libc.a. Only findfde seems to be 
exposed now.

As such, I think we can avoid all this complexity.


Repository:
  rL LLVM

https://reviews.llvm.org/D25008



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


[PATCH] D25431: [libcxx] Convert Solaris support library to C++ to fix -std=c++11 build

2016-10-18 Thread Joerg Sonnenberger via cfe-commits
joerg accepted this revision.
joerg added a reviewer: joerg.
joerg added a comment.
This revision is now accepted and ready to land.

Commit the prototype fix separately, please.


https://reviews.llvm.org/D25431



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


[PATCH] D23657: Remove some false positives when taking the address of packed members

2016-10-18 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

I agree that leaving out the really complicated parts is acceptable for now. 
Can you mark the comment as TODO?


https://reviews.llvm.org/D23657



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


[PATCH] D23657: Remove some false positives when taking the address of packed members

2016-10-14 Thread Joerg Sonnenberger via cfe-commits
joerg added a comment.

It seems like on-stack arrays still don't work?

  #include 
  
  struct test {
uint32_t x;
  } __attribute__((__packed__));
  
  int main(void) {
struct test __attribute__((__aligned__(4))) a[4];
uint32_t *p32;
p32 = [0].x;
  }


https://reviews.llvm.org/D23657



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


Re: [libunwind] r284125 - [libunwind] Add missing include. NFC.

2016-10-13 Thread Joerg Sonnenberger via cfe-commits
On Thu, Oct 13, 2016 at 02:32:24PM -, Asiri Rathnayake via cfe-commits 
wrote:
> This missing include seems to cause compilation failures on older MacOS
> versions (< 10.9). This is because r270692 has introduced uint64_t into
> config.h without including this header.

But that would be inttypes.h, wouldn't it be?

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


[PATCH] D23657: Remove some false positives when taking the address of packed members

2016-10-12 Thread Joerg Sonnenberger via cfe-commits
joerg added inline comments.



Comment at: lib/Sema/SemaChecking.cpp:11370
+// we are here such increase has not been enough. So pointing the first
+// FieldDecl that either is packed orelse its RecordDecl is,
+// seems reasonable.

Missing space.


https://reviews.llvm.org/D23657



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


  1   2   3   >