Re: build Ldc2 for win xp 32 bit Error

2012-08-06 Thread David Nadlinger

On Sunday, 5 August 2012 at 16:10:51 UTC, João Matos wrote:
I think so. I'll be taking a look at this soon, I'm interested 
in getting it to work on Windows. If someone wants to 
collaborate on it, feel free to mail me.


I'd be happy to help if you have any questions regarding the LDC 
side of things. As for the actual implementation, I guess I have 
to pass, even though I have a pretty good understanding of SEH 
right now, because I'm right in the middle of an exam session at 
university right now. My plan was to have a look at this in 
September or so, but I'll gladly work on ARM support instead.


David


Re: build Ldc2 for win xp 32 bit Error

2012-08-06 Thread Andrej Mitrovic
On 7/28/12, Kai Nacke k...@redstar.de wrote:
 Build instructions are here:
 https://github.com/ldc-developers/ldc/wiki/Building-and-hacking-LDC-on-Windows-using-MSVC

Can LDC compile D apps that use Phobos? It says never tried to use
Phobos here: https://github.com/ldc-developers/ldc/wiki/Project-Status

Does that apply only for 64bit builds? I'm interested in a 32bit build.


Re: build Ldc2 for win xp 32 bit Error

2012-08-06 Thread David Nadlinger

On Monday, 6 August 2012 at 15:28:04 UTC, Andrej Mitrovic wrote:
Can LDC compile D apps that use Phobos? It says never tried to 
use
Phobos here: 
https://github.com/ldc-developers/ldc/wiki/Project-Status


Does that apply only for 64bit builds? I'm interested in a 
32bit build.


This only applies to Windows, which is in general pretty much 
uncharted territory. Once in a while, someone (including me) 
tries to use it for their own projects and fixes the necessary 
stuff, but it has never reached the »supported« status due to 
lack of exception support (both 32 bit/64 bit).


Also note that Kai is specifically interested in building LDC 
using MSVC. Using MinGW, I was able to get LDC2/Phobos to work on 
32 bit Windows pretty straightforwardly some time ago, but again, 
there is no exception support yet.


David


Re: build Ldc2 for win xp 32 bit Error

2012-08-05 Thread David Nadlinger

On Saturday, 4 August 2012 at 23:35:30 UTC, Hans W. Uhlig wrote:

It sounds like this should be targetable from ldc now.


Hm? It's great that the bigger part of Charles' work has arrived 
in trunk in June or so, but what's still completely missing is 
landing pad codegen – isn't it?


David


Re: build Ldc2 for win xp 32 bit Error

2012-08-05 Thread João.Matos

On Sunday, 5 August 2012 at 09:56:09 UTC, David Nadlinger wrote:

On Saturday, 4 August 2012 at 23:35:30 UTC, Hans W. Uhlig wrote:

It sounds like this should be targetable from ldc now.


Hm? It's great that the bigger part of Charles' work has 
arrived in trunk in June or so, but what's still completely 
missing is landing pad codegen – isn't it?


David


I think so. I'll be taking a look at this soon, I'm interested in 
getting it to work on Windows. If someone wants to collaborate on 
it, feel free to mail me.


Re: build Ldc2 for win xp 32 bit Error

