Thread overview
[dmd-internals] Support of OpenBSD
Aug 07, 2012
Konstantin Staver
Aug 07, 2012
Konstantin Staver
Aug 08, 2012
Martin Nowak
Aug 08, 2012
Konstantin Staver
Aug 08, 2012
dawg
Aug 08, 2012
Konstantin Staver
Aug 09, 2012
Martin Nowak
Aug 09, 2012
Konstantin Staver
August 07, 2012
Hi.

I'm trying to port phobos2 and druntime2 to OpenBSD 5.1. I found next problems:

1) D compiler loops with '-O -release' flags. For example:
$ cat test.d
module my_mod;

void MyFunc()
{
    int[2] arr;
    for (size_t i = 0; i < 2; ++i) {
        arr[i] = 1;
    }
}
$ pwd
/home/walnut/work/druntime
$ dmd -lib -oflib/libtest.a -m32 -O -release -Isrc ./test.d
^C

2) File druntime/src/rt/memory.d (http://goo.gl/iD3me). I don't know
about gc_addRange params for OpenBSD :-(

3) "Empty main()" program crashes with segfault.

4) "Hello world" program failed to build with flag "-g" or "-gc":
$ cat hello.d
import std.stdio;
void main() { writeln("Hello, World!"); }
$ dmd -gc hello.d
Internal error: backend/cod3.c 2662

5) I don't know yet how implement poly from std.math (asm).

I'll be glad to any help: tips, links to docs and etc.

My work forks:
 https://github.com/MadSkipjack/druntime
 https://github.com/MadSkipjack/phobos

Thanks.
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals

August 07, 2012
On Tue, Aug 7, 2012 at 6:14 PM, Konstantin Staver <mad.skipjack@gmail.com> wrote:
> Hi.
>
> I'm trying to port phobos2 and druntime2 to OpenBSD 5.1. I found next problems:
>
> 1) D compiler loops with '-O -release' flags. For example:
> $ cat test.d
> module my_mod;
>
> void MyFunc()
> {
>     int[2] arr;
>     for (size_t i = 0; i < 2; ++i) {
>         arr[i] = 1;
>     }
> }
> $ pwd
> /home/walnut/work/druntime
> $ dmd -lib -oflib/libtest.a -m32 -O -release -Isrc ./test.d
> ^C
>
> 2) File druntime/src/rt/memory.d (http://goo.gl/iD3me). I don't know
> about gc_addRange params for OpenBSD :-(
>
> 3) "Empty main()" program crashes with segfault.
>
> 4) "Hello world" program failed to build with flag "-g" or "-gc":
> $ cat hello.d
> import std.stdio;
> void main() { writeln("Hello, World!"); }
> $ dmd -gc hello.d
> Internal error: backend/cod3.c 2662
>
> 5) I don't know yet how implement poly from std.math (asm).
>
> I'll be glad to any help: tips, links to docs and etc.
>
> My work forks:
>  https://github.com/MadSkipjack/druntime
>  https://github.com/MadSkipjack/phobos
>
> Thanks.

I've been meaning to port the tool chain to OpenBSD for a while now, but I'd have to set up VMs to get anything done. If you happen to have an OpenBSD machine running 24/7 that I could get an SSH account on, that would be great. I should be able to do most of the porting in druntime and Phobos. The compiler bugs you mention will probably take a bit of time to track down, though.

Regards,
Alex
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals

August 07, 2012
Send me SSH pubkey and desirable username, pls.

