[php-src] PR #11643: Improve DTrace probe generation /w non-default compiler
| From: | f4z4on | Date: | Sat, 08 Jul 2023 21:30:23 +0000 |
| Subject: | [php-src] PR #11643: Improve DTrace probe generation /w non-default compiler | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-22961@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/11643
Author: f4z4on
With DTrace support enabled during
./configure, our custom Autoconf macro
PHP_INIT_DTRACE creates make rules to generate header and object files using
dtrace utility. SystemTap† implementation of dtrace relies on other
utilities to provide header preprocessing and final object file compilation. [These utilities are
configured by common environment variables with common defaults:][environ]
* preprocessor from CPP defaults to "cpp"
* compiler from CC defaults to "gcc"
* compiler arguments can be expanded with CFLAGS
This has been in SystemTap since version 1.5 released on 2011-05-23. We have been setting
CFLAGS for dtrace since 717b367 released in versions 5.4.20 and 5.5.4 on
2013-09-18. This change fixed build against SystemTap. It fixes majority of cases since practically
all free Linux distributions use SystemTap for DTrace-like dynamic tracing and practically all of
them use GCC or compatible compiler suite. However, this becomes an issue when cross-compiling using
GCC because utility names contain target triplets. Autoconf already handles cross-compilation well
—setting correct CC and CPP make macros (variables).
Therefore, we simply set CC and CPP environment variables using respective
macros when executing dtrace. Although SystemTap dtrace does not always
use CC nor CPP, we set it every time. [SystemTap documentation does not
talk about this at all][stap-dtrace], so it is safer to always set it. We also follow how we set
CFLAGS every time in the past.
[Original (or ported) DTrace mainly used on Oracle Linux, Solaris and macOS ignores these and does
not support cross compilation.][oracle-dtrace]
<small>† Well-known dynamic tracing infrastructure for Linux compatible with
statically-defined tracing from DTrace.</small>
[environ]: https://sourceware.org/git/?p=systemtap.git;a=blob;f=dtrace.in;h=73a6f22e2de072773c692e3fea05c4b8cf814e43;hb=ebb424eee5599fcc131901c0d82d0bfc0d2f57ab
[stap-dtrace]: https://sourceware.org/systemtap/man/dtrace.1.html
[oracle-dtrace]: https://docs.oracle.com/cd/E88353_01/html/E72487/dtrace-8.html