Skip to content

Commit

Permalink
ExtUtils-CBuilder: Remove image-base generation on Win32/gcc
Browse files Browse the repository at this point in the history
Switches from generating an image-base address using the basename of the
output file to using GCC's built-in `--enable-auto-image-base` linker
option.

This aligns the linking behaviour for Win32/gcc with that of
ExtUtils-MakeMaker which removed image-base generation in commit
<Perl-Toolchain-Gang/ExtUtils-MakeMaker@343d21a>.
  • Loading branch information
zmughal authored and xenu committed Feb 12, 2021
1 parent 7365f8f commit e4c6153
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 25 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,7 @@ Yves Orton <[email protected]>
Zachary Miller <[email protected]>
Zachary Storer <[email protected]>
Zak B. Elep <[email protected]>
Zakariyya Mughal <[email protected]>
Zbynek Vyskovsky <[email protected]>
Zefram <[email protected]>
Zsbán Ambrus <[email protected]>
Expand Down
7 changes: 7 additions & 0 deletions dist/ExtUtils-CBuilder/Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Revision history for Perl extension ExtUtils::CBuilder.

0.280236 - 2021-02-12

Fix:

- Remove image-base generation on Win32/gcc and instead use GCC's built-in
`--enable-auto-image-base` linker option.

0.280235 - 2020-11-01

Fix:
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Perl::OSType qw/os_type/;

use warnings;
use strict;
our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA;

# We only use this once - don't waste a symbol table entry on it.
Expand Down
2 changes: 1 addition & 1 deletion dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Text::ParseWords;
use IPC::Cmd qw(can_run);
use File::Temp qw(tempfile);

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION

# More details about C/C++ compilers:
# http://developers.sun.com/sunstudio/documentation/product/compiler.jsp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use warnings;
use strict;
use ExtUtils::CBuilder::Base;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Base);

sub link_executable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use warnings;
use strict;
use ExtUtils::CBuilder::Base;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Base);

use File::Spec::Functions qw(catfile catdir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use File::Spec;
use ExtUtils::CBuilder::Base;
use IO::File;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Base);

=begin comment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ExtUtils::CBuilder::Platform::Windows::BCC;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION

use strict;
use warnings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ExtUtils::CBuilder::Platform::Windows::GCC;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION

use warnings;
use strict;
Expand Down Expand Up @@ -40,15 +40,6 @@ sub format_linker_cmd {
unshift( @{$spec{other_ldflags}}, '-nostartfiles' )
if ( $spec{startup} && @{$spec{startup}} );

# From ExtUtils::MM_Win32:
#
## one thing for GCC/Mingw32:
## we try to overcome non-relocateable-DLL problems by generating
## a (hopefully unique) image-base from the dll's name
## -- BKS, 10-19-1999
File::Basename::basename( $spec{output} ) =~ /(....)(.{0,4})/;
$spec{image_base} = sprintf( "0x%x0000", unpack('n', $1 ^ $2) );

%spec = $self->write_linker_script(%spec)
if $spec{use_scripts};

Expand All @@ -72,7 +63,7 @@ sub format_linker_cmd {
@ld ,
'-o', $spec{output} ,
"-Wl,--base-file,$spec{base_file}" ,
"-Wl,--image-base,$spec{image_base}" ,
"-Wl,--enable-auto-image-base" ,
@{$spec{lddlflags}} ,
@{$spec{libpath}} ,
@{$spec{startup}} ,
Expand All @@ -93,7 +84,7 @@ sub format_linker_cmd {
push @cmds, [ grep {defined && length} (
@ld ,
'-o', $spec{output} ,
"-Wl,--image-base,$spec{image_base}" ,
"-Wl,--enable-auto-image-base" ,
@{$spec{lddlflags}} ,
@{$spec{libpath}} ,
@{$spec{startup}} ,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ExtUtils::CBuilder::Platform::Windows::MSVC;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION

use warnings;
use strict;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use ExtUtils::CBuilder::Platform::Unix;
use File::Spec;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);

sub need_prelink { 1 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use File::Spec;
use ExtUtils::CBuilder::Platform::Unix;
use Config;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);

# The Android linker will not recognize symbols from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use File::Spec;
use ExtUtils::CBuilder::Platform::Unix;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);

# TODO: If a specific exe_file name is requested, if the exe created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use warnings;
use strict;
use ExtUtils::CBuilder::Platform::Unix;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);

sub compile {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use ExtUtils::CBuilder::Platform::Unix;
use File::Spec;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);

sub link_executable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use warnings;
use strict;
use ExtUtils::CBuilder::Platform::Unix;

our $VERSION = '0.280235'; # VERSION
our $VERSION = '0.280236'; # VERSION
our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);

sub need_prelink { 1 }
Expand Down

0 comments on commit e4c6153

Please sign in to comment.