Christian Maeder wrote:
Simon Marlow schrieb:
The only reason we keep the .size directives around at all is because
certain tools (like Valgind for example) don't work without .size
information.  GHC itself, including our dynamic linker, works fine
without it.

I can't tell exactly what has gone wrong in this particular instance -
you'll need to compile the offending module with -keep-raw-s-file
-keep-s-file and inspect those .size directives.

At the end of PrimOps.raw_s there (probably correctly) is:

.globl GHC_ZCCReturnable_static_info
        .align 4
        .type   GHC_ZCCReturnable_static_info, @object
        .size   GHC_ZCCReturnable_static_info, 4
GHC_ZCCReturnable_static_info:
        .zero   4

All ".text" blocks are followed by "p2align 2,,3" and typically look like:
        .string "delayzh_fast"
        .text
        .p2align 2,,3

In PrimOps.s it looks (wrongly mangled?) like this:

.text
        .align 4
        .type   GHC_ZCCReturnable_static_info, @object
        .size   GHC_ZCCReturnable_static_info, 4
        .zero   4
.globl GHC_ZCCReturnable_static_info
GHC_ZCCReturnable_static_info:

Right, I see the problem. The mangler moved the symbol to the end of the structure as it was supposed to (info tables are laid out backwards in memory), but it left the .size directive in place. There apparently isn't a way to indicate the size of a structure that has a symbol at the end and not one at the beginning :-)

I guess we should just eliminate the .size directives if the linker is going to be picky about them. In ghc-asm.lprl you'll find

    $T_COPY_DIRVS   = '^\s*\.(globl|type|size|local)';

if you change it to

    $T_COPY_DIRVS   = '^\s*\.(globl|local)';

that will get rid of all the .size directives. It's a bit brutal, but there isn't an easy way currently to just elimiante the problematic ones (the native code generator should generate the right thing, it's just the via-C code path that goes wrong).

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to