[perl #62010] [PATCH] fix PARROT_EXPORT visibility=default for gcc other than 4.x
[email protected] (Donald Hunter) Tue, 06 Jan 2009 04:33:32 -0800
| Newsgroups | perl.perl6.internals |
|---|---|
| Message-ID | <[email protected]> |
# New Ticket Created by Donald Hunter
# Please include the string: [perl #62010]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=62010 >
This patch fixes a problem with gcc 3.4.6 on Linux where -fvisibility=hidden
is detected as supported but __attribute__((visibility("default"))) is not
used for PARROT_EXPORT. The setting for export visibility was hard-coded for
gcc > 4.0 so I changed it to be a new test based on the detection of support
for -fvisibility=hidden
I created a new file for the config step because it has to happen after
config/auto/warnings.pm and there's no other relevant file to put it in.
config/auto/export.pm | 55
++++++++++++++++++++++++++++++++++++++
config/auto/gcc.pm | 3 --
lib/Parrot/Configure/Step/List.pm | 1
3 files changed, 56 insertions(+), 3 deletions(-)
gcc_export_visibility.patch
(application/octet-stream, 2 KB)
Index: lib/Parrot/Configure/Step/List.pm
===================================================================
--- lib/Parrot/Configure/Step/List.pm (revision 34979)
+++ lib/Parrot/Configure/Step/List.pm (working copy)
@@ -25,6 +25,7 @@
auto::msvc
auto::attributes
auto::warnings
+ auto::export
init::optimize
inter::shlibs
inter::libparrot
Index: config/auto/export.pm
===================================================================
--- config/auto/export.pm (revision 0)
+++ config/auto/export.pm (revision 0)
@@ -0,0 +1,55 @@
+# Copyright (C) 2001-2007, The Perl Foundation.
+
+=head1 NAME
+
+config/auto/export.pm - Export visibility
+
+=head1 DESCRIPTION
+
+Determines whether export visiblity is required for gcc, based on -fvisibility support
+
+=cut
+
+package auto::export;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Determine export visibility setting for gcc};
+ $data{result} = q{};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = @_;
+ my $rv = $self->_evaluate_export($conf);
+ return $rv;
+}
+
+sub _evaluate_export {
+ my ($self, $conf) = @_;
+
+ my $visibility = $conf->data->get('fvisibility=hidden');
+
+ $conf->data->set( sym_export => '__attribute__ ((visibility("default")))' )
+ unless $visibility;
+
+ return 1;
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Index: config/auto/gcc.pm
===================================================================
--- config/auto/gcc.pm (revision 34979)
+++ config/auto/gcc.pm (working copy)
@@ -88,9 +88,6 @@
my $ccwarn = $conf->data->get('ccwarn');
- $conf->data->set( sym_export => '__attribute__ ((visibility("default")))' )
- if $gccversion >= 4.0;
-
$conf->data->set(
ccwarn => "$ccwarn",
gccversion => $gccversion,