Re: r319297 - Toolchain: Normalize dwarf, sjlj and seh eh

2017-12-01 Thread Martell Malone via cfe-commits
Just catching up on this now.
r319363 looks good to me, It makes little sense to use GNU SEH in that case.

My remaining concern is mostly about why we still need the workaround for
> x86 in the function getting the default (returning None instead of WinEH
> for that case). But as long as this works and the rest of this change can
> settle, we can look at that later if any further change is warranted at all.
>
It seemed to work fine but the sanitizer does not support this setup for
x86 quite yet.
It is a little outside my scope of focus right now so will probably come
back to it much later.


On Wed, Nov 29, 2017 at 2:07 PM, Martin Storsjö <mar...@martin.st> wrote:

> On Wed, 29 Nov 2017, Martin Storsjö via cfe-commits wrote:
>
> On Wed, 29 Nov 2017, Reid Kleckner wrote:
>>
>> On Wed, Nov 29, 2017 at 12:21 PM, Martin Storsjö <mar...@martin.st>
>>> wrote:
>>>   On Wed, 29 Nov 2017, Martell Malone via cfe-commits wrote:
>>> Thanks for letting me know Reid.
>>> I’ll in work and won’t be able to access the repo
>>> until lunch time. (~3
>>> hours)
>>> Feel free to revert if it is not trivial.
>>>
>>> The easy fix might be to change to == x86_64 from !=
>>> x86 For is Windows in
>>> the default toolchain. That should restore the old
>>> behavior.
>>>
>>>
>>>   My suggestion would be to just return None for all architectures
>>>   for the default windows (msvc) case. We didn't use to set any
>>>   defines to indicate EH mode there before anyway, so setting it
>>>   to None should make things behave just as before, right?
>>>
>>>
>>> I did this slightly differently in r319363, but maybe that's silly. My
>>> reasoning was that `clang -cc1 -fseh-exceptions -fexceptions` in the MSVC
>>> environment should still use __CxxFrameHandler3. -fseh-exceptions
>>> indicates
>>> what format of unwind information we should use, and we're still using
>>> the
>>> normal SEH .xdata opcodes.
>>>
>>
>> No, I think this change makes sense - I was just about to write a comment
>> pointing out this spot in the code but was waiting for a compile to finish
>> before posting.
>>
>> Alternatively, you could view -fseh-exceptions, -fdwarf-exceptions, and
>>> -fsjlj-exceptions as choices of EH personality function,
>>>
>>
>> No, I don't think that'd make sense
>>
>
> FWIW, another reason I don't think that makes sense, is that making a
> GNU_CPlusPlus_SEH + MSVC combination probably would require quite a bit
> more changes as well.
>
> When I tested the same in a build with assertions enabled, I didn't get
> the references to _Unwind_Resume as you did, but the compilation failed on
> some internal assertion. So making GNU_CPlusPlus_SEH usable with the
> microsoft C++ ABI would probably require a significant amount of more work,
> for very little value.
>
> // Martin
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r319297 - Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-29 Thread Martell Malone via cfe-commits
Thanks for letting me know Reid.
I’ll in work and won’t be able to access the repo until lunch time. (~3
hours)
Feel free to revert if it is not trivial.

The easy fix might be to change to == x86_64 from != x86 For is Windows in
the default toolchain. That should restore the old behavior.

I’m curious, is this in clang-cl mode?


On Wed 29 Nov 2017 at 10:12, Reid Kleckner <r...@google.com> wrote:

> I see a bunch of link errors that suggest we're using the wrong EH
> personality in MSVC mode now:
>
> FAILED: win_clang_nacl_win64/swiftshader/libEGL.dll
> win_clang_nacl_win64/swiftshader/libEGL.dll.lib
> win_clang_nacl_win64/swiftshader/libEGL.dll.pdb
> C:/b/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe
> ../../build/toolchain/win/tool_wrapper.py link-wrapper environment.x64
> False link.exe /nologo
> /IMPLIB:win_clang_nacl_win64/swiftshader/libEGL.dll.lib /DLL
> /OUT:win_clang_nacl_win64/swiftshader/libEGL.dll
> /PDB:win_clang_nacl_win64/swiftshader/libEGL.dll.pdb
> @win_clang_nacl_win64/swiftshader/libEGL.dll.rsp
> Config.obj : error LNK2001: unresolved external symbol _Unwind_Resume
> Display.obj : error LNK2001: unresolved external symbol _Unwind_Resume
> Surface.obj : error LNK2001: unresolved external symbol _Unwind_Resume
> Config.obj : error LNK2001: unresolved external symbol
> __gxx_personality_seh0
> Display.obj : error LNK2001: unresolved external symbol
> __gxx_personality_seh0
> Surface.obj : error LNK2001: unresolved external symbol
> __gxx_personality_seh0
>
> I'll dig in a bit to see if there's an easy fix.
>
> On Tue, Nov 28, 2017 at 11:25 PM, Martell Malone via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: martell
>> Date: Tue Nov 28 23:25:12 2017
>> New Revision: 319297
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=319297=rev
>> Log:
>> Toolchain: Normalize dwarf, sjlj and seh eh
>>
>> This is a re-apply of r319294.
>>
>> adds -fseh-exceptions and -fdwarf-exceptions flags
>>
>> clang will check if the user has specified an exception model flag,
>> in the absense of specifying the exception model clang will then check
>> the driver default and append the model flag for that target to cc1
>>
>> -fno-exceptions has a higher priority then specifying the model
>>
>> move __SEH__ macro definitions out of Targets into InitPreprocessor
>> behind the -fseh-exceptions flag
>>
>> move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
>> InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check
>>
>> remove unused USESEHExceptions from the MinGW Driver
>>
>> fold USESjLjExceptions into a new GetExceptionModel function that
>> gives the toolchain classes more flexibility with eh models
>>
>> Reviewers: rnk, mstorsjo
>>
>> Differential Revision: https://reviews.llvm.org/D39673
>>
>> Added:
>> cfe/trunk/test/CodeGenCXX/mingw-w64-exceptions.c
>> Modified:
>> cfe/trunk/docs/ClangCommandLineReference.rst
>> cfe/trunk/include/clang/Basic/LangOptions.def
>> cfe/trunk/include/clang/Driver/Options.td
>> cfe/trunk/include/clang/Driver/ToolChain.h
>> cfe/trunk/lib/Basic/Targets/ARM.cpp
>> cfe/trunk/lib/Basic/Targets/OSTargets.cpp
>> cfe/trunk/lib/Basic/Targets/OSTargets.h
>> cfe/trunk/lib/Basic/Targets/X86.h
>> cfe/trunk/lib/CodeGen/BackendUtil.cpp
>> cfe/trunk/lib/CodeGen/CGException.cpp
>> cfe/trunk/lib/Driver/ToolChain.cpp
>> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>> cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
>> cfe/trunk/lib/Driver/ToolChains/Darwin.h
>> cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
>> cfe/trunk/lib/Driver/ToolChains/FreeBSD.h
>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> cfe/trunk/lib/Driver/ToolChains/MinGW.h
>> cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
>> cfe/trunk/lib/Driver/ToolChains/NetBSD.h
>> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>> cfe/trunk/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp
>> cfe/trunk/test/Preprocessor/arm-target-features.c
>> cfe/trunk/test/Preprocessor/init.c
>>
>> Modified: cfe/trunk/docs/ClangCommandLineReference.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=319297=319296=319297=diff
>>
>> ==
>> --- cfe/trunk/docs/ClangCommandLineReference.rst (original)
>> +++ cfe/trunk/docs/ClangCommandLineReference.rst 

r319297 - Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-28 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Nov 28 23:25:12 2017
New Revision: 319297

URL: http://llvm.org/viewvc/llvm-project?rev=319297=rev
Log:
Toolchain: Normalize dwarf, sjlj and seh eh

This is a re-apply of r319294.

adds -fseh-exceptions and -fdwarf-exceptions flags

clang will check if the user has specified an exception model flag,
in the absense of specifying the exception model clang will then check
the driver default and append the model flag for that target to cc1

-fno-exceptions has a higher priority then specifying the model

move __SEH__ macro definitions out of Targets into InitPreprocessor
behind the -fseh-exceptions flag

move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check

remove unused USESEHExceptions from the MinGW Driver

fold USESjLjExceptions into a new GetExceptionModel function that
gives the toolchain classes more flexibility with eh models

Reviewers: rnk, mstorsjo

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

Added:
cfe/trunk/test/CodeGenCXX/mingw-w64-exceptions.c
Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/X86.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.h
cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
cfe/trunk/lib/Driver/ToolChains/FreeBSD.h
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h
cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
cfe/trunk/lib/Driver/ToolChains/NetBSD.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp
cfe/trunk/test/Preprocessor/arm-target-features.c
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=319297=319296=319297=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Tue Nov 28 23:25:12 2017
@@ -1706,10 +1706,18 @@ Which overload candidates to show when o
 
 Enable C++14 sized global deallocation functions
 
+.. option:: -fdwarf-exceptions
+
+Use DWARF style exceptions
+
 .. option:: -fsjlj-exceptions
 
 Use SjLj style exceptions
 