On Tue, Aug 7, 2012 at 8:23 PM, Alex Rønne Petersen <xtzgzorex@gmail.com> wrote:
> On Tue, Aug 7, 2012 at 6:14 PM, Konstantin Staver <mad.skipjack@gmail.com> wrote:
>> Hi.
>>
>> I'm trying to port phobos2 and druntime2 to OpenBSD 5.1. I found next problems:
>>
>> 1) D compiler loops with '-O -release' flags. For example:
>> $ cat test.d
>> module my_mod;
>>
>> void MyFunc()
>> {
>>     int[2] arr;
>>     for (size_t i = 0; i < 2; ++i) {
>>         arr[i] = 1;
>>     }
>> }
>> $ pwd
>> /home/walnut/work/druntime
>> $ dmd -lib -oflib/libtest.a -m32 -O -release -Isrc ./test.d
>> ^C
>>
>> 2) File druntime/src/rt/memory.d (http://goo.gl/iD3me). I don't know
>> about gc_addRange params for OpenBSD :-(
>>
>> 3) "Empty main()" program crashes with segfault.
>>
>> 4) "Hello world" program failed to build with flag "-g" or "-gc":
>> $ cat hello.d
>> import std.stdio;
>> void main() { writeln("Hello, World!"); }
>> $ dmd -gc hello.d
>> Internal error: backend/cod3.c 2662
>>
>> 5) I don't know yet how implement poly from std.math (asm).
>>
>> I'll be glad to any help: tips, links to docs and etc.
>>
>> My work forks:
>>  https://github.com/MadSkipjack/druntime
>>  https://github.com/MadSkipjack/phobos
>>
>> Thanks.
>
> I've been meaning to port the tool chain to OpenBSD for a while now, but I'd have to set up VMs to get anything done. If you happen to have an OpenBSD machine running 24/7 that I could get an SSH account on, that would be great. I should be able to do most of the porting in druntime and Phobos. The compiler bugs you mention will probably take a bit of time to track down, though.
>
> Regards,
> Alex
> _______________________________________________
> dmd-internals mailing list
> dmd-internals@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals

August 07, 2012
Public key attached. 'alexrp' as username is fine.

On Tue, Aug 7, 2012 at 7:35 PM, Konstantin Staver <mad.skipjack@gmail.com> wrote:
> Send me SSH pubkey and desirable username, pls.
>
> On Tue, Aug 7, 2012 at 8:23 PM, Alex Rønne Petersen <xtzgzorex@gmail.com> wrote:
>> On Tue, Aug 7, 2012 at 6:14 PM, Konstantin Staver <mad.skipjack@gmail.com> wrote:
>>> Hi.
>>>
>>> I'm trying to port phobos2 and druntime2 to OpenBSD 5.1. I found next problems:
>>>
>>> 1) D compiler loops with '-O -release' flags. For example:
>>> $ cat test.d
>>> module my_mod;
>>>
>>> void MyFunc()
>>> {
>>>     int[2] arr;
>>>     for (size_t i = 0; i < 2; ++i) {
>>>         arr[i] = 1;
>>>     }
>>> }
>>> $ pwd
>>> /home/walnut/work/druntime
>>> $ dmd -lib -oflib/libtest.a -m32 -O -release -Isrc ./test.d
>>> ^C
>>>
>>> 2) File druntime/src/rt/memory.d (http://goo.gl/iD3me). I don't know
>>> about gc_addRange params for OpenBSD :-(
>>>
>>> 3) "Empty main()" program crashes with segfault.
>>>
>>> 4) "Hello world" program failed to build with flag "-g" or "-gc":
>>> $ cat hello.d
>>> import std.stdio;
>>> void main() { writeln("Hello, World!"); }
>>> $ dmd -gc hello.d
>>> Internal error: backend/cod3.c 2662
>>>
>>> 5) I don't know yet how implement poly from std.math (asm).
>>>
>>> I'll be glad to any help: tips, links to docs and etc.
>>>
>>> My work forks:
>>>  https://github.com/MadSkipjack/druntime
>>>  https://github.com/MadSkipjack/phobos
>>>
>>> Thanks.
>>
>> I've been meaning to port the tool chain to OpenBSD for a while now, but I'd have to set up VMs to get anything done. If you happen to have an OpenBSD machine running 24/7 that I could get an SSH account on, that would be great. I should be able to do most of the porting in druntime and Phobos. The compiler bugs you mention will probably take a bit of time to track down, though.
>>
>> Regards,
>> Alex
>> _______________________________________________
>> dmd-internals mailing list
>> dmd-internals@puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-internals
> _______________________________________________
> dmd-internals mailing list
> dmd-internals@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals


August 08, 2012
On Tue, 07 Aug 2012 18:14:36 +0200, Konstantin Staver <mad.skipjack@gmail.com> wrote:

