RTS linker refactoring

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RTS linker refactoring

Sylvain HENRY
Hi devs,

I have made a patch to refactor the RTS linker, especially to drastically reduce its memory usage: https://phabricator.haskell.org/D1470

We need to test it on differrent OS/architectures before it can be merged. Here is the current state:
 - Linux/x86-64: OK (Harbormaster and I)
 - Solaris/x86-64: was OK, maybe needs to be retested (@kgardas)
 - OpenBSD/x86-64: was OK, maybe needs to be tetested (@kgardas)
 - Solaris/i386: was failing with unrelated error, needs to be retested (@kgardas)
 - Linux/PowerPC: OK (@erikd)
 - Linux/ARM: was failing with unrelated #11123 (@erikd), OK? (@bgamari)
 - Windows: ?
 - MacOS: ?
 - ia64: ?

I don't have access to Windows and Mac OS boxes so I don't even know if it compiles there. Could someone test it (validate) on these OSes and report any issue they encounter to me (by mail or on phabricator)?

Do we support ia64 architecture?

Thanks!
Sylvain

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: RTS linker refactoring

Ben Gamari-3
Sylvain Henry <[hidden email]> writes:

> Hi devs,
>
> I have made a patch to refactor the RTS linker, especially to drastically
> reduce its memory usage: https://phabricator.haskell.org/D1470
>
> We need to test it on differrent OS/architectures before it can be merged.
> Here is the current state:
>  - Linux/x86-64: OK (Harbormaster and I)
>  - Solaris/x86-64: was OK, maybe needs to be retested (@kgardas)
>  - OpenBSD/x86-64: was OK, maybe needs to be tetested (@kgardas)
>  - Solaris/i386: was failing with unrelated error, needs to be retested
> (@kgardas)
>  - Linux/PowerPC: OK (@erikd)
>  - Linux/ARM: was failing with unrelated #11123 (@erikd), OK? (@bgamari)
Unfortunately my ARM box crashed hard during the build for unrelated
reasons (I believe). I'll give it another shot.

>  - Windows: ?