+.. option:: -fseh-exceptions
+
+Use SEH style exceptions
+
 .. option:: -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize
 
 Enable the superword-level parallelism vectorization passes

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=319297=319296=319297=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Nov 28 23:25:12 2017
@@ -124,7 +124,9 @@ LANGOPT(ZVector   , 1, 0, "Syste
 LANGOPT(Exceptions, 1, 0, "exception handling")
 LANGOPT(ObjCExceptions, 1, 0, "Objective-C exceptions")
 LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")
+LANGOPT(DWARFExceptions   , 1, 0, "dwarf exception handling")
 LANGOPT(SjLjExceptions, 1, 0, "setjmp-longjump exception handling")
+LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")
 LANGOPT(ExternCNoUnwind   , 1, 0, "Assume extern C functions don't unwind")
 LANGOPT(TraditionalCPP, 1, 0, "traditional CPP emulation")
 LANGOPT(RTTI  , 1, 1, "run-time type information")

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=319297=319296=319297=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Nov 28 23:25:12 2017
@@ -800,8 +800,12 @@ def fencoding_EQ : Joined<["-"], "fencod
 def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, 
Flags<[CoreOption]>;
 def fexceptions : Flag<["-"], "fexceptions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Enable support for exception handling">;
+def fdwarf_exceptions : Flag<["-"], "fdwarf-exceptions">, Group,
+  Flags<[CC1Option]>, HelpText<"Use DWARF style exceptions">;
 def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group,
   Flags<[CC1Option]>, HelpText<"Use SjLj 

r319295 - Revert "Toolchain: Normalize dwarf, sjlj and seh eh"

2017-11-28 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Nov 28 22:51:27 2017
New Revision: 319295

URL: http://llvm.org/viewvc/llvm-project?rev=319295=rev
Log:
Revert "Toolchain: Normalize dwarf, sjlj and seh eh"

This reverts rL319294.
The windows sanitizer does not like seh on x86.
Will re apply with None type for x86

Removed:
cfe/trunk/test/CodeGenCXX/mingw-w64-exceptions.c
Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/X86.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.h
cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
cfe/trunk/lib/Driver/ToolChains/FreeBSD.h
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h
cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
cfe/trunk/lib/Driver/ToolChains/NetBSD.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp
cfe/trunk/test/Preprocessor/arm-target-features.c
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=319295=319294=319295=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Tue Nov 28 22:51:27 2017
@@ -1706,18 +1706,10 @@ Which overload candidates to show when o
 
 Enable C++14 sized global deallocation functions
 
-.. option:: -fdwarf-exceptions
-
-Use DWARF style exceptions
-
 .. option:: -fsjlj-exceptions
 
 Use SjLj style exceptions
 
-.. option:: -fseh-exceptions
-
-Use SEH style exceptions
-
 .. option:: -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize
 
 Enable the superword-level parallelism vectorization passes

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=319295=319294=319295=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Nov 28 22:51:27 2017
@@ -124,9 +124,7 @@ LANGOPT(ZVector   , 1, 0, "Syste
 LANGOPT(Exceptions, 1, 0, "exception handling")
 LANGOPT(ObjCExceptions, 1, 0, "Objective-C exceptions")
 LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")
-LANGOPT(DWARFExceptions   , 1, 0, "dwarf exception handling")
 LANGOPT(SjLjExceptions, 1, 0, "setjmp-longjump exception handling")
-LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")
 LANGOPT(ExternCNoUnwind   , 1, 0, "Assume extern C functions don't unwind")
 LANGOPT(TraditionalCPP, 1, 0, "traditional CPP emulation")
 LANGOPT(RTTI  , 1, 1, "run-time type information")

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=319295=319294=319295=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Nov 28 22:51:27 2017
@@ -800,12 +800,8 @@ def fencoding_EQ : Joined<["-"], "fencod
 def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, 
Flags<[CoreOption]>;
 def fexceptions : Flag<["-"], "fexceptions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Enable support for exception handling">;
-def fdwarf_exceptions : Flag<["-"], "fdwarf-exceptions">, Group,
-  Flags<[CC1Option]>, HelpText<"Use DWARF style exceptions">;
 def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group,
   Flags<[CC1Option]>, HelpText<"Use SjLj style exceptions">;
-def fseh_exceptions : Flag<["-"], "fseh-exceptions">, Group,
-  Flags<[CC1Option]>, HelpText<"Use SEH style exceptions">;
 def fexcess_precision_EQ : Joined<["-"], "fexcess-precision=">,
 Group;
 def : Flag<["-"], "fexpensive-optimizations">, 
Group;

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=319295=319294=319295=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Nov 28 22:51:27 2017
@@ -397,9 +397,10 @@ public:
 return llvm::DebuggerKind::GDB;
   }
 
-  /// 

r319294 - Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-28 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Nov 28 22:25:13 2017
New Revision: 319294

URL: http://llvm.org/viewvc/llvm-project?rev=319294=rev
Log:
Toolchain: Normalize dwarf, sjlj and seh eh

adds -fseh-exceptions and -fdwarf-exceptions flags

clang will check if the user has specified an exception model flag,
in the absense of specifying the exception model clang will then check
the driver default and append the model flag for that target to cc1

clang cc1 assumes dwarf is the default if none is passed
and -fno-exceptions has a higher priority then specifying the model

move __SEH__ macro definitions out of Targets into InitPreprocessor
behind the -fseh-exceptions flag

move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check

remove unused USESEHExceptions from the MinGW Driver

fold USESjLjExceptions into a new GetExceptionModel function that
gives the toolchain classes more flexibility with eh models

Reviewers: rnk, mstorsjo

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

Added:
cfe/trunk/test/CodeGenCXX/mingw-w64-exceptions.c
Modified:
cfe/trunk/docs/ClangCommandLineReference.rst
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/X86.h
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
cfe/trunk/lib/Driver/ToolChains/Darwin.h
cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
cfe/trunk/lib/Driver/ToolChains/FreeBSD.h
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h
cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
cfe/trunk/lib/Driver/ToolChains/NetBSD.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp
cfe/trunk/test/Preprocessor/arm-target-features.c
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/docs/ClangCommandLineReference.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=319294=319293=319294=diff
==
--- cfe/trunk/docs/ClangCommandLineReference.rst (original)
+++ cfe/trunk/docs/ClangCommandLineReference.rst Tue Nov 28 22:25:13 2017
@@ -1706,10 +1706,18 @@ Which overload candidates to show when o
 
 Enable C++14 sized global deallocation functions
 
+.. option:: -fdwarf-exceptions
+
+Use DWARF style exceptions
+
 .. option:: -fsjlj-exceptions
 
 Use SjLj style exceptions
 
+.. option:: -fseh-exceptions
+
+Use SEH style exceptions
+
 .. option:: -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize
 
 Enable the superword-level parallelism vectorization passes

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=319294=319293=319294=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Tue Nov 28 22:25:13 2017
@@ -124,7 +124,9 @@ LANGOPT(ZVector   , 1, 0, "Syste
 LANGOPT(Exceptions, 1, 0, "exception handling")
 LANGOPT(ObjCExceptions, 1, 0, "Objective-C exceptions")
 LANGOPT(CXXExceptions , 1, 0, "C++ exceptions")
+LANGOPT(DWARFExceptions   , 1, 0, "dwarf exception handling")
 LANGOPT(SjLjExceptions, 1, 0, "setjmp-longjump exception handling")
+LANGOPT(SEHExceptions , 1, 0, "SEH .xdata exception handling")
 LANGOPT(ExternCNoUnwind   , 1, 0, "Assume extern C functions don't unwind")
 LANGOPT(TraditionalCPP, 1, 0, "traditional CPP emulation")
 LANGOPT(RTTI  , 1, 1, "run-time type information")

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=319294=319293=319294=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Nov 28 22:25:13 2017
@@ -800,8 +800,12 @@ def fencoding_EQ : Joined<["-"], "fencod
 def ferror_limit_EQ : Joined<["-"], "ferror-limit=">, Group, 
Flags<[CoreOption]>;
 def fexceptions : Flag<["-"], "fexceptions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Enable support for exception handling">;
+def fdwarf_exceptions : Flag<["-"], "fdwarf-exceptions">, Group,
+  Flags<[CC1Option]>, HelpText<"Use DWARF style exceptions">;
 def fsjlj_exceptions : Flag<["-"], "fsjlj-exceptions">, Group,
   

r318755 - [MINGW] normalize WIN32 macros

2017-11-21 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Nov 21 03:28:29 2017
New Revision: 318755

URL: http://llvm.org/viewvc/llvm-project?rev=318755=rev
Log:
[MINGW] normalize WIN32 macros

move _WIN64 and _WIN32 defines to lib/Basic/Targets/OSTargets.h
move WIN32, WIN64 and __MINGW64__ to addMinGWDefines

fixes __MINGW64__ not being defined for aarch64
adds WIN32 definition for x64

Reviewers: mstorsjo

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

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Basic/Targets.h
cfe/trunk/lib/Basic/Targets/AArch64.cpp
cfe/trunk/lib/Basic/Targets/AArch64.h
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/X86.h
cfe/trunk/test/Preprocessor/predefined-macros.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=318755=318754=318755=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Nov 21 03:28:29 2017
@@ -97,7 +97,14 @@ void addCygMingDefines(const LangOptions
   }
 }
 
-void addMinGWDefines(const LangOptions , MacroBuilder ) {
+void addMinGWDefines(const llvm::Triple , const LangOptions ,
+ MacroBuilder ) {
+  DefineStd(Builder, "WIN32", Opts);
+  DefineStd(Builder, "WINNT", Opts);
+  if (Triple.isArch64Bit()) {
+DefineStd(Builder, "WIN64", Opts);
+Builder.defineMacro("__MINGW64__");
+  }
   Builder.defineMacro("__MSVCRT__");
   Builder.defineMacro("__MINGW32__");
   addCygMingDefines(Opts, Builder);

Modified: cfe/trunk/lib/Basic/Targets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.h?rev=318755=318754=318755=diff
==
--- cfe/trunk/lib/Basic/Targets.h (original)
+++ cfe/trunk/lib/Basic/Targets.h Tue Nov 21 03:28:29 2017
@@ -40,7 +40,7 @@ void defineCPUMacros(clang::MacroBuilder
  bool Tuning = true);
 
 LLVM_LIBRARY_VISIBILITY
-void addMinGWDefines(const clang::LangOptions ,
+void addMinGWDefines(const llvm::Triple , const clang::LangOptions 
,
  clang::MacroBuilder );
 
 LLVM_LIBRARY_VISIBILITY

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=318755=318754=318755=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Tue Nov 21 03:28:29 2017
@@ -474,8 +474,6 @@ MicrosoftARM64TargetInfo::MicrosoftARM64
 void MicrosoftARM64TargetInfo::getVisualStudioDefines(
 const LangOptions , MacroBuilder ) const {
   WindowsTargetInfo::getVisualStudioDefines(Opts, 
Builder);
-  Builder.defineMacro("_WIN32", "1");
-  Builder.defineMacro("_WIN64", "1");
   Builder.defineMacro("_M_ARM64", "1");
 }
 
@@ -491,17 +489,6 @@ MinGWARM64TargetInfo::MinGWARM64TargetIn
   TheCXXABI.set(TargetCXXABI::GenericAArch64);
 }
 
-void MinGWARM64TargetInfo::getTargetDefines(const LangOptions ,
-MacroBuilder ) const {
-  WindowsTargetInfo::getTargetDefines(Opts, Builder);
-  Builder.defineMacro("_WIN32", "1");
-  Builder.defineMacro("_WIN64", "1");
-  Builder.defineMacro("WIN32", "1");
-  Builder.defineMacro("WIN64", "1");
-  addMinGWDefines(Opts, Builder);
-}
-
-
 DarwinAArch64TargetInfo::DarwinAArch64TargetInfo(const llvm::Triple ,
  const TargetOptions )
 : DarwinTargetInfo(Triple, Opts) {

Modified: cfe/trunk/lib/Basic/Targets/AArch64.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.h?rev=318755=318754=318755=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.h (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.h Tue Nov 21 03:28:29 2017
@@ -122,9 +122,6 @@ class LLVM_LIBRARY_VISIBILITY MinGWARM64
 : public WindowsARM64TargetInfo {
 public:
   MinGWARM64TargetInfo(const llvm::Triple , const TargetOptions );
-
-  void getTargetDefines(const LangOptions ,
-MacroBuilder ) const override;
 };
 
 class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=318755=318754=318755=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Tue Nov 21 03:28:29 2017
@@ -999,11 +999,8 @@ MinGWARMTargetInfo::MinGWARMTargetInfo(c
 void MinGWARMTargetInfo::getTargetDefines(const LangOptions ,
   MacroBuilder ) const {
   

r318736 - [MS] add an init test for thumbv7-windows-msvc

2017-11-21 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Nov 21 00:09:59 2017
New Revision: 318736

URL: http://llvm.org/viewvc/llvm-project?rev=318736=rev
Log:
[MS] add an init test for thumbv7-windows-msvc

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=318736=318735=318736=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Nov 21 00:09:59 2017
@@ -1438,6 +1438,11 @@
 // AARCH64-DARWIN: #define __WINT_WIDTH__ 32
 // AARCH64-DARWIN: #define __aarch64__ 1
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=thumbv7-windows-msvc < 
/dev/null | FileCheck -match-full-lines -check-prefix ARM-MSVC %s
+//
+// ARM-MSVC: #define _M_ARM_NT 1
+// ARM-MSVC: #define _WIN32 1
+
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-windows-msvc < 
/dev/null | FileCheck -match-full-lines -check-prefix AARCH64-MSVC %s
 //
 // AARCH64-MSVC: #define _INTEGRAL_MAX_BITS 64


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


r318608 - [Driver] add initial support for alpine linux

2017-11-18 Thread Martell Malone via cfe-commits
Author: martell
Date: Sat Nov 18 16:08:12 2017
New Revision: 318608

URL: http://llvm.org/viewvc/llvm-project?rev=318608=rev
Log:
[Driver] add initial support for alpine linux

set -pie as default for musl linux targets
add detection of alpine linux
append appropriate compile flags for alpine

Reviewers: rnk

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

Modified:
cfe/trunk/include/clang/Driver/Distro.h
cfe/trunk/lib/Driver/Distro.cpp
cfe/trunk/lib/Driver/ToolChains/Linux.cpp
cfe/trunk/test/Driver/pic.c

Modified: cfe/trunk/include/clang/Driver/Distro.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Distro.h?rev=318608=318607=318608=diff
==
--- cfe/trunk/include/clang/Driver/Distro.h (original)
+++ cfe/trunk/include/clang/Driver/Distro.h Sat Nov 18 16:08:12 2017
@@ -26,6 +26,7 @@ public:
 // NB: Releases of a particular Linux distro should be kept together
 // in this enum, because some tests are done by integer comparison against
 // the first and last known member in the family, e.g. IsRedHat().
+AlpineLinux,
 ArchLinux,
 DebianLenny,
 DebianSqueeze,
@@ -116,6 +117,10 @@ public:
 return DistroVal >= UbuntuHardy && DistroVal <= UbuntuBionic;
   }
 
+  bool IsAlpineLinux() const {
+return DistroVal == AlpineLinux;
+  }
+
   /// @}
 };
 

Modified: cfe/trunk/lib/Driver/Distro.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Distro.cpp?rev=318608=318607=318608=diff
==
--- cfe/trunk/lib/Driver/Distro.cpp (original)
+++ cfe/trunk/lib/Driver/Distro.cpp Sat Nov 18 16:08:12 2017
@@ -129,6 +129,9 @@ static Distro::DistroType DetectDistro(v
   if (VFS.exists("/etc/exherbo-release"))
 return Distro::Exherbo;
 
+  if (VFS.exists("/etc/alpine-release"))
+return Distro::AlpineLinux;
+
   if (VFS.exists("/etc/arch-release"))
 return Distro::ArchLinux;
 

Modified: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Linux.cpp?rev=318608=318607=318608=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp Sat Nov 18 16:08:12 2017
@@ -210,7 +210,12 @@ Linux::Linux(const Driver , const llvm
 
   Distro Distro(D.getVFS());
 
-  if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) {
+  if (Distro.IsAlpineLinux()) {
+ExtraOpts.push_back("-z");
+ExtraOpts.push_back("now");
+  }
+
+  if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
 ExtraOpts.push_back("-z");
 ExtraOpts.push_back("relro");
   }
@@ -232,7 +237,7 @@ Linux::Linux(const Driver , const llvm
   // Android loader does not support .gnu.hash.
   // Hexagon linker/loader does not support .gnu.hash
   if (!IsMips && !IsAndroid && !IsHexagon) {
-if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||
+if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
 (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
   ExtraOpts.push_back("--hash-style=gnu");
 
@@ -812,7 +817,7 @@ void Linux::AddIAMCUIncludeArgs(const Ar
 
 bool Linux::isPIEDefault() const {
   return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
- getSanitizerArgs().requiresPIE();
+  getTriple().isMusl() || getSanitizerArgs().requiresPIE();
 }
 
 SanitizerMask Linux::getSupportedSanitizers() const {

Modified: cfe/trunk/test/Driver/pic.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/pic.c?rev=318608=318607=318608=diff
==
--- cfe/trunk/test/Driver/pic.c (original)
+++ cfe/trunk/test/Driver/pic.c Sat Nov 18 16:08:12 2017
@@ -152,6 +152,22 @@
 // RUN: %clang %s -target i386-unknown-linux -shared -pie -### 2>&1 \
 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIE
 //
+// On Musl Linux, PIE is enabled by default, but can be disabled.
+// RUN: %clang -c %s -target x86_64-linux-musl -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target i686-linux-musl -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target armv6-linux-musleabihf -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang -c %s -target armv7-linux-musleabihf -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+// RUN: %clang %s -target x86_64-linux-musl -nopie -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIE
+// RUN: %clang %s -target x86_64-linux-musl -pie -nopie -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-NO-PIE
+// RUN: %clang %s -target x86_64-linux-musl -nopie -pie -### 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=CHECK-PIE2
+//
 // Darwin is a 

r317398 - CodeGenCXX: no default dllimport storage for mingw

2017-11-03 Thread Martell Malone via cfe-commits
Author: martell
Date: Fri Nov  3 19:15:49 2017
New Revision: 317398

URL: http://llvm.org/viewvc/llvm-project?rev=317398=rev
Log:
CodeGenCXX: no default dllimport storage for mingw

GNU frontends don't have options like /MT, /MD
This fixes a few link error regressions with libc++ and libc++abi

Reviewers: rnk, mstorsjo, compnerd

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

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=317398=317397=317398=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Nov  3 19:15:49 2017
@@ -2284,7 +2284,8 @@ CodeGenModule::CreateRuntimeFunction(llv
   F->setCallingConv(getRuntimeCC());
 
   if (!Local && getTriple().isOSBinFormatCOFF() &&
-  !getCodeGenOpts().LTOVisibilityPublicStd) {
+  !getCodeGenOpts().LTOVisibilityPublicStd &&
+  !getTriple().isWindowsGNUEnvironment()) {
 const FunctionDecl *FD = GetRuntimeFunctionDecl(Context, Name);
 if (!FD || FD->hasAttr()) {
   F->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);

Modified: cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp?rev=317398=317397=317398=diff
==
--- cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/runtime-dllstorage.cpp Fri Nov  3 19:15:49 2017
@@ -12,7 +12,7 @@
 // %clang_cc1 -triple i686-windows-itanium -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -fno-use-cxa-atexit -emit-llvm 
-o - %s | FileCheck %s -check-prefix CHECK-IA -check-prefix CHECK-DYNAMIC-IA 
-check-prefix CHECK-DYNAMIC-IA-ATEXIT
 // %clang_cc1 -triple i686-windows-itanium -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -fno-use-cxa-atexit -emit-llvm 
-o - %s | FileCheck %s -check-prefix CHECK-IA -check-prefix CHECK-STATIC-IA 
-check-prefix CHECK-STATIC-IA-ATEXIT
 
-// RUN: %clang_cc1 -triple i686-windows-gnu -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck 
%s -check-prefix CHECK-IA -check-prefix CHECK-DYNAMIC-IA
+// RUN: %clang_cc1 -triple i686-windows-gnu -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck 
%s -check-prefix CHECK-IA -check-prefix CHECK-STATIC-IA
 // RUN: %clang_cc1 -triple i686-windows-gnu -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -flto-visibility-public-std 
-emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-IA -check-prefix 
CHECK-STATIC-IA
 // RUN: %clang_cc1 -triple i686-windows-cygnus -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck 
%s -check-prefix CHECK-IA -check-prefix CHECK-DYNAMIC-IA
 // RUN: %clang_cc1 -triple i686-windows-cygnus -std=c++11 -fdeclspec 
-fms-compatibility -fexceptions -fcxx-exceptions -flto-visibility-public-std 
-emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-IA -check-prefix 
CHECK-STATIC-IA


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


r317397 - [Driver] MinGW: Remove custom linker detection

2017-11-03 Thread Martell Malone via cfe-commits
Author: martell
Date: Fri Nov  3 19:07:59 2017
New Revision: 317397

URL: http://llvm.org/viewvc/llvm-project?rev=317397=rev
Log:
[Driver] MinGW: Remove custom linker detection

This is a re-apply of rL313082 which was reverted in rL313088

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

rL289668 added no test cases and the mingw driver was either overlooked
or purposefully skipped because it has some custom linker tests
Removing them here because they are covered by the generic case.

Reviewers: rnk

Differntial Revision: https://reviews.llvm.org/D37727

Removed:
cfe/trunk/test/Driver/mingw-useld.c
Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=317397=317396=317397=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Fri Nov  3 19:07:59 2017
@@ -107,14 +107,6 @@ void tools::MinGW::Linker::ConstructJob(
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
-  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
-  if (LinkerName.equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-  } else if (!LinkerName.equals_lower("ld")) {
-D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
-  }
-
   if (!D.SysRoot.empty())
 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
@@ -244,7 +236,7 @@ void tools::MinGW::Linker::ConstructJob(
 
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");
-  else if (!LinkerName.equals_lower("lld"))
+  else
 AddLibGCC(Args, CmdArgs);
 }
 
@@ -255,7 +247,7 @@ void tools::MinGW::Linker::ConstructJob(
   CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
 }
   }
-  const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
+  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 

Removed: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=317396=auto
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c (removed)
@@ -1,19 +0,0 @@
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
-// CHECK_LD_32: ld{{(.exe)?}}"
-// CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "-flavor" "gnu"
-
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
-// CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
-// CHECK_LLD_32: "i386pe"
-
-// RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
-// CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
-// CHECK_LLD_64: "i386pep"
-
-// RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
-// CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
-// CHECK_LLD_ARM: "thumb2pe"


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


r315868 - Fix test case regresstion from rL315864

2017-10-15 Thread Martell Malone via cfe-commits
Author: martell
Date: Sun Oct 15 11:01:28 2017
New Revision: 315868

URL: http://llvm.org/viewvc/llvm-project?rev=315868=rev
Log:
Fix test case regresstion from rL315864

The patch should have been checking against STDCXX17 not STDCXX14.

Modified:
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=315868=315867=315868=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Sun Oct 15 11:01:28 2017
@@ -521,7 +521,7 @@
 // STDCXX14: -std=c++14
 
 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | 
FileCheck -check-prefix=STDCXX17 %s
-// STDCXX14: -std=c++17
+// STDCXX17: -std=c++17
 
 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | 
FileCheck -check-prefix=STDCXXLATEST %s
 // STDCXXLATEST: -std=c++2a


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


r315867 - Driver: use ld64.lld when -fuse-ld=lld for darwin

2017-10-15 Thread Martell Malone via cfe-commits
Author: martell
Date: Sun Oct 15 10:53:45 2017
New Revision: 315867

URL: http://llvm.org/viewvc/llvm-project?rev=315867=rev
Log:
Driver: use ld64.lld when -fuse-ld=lld for darwin

When using lld on macOS the current level of detection between ld and
ld64 forces us to rename lld to ld.

For ELF targets we have the ld.lld alias so for MACHO we should have
ld64.lld so we can use lld without replacing the system compiler.

This also solves the additional issue of cross compiling for MACHO
where renaming lld to ld with only target ELF.

This is the clang driver component change to use this new alias.

Reviewers: ruiu, rnk

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

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

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=315867=315866=315867=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Sun Oct 15 10:53:45 2017
@@ -390,7 +390,11 @@ std::string ToolChain::GetLinkerPath() c
 // then use whatever the default system linker is.
 return GetProgramPath(getDefaultLinker());
   } else {
-llvm::SmallString<8> LinkerName("ld.");
+llvm::SmallString<8> LinkerName;
+if (Triple.isOSDarwin())
+  LinkerName.append("ld64.");
+else
+  LinkerName.append("ld.");
 LinkerName.append(UseLinker);
 
 std::string LinkerPath(GetProgramPath(LinkerName.c_str()));


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


r315864 - [driver] [cl] Add/fix c++17/c++latest

2017-10-15 Thread Martell Malone via cfe-commits
Author: martell
Date: Sun Oct 15 10:27:58 2017
New Revision: 315864

URL: http://llvm.org/viewvc/llvm-project?rev=315864=rev
Log:
[driver] [cl] Add/fix c++17/c++latest

Patch by: daxpedda

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

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=315864=315863=315864=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sun Oct 15 10:27:58 2017
@@ -4075,7 +4075,8 @@ void Clang::ConstructJob(Compilation ,
 if (const Arg *StdArg = Args.getLastArg(options::OPT__SLASH_std)) {
   LanguageStandard = llvm::StringSwitch(StdArg->getValue())
  .Case("c++14", "-std=c++14")
- .Case("c++latest", "-std=c++1z")
+ .Case("c++17", "-std=c++17")
+ .Case("c++latest", "-std=c++2a")
  .Default("");
   if (LanguageStandard.empty())
 D.Diag(clang::diag::warn_drv_unused_argument)

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=315864=315863=315864=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Sun Oct 15 10:27:58 2017
@@ -520,8 +520,11 @@
 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | 
FileCheck -check-prefix=STDCXX14 %s
 // STDCXX14: -std=c++14
 
+// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | 
FileCheck -check-prefix=STDCXX17 %s
+// STDCXX14: -std=c++17
+
 // RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | 
FileCheck -check-prefix=STDCXXLATEST %s
-// STDCXXLATEST: -std=c++1z
+// STDCXXLATEST: -std=c++2a
 
 // RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck 
-check-prefix=ENV-CL %s
 // ENV-CL: "-ffunction-sections"


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


Re: r313104 - Revert "[Driver] MinGW: Remove custom linker detection"

2017-09-12 Thread Martell Malone via cfe-commits
Just to follow up,
The test case here was added by yaron in https://reviews.llvm.org/rL253066
As a follow up to the original detection which I originally wrote and reid
reviewed https://reviews.llvm.org/rL242121
Given that no other target does special checks except msvc for lld-link
removing this test case might also be an option.

On Wed, Sep 13, 2017 at 2:54 AM, Martell Malone <martellmal...@gmail.com>
wrote:

> Hey Reid, Rui,
>
> I had to revert this twice. I'm not sure where the configurations for the
> build bots are but there are 2 issues as I mentioned in the commit message
>
> Looking through the clang test directory I only se -fuse-ld=lld tested in
> 4 locations
>
> test/Driver/windows-cross.c does some really old tests like
> `-fuse-ld=lld-link2` which was back when Rui had just started the new COFF
> linker. (maybe we should remove / update these ? )
> test/Driver/cl-link.c which checks that for cl -fuse-ld=lld is converted
> to lld-link and not ld.lld
> test/Driver/cl-options.c just checks an error showing LTO that requires
> -fuse-ld=lld
> and in
> test/Driver/mingw-useld.c where we run into our errors.
>
> So to begin there does not seem to be any checking for lld in the test
> suite because it is not properly tested anywhere (from a clang perspective).
>
> For the first error `error: invalid linker name in argument '-fuse-ld=lld'`
> I'm not sure exactly how to add requirements to the lit tooling, I did a
> few greps build only came up with target checks.
> but do you know where I would look to implement something like this?
> `// REQUIRES: lld`
>
> As for the second issue.
>
> lld-link.exe: warning: ignoring unknown argument: -fuse-ld=lld
>
> I can't confirm but it seems like a configuration with the buildbot itself.
> Possibly related to setting LLD_SYMLINKS_TO_CREATE within the bot itself
> or some bat file on the system itself for symlinking?
>
> I don't think it is clang itself that is doing this because the only place
> where lld is remapped to lld-link is in lib/Driver/ToolChains/MSVC.cpp
> and that is only for msvc targets with a testcase in test/Driver/cl-link.c
>
> Best,
> Martell
>
>
> On Wed, Sep 13, 2017 at 1:57 AM, Martell Malone via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: martell
>> Date: Tue Sep 12 17:57:50 2017
>> New Revision: 313104
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=313104=rev
>> Log:
>> Revert "[Driver] MinGW: Remove custom linker detection"
>>
>> This reverts rL313102 because it still fails some build bot tests.
>>
>> On many linux bots it fails with the following error.
>> error: invalid linker name in argument '-fuse-ld=lld'
>> and on some windows bots also because there is no ld.lld.exe
>> lld-link.exe: warning: ignoring unknown argument: -fuse-ld=lld
>>
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> cfe/trunk/test/Driver/mingw-useld.c
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.cpp?rev=313104=313103=313104=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 17:57:50 2017
>> @@ -104,6 +104,14 @@ void tools::MinGW::Linker::ConstructJob(
>>// handled somewhere else.
>>Args.ClaimAllArgs(options::OPT_w);
>>
>> +  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
>> "ld");
>> +  if (LinkerName.equals_lower("lld")) {
>> +CmdArgs.push_back("-flavor");
>> +CmdArgs.push_back("gnu");
>> +  } else if (!LinkerName.equals_lower("ld")) {
>> +D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>> +  }
>> +
>>if (!D.SysRoot.empty())
>>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>>
>> @@ -233,7 +241,7 @@ void tools::MinGW::Linker::ConstructJob(
>>
>>if (Args.hasArg(options::OPT_static))
>>  CmdArgs.push_back("--end-group");
>> -  else
>> +  else if (!LinkerName.equals_lower("lld"))
>>  AddLibGCC(Args, CmdArgs);
>>  }
>>
>> @@ -244,7 +252,7 @@ void tools::MinGW::Linker::ConstructJob(
>>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
>>  }
>>}
>> -  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
>> +  const char *Exec = Args

Re: r313104 - Revert "[Driver] MinGW: Remove custom linker detection"

2017-09-12 Thread Martell Malone via cfe-commits
Hey Reid, Rui,

I had to revert this twice. I'm not sure where the configurations for the
build bots are but there are 2 issues as I mentioned in the commit message

Looking through the clang test directory I only se -fuse-ld=lld tested in 4
locations

test/Driver/windows-cross.c does some really old tests like
`-fuse-ld=lld-link2` which was back when Rui had just started the new COFF
linker. (maybe we should remove / update these ? )
test/Driver/cl-link.c which checks that for cl -fuse-ld=lld is converted
to lld-link and not ld.lld
test/Driver/cl-options.c just checks an error showing LTO that requires
-fuse-ld=lld
and in
test/Driver/mingw-useld.c where we run into our errors.

So to begin there does not seem to be any checking for lld in the test
suite because it is not properly tested anywhere (from a clang perspective).

For the first error `error: invalid linker name in argument '-fuse-ld=lld'`
I'm not sure exactly how to add requirements to the lit tooling, I did a
few greps build only came up with target checks.
but do you know where I would look to implement something like this?
`// REQUIRES: lld`

As for the second issue.

lld-link.exe: warning: ignoring unknown argument: -fuse-ld=lld

I can't confirm but it seems like a configuration with the buildbot itself.
Possibly related to setting LLD_SYMLINKS_TO_CREATE within the bot itself or
some bat file on the system itself for symlinking?

I don't think it is clang itself that is doing this because the only place
where lld is remapped to lld-link is in lib/Driver/ToolChains/MSVC.cpp
and that is only for msvc targets with a testcase in test/Driver/cl-link.c

Best,
Martell

On Wed, Sep 13, 2017 at 1:57 AM, Martell Malone via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: martell
> Date: Tue Sep 12 17:57:50 2017
> New Revision: 313104
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313104=rev
> Log:
> Revert "[Driver] MinGW: Remove custom linker detection"
>
> This reverts rL313102 because it still fails some build bot tests.
>
> On many linux bots it fails with the following error.
> error: invalid linker name in argument '-fuse-ld=lld'
> and on some windows bots also because there is no ld.lld.exe
> lld-link.exe: warning: ignoring unknown argument: -fuse-ld=lld
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
> cfe/trunk/test/Driver/mingw-useld.c
>
> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
> lChains/MinGW.cpp?rev=313104=313103=313104=diff
> 
> ==
> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 17:57:50 2017
> @@ -104,6 +104,14 @@ void tools::MinGW::Linker::ConstructJob(
>// handled somewhere else.
>Args.ClaimAllArgs(options::OPT_w);
>
> +  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
> "ld");
> +  if (LinkerName.equals_lower("lld")) {
> +CmdArgs.push_back("-flavor");
> +CmdArgs.push_back("gnu");
> +  } else if (!LinkerName.equals_lower("ld")) {
> +D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
> +  }
> +
>if (!D.SysRoot.empty())
>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>
> @@ -233,7 +241,7 @@ void tools::MinGW::Linker::ConstructJob(
>
>if (Args.hasArg(options::OPT_static))
>  CmdArgs.push_back("--end-group");
> -  else
> +  else if (!LinkerName.equals_lower("lld"))
>  AddLibGCC(Args, CmdArgs);
>  }
>
> @@ -244,7 +252,7 @@ void tools::MinGW::Linker::ConstructJob(
>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
>  }
>}
> -  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
> +  const char *Exec = Args.MakeArgString(TC.GetProgr
> amPath(LinkerName.data()));
>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs,
> Inputs));
>  }
>
>
> Modified: cfe/trunk/test/Driver/mingw-useld.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mi
> ngw-useld.c?rev=313104=313103=313104=diff
> 
> ==
> --- cfe/trunk/test/Driver/mingw-useld.c (original)
> +++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 17:57:50 2017
> @@ -1,19 +1,19 @@
> -// RUN: %clang -### -target i686-pc-windows-gnu -fuse-ld=platform
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
> -check-prefix=CHECK_LD_32 %s
> -// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
> +// RUN: %clang -### -target i686-pc-windows-gnu
> --sy

r313104 - Revert "[Driver] MinGW: Remove custom linker detection"

2017-09-12 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Sep 12 17:57:50 2017
New Revision: 313104

URL: http://llvm.org/viewvc/llvm-project?rev=313104=rev
Log:
Revert "[Driver] MinGW: Remove custom linker detection"

This reverts rL313102 because it still fails some build bot tests.

On many linux bots it fails with the following error.
error: invalid linker name in argument '-fuse-ld=lld'
and on some windows bots also because there is no ld.lld.exe
lld-link.exe: warning: ignoring unknown argument: -fuse-ld=lld

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=313104=313103=313104=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 17:57:50 2017
@@ -104,6 +104,14 @@ void tools::MinGW::Linker::ConstructJob(
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
+  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
+  if (LinkerName.equals_lower("lld")) {
+CmdArgs.push_back("-flavor");
+CmdArgs.push_back("gnu");
+  } else if (!LinkerName.equals_lower("ld")) {
+D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
+  }
+
   if (!D.SysRoot.empty())
 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
@@ -233,7 +241,7 @@ void tools::MinGW::Linker::ConstructJob(
 
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");
-  else
+  else if (!LinkerName.equals_lower("lld"))
 AddLibGCC(Args, CmdArgs);
 }
 
@@ -244,7 +252,7 @@ void tools::MinGW::Linker::ConstructJob(
   CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
 }
   }
-  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
+  const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=313104=313103=313104=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 17:57:50 2017
@@ -1,19 +1,19 @@
-// RUN: %clang -### -target i686-pc-windows-gnu -fuse-ld=platform 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
-// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
+// CHECK_LD_32: ld{{(.exe)?}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LD_32-NOT: "-flavor" "gnu"
 
-// RUN: %clang -### -target i686-pc-windows-gnu -fuse-ld=lld 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
 // CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
 // CHECK_LLD_32: "i386pe"
 
-// RUN: %clang -### -target x86_64-pc-windows-gnu -fuse-ld=lld 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
+// RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
 // CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
 // CHECK_LLD_64: "i386pep"
 
-// RUN: %clang -### -target arm-pc-windows-gnu -fuse-ld=lld 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
+// RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
 // CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
 // CHECK_LLD_ARM: "thumb2pe"


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


r313102 - [Driver] MinGW: Remove custom linker detection

2017-09-12 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Sep 12 17:46:54 2017
New Revision: 313102

URL: http://llvm.org/viewvc/llvm-project?rev=313102=rev
Log:
[Driver] MinGW: Remove custom linker detection

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

This is a re-apply of rL313082 which was reverted in rL313088
due to failing buildbot tests.

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

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=313102=313101=313102=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 17:46:54 2017
@@ -104,14 +104,6 @@ void tools::MinGW::Linker::ConstructJob(
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
-  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
-  if (LinkerName.equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-  } else if (!LinkerName.equals_lower("ld")) {
-D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
-  }
-
   if (!D.SysRoot.empty())
 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
@@ -241,7 +233,7 @@ void tools::MinGW::Linker::ConstructJob(
 
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");
-  else if (!LinkerName.equals_lower("lld"))
+  else
 AddLibGCC(Args, CmdArgs);
 }
 
@@ -252,7 +244,7 @@ void tools::MinGW::Linker::ConstructJob(
   CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
 }
   }
-  const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
+  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=313102=313101=313102=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 17:46:54 2017
@@ -1,19 +1,19 @@
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
-// CHECK_LD_32: ld{{(.exe)?}}"
+// RUN: %clang -### -target i686-pc-windows-gnu -fuse-ld=platform 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
+// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "-flavor" "gnu"
+// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
 
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
+// RUN: %clang -### -target i686-pc-windows-gnu -fuse-ld=lld 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
 // CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
 // CHECK_LLD_32: "i386pe"
 
-// RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
+// RUN: %clang -### -target x86_64-pc-windows-gnu -fuse-ld=lld 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
 // CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_64: "{{[^"]*}}ld.lld{{(.exe)?}}"
 // CHECK_LLD_64: "i386pep"
 
-// RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
+// RUN: %clang -### -target arm-pc-windows-gnu -fuse-ld=lld 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
 // CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_ARM: "{{[^"]*}}ld.lld{{(.exe)?}}"
 // CHECK_LLD_ARM: "thumb2pe"


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


Re: r313088 - Revert "[Driver] MinGW: Remove custom linker detection"

2017-09-12 Thread Martell Malone via cfe-commits
Just incase anyone comes here wondering why.
The thread for the original patch `r313082 - [Driver] MinGW: Remove custom
linker detection` here on cfe-commits explains why.


On Wed, Sep 13, 2017 at 12:05 AM, Rui Ueyama <r...@google.com> wrote:

> I wonder why you reverted this change.
>
> On Tue, Sep 12, 2017 at 4:04 PM, Martell Malone <martellmal...@gmail.com>
> wrote:
>
>> Will do in future, thanks Rui.
>>
>> On Wed, Sep 13, 2017 at 12:03 AM, Rui Ueyama <r...@google.com> wrote:
>>
>>> When you revert a commit, please explain why you are reverting it in the
>>> commit message.
>>>
>>> On Tue, Sep 12, 2017 at 3:58 PM, Martell Malone via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
>>>> Author: martell
>>>> Date: Tue Sep 12 15:58:12 2017
>>>> New Revision: 313088
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=313088=rev
>>>> Log:
>>>> Revert "[Driver] MinGW: Remove custom linker detection"
>>>>
>>>> This reverts rL313082
>>>>
>>>> Modified:
>>>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>>> cfe/trunk/test/Driver/mingw-useld.c
>>>>
>>>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>>>> lChains/MinGW.cpp?rev=313088=313087=313088=diff
>>>> 
>>>> ==
>>>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>>>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:58:12 2017
>>>> @@ -104,6 +104,14 @@ void tools::MinGW::Linker::ConstructJob(
>>>>// handled somewhere else.
>>>>Args.ClaimAllArgs(options::OPT_w);
>>>>
>>>> +  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
>>>> "ld");
>>>> +  if (LinkerName.equals_lower("lld")) {
>>>> +CmdArgs.push_back("-flavor");
>>>> +CmdArgs.push_back("gnu");
>>>> +  } else if (!LinkerName.equals_lower("ld")) {
>>>> +D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>>>> +  }
>>>> +
>>>>if (!D.SysRoot.empty())
>>>>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>>>>
>>>> @@ -233,7 +241,7 @@ void tools::MinGW::Linker::ConstructJob(
>>>>
>>>>if (Args.hasArg(options::OPT_static))
>>>>  CmdArgs.push_back("--end-group");
>>>> -  else
>>>> +  else if (!LinkerName.equals_lower("lld"))
>>>>  AddLibGCC(Args, CmdArgs);
>>>>  }
>>>>
>>>> @@ -244,7 +252,7 @@ void tools::MinGW::Linker::ConstructJob(
>>>>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend
>>>> .o")));
>>>>  }
>>>>}
>>>> -  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
>>>> +  const char *Exec = Args.MakeArgString(TC.GetProgr
>>>> amPath(LinkerName.data()));
>>>>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs,
>>>> Inputs));
>>>>  }
>>>>
>>>>
>>>> Modified: cfe/trunk/test/Driver/mingw-useld.c
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mi
>>>> ngw-useld.c?rev=313088=313087=313088=diff
>>>> 
>>>> ==
>>>> --- cfe/trunk/test/Driver/mingw-useld.c (original)
>>>> +++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 15:58:12 2017
>>>> @@ -1,19 +1,19 @@
>>>> -// RUN: %clang -### -target i686-pc-windows-gnu
>>>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=platform 2>&1
>>>> | FileCheck -check-prefix=CHECK_LD_32 %s
>>>> -// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
>>>> +// RUN: %clang -### -target i686-pc-windows-gnu
>>>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
>>>> -check-prefix=CHECK_LD_32 %s
>>>> +// CHECK_LD_32: ld{{(.exe)?}}"
>>>>  // CHECK_LD_32: "i386pe"
>>>> -// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
>>>> +// CHECK_LD_32-NOT: "-flavor"

Re: r313082 - [Driver] MinGW: Remove custom linker detection

2017-09-12 Thread Martell Malone via cfe-commits
cc @rui this is why I reverted it.

On Wed, Sep 13, 2017 at 12:00 AM, Martell Malone <martellmal...@gmail.com>
wrote:

> Hi Mike,
>
> I reverted this for now, I assume it has to do with the argument ordering.
> Will try a change and re apply.
>
> Many Thanks,
> Martell
>
> On Tue, Sep 12, 2017 at 11:57 PM, Martell Malone <martellmal...@gmail.com>
> wrote:
>
>> Hi Mike,
>>
>> I actually posted this in the phab thread a few minutes ago.
>>
>> ```
>> Tests for this pass locally but the build bots are complaining with
>>
>> // CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
>>  ^
>> :1:1: note: scanning from here
>> clang version 6.0.0 (trunk 313082)
>> ^
>> :5:51: note: possible intended match here
>> clang-6.0: error: invalid linker name in argument '-fuse-ld=lld'
>>
>>
>> Can someone enlighten me before I do a revert? :)
>> ```
>>
>> Best,
>> Martell
>>
>> On Tue, Sep 12, 2017 at 11:54 PM, Mike Edwards <m...@sqlby.me> wrote:
>>
>>> Hi,
>>> Would you please have a look at:
>>> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-in
>>> cremental/42380/
>>>
>>> it appears this commit is causing some tests to fail on our bots.  Any
>>> assistance you may provide in getting the bots back green would be greatly
>>> appreciated.
>>>
>>> Respectfully,
>>> Mike Edwards
>>>
>>> On Tue, Sep 12, 2017 at 3:14 PM, Martell Malone via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
>>>> Author: martell
>>>> Date: Tue Sep 12 15:14:18 2017
>>>> New Revision: 313082
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=313082=rev
>>>> Log:
>>>> [Driver] MinGW: Remove custom linker detection
>>>>
>>>> In rL289668 the ability to specify the default linker at compile time
>>>> was added but because the MinGW driver used custom detection we could
>>>> not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.
>>>>
>>>> Modified:
>>>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>>> cfe/trunk/test/Driver/mingw-useld.c
>>>>
>>>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>>>> lChains/MinGW.cpp?rev=313082=313081=313082=diff
>>>> 
>>>> ==
>>>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>>>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:14:18 2017
>>>> @@ -104,14 +104,6 @@ void tools::MinGW::Linker::ConstructJob(
>>>>// handled somewhere else.
>>>>Args.ClaimAllArgs(options::OPT_w);
>>>>
>>>> -  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
>>>> "ld");
>>>> -  if (LinkerName.equals_lower("lld")) {
>>>> -CmdArgs.push_back("-flavor");
>>>> -CmdArgs.push_back("gnu");
>>>> -  } else if (!LinkerName.equals_lower("ld")) {
>>>> -D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>>>> -  }
>>>> -
>>>>if (!D.SysRoot.empty())
>>>>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>>>>
>>>> @@ -241,7 +233,7 @@ void tools::MinGW::Linker::ConstructJob(
>>>>
>>>>if (Args.hasArg(options::OPT_static))
>>>>  CmdArgs.push_back("--end-group");
>>>> -  else if (!LinkerName.equals_lower("lld"))
>>>> +  else
>>>>  AddLibGCC(Args, CmdArgs);
>>>>  }
>>>>
>>>> @@ -252,7 +244,7 @@ void tools::MinGW::Linker::ConstructJob(
>>>>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend
>>>> .o")));
>>>>  }
>>>>}
>>>> -  const char *Exec = Args.MakeArgString(TC.GetProgr
>>>> amPath(LinkerName.data()));
>>>> +  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
>>>>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs,
>>>> Inputs));
>>>>  }
>>>>
>>>>
>>>> Modified: cfe/trunk/test/Driver/mingw-useld.c
>>>> URL: http://llvm.org/view

Re: r313088 - Revert "[Driver] MinGW: Remove custom linker detection"

2017-09-12 Thread Martell Malone via cfe-commits
Will do in future, thanks Rui.

On Wed, Sep 13, 2017 at 12:03 AM, Rui Ueyama <r...@google.com> wrote:

> When you revert a commit, please explain why you are reverting it in the
> commit message.
>
> On Tue, Sep 12, 2017 at 3:58 PM, Martell Malone via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: martell
>> Date: Tue Sep 12 15:58:12 2017
>> New Revision: 313088
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=313088=rev
>> Log:
>> Revert "[Driver] MinGW: Remove custom linker detection"
>>
>> This reverts rL313082
>>
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> cfe/trunk/test/Driver/mingw-useld.c
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.cpp?rev=313088=313087=313088=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:58:12 2017
>> @@ -104,6 +104,14 @@ void tools::MinGW::Linker::ConstructJob(
>>// handled somewhere else.
>>Args.ClaimAllArgs(options::OPT_w);
>>
>> +  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
>> "ld");
>> +  if (LinkerName.equals_lower("lld")) {
>> +CmdArgs.push_back("-flavor");
>> +CmdArgs.push_back("gnu");
>> +  } else if (!LinkerName.equals_lower("ld")) {
>> +D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>> +  }
>> +
>>if (!D.SysRoot.empty())
>>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>>
>> @@ -233,7 +241,7 @@ void tools::MinGW::Linker::ConstructJob(
>>
>>if (Args.hasArg(options::OPT_static))
>>  CmdArgs.push_back("--end-group");
>> -  else
>> +  else if (!LinkerName.equals_lower("lld"))
>>  AddLibGCC(Args, CmdArgs);
>>  }
>>
>> @@ -244,7 +252,7 @@ void tools::MinGW::Linker::ConstructJob(
>>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
>>  }
>>}
>> -  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
>> +  const char *Exec = Args.MakeArgString(TC.GetProgr
>> amPath(LinkerName.data()));
>>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs,
>> Inputs));
>>  }
>>
>>
>> Modified: cfe/trunk/test/Driver/mingw-useld.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mi
>> ngw-useld.c?rev=313088=313087=313088=diff
>> 
>> ==
>> --- cfe/trunk/test/Driver/mingw-useld.c (original)
>> +++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 15:58:12 2017
>> @@ -1,19 +1,19 @@
>> -// RUN: %clang -### -target i686-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=platform 2>&1 |
>> FileCheck -check-prefix=CHECK_LD_32 %s
>> -// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
>> +// RUN: %clang -### -target i686-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
>> -check-prefix=CHECK_LD_32 %s
>> +// CHECK_LD_32: ld{{(.exe)?}}"
>>  // CHECK_LD_32: "i386pe"
>> -// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
>> +// CHECK_LD_32-NOT: "-flavor" "gnu"
>>
>>  // RUN: %clang -### -target i686-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
>> FileCheck -check-prefix=CHECK_LLD_32 %s
>>  // CHECK_LLD_32-NOT: invalid linker name in argument
>> -// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
>> +// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
>>  // CHECK_LLD_32: "i386pe"
>>
>>  // RUN: %clang -### -target x86_64-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
>> FileCheck -check-prefix=CHECK_LLD_64 %s
>>  // CHECK_LLD_64-NOT: invalid linker name in argument
>> -// CHECK_LLD_64: "{{[^"]*}}ld.lld{{(.exe)?}}"
>> +// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
>>  // CHECK_LLD_64: "i386pep"
>>
>>  // RUN: %clang -### -target arm-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
>> FileCheck -check-prefix=CHECK_LLD_ARM %s
>>  // CHECK_LLD_ARM-NOT: invalid linker name in argument
>> -// CHECK_LLD_ARM: "{{[^"]*}}ld.lld{{(.exe)?}}"
>> +// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
>>  // CHECK_LLD_ARM: "thumb2pe"
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r313082 - [Driver] MinGW: Remove custom linker detection

