Skip to content

Commit

Permalink
On AIX, use $config{ptr_size} to conditionally add 32 bit linker flags.
Browse files Browse the repository at this point in the history
This eliminates the only use of $config{arch_bits} and hence the only use of
build::probe::numbits().

Only set this flag if the linker is xlc - gcc doesn't support it.
  • Loading branch information
nwc10 committed Dec 29, 2020
1 parent 78f4f1d commit 84844ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 38 deletions.
9 changes: 4 additions & 5 deletions Configure.pl
Expand Up @@ -555,16 +555,15 @@ sub uniq {
. "\t\$(CP) 3rdparty/msinttypes/*.h \"\$(DESTDIR)\$(PREFIX)/include/msinttypes\"\n";
}

if ($^O eq 'aix' && $config{ld} =~ /xlc/ && $config{ptr_size} == 4) {
$config{ldflags} = join(',', $config{ldflags}, '-bmaxdata:0x80000000');
}

build::probe::C_type_bool(\%config, \%defaults);
build::probe::computed_goto(\%config, \%defaults);
build::probe::pthread_yield(\%config, \%defaults);
build::probe::pthread_setname_np(\%config, \%defaults);
build::probe::check_fn_malloc_trim(\%config, \%defaults);
if ($^O eq 'aix') {
build::probe::numbits(\%config, \%defaults);
$config{ldflags} = join(',', $config{ldflags}, '-bmaxdata:0x80000000')
if $config{arch_bits} == 32;
}
build::probe::rdtscp(\%config, \%defaults);

my $order = $config{be} ? 'big endian' : 'little endian';
Expand Down
33 changes: 0 additions & 33 deletions build/probe.pm
Expand Up @@ -756,39 +756,6 @@ EOT
$config->{has_pthread_setname_np} = $has_pthread_setname_np || 0
}

sub numbits {
my ($config) = @_;
my $restore = _to_probe_dir();
_spew('numbits.c', <<'EOT');
#include <stdint.h>
int main(int argc, char **argv) {
#if UINTPTR_MAX == 0xffffffff
return 32;
/* 32-bit */
#elif UINTPTR_MAX == 0xffffffffffffffff
/* 64-bit */
return 64;
#else
/* unknown */
return -1;
#endif
}
EOT

print ::dots(' probing number of bits');
my $print_result;
my $num_bits = 0;
if(compile($config, 'numbits')) {
$num_bits = $print_result = system('./numbits') >> 8;
}
if (!defined $print_result || $print_result == -1) {
$print_result = 'UNKNOWN';
}
print $print_result . "\n";
$config->{arch_bits} = $num_bits;
}

sub win32_compiler_toolchain {
my ($config) = @_;
my $has_nmake = 0 == system('nmake /? >NUL 2>&1');
Expand Down

0 comments on commit 84844ad

Please sign in to comment.