This failed validation on mingw64 with a few warnings,

    rts\Linker.c: In function 'mkOc':

    rts\Linker.c:2048:32: error:
        error: implicit declaration of function 'strdup_' [-Werror=implicit-function-declaration]
                oc->archiveMemberName = strdup_(archiveMemberName);
                                        ^

    rts\Linker.c:2048:8: error:
        error: nested extern declaration of 'strdup_' [-Werror=nested-externs]
                oc->archiveMemberName = strdup_(archiveMemberName);
                ^

    rts\Linker.c:2048:30: error:
        error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
                oc->archiveMemberName = strdup_(archiveMemberName);
                                      ^
    rts\Linker.c: At top level:

    rts\Linker.c:3113:7: error:
        error: unknown type name 'UInt8'
              UInt8  MajorLinkerVersion;
              ^

    rts\Linker.c:3114:7: error:
        error: unknown type name 'UInt8'
              UInt8  MinorLinkerVersion;
              ^
    rts\Linker.c: In function 'ocAllocateSymbolExtras_PEi386':

    rts\Linker.c:4000:38: error:
        error: 'ObjectCode {aka struct _ObjectCode}' has no member named 'fileSize'
                  + ((PEi386_IMAGE_OFFSET + oc->fileSize + 0x7) & ~0x7));
                                              ^
    rts\Linker.c: At top level:

    rts\Linker.c:1796:15: error:
        error: 'allocMem' defined but not used [-Werror=unused-function]
        static void * allocMem(StgWord size, StgWord alignment,


>  - MacOS: ?

This is running.

>  - ia64: ?
>
> I don't have access to Windows and Mac OS boxes so I don't even know if it
> compiles there. Could someone test it (validate) on these OSes and report
> any issue they encounter to me (by mail or on phabricator)?
>
> Do we support ia64 architecture?
>
It worked once. It's now a second tier platform at best. If someone
steps up they can fix the pieces.

Cheers,

- Ben


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (482 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: RTS linker refactoring

Ben Gamari-3
Ben Gamari <[hidden email]> writes:

> Sylvain Henry <[hidden email]> writes:
>
>> Hi devs,
>>
>> I have made a patch to refactor the RTS linker, especially to drastically
>> reduce its memory usage: https://phabricator.haskell.org/D1470
>>
>> We need to test it on differrent OS/architectures before it can be merged.
>> Here is the current state:
>>  - Linux/x86-64: OK (Harbormaster and I)
>>  - Solaris/x86-64: was OK, maybe needs to be retested (@kgardas)
>>  - OpenBSD/x86-64: was OK, maybe needs to be tetested (@kgardas)
>>  - Solaris/i386: was failing with unrelated error, needs to be retested
>> (@kgardas)
>>  - Linux/PowerPC: OK (@erikd)
>>  - Linux/ARM: was failing with unrelated #11123 (@erikd), OK? (@bgamari)
>
> Unfortunately my ARM box crashed hard during the build for unrelated
> reasons (I believe). I'll give it another shot.
>
snip
>
>>  - MacOS: ?
>
> This is running.
>

OS X failed with errors,

    rts/Linker.c:6943:37: error:
        error: no member named 'alignment' in 'struct section_64'
                StgWord alignment = shdr[i].alignment;
                                    ~~~~~~~ ^

    rts/Linker.c:6954:13: error:
        error: use of undeclared identifier 'addr'
                    addr = allocMem(size,alignment,&alloc,&misalignment);
                    ^

    rts/Linker.c:6954:45: error:
        error: use of undeclared identifier 'alloc'
                    addr = allocMem(size,alignment,&alloc,&misalignment);
                                                    ^

    rts/Linker.c:6954:52: error:
        error: use of undeclared identifier 'misalignment'; did you mean 'alignment'?
                    addr = allocMem(size,alignment,&alloc,&misalignment);
                                                          ^~~~~~~~~~~~
                                                          alignment

    rts/Linker.c:6943:17: error:
        note: 'alignment' declared here
                StgWord alignment = shdr[i].alignment;
                        ^

    rts/Linker.c:6955:20: error:
        error: use of undeclared identifier 'addr'; did you mean 'shdr'?
                    memset(addr,0,size);
                          ^~~~
                          shdr

    /usr/include/secure/_string.h:77:27: error:
        note: expanded from macro 'memset'
          __builtin___memset_chk (dest, val, len, __darwin_obsz0 (dest))
                                  ^

    rts/Linker.c:6771:21: error:
        note: 'shdr' declared here
            struct section *shdr;
                            ^

    rts/Linker.c:6955:20: error:
        error: use of undeclared identifier 'addr'; did you mean 'shdr'?
                    memset(addr,0,size);
                          ^~~~
                          shdr

    /usr/include/secure/_string.h:77:59: error:
        note: expanded from macro 'memset'
          __builtin___memset_chk (dest, val, len, __darwin_obsz0 (dest))
                                                                  ^

    /usr/include/secure/_common.h:38:55: error:
        note: expanded from macro '__darwin_obsz0'
    #define __darwin_obsz0(object) __builtin_object_size (object, 0)
                                                          ^

    rts/Linker.c:6771:21: error:
        note: 'shdr' declared here
            struct section *shdr;
                            ^

    rts/Linker.c:6963:39: error:
        error: use of undeclared identifier 'offset'
                      && ((oc->memberOffset + offset) % alignment == 0)) {
                                              ^

    rts/Linker.c:6964:21: error:
        error: use of undeclared identifier 'fd'
                        if (fd == -1) {
                            ^

    rts/Linker.c:6965:21: error:
        error: use of undeclared identifier 'fd'
                            fd = open_(oc->memberPath, O_RDONLY);
                            ^

    rts/Linker.c:6967:21: error:
        error: use of undeclared identifier 'fd'
                        if (fd != -1) {
                            ^

    rts/Linker.c:6974:21: error:
        error: use of undeclared identifier 'addr'
                            addr = mapObjectFileSection(fd,
                            ^

    rts/Linker.c:6974:28: error:
        error: implicit declaration of function 'mapObjectFileSection' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                            addr = mapObjectFileSection(fd,
                                  ^

    rts/Linker.c:6975:68: error:
        error: use of undeclared identifier 'offset'
                                                        oc->memberOffset + offset,
                                                                          ^

    rts/Linker.c:6974:49: error:
        error: use of undeclared identifier 'fd'
                            addr = mapObjectFileSection(fd,
                                                        ^

    rts/Linker.c:6977:50: error:
        error: use of undeclared identifier 'misalignment'; did you mean 'alignment'?
                                                        &misalignment);
                                                        ^~~~~~~~~~~~
                                                        alignment

    rts/Linker.c:6943:17: error:
        note: 'alignment' declared here
                StgWord alignment = shdr[i].alignment;
                        ^

    rts/Linker.c:6978:25: error:
        error: use of undeclared identifier 'addr'; did you mean 'shdr'?
                            if (addr == NULL) goto fail;
                                ^~~~
                                shdr

    rts/Linker.c:6771:21: error:
        note: 'shdr' declared here
            struct section *shdr;
                            ^

    rts/Linker.c:6979:21: error:
        error: use of undeclared identifier 'alloc'
                            alloc = ALLOC_MMAP;
                            ^

    rts/Linker.c:7003:17: error:
        error: use of undeclared identifier 'addr'
                        addr = allocMem(size,alignment,&alloc,&misalignment);
                        ^

    rts/Linker.c:7003:49: error:
        error: use of undeclared identifier 'alloc'
                        addr = allocMem(size,alignment,&alloc,&misalignment);
                                                        ^
    fatal error: too many errors emitted, stopping now [-ferror-limit=]

Cheers,

- Ben

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

signature.asc (482 bytes) Download Attachment