2017-09-12 Thread Martell Malone via cfe-commits
Hi Mike,

I reverted this for now, I assume it has to do with the argument ordering.
Will try a change and re apply.

Many Thanks,
Martell

On Tue, Sep 12, 2017 at 11:57 PM, Martell Malone <martellmal...@gmail.com>
wrote:

> Hi Mike,
>
> I actually posted this in the phab thread a few minutes ago.
>
> ```
> Tests for this pass locally but the build bots are complaining with
>
> // CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
>  ^
> :1:1: note: scanning from here
> clang version 6.0.0 (trunk 313082)
> ^
> :5:51: note: possible intended match here
> clang-6.0: error: invalid linker name in argument '-fuse-ld=lld'
>
>
> Can someone enlighten me before I do a revert? :)
> ```
>
> Best,
> Martell
>
> On Tue, Sep 12, 2017 at 11:54 PM, Mike Edwards <m...@sqlby.me> wrote:
>
>> Hi,
>> Would you please have a look at:
>> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-in
>> cremental/42380/
>>
>> it appears this commit is causing some tests to fail on our bots.  Any
>> assistance you may provide in getting the bots back green would be greatly
>> appreciated.
>>
>> Respectfully,
>> Mike Edwards
>>
>> On Tue, Sep 12, 2017 at 3:14 PM, Martell Malone via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: martell
>>> Date: Tue Sep 12 15:14:18 2017
>>> New Revision: 313082
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=313082=rev
>>> Log:
>>> [Driver] MinGW: Remove custom linker detection
>>>
>>> In rL289668 the ability to specify the default linker at compile time
>>> was added but because the MinGW driver used custom detection we could
>>> not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.
>>>
>>> Modified:
>>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>> cfe/trunk/test/Driver/mingw-useld.c
>>>
>>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>>> lChains/MinGW.cpp?rev=313082=313081=313082=diff
>>> 
>>> ==
>>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:14:18 2017
>>> @@ -104,14 +104,6 @@ void tools::MinGW::Linker::ConstructJob(
>>>// handled somewhere else.
>>>Args.ClaimAllArgs(options::OPT_w);
>>>
>>> -  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
>>> "ld");
>>> -  if (LinkerName.equals_lower("lld")) {
>>> -CmdArgs.push_back("-flavor");
>>> -CmdArgs.push_back("gnu");
>>> -  } else if (!LinkerName.equals_lower("ld")) {
>>> -D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>>> -  }
>>> -
>>>if (!D.SysRoot.empty())
>>>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>>>
>>> @@ -241,7 +233,7 @@ void tools::MinGW::Linker::ConstructJob(
>>>
>>>if (Args.hasArg(options::OPT_static))
>>>  CmdArgs.push_back("--end-group");
>>> -  else if (!LinkerName.equals_lower("lld"))
>>> +  else
>>>  AddLibGCC(Args, CmdArgs);
>>>  }
>>>
>>> @@ -252,7 +244,7 @@ void tools::MinGW::Linker::ConstructJob(
>>>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend
>>> .o")));
>>>  }
>>>}
>>> -  const char *Exec = Args.MakeArgString(TC.GetProgr
>>> amPath(LinkerName.data()));
>>> +  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
>>>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs,
>>> Inputs));
>>>  }
>>>
>>>
>>> Modified: cfe/trunk/test/Driver/mingw-useld.c
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mi
>>> ngw-useld.c?rev=313082=313081=313082=diff
>>> 
>>> ==
>>> --- cfe/trunk/test/Driver/mingw-useld.c (original)
>>> +++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 15:14:18 2017
>>> @@ -1,19 +1,19 @@
>>> -// RUN: %clang -### -target i686-pc-windows-gnu
>>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
>>> -check-prefix=CHECK_LD_32 %s
>>> -//