2012-08-04 Thread Kagamin
Dwarf2 exceptions work in clang+gcc on win32. It would be SOME 
exception handling (and quite interesting, I'd say).


Re: build Ldc2 for win xp 32 bit Error

2012-08-04 Thread Jacob Carlborg

On 2012-08-04 17:20, Kagamin wrote:

Dwarf2 exceptions work in clang+gcc on win32. It would be SOME exception
handling (and quite interesting, I'd say).


This post recently appeared on the Clang mailing list:

Hi,

I have just been made aware that GCC 4.7.2 and later will use SEH by 
default on Win64:

http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00512.html

I would like to inquire as to possibility of this being implemented in 
Clang/LLVM. As this type of exception handling is much closer to the 
classic Dwarf model currently used, I hope it won't be too difficult to 
implement this in Clang? Remember that Win64 EH is broken right now, so 
any improvement is the right improvement ;-)


For 32-bit dw2 eh already works well, and in light of the misty Borland 
patents will probably remain the only option for a while.


Thanks!

Ruben

PS: please also reply to my email address, as I'm not subscribed to cfe-dev


--
/Jacob Carlborg


Re: build Ldc2 for win xp 32 bit Error

2012-08-04 Thread Hans W. Uhlig

On Saturday, 4 August 2012 at 16:11:45 UTC, Jacob Carlborg wrote:

On 2012-08-04 17:20, Kagamin wrote:
Dwarf2 exceptions work in clang+gcc on win32. It would be SOME 
exception

handling (and quite interesting, I'd say).


This post recently appeared on the Clang mailing list:

Hi,

I have just been made aware that GCC 4.7.2 and later will use 
SEH by default on Win64:

http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00512.html

I would like to inquire as to possibility of this being 
implemented in Clang/LLVM. As this type of exception handling 
is much closer to the classic Dwarf model currently used, I 
hope it won't be too difficult to implement this in Clang? 
Remember that Win64 EH is broken right now, so any improvement 
is the right improvement ;-)


For 32-bit dw2 eh already works well, and in light of the misty 
Borland patents will probably remain the only option for a 
while.


Thanks!

Ruben

PS: please also reply to my email address, as I'm not 
subscribed to cfe-dev


Charles Davis did a lot of work on Win64 SEH support in LLVM,
check commits r131652-r132880.

It's not finished yet. All the stuff for assembly code that uses
Win64 EH is done, but not the code-gen-side stuff (cf.
Win64Exception class in CodeGen). I was about to finish it, but
then real life happened :). This would have allowed us to use
DW2-style EH on Win64, but it still would have been problematic
for VC++ EH.

Kai Tietz was interested in finishing it, so I emailed him what I
have. I assume he's been working on it--he recently submitted a
patch to fix the permissions on .pdata/.xdata sections that I got
wrong :). I've CC'd him as well so we can see what he has for us.

Chip

It sounds like this should be targetable from ldc now.


Re: build Ldc2 for win xp 32 bit Error

2012-08-04 Thread Hans W. Uhlig

On Saturday, 4 August 2012 at 23:35:30 UTC, Hans W. Uhlig wrote:
On Saturday, 4 August 2012 at 16:11:45 UTC, Jacob Carlborg 
wrote:

On 2012-08-04 17:20, Kagamin wrote:
Dwarf2 exceptions work in clang+gcc on win32. It would be 
SOME exception

handling (and quite interesting, I'd say).


This post recently appeared on the Clang mailing list:

Hi,

I have just been made aware that GCC 4.7.2 and later will use 
SEH by default on Win64:

http://gcc.gnu.org/ml/gcc-patches/2012-07/msg00512.html

I would like to inquire as to possibility of this being 
implemented in Clang/LLVM. As this type of exception handling 
is much closer to the classic Dwarf model currently used, I 
hope it won't be too difficult to implement this in Clang? 
Remember that Win64 EH is broken right now, so any improvement 
is the right improvement ;-)


For 32-bit dw2 eh already works well, and in light of the 
misty Borland patents will probably remain the only option for 
a while.


Thanks!

Ruben

PS: please also reply to my email address, as I'm not 
subscribed to cfe-dev


Charles Davis did a lot of work on Win64 SEH support in LLVM,
check commits r131652-r132880.

It's not finished yet. All the stuff for assembly code that uses
Win64 EH is done, but not the code-gen-side stuff (cf.
Win64Exception class in CodeGen). I was about to finish it, but
then real life happened :). This would have allowed us to use
DW2-style EH on Win64, but it still would have been problematic
for VC++ EH.

Kai Tietz was interested in finishing it, so I emailed him what 
I

have. I assume he's been working on it--he recently submitted a
patch to fix the permissions on .pdata/.xdata sections that I 
got
wrong :). I've CC'd him as well so we can see what he has for 
us.


Chip

It sounds like this should be targetable from ldc now.


http://www.nynaeve.net/?p=113


Re: build Ldc2 for win xp 32 bit Error

2012-07-31 Thread Don Clugston

On 26/07/12 09:05, Jacob Carlborg wrote:

On 2012-07-25 22:39, Rainer Schuetze wrote:


What is the state of the missing exception handling for Windows?


I just read an old post on the Clang mailing list, it's not looking
good. It seems Microsoft (or someone else) has a patent on SEH,


I've heard this, but does anyone know what patent is being referred to? 
Several times I've heard mention of an old one by Borland, which 
Microsoft bought. The Borland patent is not a patent on SEH, it's 
basically a patent on using a thunk. I suspect it is extremely unlikely 
to be a valid patent, for sure there is prior art. And the only reason 
for implementing it with a thunk anyway, is as a workaround for the 
broken thread-local support in Windows prior to Vista.