> Hi.
>
> I'm trying to port phobos2 and druntime2 to OpenBSD 5.1. I found next problems:
>
Are you compiling HEAD?

> 1) D compiler loops with '-O -release' flags. For example:
> $ cat test.d
> module my_mod;
>
> void MyFunc()
> {
>     int[2] arr;
>     for (size_t i = 0; i < 2; ++i) {
>         arr[i] = 1;
>     }
> }
> $ pwd
> /home/walnut/work/druntime
> $ dmd -lib -oflib/libtest.a -m32 -O -release -Isrc ./test.d
> ^C
>
I will have a look at this. Can you recommend a live CD.

> 2) File druntime/src/rt/memory.d (http://goo.gl/iD3me). I don't know
> about gc_addRange params for OpenBSD :-(
>
You need to find bracket symbols for the relevant ELF sections. You'll need to find writeable allocated sections and bracket symbols provided by the linker script.

What's your output of this?
----
SHELL=/bin/sh script sections.txt

echo "void main() {}" > main.d
dmd main
readelf --segments main
readelf --sections main

# ld --verbose for linker script
dmd main -L--verbose
exit
----

> 3) "Empty main()" program crashes with segfault.
>
> 4) "Hello world" program failed to build with flag "-g" or "-gc":
> $ cat hello.d
> import std.stdio;
> void main() { writeln("Hello, World!"); }
> $ dmd -gc hello.d
> Internal error: backend/cod3.c 2662
>
> 5) I don't know yet how implement poly from std.math (asm).
>
The only difference between OSes is the real padding, I guess it's 12byte as on linux and FreeBSD.

> I'll be glad to any help: tips, links to docs and etc.
>
> My work forks:
>  https://github.com/MadSkipjack/druntime
>  https://github.com/MadSkipjack/phobos
>
> Thanks.
> _______________________________________________
> dmd-internals mailing list
> dmd-internals@puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals

August 08, 2012
> Are you compiling HEAD?

Yes

> I will have a look at this. Can you recommend a live CD.

Send me SSH public key and username. I'll give you access to the host :-)

> What's your output of this?

I attached sections.txt.gz


August 08, 2012
> Send me SSH public key and username. I'll give you access to the host :-)
>
dawg



August 08, 2012
On Wed, Aug 08, 2012 at 05:15:47PM +0200, dawg@dawgfoto.de wrote:
> >Send me SSH public key and username. I'll give you access to the host :-)
> >
> dawg
> 

dawg@65.49.80.18

Done :-)


_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals

August 09, 2012
On Tue, 07 Aug 2012 18:14:36 +0200, Konstantin Staver <mad.skipjack@gmail.com> wrote:

> Hi.
>
> I'm trying to port phobos2 and druntime2 to OpenBSD 5.1. I found next problems:
>
> 1) D compiler loops with '-O -release' flags. For example:
> $ cat test.d
> module my_mod;
>
> void MyFunc()
> {
>     int[2] arr;
>     for (size_t i = 0; i < 2; ++i) {
>         arr[i] = 1;
>     }
> }
> $ pwd
> /home/walnut/work/druntime
> $ dmd -lib -oflib/libtest.a -m32 -O -release -Isrc ./test.d
> ^C
>
http://d.puremagic.com/issues/show_bug.cgi?id=8525
https://github.com/D-Programming-Language/dmd/pull/1076

It's pretty hard to debug those IR optimization loops.
For now you can workaround them by disabling the OpenBSD4.x <fenv.h> workarounds in backend/evalu8.c but we should actually fix that some transformations loop if evalu8 fails.

http://www.openbsd.org/cgi-bin/cvsweb/src/include/fenv.h
_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals

August 09, 2012
> It's pretty hard to debug those IR optimization loops.
> For now you can workaround them by disabling the OpenBSD4.x <fenv.h>
> workarounds in backend/evalu8.c but we should actually fix that some
> transformations loop if evalu8 fails.

Thanks for taking the time to found the problem! I'm going to try to solve other challenges %)

_______________________________________________
dmd-internals mailing list
dmd-internals@puremagic.com
http://lists.puremagic.com/mailman/listinfo/dmd-internals