r313088 - Revert "[Driver] MinGW: Remove custom linker detection"

2017-09-12 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Sep 12 15:58:12 2017
New Revision: 313088

URL: http://llvm.org/viewvc/llvm-project?rev=313088=rev
Log:
Revert "[Driver] MinGW: Remove custom linker detection"

This reverts rL313082

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=313088=313087=313088=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:58:12 2017
@@ -104,6 +104,14 @@ void tools::MinGW::Linker::ConstructJob(
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
+  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
+  if (LinkerName.equals_lower("lld")) {
+CmdArgs.push_back("-flavor");
+CmdArgs.push_back("gnu");
+  } else if (!LinkerName.equals_lower("ld")) {
+D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
+  }
+
   if (!D.SysRoot.empty())
 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
@@ -233,7 +241,7 @@ void tools::MinGW::Linker::ConstructJob(
 
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");
-  else
+  else if (!LinkerName.equals_lower("lld"))
 AddLibGCC(Args, CmdArgs);
 }
 
@@ -244,7 +252,7 @@ void tools::MinGW::Linker::ConstructJob(
   CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
 }
   }
-  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
+  const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=313088=313087=313088=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 15:58:12 2017
@@ -1,19 +1,19 @@
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=platform 2>&1 | 
FileCheck -check-prefix=CHECK_LD_32 %s
-// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
+// CHECK_LD_32: ld{{(.exe)?}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LD_32-NOT: "-flavor" "gnu"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
 // CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
 // CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
 // CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: "{{[^"]*}}ld.lld{{(.exe)?}}"
+// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
 // CHECK_LLD_ARM: "thumb2pe"


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


Re: r313082 - [Driver] MinGW: Remove custom linker detection

2017-09-12 Thread Martell Malone via cfe-commits
Hi Mike,

I actually posted this in the phab thread a few minutes ago.

```
Tests for this pass locally but the build bots are complaining with

// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
 ^
:1:1: note: scanning from here
clang version 6.0.0 (trunk 313082)
^
:5:51: note: possible intended match here
clang-6.0: error: invalid linker name in argument '-fuse-ld=lld'


Can someone enlighten me before I do a revert? :)
```

Best,
Martell

On Tue, Sep 12, 2017 at 11:54 PM, Mike Edwards <m...@sqlby.me> wrote:

> Hi,
> Would you please have a look at:
> http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-
> incremental/42380/
>
> it appears this commit is causing some tests to fail on our bots.  Any
> assistance you may provide in getting the bots back green would be greatly
> appreciated.
>
> Respectfully,
> Mike Edwards
>
> On Tue, Sep 12, 2017 at 3:14 PM, Martell Malone via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: martell
>> Date: Tue Sep 12 15:14:18 2017
>> New Revision: 313082
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=313082=rev
>> Log:
>> [Driver] MinGW: Remove custom linker detection
>>
>> In rL289668 the ability to specify the default linker at compile time
>> was added but because the MinGW driver used custom detection we could
>> not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.
>>
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> cfe/trunk/test/Driver/mingw-useld.c
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.cpp?rev=313082=313081=313082=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:14:18 2017
>> @@ -104,14 +104,6 @@ void tools::MinGW::Linker::ConstructJob(
>>// handled somewhere else.
>>Args.ClaimAllArgs(options::OPT_w);
>>
>> -  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
>> "ld");
>> -  if (LinkerName.equals_lower("lld")) {
>> -CmdArgs.push_back("-flavor");
>> -CmdArgs.push_back("gnu");
>> -  } else if (!LinkerName.equals_lower("ld")) {
>> -D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
>> -  }
>> -
>>if (!D.SysRoot.empty())
>>  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>>
>> @@ -241,7 +233,7 @@ void tools::MinGW::Linker::ConstructJob(
>>
>>if (Args.hasArg(options::OPT_static))
>>  CmdArgs.push_back("--end-group");
>> -  else if (!LinkerName.equals_lower("lld"))
>> +  else
>>  AddLibGCC(Args, CmdArgs);
>>  }
>>
>> @@ -252,7 +244,7 @@ void tools::MinGW::Linker::ConstructJob(
>>CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
>>  }
>>}
>> -  const char *Exec = Args.MakeArgString(TC.GetProgr
>> amPath(LinkerName.data()));
>> +  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
>>C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs,
>> Inputs));
>>  }
>>
>>
>> Modified: cfe/trunk/test/Driver/mingw-useld.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mi
>> ngw-useld.c?rev=313082=313081=313082=diff
>> 
>> ==
>> --- cfe/trunk/test/Driver/mingw-useld.c (original)
>> +++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 15:14:18 2017
>> @@ -1,19 +1,19 @@
>> -// RUN: %clang -### -target i686-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
>> -check-prefix=CHECK_LD_32 %s
>> -// CHECK_LD_32: ld{{(.exe)?}}"
>> +// RUN: %clang -### -target i686-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=platform 2>&1 |
>> FileCheck -check-prefix=CHECK_LD_32 %s
>> +// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
>>  // CHECK_LD_32: "i386pe"
>> -// CHECK_LD_32-NOT: "-flavor" "gnu"
>> +// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
>>
>>  // RUN: %clang -### -target i686-pc-windows-gnu
>> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
>> FileCheck -check-prefix=CHECK_LLD_32 %s
>>  // CHECK_LLD_32-

[libcxx] r313084 - libcxx: fix merge_archives error variable name

2017-09-12 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Sep 12 15:32:02 2017
New Revision: 313084

URL: http://llvm.org/viewvc/llvm-project?rev=313084=rev
Log:
libcxx: fix merge_archives error variable name

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

Modified:
libcxx/trunk/utils/merge_archives.py

Modified: libcxx/trunk/utils/merge_archives.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/merge_archives.py?rev=313084=313083=313084=diff
==
--- libcxx/trunk/utils/merge_archives.py (original)
+++ libcxx/trunk/utils/merge_archives.py Tue Sep 12 15:32:02 2017
@@ -120,7 +120,7 @@ def main():
 
 files = glob.glob(os.path.join(temp_directory_root, '*.o*'))
 if not files:
-print_and_exit('Failed to glob for %s' % glob_path)
+print_and_exit('Failed to glob for %s' % temp_directory_root)
 cmd = [ar_exe, '-qc', args.output] + files
 execute_command_verbose(cmd, cwd=temp_directory_root, verbose=args.verbose)
 


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


r313082 - [Driver] MinGW: Remove custom linker detection

2017-09-12 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Sep 12 15:14:18 2017
New Revision: 313082

URL: http://llvm.org/viewvc/llvm-project?rev=313082=rev
Log:
[Driver] MinGW: Remove custom linker detection

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=313082=313081=313082=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Sep 12 15:14:18 2017
@@ -104,14 +104,6 @@ void tools::MinGW::Linker::ConstructJob(
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
-  StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
-  if (LinkerName.equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-  } else if (!LinkerName.equals_lower("ld")) {
-D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
-  }
-
   if (!D.SysRoot.empty())
 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
@@ -241,7 +233,7 @@ void tools::MinGW::Linker::ConstructJob(
 
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");
-  else if (!LinkerName.equals_lower("lld"))
+  else
 AddLibGCC(Args, CmdArgs);
 }
 
@@ -252,7 +244,7 @@ void tools::MinGW::Linker::ConstructJob(
   CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
 }
   }
-  const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
+  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
   C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=313082=313081=313082=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Tue Sep 12 15:14:18 2017
@@ -1,19 +1,19 @@
-// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
-// CHECK_LD_32: ld{{(.exe)?}}"
+// RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=platform 2>&1 | 
FileCheck -check-prefix=CHECK_LD_32 %s
+// CHECK_LD_32: "{{[^"]*}}ld{{(.exe)?}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "-flavor" "gnu"
+// CHECK_LD_32-NOT: "{{[^"]*}}ld.lld{{(.exe)?}}"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
 // CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_32: "{{[^"]*}}ld.lld{{(.exe)?}}"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
 // CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_64: "{{[^"]*}}ld.lld{{(.exe)?}}"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
 // CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: lld{{(.exe)?}}" "-flavor" "gnu"
+// CHECK_LLD_ARM: "{{[^"]*}}ld.lld{{(.exe)?}}"
 // CHECK_LLD_ARM: "thumb2pe"


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


[libcxxabi] r304664 - [libcxxabi] HandleLLVMOptions in out of tree build

2017-06-03 Thread Martell Malone via cfe-commits
Author: martell
Date: Sat Jun  3 12:23:19 2017
New Revision: 304664

URL: http://llvm.org/viewvc/llvm-project?rev=304664=rev
Log:
[libcxxabi] HandleLLVMOptions in out of tree build

Differential revision: https://reviews.llvm.org/D33753

Modified:
libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake

Modified: libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=304664=304663=304664=diff
==
--- libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)
+++ libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Sat Jun  3 12:23:19 
2017
@@ -93,6 +93,7 @@ macro(configure_out_of_tree_llvm)
   endif()
   if (LLVM_FOUND)
 include(AddLLVM OPTIONAL)
+include(HandleLLVMOptions OPTIONAL)
   endif()
 
   # LLVM Options --


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


[libcxxabi] r304374 - [libcxxabi] Rework CMakeLists.txt into modules

2017-05-31 Thread Martell Malone via cfe-commits
Author: martell
Date: Wed May 31 19:09:20 2017
New Revision: 304374

URL: http://llvm.org/viewvc/llvm-project?rev=304374=rev
Log:
[libcxxabi] Rework CMakeLists.txt into modules

Refactor cmake to remove dependence on LLVM's cmake modules.
This improves handling of cmake checks when cross compiling and brings
libcxxabi in line with libcxx and other project modules.

Differential revision: https://reviews.llvm.org/D33635

Added:
libcxxabi/trunk/cmake/Modules/HandleLibcxxabiFlags.cmake
libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
libcxxabi/trunk/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
Modified:
libcxxabi/trunk/CMakeLists.txt
libcxxabi/trunk/src/CMakeLists.txt

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=304374=304373=304374=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Wed May 31 19:09:20 2017
@@ -1,3 +1,5 @@
+# See www/CMake.html for instructions on how to build libcxxabi with CMake.
+
 
#===
 # Setup Project
 
