In perl.git, the branch jdb/win32-mingw-reloc has been created
<http://perl5.git.perl.org/perl.git/commitdiff/7104860ba2756149bd0006f36b5a7d92dfe38991?hp=0000000000000000000000000000000000000000>
at 7104860ba2756149bd0006f36b5a7d92dfe38991 (commit)
- Log -----------------------------------------------------------------
commit 7104860ba2756149bd0006f36b5a7d92dfe38991
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 46e765f50d3f5091e446d2cd320524cc6091bef7
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 91584c0ec7e532109682035d275e35d5f27f2a3d
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