It's not difficult to implement SEH without violating that patent (which 
is due to expire soon anyway). Is there some other patent that people 
are referring to?



which

basically means: never gonna happen. An alternative could be
setjmp/longjmp. On 64bit it looks a bit better, where the correct way
seems to be to use the Win64 exception ABI.


Win64 SEH is scarcely any different to Win32 SEH, it's just better 
documented. You can do the same thing on Win32.




http://clang-developers.42468.n3.nabble.com/LLVM-Clang-and-setjmp-longjmp-exception-handling-on-MinGW-td3407322.html


http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx


The situation makes no sense to me.



Re: build Ldc2 for win xp 32 bit Error

2012-07-31 Thread David Nadlinger

On Tuesday, 31 July 2012 at 11:21:21 UTC, Don Clugston wrote:
Win64 SEH is scarcely any different to Win32 SEH, it's just 
better documented. You can do the same thing on Win32.


Unless I'm mistaken, SEH on Win64 is quite a lot different to 
Win32, as it is based on tables, rather than keeping FS:[0] up to 
date in the function pro-/epilogues.


David


Re: build Ldc2 for win xp 32 bit Error

2012-07-31 Thread Jacob Carlborg

On 2012-07-31 13:21, Don Clugston wrote:


I've heard this, but does anyone know what patent is being referred to?
Several times I've heard mention of an old one by Borland, which
Microsoft bought. The Borland patent is not a patent on SEH, it's
basically a patent on using a thunk. I suspect it is extremely unlikely
to be a valid patent, for sure there is prior art. And the only reason
for implementing it with a thunk anyway, is as a workaround for the
broken thread-local support in Windows prior to Vista.


I think it's this patent:

http://www.google.com/patents/about?id=21MgEBAJdq=5,628,016

Inventor: Peter Kukol
Original Assignee: Borland International, Inc.
Primary Examiner: Peter J. Corcoran, III
Current U.S. Classification: 717/140; 717/114
International Classification: G06F 945


It's not difficult to implement SEH without violating that patent (which
is due to expire soon anyway). Is there some other patent that people
are referring to?


It doesn't matter. The Clang/LLVM developers won't accept an 
implementation that has any chance of being covered by a patent.


--
/Jacob Carlborg


Re: build Ldc2 for win xp 32 bit Error

2012-07-29 Thread Kai Nacke

Hi huynh van sen!

This is fixed now. Please try again.

Regards
Kai

On 25.07.2012 06:28, huynh van sen wrote:

Please build LDC2 for windowXP with visual studio 2010
I try compling on windows XP 32 bit .But I get Error
Please Help me !

C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(33): error A2034: must be in
segment
  block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(34): error A2034: must be in
segment
  block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(35): error A2034: must be in
segment
  block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(36): error A2034: must be in
segment
  block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(37): error A2034: must be in
segment
  block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(38): fatal error A1010:
unmatched bl
ock nesting : ld_read [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
Done Building Project C:\ldcenv\build-ldc2\LDCShared.vcxproj (default
targets



C:\ldcenv\build-ldc2\ALL_BUILD.vcxproj (default target) (1) -
C:\ldcenv\build-ldc2\LDCShared.vcxproj (default target) (2) -
(CustomBuild target) -
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(23): error A2013: .MODEL
must prec
ede this directive [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(25): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(27): error A2013: .MODEL
must prec
ede this directive [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(31): error A2034: must be
in segme
nt block : ld_read [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(32): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(33): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(34): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(35): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(36): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(37): error A2034: must be
in segme
nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(38): fatal error A1010:
unmatched
block nesting : ld_read [C:\ldcenv\build-ldc2\LDCShared.vcxproj]


C:\ldcenv\build-ldc2\ALL_BUILD.vcxproj (default target) (1) -
C:\ldcenv\build-ldc2\ldmd2.vcxproj (default target) (8) -
(Link target) -
   LINK : fatal error LNK1104: cannot open file 'Program.lib'
[C:\ldcenv\build-l
dc2\ldmd2.vcxproj]

 30 Warning(s)
 12 Error(s)

Time Elapsed 00:00:20.18

C:\ldcenv\build-ldc2




Re: build Ldc2 for win xp 32 bit Error

2012-07-28 Thread Kai Nacke

On 25.07.2012 22:39, Rainer Schuetze wrote:



On 25.07.2012 06:28, huynh van sen wrote:

Please build LDC2 for windowXP with visual studio 2010
I try compling on windows XP 32 bit .But I get Error
Please Help me !

C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(33): error A2034: must be in
segment



nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(38): fatal error A1010:
unmatched
block nesting : ld_read [C:\ldcenv\build-ldc2\LDCShared.vcxproj]


C:\ldcenv\build-ldc2\ALL_BUILD.vcxproj (default target) (1) -
C:\ldcenv\build-ldc2\ldmd2.vcxproj (default target) (8) -
(Link target) -
   LINK : fatal error LNK1104: cannot open file 'Program.lib'
[C:\ldcenv\build-l
dc2\ldmd2.vcxproj]

 30 Warning(s)
 12 Error(s)

Time Elapsed 00:00:20.18

C:\ldcenv\build-ldc2


I have not tried to build LDC myself, but my guess is that there is
something wrong with the build step for the assembly file ldfpu.asm. It
seems the VS projects are generated from CMake, so it might not be setup
correctly.

For x64 builds, the command line in dmd_msc.vcproj is ml64 -c -Zi
-Fl$(IntDir)\$(InputName).lst -Fo$(IntDir)\$(InputName).obj
$(InputPath).
For win32 builds, ldfpu.asm should be excluded from the build, inline
assembly is used instead in longdouble.c.

BTW: are there instructions how to build LDC2 on Windows? What is the
state of the missing exception handling for Windows?


Hi!

Thanks for the hint. I try to correct the build file generation. Because 
of missing SEH support (protected by patents :-( ), I only work on the 
x64 version of LDC.


Build instructions are here:
https://github.com/ldc-developers/ldc/wiki/Building-and-hacking-LDC-on-Windows-using-MSVC

Regards
Kai


Re: build Ldc2 for win xp 32 bit Error

2012-07-26 Thread Jacob Carlborg

On 2012-07-25 22:39, Rainer Schuetze wrote:


What is the state of the missing exception handling for Windows?


I just read an old post on the Clang mailing list, it's not looking 
good. It seems Microsoft (or someone else) has a patent on SEH, which 
basically means: never gonna happen. An alternative could be 
setjmp/longjmp. On 64bit it looks a bit better, where the correct way 
seems to be to use the Win64 exception ABI.


http://clang-developers.42468.n3.nabble.com/LLVM-Clang-and-setjmp-longjmp-exception-handling-on-MinGW-td3407322.html

http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx

--
/Jacob Carlborg


Re: build Ldc2 for win xp 32 bit Error

2012-07-25 Thread Rainer Schuetze



On 25.07.2012 06:28, huynh van sen wrote:

Please build LDC2 for windowXP with visual studio 2010
I try compling on windows XP 32 bit .But I get Error
Please Help me !

C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(33): error A2034: must be in
segment



nt block [C:\ldcenv\build-ldc2\LDCShared.vcxproj]
   C:/ldcenv/build-ldc2/ldc/vcbuild/ldfpu.asm(38): fatal error A1010:
unmatched
block nesting : ld_read [C:\ldcenv\build-ldc2\LDCShared.vcxproj]


C:\ldcenv\build-ldc2\ALL_BUILD.vcxproj (default target) (1) -
C:\ldcenv\build-ldc2\ldmd2.vcxproj (default target) (8) -
(Link target) -
   LINK : fatal error LNK1104: cannot open file 'Program.lib'
[C:\ldcenv\build-l
dc2\ldmd2.vcxproj]

 30 Warning(s)
 12 Error(s)

Time Elapsed 00:00:20.18

C:\ldcenv\build-ldc2


I have not tried to build LDC myself, but my guess is that there is 
something wrong with the build step for the assembly file ldfpu.asm. It 
seems the VS projects are generated from CMake, so it might not be setup 
correctly.


For x64 builds, the command line in dmd_msc.vcproj is ml64 -c -Zi 
-Fl$(IntDir)\$(InputName).lst -Fo$(IntDir)\$(InputName).obj 
$(InputPath).
For win32 builds, ldfpu.asm should be excluded from the build, inline 
assembly is used instead in longdouble.c.


BTW: are there instructions how to build LDC2 on Windows? What is the 
state of the missing exception handling for Windows?