#===
@@ -16,121 +18,28 @@ set(CMAKE_MODULE_PATH
   )
 
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
-  project(libcxxabi)
-
-  # Rely on llvm-config.
-  set(CONFIG_OUTPUT)
-  if (NOT LLVM_CONFIG_PATH)
-find_program(LLVM_CONFIG_PATH "llvm-config")
-  endif()
-  if(DEFINED LLVM_PATH)
-set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
-set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
-set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
-set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
-  elseif(LLVM_CONFIG_PATH)
-message(STATUS "Found LLVM_CONFIG_PATH as ${LLVM_CONFIG_PATH}")
-set(CONFIG_COMMAND ${LLVM_CONFIG_PATH}
-  "--includedir"
-  "--prefix"
-  "--src-root")
-execute_process(
-  COMMAND ${CONFIG_COMMAND}
-  RESULT_VARIABLE HAD_ERROR
-  OUTPUT_VARIABLE CONFIG_OUTPUT
-)
-if(NOT HAD_ERROR)
-  string(REGEX REPLACE
-"[ \t]*[\r\n]+[ \t]*" ";"
-CONFIG_OUTPUT ${CONFIG_OUTPUT})
-else()
-  string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
-  message(STATUS "${CONFIG_COMMAND_STR}")
-  message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
-endif()
-
-list(GET CONFIG_OUTPUT 0 INCLUDE_DIR)
-list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT)
-list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR)
-
-set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
-set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
-set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source 
tree")
-set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py")
-
-# --cmakedir is supported since llvm r291218 (4.0 release)
-execute_process(
-  COMMAND ${LLVM_CONFIG_PATH} --cmakedir
-  RESULT_VARIABLE HAD_ERROR
-  OUTPUT_VARIABLE CONFIG_OUTPUT
-  ERROR_QUIET)
-if(NOT HAD_ERROR)
-  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
-else()
-  set(LLVM_CMAKE_PATH
-  "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
-endif()
-  else()
-message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not 
defined. "
-"Reconfigure with 
-DLLVM_CONFIG_PATH=path/to/llvm-config "
-"or -DLLVM_PATH=path/to/llvm-source-root.")
-  endif()
-
-  if(EXISTS ${LLVM_CMAKE_PATH})
-list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
-include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
-include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
-  else()
-message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}")
-  endif()
+  project(libcxxabi CXX C)
 
   set(PACKAGE_NAME libcxxabi)
   set(PACKAGE_VERSION 5.0.0svn)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
   set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 
-  if (NOT DEFINED LLVM_INCLUDE_TESTS)
-set(LLVM_INCLUDE_TESTS ON)
-  endif()
-
-  if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
-set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
-  else()
-# Seek installed Lit.
-find_program(LLVM_LIT "lit.py" ${LLVM_MAIN_SRC_DIR}/utils/lit
-  DOC "Path to lit.py")
-  endif()
-
-  if(LLVM_LIT)
-# Define the default arguments to use with 'lit', and an option for the 
user
-# to override.
-set(LIT_ARGS_DEFAULT "-sv")
-if (MSVC OR XCODE)
-  set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
-endif()
-set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for 
lit")
-
-# On Win32 hosts, provide an option to specify the path to the GnuWin32 
tools.
-if( WIN32 AND NOT CYGWIN )
-  set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 

[libcxxabi] r304110 - [libcxxabi] Disable DLL annotations on static

2017-05-28 Thread Martell Malone via cfe-commits
Author: martell
Date: Sun May 28 17:46:50 2017
New Revision: 304110

URL: http://llvm.org/viewvc/llvm-project?rev=304110=rev
Log:
[libcxxabi] Disable DLL annotations on static

rL288692 renames
_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT to
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS

Modified:
libcxxabi/trunk/CMakeLists.txt

Modified: libcxxabi/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=304110=304109=304110=diff
==
--- libcxxabi/trunk/CMakeLists.txt (original)
+++ libcxxabi/trunk/CMakeLists.txt Sun May 28 17:46:50 2017
@@ -322,7 +322,7 @@ add_definitions(-D_LIBCXXABI_BUILDING_LI
 
 # Disable DLL annotations on Windows for static builds.
 if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
-  add_definitions(-D_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
+  add_definitions(-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
 endif()
 
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_WERROR_FLAG 
-Werror=return-type)


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


[libcxxabi] r304026 - [libcxxabi] iconv is not needed for mingw-w64

2017-05-26 Thread Martell Malone via cfe-commits
Author: martell
Date: Fri May 26 14:39:39 2017
New Revision: 304026

URL: http://llvm.org/viewvc/llvm-project?rev=304026=rev
Log:
[libcxxabi] iconv is not needed for mingw-w64

Modified:
libcxxabi/trunk/cmake/config-ix.cmake

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=304026=304025=304026=diff
==
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Fri May 26 14:39:39 2017
@@ -36,7 +36,7 @@ if (LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
   set(MINGW_RUNTIME gcc_s gcc)
 endif()
 set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt 
advapi32
-shell32 user32 kernel32 iconv mingw32 ${MINGW_RUNTIME}
+shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
 moldname mingwex msvcrt)
 list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()


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


Re: r304012 - Enable __float128 for mingw for GCC compatibility and define __SIZEOF_FLOAT128__ on x86

2017-05-26 Thread Martell Malone via cfe-commits
Thanks Reid for looking at this today

On Fri, May 26, 2017 at 6:38 PM, Reid Kleckner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rnk
> Date: Fri May 26 12:38:15 2017
> New Revision: 304012
>
> URL: http://llvm.org/viewvc/llvm-project?rev=304012=rev
> Log:
> Enable __float128 for mingw for GCC compatibility and define
> __SIZEOF_FLOAT128__ on x86
>
> GCC defines __FLOAT128__ on Power and __SIZEOF_FLOAT128__ on x86. We're
> just following the inconsistency for now so users have some way to test.
>
> Effectively merges this patch as requested by Martell Malone:
> https://github.com/Alexpux/MINGW-packages/blob/master/
> mingw-w64-clang/0107-enable-__float128-for-X86-MinGW.patch
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/test/Sema/128bitfloat.cpp
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/
> Targets.cpp?rev=304012=304011=304012=diff
> 
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Fri May 26 12:38:15 2017
> @@ -4644,7 +4644,9 @@ static void addMinGWDefines(const LangOp
>  class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
>  public:
>MinGWX86_32TargetInfo(const llvm::Triple , const TargetOptions
> )
> -  : WindowsX86_32TargetInfo(Triple, Opts) {}
> +  : WindowsX86_32TargetInfo(Triple, Opts) {
> +HasFloat128 = true;
> +  }
>void getTargetDefines(const LangOptions ,
>  MacroBuilder ) const override {
>  WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
> @@ -4936,6 +4938,7 @@ public:
>  // with x86 FP ops. Weird.
>  LongDoubleWidth = LongDoubleAlign = 128;
>  LongDoubleFormat = ::APFloat::x87DoubleExtended();
> +HasFloat128 = true;
>}
>
>void getTargetDefines(const LangOptions ,
>
> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/
> Frontend/InitPreprocessor.cpp?rev=304012=304011=304012=diff
> 
> ==
> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Fri May 26 12:38:15 2017
> @@ -750,6 +750,8 @@ static void InitializePredefinedMacros(c
> TI.getTypeWidth(TI.getWIntType()), TI, Builder);
>if (TI.hasInt128Type())
>  DefineTypeSizeof("__SIZEOF_INT128__", 128, TI, Builder);
> +  if (TI.hasFloat128Type())
> +DefineTypeSizeof("__SIZEOF_FLOAT128__", 128, TI, Builder);
>
>DefineType("__INTMAX_TYPE__", TI.getIntMaxType(), Builder);
>DefineFmt("__INTMAX", TI.getIntMaxType(), TI, Builder);
>
> Modified: cfe/trunk/test/Sema/128bitfloat.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/
> 128bitfloat.cpp?rev=304012=304011=304012=diff
> 
> ==
> --- cfe/trunk/test/Sema/128bitfloat.cpp (original)
> +++ cfe/trunk/test/Sema/128bitfloat.cpp Fri May 26 12:38:15 2017
> @@ -1,7 +1,11 @@
> -// RUN: %clang_cc1 -fsyntax-only -verify -std=gnu++11 %s
> -// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
> +// RUN: %clang_cc1 -verify -std=gnu++11 %s
> +// RUN: %clang_cc1 -verify -std=c++11 %s
> +// RUN: %clang_cc1 -triple powerpc64-linux -verify -std=c++11 %s
> +// RUN: %clang_cc1 -triple i686-windows-gnu -verify -std=c++11 %s
> +// RUN: %clang_cc1 -triple x86_64-windows-gnu -verify -std=c++11 %s
> +// RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s
>
> -#ifdef __FLOAT128__
> +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
>  __float128 f;
>  template struct __is_floating_point_helper {};
>  template<> struct __is_floating_point_helper<__float128> {};
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r303928 - libcxx: fix bootstrapping for mingw-w64

2017-05-25 Thread Martell Malone via cfe-commits
Author: martell
Date: Thu May 25 17:37:15 2017
New Revision: 303928

URL: http://llvm.org/viewvc/llvm-project?rev=303928=rev
Log:
libcxx: fix bootstrapping for mingw-w64

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

Modified:
libcxx/trunk/cmake/config-ix.cmake
libcxx/trunk/include/__threading_support
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=303928=303927=303928=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Thu May 25 17:37:15 2017
@@ -41,7 +41,15 @@ if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
   if (MINGW)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
-list(APPEND CMAKE_REQUIRED_LIBRARIES mingw32 gcc gcc_eh mingwex msvcrt gcc)
+if (LIBCXX_USE_COMPILER_RT)
+  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+else ()
+  set(MINGW_RUNTIME gcc_s gcc)
+endif()
+set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt 
advapi32
+shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME}
+moldname mingwex msvcrt)
+list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")

Modified: libcxx/trunk/include/__threading_support
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__threading_support?rev=303928=303927=303928=diff
==
--- libcxx/trunk/include/__threading_support (original)
+++ libcxx/trunk/include/__threading_support Thu May 25 17:37:15 2017
@@ -27,7 +27,7 @@
 # include 
 # include 
 #elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#include 
+#include 
 #include 
 #include 
 #include <__undef_min_max>

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=303928=303927=303928=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Thu May 25 17:37:15 2017
@@ -242,14 +242,11 @@ endif()
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC $)
   target_link_libraries(cxx_static ${LIBCXX_LIBRARIES})
-  set(STATIC_OUTPUT_NAME "c++")
-  if (WIN32)
-set(STATIC_OUTPUT_NAME "libc++")
-  endif()
+  set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
   set_target_properties(cxx_static
 PROPERTIES
   LINK_FLAGS"${LIBCXX_LINK_FLAGS}"
-  OUTPUT_NAME   "${STATIC_OUTPUT_NAME}"
+  OUTPUT_NAME   "c++"
   )
 
   list(APPEND LIBCXX_TARGETS "cxx_static")


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


[libcxxabi] r302824 - [Libcxxabi]: Support using compiler-rt for MinGW64

2017-05-11 Thread Martell Malone via cfe-commits
Author: martell
Date: Thu May 11 16:16:29 2017
New Revision: 302824

URL: http://llvm.org/viewvc/llvm-project?rev=302824=rev
Log:
[Libcxxabi]: Support using compiler-rt for MinGW64

Reviewers: EricWF

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

Modified:
libcxxabi/trunk/cmake/config-ix.cmake

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=302824=302823=302824=diff
==
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Thu May 11 16:16:29 2017
@@ -30,9 +30,14 @@ if (LIBCXXABI_HAS_NODEFAULTLIBS_FLAG)
   if (MINGW)
 # Mingw64 requires quite a few "C" runtime libraries in order for basic
 # programs to link successfully with -nodefaultlibs.
-set(MINGW_LIBRARIES mingw32 gcc_s gcc moldname mingwex msvcrt advapi32
-shell32 user32 kernel32 iconv mingw32 gcc_s gcc 
moldname
-mingwex msvcrt)
+if (LIBCXXABI_USE_COMPILER_RT)
+  set(MINGW_RUNTIME ${LIBCXXABI_BUILTINS_LIBRARY})
+else ()
+  set(MINGW_RUNTIME gcc_s gcc)
+endif()
+set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt 
advapi32
+shell32 user32 kernel32 iconv mingw32 ${MINGW_RUNTIME}
+moldname mingwex msvcrt)
 list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES})
   endif()
   if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)


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


r300562 - mingw-w64: enable support for __declspec(selectany)

2017-04-18 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Apr 18 10:56:24 2017
New Revision: 300562

URL: http://llvm.org/viewvc/llvm-project?rev=300562=rev
Log:
mingw-w64: enable support for __declspec(selectany)

Add selectany as a GCC spelling for mingw-w64

Reviewers: rnk

Differential revision: https://reviews.llvm.org/D32083

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/test/Sema/attr-selectany.c
cfe/trunk/test/SemaCXX/attr-selectany.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=300562=300561=300562=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Apr 18 10:56:24 2017
@@ -2351,9 +2351,8 @@ def DLLImport : InheritableAttr, TargetS
   let Documentation = [DLLImportDocs];
 }
 
-def SelectAny : InheritableAttr {
-  let Spellings = [Declspec<"selectany">];
-  let LangOpts = [MicrosoftExt];
+def SelectAny : InheritableAttr, TargetSpecificAttr {
+  let Spellings = [Declspec<"selectany">, GCC<"selectany">];
   let Documentation = [Undocumented];
 }
 

Modified: cfe/trunk/test/Sema/attr-selectany.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-selectany.c?rev=300562=300561=300562=diff
==
--- cfe/trunk/test/Sema/attr-selectany.c (original)
+++ cfe/trunk/test/Sema/attr-selectany.c Tue Apr 18 10:56:24 2017
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fms-compatibility -fms-extensions -verify %s
+// RUN: %clang_cc1 -triple x86_64-win32 -fdeclspec -verify %s
+// RUN: %clang_cc1 -triple x86_64-mingw32 -verify %s
 
 extern __declspec(selectany) const int x1 = 1; // no warning, const means we 
need extern in C++
 

Modified: cfe/trunk/test/SemaCXX/attr-selectany.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-selectany.cpp?rev=300562=300561=300562=diff
==
--- cfe/trunk/test/SemaCXX/attr-selectany.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-selectany.cpp Tue Apr 18 10:56:24 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-compatibility -fms-extensions -fsyntax-only -verify 
-std=c++11 %s
+// RUN: %clang_cc1 -triple x86_64-win32 -fms-compatibility -fms-extensions 
-fsyntax-only -verify -std=c++11 %s
 // MSVC produces similar diagnostics.
 
 __declspec(selectany) void foo() { } // expected-error{{'selectany' can only 
be applied to data items with external linkage}}


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


Re: r300555 - Driver: Better detection of mingw-gcc

2017-04-18 Thread Martell Malone via cfe-commits
Yes I do :)
I updated https://reviews.llvm.org/D15005 with a comment incase anyone goes
there.
I also updated https://reviews.llvm.org/D15006 (the correct link) to point
to the commit revision.

Thanks for pointing that out Alex

On Tue, Apr 18, 2017 at 3:49 PM, Alex L <arpha...@gmail.com> wrote:

> I think you've got the wrong Phabricator link in the commit log.
>
> On 18 April 2017 at 15:27, Martell Malone via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: martell
>> Date: Tue Apr 18 09:27:36 2017
>> New Revision: 300555
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=300555=rev
>> Log:
>> Driver: Better detection of mingw-gcc
>>
>> Stop blindly searching for "gcc.exe" on windows.
>> Stop assuming "/usr" on unix, fixes cross compiling.
>>
>> Reviewers: mati865, yaron.keren
>>
>> Subscribers: ismail, rnk
>>
>> Differential revision: https://reviews.llvm.org/D15005
>>
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> cfe/trunk/lib/Driver/ToolChains/MinGW.h
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.cpp?rev=300555=300554=300555=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017
>> @@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir()
>>}
>>  }
>>
>> +llvm::ErrorOr toolchains::MinGW::findGcc() {
>> +  llvm::SmallVector<llvm::SmallString<32>, 2> Gccs;
>> +  Gccs.emplace_back(getTriple().getArchName());
>> +  Gccs[0] += "-w64-mingw32-gcc";
>> +  Gccs.emplace_back("mingw32-gcc");
>> +  // Please do not add "gcc" here
>> +  for (StringRef CandidateGcc : Gccs)
>> +if (llvm::ErrorOr GPPName =
>> llvm::sys::findProgramByName(CandidateGcc))
>> +  return GPPName;
>> +  return make_error_code(std::errc::no_such_file_or_directory);
>> +}
>> +
>>  toolchains::MinGW::MinGW(const Driver , const llvm::Triple ,
>>   const ArgList )
>>  : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) {
>>getProgramPaths().push_back(getDriver().getInstalledDir());
>>
>> -// In Windows there aren't any standard install locations, we search
>> -// for gcc on the PATH. In Linux the base is always /usr.
>> -#ifdef LLVM_ON_WIN32
>>if (getDriver().SysRoot.size())
>>  Base = getDriver().SysRoot;
>> -  else if (llvm::ErrorOr GPPName =
>> -   llvm::sys::findProgramByName("gcc"))
>> +  else if (llvm::ErrorOr GPPName = findGcc())
>>  Base = llvm::sys::path::parent_path(
>>  llvm::sys::path::parent_path(GPPName.get()));
>>else
>>  Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
>> -#else
>> -  if (getDriver().SysRoot.size())
>> -Base = getDriver().SysRoot;
>> -  else
>> -Base = "/usr";
>> -#endif
>>
>>Base += llvm::sys::path::get_separator();
>>findGccLibDir();
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Too
>> lChains/MinGW.h?rev=300555=300554=300555=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017
>> @@ -93,6 +93,7 @@ private:
>>mutable std::unique_ptr Preprocessor;
>>mutable std::unique_ptr Compiler;
>>void findGccLibDir();
>> +  llvm::ErrorOr findGcc();
>>  };
>>
>>  } // end namespace toolchains
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r300555 - Driver: Better detection of mingw-gcc

2017-04-18 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Apr 18 09:27:36 2017
New Revision: 300555

URL: http://llvm.org/viewvc/llvm-project?rev=300555=rev
Log:
Driver: Better detection of mingw-gcc

Stop blindly searching for "gcc.exe" on windows.
Stop assuming "/usr" on unix, fixes cross compiling.

Reviewers: mati865, yaron.keren

Subscribers: ismail, rnk

Differential revision: https://reviews.llvm.org/D15005

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=300555=300554=300555=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Apr 18 09:27:36 2017
@@ -285,28 +285,30 @@ void toolchains::MinGW::findGccLibDir()
   }
 }
 
+llvm::ErrorOr toolchains::MinGW::findGcc() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  // Please do not add "gcc" here
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName = 
llvm::sys::findProgramByName(CandidateGcc))
+  return GPPName;
+  return make_error_code(std::errc::no_such_file_or_directory);
+}
+
 toolchains::MinGW::MinGW(const Driver , const llvm::Triple ,
  const ArgList )
 : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-// In Windows there aren't any standard install locations, we search
