From: Eric Wong <mwrap-perl@80x24.org>
To: mwrap-perl@80x24.org
Subject: [PATCH 1/2] Makefile.PL: check for execinfo on FreeBSD
Date: Sun, 4 Sep 2022 07:44:41 +0000 [thread overview]
Message-ID: <20220904074442.26051-2-mwrap-perl@80x24.org> (raw)
In-Reply-To: <20220904074442.26051-1-mwrap-perl@80x24.org>
This is required for it to work reliably in FreeBSD if we hit a
code path which calls backtrace_symbols before BOOT:. This will
allow the next commit to setup `totals' rculfhash earlier in the
constructor, rather than BOOT, allowing allocations to be
tracked as early as possible.
---
Makefile.PL | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/Makefile.PL b/Makefile.PL
index c3caf6c..7ea7929 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -32,6 +32,37 @@ END
chomp(my $INC = `$pkg_config --cflags liburcu-cds liburcu-bp`);
my @writemakefile_args = ();
+use IO::Handle;
+STDOUT->autoflush(1);
+require ExtUtils::CBuilder;
+require File::Temp;
+my $cb = ExtUtils::CBuilder->new(quiet => $ENV{V} ? 0 : 1);
+my $d = File::Temp->newdir('mwrap-perl-build-XXXX');
+my $olderr;
+print '# checking for -lexecinfo... ';
+{
+ use autodie;
+ open my $fh, '>', "$d/execinfo.c";
+ print $fh <<EOM;
+#include <execinfo.h>
+int main(void) { return backtrace_symbols ? 1 : 0; }
+EOM
+ close $fh;
+ open $olderr, '+>&', *STDERR{IO};
+ open STDERR, '>', "$d/err.log";
+}
+eval {
+ my $obj = $cb->compile(source => "$d/execinfo.c");
+ $cb->link(objects => $obj, extra_linker_flags => '-lexecinfo');
+ $LIBS .= ' -lexecinfo';
+ say " yes on $^O";
+};
+say " no on $^O" if $@;
+{
+ use autodie;
+ open STDERR, '+>&', $olderr or die "dup stderr: $!";
+}
+
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
push @writemakefile_args, (
next prev parent reply other threads:[~2022-09-04 7:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-04 7:44 [PATCH 0/2] allow tracking allocations earlier Eric Wong
2022-09-04 7:44 ` Eric Wong [this message]
2022-09-04 7:44 ` [PATCH 2/2] create the `totals' rculfhash as early as possible Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220904074442.26051-2-mwrap-perl@80x24.org \
--to=mwrap-perl@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap-perl.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).