In perl.git, the branch jdb/win32-mingw-reloc has been created

<http://perl5.git.perl.org/perl.git/commitdiff/d2728c59d12efd9e1eb0245a100c31ec0e0e5f8f?hp=0000000000000000000000000000000000000000>

        at  d2728c59d12efd9e1eb0245a100c31ec0e0e5f8f (commit)

- Log -----------------------------------------------------------------
commit d2728c59d12efd9e1eb0245a100c31ec0e0e5f8f
Author: Jan Dubois <[email protected]>
Date:   Mon Jun 8 17:31:07 2015 -0700

    Don't use --base-file to create XS DLLs using MinGW on Windows
    
    Analyzed by bulk88++:
    https://rt.cpan.org/Ticket/Display.html?id=78395#txn-1458445
    
    TL;DR: Any time a compilation unit uses the __declspec(dllexport)
    decorator, GCC will already include relocation information directly.
    Including relocation fixups via the --base-file mechanism will then
    include a second copy of the fixups, which will *both* be applied by
    the Windows loader, resulting in invalid addresses.
    
    Some XS extensions already use __declspec(dllexport) on Windows, e.g.
    
https://github.com/ingydotnet/yaml-libyaml-pm/blob/c87c997/LibYAML/yaml.h#L29-L39
    
    So to avoid generating broken relocation fixups for XS modules, we
    must not use --base-file to generate the DLLs.
    
    To avoid leaving XS modules without relocation information (if they
    don't use _declspec(dllexport) anywhere), XSUB.h in the core has been
    modified to add __declspec(dllexport) to XS_EXTERNAL in 5.20.3+ and
    5.22.1+.

M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm

commit b38f296a9d3c13c5be2c072134f9c6a458cb80f9
Author: Jan Dubois <[email protected]>
Date:   Mon Jun 8 17:08:13 2015 -0700

    Don't use --base-file to create XS DLLs using MinGW on Windows
    
    Analyzed by bulk88++:
    https://rt.cpan.org/Ticket/Display.html?id=78395#txn-1458445
    
    TL;DR: Any time a compilation unit uses the __declspec(dllexport)
    decorator, GCC will already include relocation information directly.
    Including relocation fixups via the --base-file mechanism will then
    include a second copy of the fixups, which will *both* be applied by
    the Windows loader, resulting in invalid addresses.
    
    Some XS extensions already use __declspec(dllexport) on Windows, e.g.
    
https://github.com/ingydotnet/yaml-libyaml-pm/blob/c87c997/LibYAML/yaml.h#L29-L39
    
    So to avoid generating broken relocation fixups for XS modules, we
    must not use --base-file to generate the DLLs.
    
    To avoid leaving XS modules without relocation information (if they
    don't use _declspec(dllexport) anywhere), XSUB.h in the core has been
    modified to add __declspec(dllexport) to XS_EXTERNAL in 5.20.3+ and
    5.22.1+.

M       cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win32.pm

commit 14a00dcc6e5730ef6bd6a989a60f95401326bbc7
Author: Jan Dubois <[email protected]>
Date:   Mon Jun 1 17:32:16 2015 -0700

    Don't use --base-file with MinGW to link perl5xx.dll
    
    This fixes https://rt.cpan.org/Ticket/Display.html?id=103782
    
    It is the same issue that has been analyzed by bulk88++ for XS modules
    here: https://rt.cpan.org/Ticket/Display.html?id=78395#txn-1458445
    
    TL;DR: Any time a compilation unit uses the __declspec(dllexport)
    decorator, GCC will already include relocation information directly.
    Including relocation fixups via the --base-file mechanism will then
    include a second copy of the fixups, which will *both* be applied by
    the Windows loader, resulting in invalid addresses.
    
    Since the core is already using __declspec(dllexport) on some symbols,
    don't use --base-file anymore.
    
    XS extensions face the same problem, e.g. YAML::XS also uses
    __declspec(dllexport) on Windows:
    
    
https://github.com/ingydotnet/yaml-libyaml-pm/blob/c87c997/LibYAML/yaml.h#L29-L39
    
    So the only way to fix this generally for CPAN modules is to also
    remove --base-file from ExtUtils::MakeMaker and ExtUtils::CBuilder.
    
    To avoid leaving XS modules without relocation information (if they
    don't use _declspec(dllexport) anywhere) this commit also adds
    __declspec(dllexport) to XS_EXTERNAL.
    
    Due to their dual-life nature ExtUtils::MakeMaker and
    ExtUtils::CBuilder are updated in separate commits.

M       XSUB.h
M       win32/makefile.mk
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to