-// for gcc on the PATH. In Linux the base is always /usr.
-#ifdef LLVM_ON_WIN32
   if (getDriver().SysRoot.size())
 Base = getDriver().SysRoot;
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
+  else if (llvm::ErrorOr GPPName = findGcc())
 Base = llvm::sys::path::parent_path(
 llvm::sys::path::parent_path(GPPName.get()));
   else
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
-#else
-  if (getDriver().SysRoot.size())
-Base = getDriver().SysRoot;
-  else
-Base = "/usr";
-#endif
 
   Base += llvm::sys::path::get_separator();
   findGccLibDir();

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.h?rev=300555=300554=300555=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Tue Apr 18 09:27:36 2017
@@ -93,6 +93,7 @@ private:
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
   void findGccLibDir();
+  llvm::ErrorOr findGcc();
 };
 
 } // end namespace toolchains


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


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-12-15 Thread Martell Malone via cfe-commits
martell updated this revision to Diff 42933.
martell added a comment.

Sorry I was a bit slow getting around to this.

Will do testcases if Yaron thinks this is okay


http://reviews.llvm.org/D15006

Files:
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChains.h

Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -662,6 +662,7 @@
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
   void findGccLibDir();
+  llvm::ErrorOr findGcc();
 };
 
 class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -62,20 +62,27 @@
   }
 }
 
+llvm::ErrorOr MinGW::findGcc() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName = 
llvm::sys::findProgramByName(CandidateGcc))
+  return GPPName;
+  return make_error_code(std::errc::no_such_file_or_directory);
+}
+
 MinGW::MinGW(const Driver , const llvm::Triple , const ArgList )
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-  // On Windows if there is no sysroot we search for gcc on the PATH.
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
+Base = getDriver().SysRoot;
+  else if (llvm::ErrorOr GPPName = findGcc())
 Base = llvm::sys::path::parent_path(
 llvm::sys::path::parent_path(GPPName.get()));
-#endif
-  if (!Base.size())
+  else
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
 
   Base += llvm::sys::path::get_separator();


Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -662,6 +662,7 @@
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
   void findGccLibDir();
+  llvm::ErrorOr findGcc();
 };
 
 class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF {
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -62,20 +62,27 @@
   }
 }
 
+llvm::ErrorOr MinGW::findGcc() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName = llvm::sys::findProgramByName(CandidateGcc))
+  return GPPName;
+  return make_error_code(std::errc::no_such_file_or_directory);
+}
+
 MinGW::MinGW(const Driver , const llvm::Triple , const ArgList )
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-  // On Windows if there is no sysroot we search for gcc on the PATH.
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
+Base = getDriver().SysRoot;
+  else if (llvm::ErrorOr GPPName = findGcc())
 Base = llvm::sys::path::parent_path(
 llvm::sys::path::parent_path(GPPName.get()));
-#endif
-  if (!Base.size())
+  else
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
 
   Base += llvm::sys::path::get_separator();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-12-09 Thread Martell Malone via cfe-commits
martell added a comment.

hi ismail,
I will tidy up for review closer towards the weekend where i can work on out of 
work stuff


http://reviews.llvm.org/D15006



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


Re: [PATCH] D14180: enable -fms-extensions by default on the mingw-w64 target

2015-11-30 Thread Martell Malone via cfe-commits
martell added a comment.

I tried testing __has_builtin(_InterlockedCompareExchangeAdd) as it seem to not 
exist even when -fms-extensions is passed
Is this a bug or it is intended ?


http://reviews.llvm.org/D14180



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


r254117 - Driver: protect from empty -L args

2015-11-25 Thread Martell Malone via cfe-commits
Author: martell
Date: Wed Nov 25 19:02:07 2015
New Revision: 254117

URL: http://llvm.org/viewvc/llvm-project?rev=254117=rev
Log:
Driver: protect from empty -L args

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

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

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=254117=254116=254117=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Wed Nov 25 19:02:07 2015
@@ -619,7 +619,8 @@ void ToolChain::AddCXXStdlibLibArgs(cons
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getFilePaths())
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,


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


Re: [PATCH] D12466: Fix empty -L Path on OSX hosts

2015-11-25 Thread Martell Malone via cfe-commits
martell added a comment.

> Is this testable?


Seems to me the only way to add this as a test would be to add bad code to 
clang to purposely pass an empty LibPath argument.
This is probably something we do not want to do.

This is probably why Reid never asked me for one in the review.


Repository:
  rL LLVM

http://reviews.llvm.org/D12466



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


Re: [PATCH] D12466: Fix empty -L Path on OSX hosts

2015-11-25 Thread Martell Malone via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL254117: Driver: protect from empty -L args (authored by 
martell).

Changed prior to commit:
  http://reviews.llvm.org/D12466?vs=33510=41202#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12466

Files:
  cfe/trunk/lib/Driver/ToolChain.cpp

Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -619,7 +619,8 @@
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getFilePaths())
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,


Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -619,7 +619,8 @@
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getFilePaths())
-CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Martell Malone via cfe-commits
martell added a comment.

@ismail can you test this for your setup please? :)


http://reviews.llvm.org/D15006



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


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Martell Malone via cfe-commits
martell updated the summary for this revision.
martell updated this revision to Diff 41208.
martell added a comment.

Removed the break that I didn't think was needed
Can be re-added ??

Will added testcases


http://reviews.llvm.org/D15006

Files:
  lib/Driver/MinGWToolChain.cpp

Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -66,15 +66,20 @@
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc))
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
 


Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -66,15 +66,20 @@
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc))
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15006: Driver: Better detection of mingw-gcc

2015-11-25 Thread Martell Malone via cfe-commits
martell updated this revision to Diff 41209.
martell added a comment.

Updated to reflect feedback

I'm not too sure what todo for testcases on this one because they already exist 
for the most part.
I ran the test suite and they all pass.

I would have to create a mingw32-gcc and {armv7|i686|x86_64}-w64-mingw32-gcc 
and chmod+x for the testcase.
Is that safe ?


http://reviews.llvm.org/D15006

Files:
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChains.h

Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -661,6 +661,7 @@
   std::string Arch;
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
+  void findGccDir();
   void findGccLibDir();
 };
 
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -62,19 +62,29 @@
   }
 }

+void MinGW::findGccDir() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc)) {
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+  return;
+}
+}
+
 MinGW::MinGW(const Driver , const llvm::Triple , const ArgList )
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+  else
+findGccDir();
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());



Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -661,6 +661,7 @@
   std::string Arch;
   mutable std::unique_ptr Preprocessor;
   mutable std::unique_ptr Compiler;
+  void findGccDir();
   void findGccLibDir();
 };
 
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -62,19 +62,29 @@
   }
 }

+void MinGW::findGccDir() {
+  llvm::SmallVector, 2> Gccs;
+  Gccs.emplace_back(getTriple().getArchName());
+  Gccs[0] += "-w64-mingw32-gcc";
+  Gccs.emplace_back("mingw32-gcc");
+  for (StringRef CandidateGcc : Gccs)
+if (llvm::ErrorOr GPPName =
+  llvm::sys::findProgramByName(CandidateGcc)) {
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
+  return;
+}
+}
+
 MinGW::MinGW(const Driver , const llvm::Triple , const ArgList )
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());

-  // On Windows if there is no sysroot we search for gcc on the PATH.
   if (getDriver().SysRoot.size())
-  Base = getDriver().SysRoot;
-#ifdef LLVM_ON_WIN32
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-#endif
+Base = getDriver().SysRoot;
+  else
+findGccDir();
+
   if (!Base.size())
 Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());

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


Re: r253898 - Driver: fallback to the location of clang if no sysroot,

2015-11-24 Thread Martell Malone via cfe-commits
>
> This breaks mingw support on openSUSE :

My first question is why on SUSE is clang installed in /opt while mingw-w64
in /usr?

x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before
> this commit.

It doesn't look for gcc on linux that is a windows host only thing.
It didn't do that before this commit also.
SUSE was just lucky because we hard coded /usr as the base path.

I don't like the idea of hard coding for just a single distro so I think
We could optionally do some search for "x86_64-w64-mingw32-gcc" on non
windows hosts
Just like we do for "gcc" on windows hosts.
This should fix SUSE while maintaining the new more reasonable search
pattern.

If Yaron approves this idea I will commit it with a test case for SUSE so
we don't break it again :)
Yaron your thoughts?

Kind Regards
Martell

On Tue, Nov 24, 2015 at 12:02 AM, Ismail Donmez <ism...@i10z.com> wrote:

> Hi,
>
> On Mon, Nov 23, 2015 at 8:59 PM, Martell Malone via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
> > Author: martell
> > Date: Mon Nov 23 12:59:48 2015
> > New Revision: 253898
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253898=rev
> > Log:
> > Driver: fallback to the location of clang if no sysroot,
> >
> > hard coding /usr makes little sense for mingw-w64.
> > If we have portable toolchains having /usr breaks that.
> > If the clang we use is in /usr/bin or /usr/sbin etc this will
> > still detect as though it was hard coded to /usr
> >
> > This makes the most sense going forward for mingw-w64 toolchains
> > on both linux and mac
>
> This breaks mingw support on openSUSE :
>
> λ cat hello.c
> #include 
>
> int main()
> {
> return 0;
> }
>
> λ clang -v -target x86_64-w64-mingw32 hello.c
> clang version 3.8.0 (trunk 253903)
> Target: x86_64-w64-windows-gnu
> Thread model: posix
> InstalledDir: /opt/clang/bin
>  "/opt/clang/bin/clang-3.8" -cc1 -triple x86_64-w64-windows-gnu
> -emit-obj -mrelax-all -disable-free -main-file-name hello.c
> -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno
> -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
> -momit-leaf-frame-pointer -v -dwarf-column-info -resource-dir
> /opt/clang/bin/../lib64/clang/3.8.0 -internal-isystem
> /opt/clang/bin/../lib64/clang/3.8.0/include -internal-isystem include
> -internal-isystem /opt/clang/x86_64-w64-mingw32/sys-root/mingw/include
> -internal-isystem include-fixed -internal-isystem
> /opt/clang/x86_64-w64-mingw32/include -internal-isystem
> /opt/clang/include -fdebug-compilation-dir /home/ismail -ferror-limit
> 19 -fmessage-length 127 -fno-use-cxa-atexit -fobjc-runtime=gcc
> -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-f129aa.o
> -x c hello.c
> clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target
> x86_64-suse-linux
> ignoring nonexistent directory "include"
> ignoring nonexistent directory
> "/opt/clang/x86_64-w64-mingw32/sys-root/mingw/include"
> ignoring nonexistent directory "include-fixed"
> ignoring nonexistent directory "/opt/clang/x86_64-w64-mingw32/include"
> #include "..." search starts here:
> #include <...> search starts here:
>  /opt/clang/bin/../lib64/clang/3.8.0/include
>  /opt/clang/include
> End of search list.
> hello.c:1:10: fatal error: 'stdlib.h' file not found
> #include 
>  ^
> 1 error generated.
>
> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before
> this commit.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253898 - Driver: fallback to the location of clang if no sysroot,

2015-11-24 Thread Martell Malone via cfe-commits
>
> Why not hardcode /usr for Linux hosts?

Portable toolchain packages exist but can't on linux if you do this.
but in general I'm sure most would agree that detection is much better then
hard coding.
This is why Yaron approved the patch

Well this is a custom clang it can be anywhere. Official one is in /usr.

This means that your earlier statement of "This breaks mingw support on
openSUSE" is incorrect.
The official SUSE packages still work with this patch.

More accurately it breaks your setup of having clang and mingw-w64 in 2
completely separate install locations.
Which is not a typical use case even for gcc and one would be expected to
pass a sysroot for this.

For a more immediate solution for your specific setup I would create a bash
script called
x86_64-w64-mingw32-clang
with this content like this
#!/usr/bin/env bash
/opt/bin/clang -target x86_64-windows-gnu -sysroot=/usr "$@"

It seems as though SUSE''s binutils is built with sysroot so this should be
acceptable
https://build.opensuse.org/package/view_file/windows:mingw:win64/mingw64-cross-binutils/mingw64-binutils.spec?expand=1

Other then that we should wait for Yaron's thoughts on mingw-gcc detection
on linux :)



On Tue, Nov 24, 2015 at 2:53 AM, Ismail Donmez  wrote:

> On Tue, Nov 24, 2015 at 12:43 PM, Martell Malone
>  wrote:
> >> This breaks mingw support on openSUSE :
> >
> > My first question is why on SUSE is clang installed in /opt while
> mingw-w64
> > in /usr?
>
> Well this is a custom clang it can be anywhere. Official one is in /usr.
>
> >> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before
> >> this commit.
> >
> > It doesn't look for gcc on linux that is a windows host only thing.
> > It didn't do that before this commit also.
> > SUSE was just lucky because we hard coded /usr as the base path.
>
> This is not a SUSE only thing, afaik Fedora has the same setup.
>
> > I don't like the idea of hard coding for just a single distro so I think
> > We could optionally do some search for "x86_64-w64-mingw32-gcc" on non
> > windows hosts
> > Just like we do for "gcc" on windows hosts.
> > This should fix SUSE while maintaining the new more reasonable search
> > pattern.
>
> Why not hardcode /usr for Linux hosts?
>
> Thanks,
> ismail
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253898 - Driver: fallback to the location of clang if no sysroot,

2015-11-24 Thread Martell Malone via cfe-commits
>
> Searching for gcc on Linux is not a good idea, you'll find the system one
> not the mingw one. Searching for i686-w64-mingw32-gcc or
> x86_64-w64-mingw32-gcc should work better, that is searching for:
>   getTriple().getArchName()) + "-w64-mingw32-gcc"

Moreover, this should work on Windows as well, mingw-w64 distribution has
> [i686|x86_64]-w64-mingw32-gcc.exe at the same location as gcc.exe. For this
> you can unite the code for both Linux and Windows.
>
Agreed this makes most sense.

To continue supporting mingw.org, if this search fails, search for
> mingw32-gcc.

I'll make a patch for review, I won't be able todo it until the weekend
because of work but I will get to it

On Tue, Nov 24, 2015 at 7:03 AM, Yaron Keren  wrote:

> Searching for gcc on Linux is not a good idea, you'll find the system one
> not the mingw one. Searching for i686-w64-mingw32-gcc or
> x86_64-w64-mingw32-gcc should work better, that is searching for:
>
>   getTriple().getArchName()) + "-w64-mingw32-gcc"
>
> Moreover, this should work on Windows as well, mingw-w64 distribution has
> [i686|x86_64]-w64-mingw32-gcc.exe at the same location as gcc.exe. For this
> you can unite the code for both Linux and Windows.
>
> To continue supporting mingw.org, if this search fails, search for
> mingw32-gcc.
>
>
>
> 2015-11-24 16:36 GMT+02:00 Martell Malone :
>
>> Why not hardcode /usr for Linux hosts?
>>
>> Portable toolchain packages exist but can't on linux if you do this.
>> but in general I'm sure most would agree that detection is much better
>> then hard coding.
>> This is why Yaron approved the patch
>>
>> Well this is a custom clang it can be anywhere. Official one is in /usr.
>>
>> This means that your earlier statement of "This breaks mingw support on
>> openSUSE" is incorrect.
>> The official SUSE packages still work with this patch.
>>
>> More accurately it breaks your setup of having clang and mingw-w64 in 2
>> completely separate install locations.
>> Which is not a typical use case even for gcc and one would be expected to
>> pass a sysroot for this.
>>
>> For a more immediate solution for your specific setup I would create a
>> bash script called
>> x86_64-w64-mingw32-clang
>> with this content like this
>> #!/usr/bin/env bash
>> /opt/bin/clang -target x86_64-windows-gnu -sysroot=/usr "$@"
>>
>> It seems as though SUSE''s binutils is built with sysroot so this should
>> be acceptable
>>
>> https://build.opensuse.org/package/view_file/windows:mingw:win64/mingw64-cross-binutils/mingw64-binutils.spec?expand=1
>>
>> Other then that we should wait for Yaron's thoughts on mingw-gcc
>> detection on linux :)
>>
>>
>>
> On Tue, Nov 24, 2015 at 2:53 AM, Ismail Donmez  wrote:
>
>> On Tue, Nov 24, 2015 at 12:43 PM, Martell Malone
>>  wrote:
>> >> This breaks mingw support on openSUSE :
>> >
>> > My first question is why on SUSE is clang installed in /opt while
>> mingw-w64
>> > in /usr?
>>
>> Well this is a custom clang it can be anywhere. Official one is in /usr.
>>
>> >> x86_64-w64-mingw32-gcc is in $PATH, and this used to work fine before
>> >> this commit.
>> >
>> > It doesn't look for gcc on linux that is a windows host only thing.
>> > It didn't do that before this commit also.
>> > SUSE was just lucky because we hard coded /usr as the base path.
>>
>> This is not a SUSE only thing, afaik Fedora has the same setup.
>>
>> > I don't like the idea of hard coding for just a single distro so I think
>> > We could optionally do some search for "x86_64-w64-mingw32-gcc" on non
>> > windows hosts
>> > Just like we do for "gcc" on windows hosts.
>> > This should fix SUSE while maintaining the new more reasonable search
>> > pattern.
>>
>> Why not hardcode /usr for Linux hosts?
>>
>> Thanks,
>> ismail
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253874 - Revert part of r253813

2015-11-23 Thread Martell Malone via cfe-commits
Author: martell
Date: Mon Nov 23 10:04:55 2015
New Revision: 253874

