RTS linker refactoring

Ben Gamari ben at well-typed.com
Tue Dec 8 14:41:12 UTC 2015


Ben Gamari <ben at well-typed.com> writes:

> Sylvain Henry <hsyl20 at gmail.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151208/d7b57c36/attachment.sig>


More information about the ghc-devs mailing list