URL: http://llvm.org/viewvc/llvm-project?rev=253874=rev
Log:
Revert part of r253813
The new lld gnu frontend does not support the -target option

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=253874=253873=253874=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 10:04:55 2015
@@ -9479,13 +9479,6 @@ void MinGW::Linker::ConstructJob(Compila
   if (LinkerName.equals_lower("lld")) {
 CmdArgs.push_back("-flavor");
 CmdArgs.push_back("gnu");
-CmdArgs.push_back("-target");
-if (TC.getArch() == llvm::Triple::x86)
-  CmdArgs.push_back("i686--windows-gnu");
-if (TC.getArch() == llvm::Triple::x86_64)
-  CmdArgs.push_back("x86_64--windows-gnu");
-if (TC.getArch() == llvm::Triple::arm)
-  CmdArgs.push_back("armv7--windows-gnu");
   } else if (!LinkerName.equals_lower("ld")) {
 D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
   }


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


Re: r253813 - Driver: Specifically tell the linker the target for mingw-w64

2015-11-23 Thread Martell Malone via cfe-commits
>
> This changes the linker from old-gnu to gnu. Are you sure you want to
> that?

Originally I didn't actually mean to commit that. I had been working on
some stuff locally.
Pointing to the new one should be fine as neither work for COFF atm anyway
so no point in having it point to the old one.
I'll make lld more verbose about this when it receives this emulation
target.

> I don't think the new linker takes a -target option. In any
> case, it needs a test.

You are correct the new linker does not support -target. I reverted this in
rL253874.


On Mon, Nov 23, 2015 at 7:05 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> This changes the linker from old-gnu to gnu. Are you sure you want to
> that? I don't think the new linker takes a -target option. In any
> case, it needs a test.
>
> Cheers,
> Rafael
>
>
> On 22 November 2015 at 00:40, Martell Malone via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
> > Author: martell
> > Date: Sat Nov 21 23:40:06 2015
> > New Revision: 253813
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253813=rev
> > Log:
> > Driver: Specifically tell the linker the target for mingw-w64
> >
> > Cross compiling from linux and OSX results in Error: Exec format.
> > This is because the linker is expecting ELF formated objects.
> > By passing the target we can explicitly tell the linker that
> > it should be linking COFF objects regardless of the host.
> >
> > 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=253813=253812=253813=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Sat Nov 21 23:40:06 2015
> > @@ -9478,7 +9478,14 @@ void MinGW::Linker::ConstructJob(Compila
> >StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ,
> "ld");
> >if (LinkerName.equals_lower("lld")) {
> >  CmdArgs.push_back("-flavor");
> > -CmdArgs.push_back("old-gnu");
> > +CmdArgs.push_back("gnu");
> > +CmdArgs.push_back("-target");
> > +if (TC.getArch() == llvm::Triple::x86)
> > +  CmdArgs.push_back("i686--windows-gnu");
> > +if (TC.getArch() == llvm::Triple::x86_64)
> > +  CmdArgs.push_back("x86_64--windows-gnu");
> > +if (TC.getArch() == llvm::Triple::arm)
> > +  CmdArgs.push_back("armv7--windows-gnu");
> >} else if (!LinkerName.equals_lower("ld")) {
> >  D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
> >}
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253898 - Driver: fallback to the location of clang if no sysroot,

2015-11-23 Thread Martell Malone via cfe-commits
Author: martell
Date: Mon Nov 23 12:59:48 2015
New Revision: 253898

URL: http://llvm.org/viewvc/llvm-project?rev=253898=rev
Log:
Driver: fallback to the location of clang if no sysroot,

hard coding /usr makes little sense for mingw-w64.
If we have portable toolchains having /usr breaks that.
If the clang we use is in /usr/bin or /usr/sbin etc this will
still detect as though it was hard coded to /usr

This makes the most sense going forward for mingw-w64 toolchains
on both linux and mac

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

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

Modified: cfe/trunk/lib/Driver/MinGWToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MinGWToolChain.cpp?rev=253898=253897=253898=diff
==
--- cfe/trunk/lib/Driver/MinGWToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MinGWToolChain.cpp Mon Nov 23 12:59:48 2015
@@ -66,24 +66,20 @@ MinGW::MinGW(const Driver , const llvm
 : ToolChain(D, Triple, Args) {
   getProgramPaths().push_back(getDriver().getInstalledDir());
 
-// In Windows there aren't any standard install locations, we search
-// for gcc on the PATH. In Linux the base is always /usr.
+// On Windows if there is no sysroot we search for gcc on the PATH.
+
+if (getDriver().SysRoot.size())
+  Base = getDriver().SysRoot;
 #ifdef LLVM_ON_WIN32
-  if (getDriver().SysRoot.size())
-Base = getDriver().SysRoot;
-  else if (llvm::ErrorOr GPPName =
-   llvm::sys::findProgramByName("gcc"))
-Base = llvm::sys::path::parent_path(
-llvm::sys::path::parent_path(GPPName.get()));
-  else
-Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
-#else
-  if (getDriver().SysRoot.size())
-Base = getDriver().SysRoot;
-  else
-Base = "/usr";
+else if (llvm::ErrorOr GPPName =
+ llvm::sys::findProgramByName("gcc"))
+  Base = llvm::sys::path::parent_path(
+  llvm::sys::path::parent_path(GPPName.get()));
 #endif
 
+if (!Base.size())
+  Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
+
   Base += llvm::sys::path::get_separator();
   findGccLibDir();
   // GccLibDir must precede Base/lib so that the


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


Re: r253815 - Test: Update mingw-useld.c to reflect r253813

2015-11-23 Thread Martell Malone via cfe-commits
>
> The new "gnu" is ELF only. What exactly are you trying to do?

Yes and so was the old-gnu linker.
I maintained patches in msys2 so that mingw-w64 could be able to use gnu
with COFF.
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-clang/0034-GNU-add-support-for-linking-PECOFF.patch
I just wanted to update head to maintain a similar patch like I did for the
new ELF linker like I did for the old one.
Please see http://reviews.llvm.org/D11088

On Mon, Nov 23, 2015 at 8:43 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> This (and all the patches in this series) look odd.
>
> The new "gnu" is ELF only. What exactly are you trying to do?
>
> Cheers,
> Rafael
>
>
> On 22 November 2015 at 00:45, Martell Malone via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
> > Author: martell
> > Date: Sat Nov 21 23:45:03 2015
> > New Revision: 253815
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253815=rev
> > Log:
> > Test: Update mingw-useld.c to reflect r253813
> >
> > Modified:
> > cfe/trunk/test/Driver/mingw-useld.c
> >
> > Modified: cfe/trunk/test/Driver/mingw-useld.c
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253815=253814=253815=diff
> >
> ==
> > --- cfe/trunk/test/Driver/mingw-useld.c (original)
> > +++ cfe/trunk/test/Driver/mingw-useld.c Sat Nov 21 23:45:03 2015
> > @@ -1,19 +1,19 @@
> >  // RUN: %clang -### -target i686-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck
> -check-prefix=CHECK_LD_32 %s
> >  // CHECK_LD_32: {{ld|ld.exe}}"
> >  // CHECK_LD_32: "i386pe"
> > -// CHECK_LD_32-NOT: "-flavor" "old-gnu"
> > +// CHECK_LD_32-NOT: "-flavor" "gnu"
> >
> >  // RUN: %clang -### -target i686-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
> FileCheck -check-prefix=CHECK_LLD_32 %s
> >  // CHECK_LLD_32-NOT: invalid linker name in argument
> > -// CHECK_LLD_32: lld" "-flavor" "old-gnu"
> > +// CHECK_LLD_32: lld" "-flavor" "gnu"
> >  // CHECK_LLD_32: "i386pe"
> >
> >  // RUN: %clang -### -target x86_64-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
> FileCheck -check-prefix=CHECK_LLD_64 %s
> >  // CHECK_LLD_64-NOT: invalid linker name in argument
> > -// CHECK_LLD_64: lld" "-flavor" "old-gnu"
> > +// CHECK_LLD_64: lld" "-flavor" "gnu"
> >  // CHECK_LLD_64: "i386pep"
> >
> >  // RUN: %clang -### -target arm-pc-windows-gnu
> --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 |
> FileCheck -check-prefix=CHECK_LLD_ARM %s
> >  // CHECK_LLD_ARM-NOT: invalid linker name in argument
> > -// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
> > +// CHECK_LLD_ARM: lld" "-flavor" "gnu"
> >  // CHECK_LLD_ARM: "thumb2pe"
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253874 - Revert part of r253813

2015-11-23 Thread Martell Malone via cfe-commits
Yes the test case was updated in r253815 to reflect the change of old-gnu
to gnu

On Mon, Nov 23, 2015 at 8:37 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> This still needs a testcase.
>
> On 23 November 2015 at 11:04, Martell Malone via cfe-commits
> <cfe-commits@lists.llvm.org> wrote:
> > Author: martell
> > Date: Mon Nov 23 10:04:55 2015
> > New Revision: 253874
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=253874=rev
> > Log:
> > Revert part of r253813
> > The new lld gnu frontend does not support the -target option
> >
> > 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=253874=253873=253874=diff
> >
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 23 10:04:55 2015
> > @@ -9479,13 +9479,6 @@ void MinGW::Linker::ConstructJob(Compila
> >if (LinkerName.equals_lower("lld")) {
> >  CmdArgs.push_back("-flavor");
> >  CmdArgs.push_back("gnu");
> > -CmdArgs.push_back("-target");
> > -if (TC.getArch() == llvm::Triple::x86)
> > -  CmdArgs.push_back("i686--windows-gnu");
> > -if (TC.getArch() == llvm::Triple::x86_64)
> > -  CmdArgs.push_back("x86_64--windows-gnu");
> > -if (TC.getArch() == llvm::Triple::arm)
> > -  CmdArgs.push_back("armv7--windows-gnu");
> >} else if (!LinkerName.equals_lower("ld")) {
> >  D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
> >}
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r253815 - Test: Update mingw-useld.c to reflect r253813

2015-11-21 Thread Martell Malone via cfe-commits
Author: martell
Date: Sat Nov 21 23:45:03 2015
New Revision: 253815

URL: http://llvm.org/viewvc/llvm-project?rev=253815=rev
Log:
Test: Update mingw-useld.c to reflect r253813

Modified:
cfe/trunk/test/Driver/mingw-useld.c

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253815=253814=253815=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Sat Nov 21 23:45:03 2015
@@ -1,19 +1,19 @@
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
 // CHECK_LD_32: {{ld|ld.exe}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32-NOT: "-flavor" "old-gnu"
+// CHECK_LD_32-NOT: "-flavor" "gnu"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
 // CHECK_LLD_32-NOT: invalid linker name in argument
-// CHECK_LLD_32: lld" "-flavor" "old-gnu"
+// CHECK_LLD_32: lld" "-flavor" "gnu"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
 // CHECK_LLD_64-NOT: invalid linker name in argument
-// CHECK_LLD_64: lld" "-flavor" "old-gnu"
+// CHECK_LLD_64: lld" "-flavor" "gnu"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
 // CHECK_LLD_ARM-NOT: invalid linker name in argument
-// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
+// CHECK_LLD_ARM: lld" "-flavor" "gnu"
 // CHECK_LLD_ARM: "thumb2pe"


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


r253813 - Driver: Specifically tell the linker the target for mingw-w64

2015-11-21 Thread Martell Malone via cfe-commits
Author: martell
Date: Sat Nov 21 23:40:06 2015
New Revision: 253813

URL: http://llvm.org/viewvc/llvm-project?rev=253813=rev
Log:
Driver: Specifically tell the linker the target for mingw-w64

Cross compiling from linux and OSX results in Error: Exec format.
This is because the linker is expecting ELF formated objects.
By passing the target we can explicitly tell the linker that
it should be linking COFF objects regardless of the host.

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=253813=253812=253813=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Nov 21 23:40:06 2015
@@ -9478,7 +9478,14 @@ void MinGW::Linker::ConstructJob(Compila
   StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
   if (LinkerName.equals_lower("lld")) {
 CmdArgs.push_back("-flavor");
-CmdArgs.push_back("old-gnu");
+CmdArgs.push_back("gnu");
+CmdArgs.push_back("-target");
+if (TC.getArch() == llvm::Triple::x86)
+  CmdArgs.push_back("i686--windows-gnu");
+if (TC.getArch() == llvm::Triple::x86_64)
+  CmdArgs.push_back("x86_64--windows-gnu");
+if (TC.getArch() == llvm::Triple::arm)
+  CmdArgs.push_back("armv7--windows-gnu");
   } else if (!LinkerName.equals_lower("ld")) {
 D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
   }


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


Re: [PATCH] D14180: enable -fms-extensions by default on the mingw-w64 target

2015-11-03 Thread Martell Malone via cfe-commits
martell added a comment.

> This is what I'm worried about. :) Can you elaborate on what would break?


Essentially mingw-w64 has a few header defines for working around builtings 
such as __rtdsc and the interlocked functions and some other builtins
As soon as one of these headers are included it would result in a compile time 
error as it would collide with what clang now provides.

I have talked to jon_y the 4.x maintainer about this before.
We could port back my patches to next 4.x release which i believe is 4.0.4.
But essentially older versions of mingw-w64 that doesn't respect the compiler 
may have the builtins would not work.

We don't have to make this break now of course but we should do it at some 
point?


http://reviews.llvm.org/D14180



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


Re: [PATCH] D14180: enable -fms-extensions by default on the mingw-w64 target

2015-11-03 Thread Martell Malone via cfe-commits
martell added a comment.

In http://reviews.llvm.org/D14180#280184, @rnk wrote:

> You're mostly interested in the non-builtin parts of -fms-extensions, like 
> declspec and UUID, right?


Yes that would be one of the main reasons, gcc is very lacking in this 
department :)

> You can then change the mingw headers to use 
> `__has_builtin(_InterlockedCompareExchange)` to provide compatibility with 
> either mode.


Yes I could do this but this still won't work with the the existing mingw 
toolchains that don't have this in their headers right?
I can update head to support both though yes


http://reviews.llvm.org/D14180



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


Re: [PATCH] D14179: Remove some legacy mingw-w64 gcc struct info

2015-11-03 Thread Martell Malone via cfe-commits
martell added a comment.

From what I can gather it made sense at the time of gcc 4.6 so I don't think 
anyone is at fault :)


Repository:
  rL LLVM

http://reviews.llvm.org/D14179



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


r251930 - Remove some legacy mingw-w64 gcc struct info

2015-11-03 Thread Martell Malone via cfe-commits
Author: martell
Date: Tue Nov  3 09:57:45 2015
New Revision: 251930

URL: http://llvm.org/viewvc/llvm-project?rev=251930=rev
Log:
Remove some legacy mingw-w64 gcc struct info

As of gcc 4.7 mingw-w64 no longer emits 128-bit structs as i128

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

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

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=251930=251929=251930=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue Nov  3 09:57:45 2015
@@ -,10 +,6 @@ ABIArgInfo WinX86_64ABIInfo::classify(Qu
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
-// FIXME: mingw-w64-gcc emits 128-bit struct as i128
-if (Width == 128 && IsMingw64)
-  return ABIArgInfo::getDirect(
-  llvm::IntegerType::get(getVMContext(), Width));
   }
 
   // vectorcall adds the concept of a homogenous vector aggregate, similar to


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


Re: [PATCH] D14179: Remove some legacy mingw-w64 gcc struct info

2015-11-03 Thread Martell Malone via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL251930: Remove some legacy mingw-w64 gcc struct info 
(authored by martell).

Changed prior to commit:
  http://reviews.llvm.org/D14179?vs=38744=39067#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14179

Files:
  cfe/trunk/lib/CodeGen/TargetInfo.cpp

Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -,10 +,6 @@
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
-// FIXME: mingw-w64-gcc emits 128-bit struct as i128
-if (Width == 128 && IsMingw64)
-  return ABIArgInfo::getDirect(
-  llvm::IntegerType::get(getVMContext(), Width));
   }
 
   // vectorcall adds the concept of a homogenous vector aggregate, similar to


Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -,10 +,6 @@
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);
 
-// FIXME: mingw-w64-gcc emits 128-bit struct as i128
-if (Width == 128 && IsMingw64)
-  return ABIArgInfo::getDirect(
-  llvm::IntegerType::get(getVMContext(), Width));
   }
 
   // vectorcall adds the concept of a homogenous vector aggregate, similar to
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14180: enable -fms-extensions by default on the mingw-w64 target

2015-11-03 Thread Martell Malone via cfe-commits
martell added a comment.

In http://reviews.llvm.org/D14180#279651, @rnk wrote:

> Will Clang be able to compile the last few stable mingw-w64 releases with 
> this change? I'd like that to keep working.


Clang has not been able to compile mingw-w64 crt for the last few releases.
I have only added support for this on HEAD.

There would be a drawback though.
Clang would not like older mingw-w64 headers.


http://reviews.llvm.org/D14180



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


[PATCH] D14179: Remove some legacy mingw-w64 gcc struct info

2015-10-29 Thread Martell Malone via cfe-commits
martell created this revision.
martell added a reviewer: rnk.
martell added a subscriber: cfe-commits.

GCC versions starting at 4.8+ conform to standard Windows 64-bit ABI.
Not quite sure if we should keep this to support mingw-w64 and gcc 4.6
Thoughts ?

Also it seems to fix:
https://llvm.org/bugs/show_bug.cgi?id=24408_id=75541

Thanks to awson for the tip

http://reviews.llvm.org/D14179

Files:
  lib/CodeGen/TargetInfo.cpp

Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -,10 +,6 @@
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);

-// FIXME: mingw-w64-gcc emits 128-bit struct as i128
-if (Width == 128 && IsMingw64)
-  return ABIArgInfo::getDirect(
-  llvm::IntegerType::get(getVMContext(), Width));
   }

   // vectorcall adds the concept of a homogenous vector aggregate, similar to


Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -,10 +,6 @@
 if (RT->getDecl()->hasFlexibleArrayMember())
   return getNaturalAlignIndirect(Ty, /*ByVal=*/false);

-// FIXME: mingw-w64-gcc emits 128-bit struct as i128
-if (Width == 128 && IsMingw64)
-  return ABIArgInfo::getDirect(
-  llvm::IntegerType::get(getVMContext(), Width));
   }

   // vectorcall adds the concept of a homogenous vector aggregate, similar to
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D14180: enable -fms-extensions by default on the mingw-w64 target

2015-10-29 Thread Martell Malone via cfe-commits
martell created this revision.
martell added a reviewer: rnk.
martell added subscribers: cfe-commits, yaron.keren, compnerd.

As of commit b8a164 mingw-w64 support clang with -fms-extensions.
We can built the mingw-w64 crt with clang now also.
As we are dropping support for mingw.org I think switching to this would be a 
good move
rather then using the gcc hacks we currently comply to

http://sourceforge.net/p/mingw-w64/mingw-w64/ci/b8a16418409d88215cce97727a42cc25eb011f3e/

http://reviews.llvm.org/D14180

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4654,7 +4654,7 @@

   // -fms-extensions=0 is default.
   if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
-   IsWindowsMSVC))
+   IsWindowsMSVC || IsWindowsGNU))
 CmdArgs.push_back("-fms-extensions");

   // -fno-use-line-directives is default.


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4654,7 +4654,7 @@

   // -fms-extensions=0 is default.
   if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
-   IsWindowsMSVC))
+   IsWindowsMSVC || IsWindowsGNU))
 CmdArgs.push_back("-fms-extensions");

   // -fno-use-line-directives is default.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-09-19 Thread Martell Malone via cfe-commits
For reference It was raised again here also
https://github.com/Alexpux/MINGW-packages/issues/722


"that is extended from X86TargetInfo
Which sets LongDoubleFormat = ::APFloat::x87DoubleExtended;"

On Saturday, September 19, 2015, Yaron Keren > wrote:

> Thanks, I have replied there.
>
> 2015-09-19 13:33 GMT+03:00 Hal Finkel :
>
>> FYI: https://llvm.org/bugs/show_bug.cgi?id=24398 was just reopened
>> pointing to a lack of resolution here.
>>
>>  -Hal
>>
>> - Original Message -
>> > From: "Yaron Keren via cfe-commits" 
>> > To: "Martell Malone" 
>> > Cc: "Richard Smith" , "cfe-commits" <
>> cfe-commits@lists.llvm.org>
>> > Sent: Friday, August 21, 2015 2:47:50 AM
>> > Subject: Re: r245459 - According to i686 ABI, long double size on x86
>> is 12 bytes not 16 bytes.
>> >
>> >
>> >
>> >
>> > The testcase from r245459 was not reverted and still in SVN.
>> >
>> >
>> >
>> >
>> >
>> > 2015-08-21 2:05 GMT+03:00 Martell Malone < martellmal...@gmail.com >
>> > :
>> >
>> >
>> >
>> >
>> >
>> > I feel very silly now.
>> > After testing the testcase again on svn it still works.
>> > It appears the OP was looking for this patch to go onto the 3.6
>> > branch and was applying my patch to that.
>> >
>> >
>> > I'll know in future to recheck the testcase afterwards myself in
>> > future.
>> >
>> >
>> > Apologies for the noise guys.
>> >
>> >
>> > Yaron I think the test case from r245459 would be useful to ensure it
>> > is never broken in the future?
>> >
>> > Would you be able to recommit the test case?
>> >
>> >
>> >
>> > Kind Regards
>> >
>> > Martell
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Aug 20, 2015 at 3:57 PM, Martell Malone <
>> > martellmal...@gmail.com > wrote:
>> >
>> >
>> >
>> >
>> >
>> > There is no testcase for PR24398 nor the OP reporting the problem was
>> > actually solved. Martell?
>> > I'm just re-looking through it now.
>> >
>> >
>> > X86TargetInfo sets LongDoubleFormat =
>> > ::APFloat::x87DoubleExtended;
>> > X86_64TargetInfo then sets LongDoubleWidth = LongDoubleAlign = 128 ;
>> > X86_32 TargetInfo then sets LongDoubleWidth = 96 ; LongDoubleAlign =
>> > 32 ;
>> >
>> >
>> > From this I can see that the patch I committed actually doesn't
>> > change anything but only breaks mingw x86.
>> >
>> >
>> > I can only see these values changed in Microsoft*TargetInfo classes
>> > which is not a parent of MINGW
>> >
>> >
>> > When I submitted the patch I just wanted to explicitly set the values
>> > in MinGWX86_64TargetInfo to ensure it was in fact that.
>> >
>> > It seemed as though it was not inheriting the value from the root
>> > parent class somehow.
>> >
>> >
>> >
>> > I was told on irc that it did fix the bug which is even stranger.
>> > I'm actually at a bit of a loss as to what the proper fix to this is
>> > then.
>> >
>> > Apologies for breaking mingw i686 long double.
>> >
>> >
>> > I will do up a test case and try to find the actual cause of the long
>> > double bug and reopen the issue.
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Aug 20, 2015 at 3:09 PM, Yaron Keren < yaron.ke...@gmail.com
>> > > wrote:
>> >
>> >
>> >
>> >
>> > Hi, I've just done this exactly this in r245618 (32 bit) and r245620
>> > (64 bits).
>> >
>> >
>> > mingw i686 long double values were correct before r245084 and wrong
>> > after it.
>> > mingw x86_64 long double values were not modified at all by r245084
>> > for the reason you stated, so I agree and do not see how this
>> > non-change can solve anything . There is no testcase for PR24398 nor
>> > the OP reporting the problem was actually solved. Martell?
>> >
>> >
>> > About PR24398, long double support was in clang long ago and b oth
>> > code examples compile and run correctly with current svn (without
>> > r245084) and gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by
>> > MinGW-W64 project).
>> > It's not x86_64 but as said r245084 didn't actually modify x86_64
>> > configuration.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2015-08-21 0:52 GMT+03:00 Richard Smith < rich...@metafoo.co.uk > :
>> >
>> >
>> > OK, so here's the problem:
>> >
>> >
>> > The right way to fix this seems to be to delete the assignments to
>> > LongDouble* from the MinGWX86_32TargetInfo constructor; the
>> > X86_32TargetInfo and X86TargetInfo base classes already set them to
>> > the right values. Likewise we can delete the assignments to
>> > LongDouble* from the MinGWX86_64TargetInfo constructor for the same
>> > reason.
>> >
>> >
>> > But... that completely reverts Martell's r245084, which apparently
>> > fixed PR24398. So you two need to figure out what the actual problem
>> > is here, and what the right fix is. r245084 didn't provide any test
>> > cases, and had no apparent effect other than to break long double
>> > for 

[PATCH] D12466: Fix empty -L Path on OSX hosts

2015-08-28 Thread Martell Malone via cfe-commits
martell created this revision.
martell added reviewers: rnk, yaron.keren.
martell added a subscriber: cfe-commits.
martell set the repository for this revision to rL LLVM.

Not quite sure if this is the proper way to fix this.
This is currently my work around when working from an OSX host though.

I think I need some feedback from either rnk or yaron on how to fix this.
I assume the path is supposed to be . and not an empty string as it is on mac.
I can't reproduce this issue on linux or windows also.

Repository:
  rL LLVM

http://reviews.llvm.org/D12466

Files:
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9267,6 +9267,7 @@
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   const ToolChain::path_list Paths = TC.getFilePaths();
   for (const auto Path : Paths)
+  if(Path.length()  0)
 CmdArgs.push_back(Args.MakeArgString(StringRef(-L) + Path));

   AddLinkerInputs(TC, Inputs, Args, CmdArgs);


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9267,6 +9267,7 @@
   Args.AddAllArgs(CmdArgs, options::OPT_L);
   const ToolChain::path_list Paths = TC.getFilePaths();
   for (const auto Path : Paths)
+  if(Path.length()  0)
 CmdArgs.push_back(Args.MakeArgString(StringRef(-L) + Path));

   AddLinkerInputs(TC, Inputs, Args, CmdArgs);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r245459 - According to i686 ABI, long double size on x86 is 12 bytes not 16 bytes.

2015-08-20 Thread Martell Malone via cfe-commits
I feel very silly now.
After testing the testcase again on svn it still works.
It appears the OP was looking for this patch to go onto the 3.6 branch and
was applying my patch to that.

I'll know in future to recheck the testcase afterwards myself in future.

Apologies for the noise guys.

Yaron I think the test case from r245459 would be useful to ensure it is
never broken in the future?
Would you be able to recommit the test case?

Kind Regards
Martell


On Thu, Aug 20, 2015 at 3:57 PM, Martell Malone martellmal...@gmail.com
wrote:

 There is no testcase for PR24398 nor the OP reporting the problem was
 actually solved. Martell?

 I'm just re-looking through it now.

 X86TargetInfo sets LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
 X86_64TargetInfo then sets LongDoubleWidth = LongDoubleAlign = 128;
 X86_32TargetInfo then sets LongDoubleWidth = 96; LongDoubleAlign = 32;

 From this I can see that the patch I committed actually doesn't change
 anything but only breaks mingw x86.
 I can only see these values changed in Microsoft*TargetInfo classes which
 is not a parent of MINGW

 When I submitted the patch I just wanted to explicitly set the values in 
 MinGWX86_64TargetInfo
 to ensure it was in fact that.
 It seemed as though it was not inheriting the value from the root parent
 class somehow.

 I was told on irc that it did fix the bug which is even stranger.
 I'm actually at a bit of a loss as to what the proper fix to this is then.

 Apologies for breaking mingw i686 long double.

 I will do up a test case and try to find the actual cause of the long
 double bug and reopen the issue.

 On Thu, Aug 20, 2015 at 3:09 PM, Yaron Keren yaron.ke...@gmail.com
 wrote:

 Hi, I've just done this exactly this in r245618 (32 bit) and r245620 (64
 bits).

 mingw i686 long double values were correct before r245084 and wrong after
  it.
 mingw x86_64 long double values were not modified at all by r245084 for
 the reason you stated, so I agree and do not see how this non-change can
 solve anything. There is no testcase for PR24398 nor the OP reporting
 the problem was actually solved. Martell?

 About PR24398,  long double support was in clang long ago and both code
 examples compile and run correctly with current svn (without r245084)
 and gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64
 project).
 It's not x86_64 but as said r245084 didn't actually modify x86_64
 configuration.




 2015-08-21 0:52 GMT+03:00 Richard Smith rich...@metafoo.co.uk:

 OK, so here's the problem:

 The right way to fix this seems to be to delete the assignments to
 LongDouble* from the MinGWX86_32TargetInfo constructor; the
 X86_32TargetInfo and X86TargetInfo base classes already set them to the
 right values. Likewise we can delete the assignments to LongDouble* from
 the MinGWX86_64TargetInfo constructor for the same reason.

 But... that completely reverts Martell's r245084, which apparently fixed
 PR24398. So you two need to figure out what the actual problem is here, and
 what the right fix is. r245084 didn't provide any test cases, and had no
 apparent effect other than to break long double for mingw32; did it really
 fix PR24398 (and if so, how)?


 On Thu, Aug 20, 2015 at 2:27 PM, Yaron Keren yaron.ke...@gmail.com
 wrote:

 OK, based on testing, mingw i686 aligns long doubles to 4 bytes:

 sh-4.3$ cat  a.cpp
 #include iostream
 int main() {
   struct {
 char c[1];
 long double d;
   } s;
   std::couts.cstd::endl;
   std::couts.dstd::endl;
 }
 sh-4.3$ g++ a.cpp./a.exe
 0x28fea0
 0x28fea4

 I'll fix that.


 2015-08-21 0:13 GMT+03:00 Richard Smith rich...@metafoo.co.uk:

 On Wed, Aug 19, 2015 at 11:42 AM, Yaron Keren yaron.ke...@gmail.com
 wrote:

 Yes, it looks like a legacy issue. Documentation says so:

 *https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html
 https://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html*

 -m96bit-long-double-m128bit-long-doubleThese switches control the
 size of long double type. The i386 application binary interface
 specifies the size to be 96 bits, so -m96bit-long-double is the
 default in 32-bit mode.

 Modern architectures (Pentium and newer) prefer long double to be
 aligned to an 8- or 16-byte boundary. In arrays or structures conforming 
 to
 the ABI, this is not possible. So specifying -m128bit-long-double
  aligns long double to a 16-byte boundary by padding the long double with
 an additional 32-bit zero.

 In the x86-64 compiler, -m128bit-long-double is the default choice
 as its ABI specifies that long double is aligned on 16-byte boundary.

 Notice that neither of these options enable any extra precision over
 the x87 standard of 80 bits for a long double.

 *Warning:* if you override the default value for your target ABI,
 this changes the size of structures and arrays containing long double 
 variables,
 as well as modifying the function calling convention for functions 
 taking long
 double. Hence they are not 

Re: r245084 - WindowsX86: long double is x87DoubleExtended on mingw

2015-08-19 Thread Martell Malone via cfe-commits
Thanks for the spot yaron.
I had only tested x64 at the time as that's what the original bug report
was for.
I can confirm that your fix does infact fix i686

Many Thanks
Martell

On Wed, Aug 19, 2015 at 1:22 PM, Yaron Keren yaron.ke...@gmail.com wrote:

 Yes, worth merging with Richard approval.

 2015-08-19 23:16 GMT+03:00 Hans Wennborg h...@chromium.org:

 I assume this is a merge request?

 Richard: what do you think about r245459+r245462?



 On Wed, Aug 19, 2015 at 10:22 AM, Yaron Keren yaron.ke...@gmail.com
 wrote:
  Sorry to notice late (just diagnosed the issue from a failing
 boost::math
  test), according to i686 ABI, long double size on x86 is 12 bytes (the
  memory allocated, not the underlying 80 bits register), see
 
  https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/i386-and-x86-64-Options.html
 
  -m128bit-long-double
  Control the size of long double type. i386 application binary interface
  specify the size to be 12 bytes, while modern architectures (Pentium and
  newer) prefer long double aligned to 8 or 16 byte boundary. This is
  impossible to reach with 12 byte long doubles in the array accesses.
  Warning: if you use the -m128bit-long-double switch, the structures and
  arrays containing long double will change their size as well as function
  calling convention for function taking long double will be modified.
 
  -m96bit-long-double
  Set the size of long double to 96 bits as required by the i386
 application
  binary interface. This is the default.
 
 
  You can check long double size out by running
 
  #include iostream
  int main() {
long double a;
std::coutsizeof(a)std::endl;
  }
 
  which outputs 12 with mingw 32 bit, 16 with mingw 64 bit but always 16
 with
  current clang.
  I fixed this and added test in r245459+r245462.
 
 
  2015-08-19 19:41 GMT+03:00 Hans Wennborg via cfe-commits
  cfe-commits@lists.llvm.org:
 
  On Tue, Aug 18, 2015 at 6:11 PM, Richard Smith rich...@metafoo.co.uk
  wrote:
   On Tue, Aug 18, 2015 at 3:01 PM, Hans Wennborg h...@chromium.org
   wrote:
  
   Richard, I tried to ping you on the review thread but I'm not sure
 it
   got through. Martell requested this be merged to 3.7. What do you
   think?
  
  
   LGTM
 
  Thanks! r245456.
 
  
  
   On Fri, Aug 14, 2015 at 12:05 PM, Martell Malone via cfe-commits
   cfe-commits@lists.llvm.org wrote:
Author: martell
Date: Fri Aug 14 14:05:56 2015
New Revision: 245084
   
URL: http://llvm.org/viewvc/llvm-project?rev=245084view=rev
Log:
WindowsX86: long double is x87DoubleExtended on mingw
   
Summary:
long double on x86 mingw is 80bits and is aligned to 16bytes
   
Fixes:
https://llvm.org/bugs/show_bug.cgi?id=24398
   
Reviewers: rnk
   
Subscribers: cfe-commits
   
Differential Revision: http://reviews.llvm.org/D12037
   
Modified:
cfe/trunk/lib/Basic/Targets.cpp
   
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL:
   
   
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=245084r1=245083r2=245084view=diff
   
   
   
 ==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Aug 14 14:05:56 2015
@@ -3784,7 +3784,10 @@ namespace {
 class MinGWX86_32TargetInfo : public WindowsX86_32TargetInfo {
 public:
   MinGWX86_32TargetInfo(const llvm::Triple Triple)
-  : WindowsX86_32TargetInfo(Triple) {}
+  : WindowsX86_32TargetInfo(Triple) {
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
+  }
   void getTargetDefines(const LangOptions Opts,
 MacroBuilder Builder) const override {
 WindowsX86_32TargetInfo::getTargetDefines(Opts, Builder);
@@ -4014,7 +4017,10 @@ public:
 class MinGWX86_64TargetInfo : public WindowsX86_64TargetInfo {
 public:
   MinGWX86_64TargetInfo(const llvm::Triple Triple)
-  : WindowsX86_64TargetInfo(Triple) {}
+  : WindowsX86_64TargetInfo(Triple) {
+LongDoubleWidth = LongDoubleAlign = 128;
+LongDoubleFormat = llvm::APFloat::x87DoubleExtended;
+  }
   void getTargetDefines(const LangOptions Opts,
 MacroBuilder Builder) const override {
 WindowsX86_64TargetInfo::getTargetDefines(Opts, Builder);
   
   
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  
  
  ___
  cfe-commits mailing list
  cfe-commits@lists.llvm.org
  http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
 
 



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


Re: [PATCH] D12037: WindowsX86: long double is x87DoubleExtended on mingw-w64

2015-08-14 Thread Martell Malone via cfe-commits
martell added a comment.

Landed in http://reviews.llvm.org/rL245084

The commit parser is bugged :/


http://reviews.llvm.org/D12037



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


Re: [PATCH] D11808: Driver: Fix include and lib dirs when not using gcc under mingw

2015-08-12 Thread Martell Malone via cfe-commits
martell updated this revision to Diff 32007.
martell added a comment.

Updated to address yaron's comments.

Okay for me to merge now ?


http://reviews.llvm.org/D11808

Files:
  lib/Driver/MinGWToolChain.cpp
  test/Driver/Inputs/mingw_clang_tree/mingw32/i686-w64-mingw32/include/.keep
  test/Driver/Inputs/mingw_clang_tree/mingw32/include/.keep
  test/Driver/mingw.cpp

Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -1,3 +1,8 @@
+// RUN: %clang -target i686-windows-gnu -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 21 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE %s
+// CHECK_MINGW_CLANG_TREE: 
{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include
+// CHECK_MINGW_CLANG_TREE: 
{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include
+
+
 // RUN: %clang -target i686-pc-windows-gnu -stdlib=libstdc++ -c -### 
--sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 21 | FileCheck 
-check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: 
{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++
 // CHECK_MINGW_ORG_TREE: 
{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -47,7 +47,7 @@
   Archs.emplace_back(getTriple().getArchName());
   Archs[0] += -w64-mingw32;
   Archs.emplace_back(mingw32);
-  Arch = unknown;
+  Arch = Archs[0].str();
   // lib: Arch Linux, Ubuntu, Windows
   // lib64: openSUSE Linux
   for (StringRef CandidateLib : {lib, lib64}) {


Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -1,3 +1,8 @@
+// RUN: %clang -target i686-windows-gnu -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 21 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE %s
+// CHECK_MINGW_CLANG_TREE: {{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include
+// CHECK_MINGW_CLANG_TREE: {{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include
+
+
 // RUN: %clang -target i686-pc-windows-gnu -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 21 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: {{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++
 // CHECK_MINGW_ORG_TREE: {{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -47,7 +47,7 @@
   Archs.emplace_back(getTriple().getArchName());
   Archs[0] += -w64-mingw32;
   Archs.emplace_back(mingw32);
-  Arch = unknown;
+  Arch = Archs[0].str();
   // lib: Arch Linux, Ubuntu, Windows
   // lib64: openSUSE Linux
   for (StringRef CandidateLib : {lib, lib64}) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits