Skip to content

Commit da0f6aa

Browse files
committed
wip
1 parent e3e9365 commit da0f6aa

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.gitlab/link-tracing-extension.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,18 @@ set -e -o pipefail
44
suffix="${1:-}"
55

66
sed -i 's/-export-symbols .*\/ddtrace\.sym/-Wl,--retain-symbols-file=ddtrace.sym/g' "ddtrace_$(uname -m)${suffix}.ldflags"
7+
8+
# Compile solib_bootstrap.c: the split build (--enable-ddtrace-rust-library-split) excludes
9+
# it from the per-PHP-version .a archives, but the final ddtrace.so still needs it as the
10+
# ELF entry point for ExecSolib sidecar spawning.
11+
SOLIB_BOOTSTRAP_OBJ=$(mktemp --suffix=.o)
12+
cc -c -fPIC -O2 -fvisibility=hidden -fno-stack-protector \
13+
ext/solib_bootstrap.c -o "${SOLIB_BOOTSTRAP_OBJ}"
14+
715
pids=()
816
for archive in extensions_$(uname -m)/*.a; do
917
(
10-
cc -shared -Wl,-whole-archive $archive -Wl,-no-whole-archive $(cat "ddtrace_$(uname -m)${suffix}.ldflags") "libddtrace_php_$(uname -m)${suffix}.a" -Wl,-soname -Wl,ddtrace.so -o ${archive%.a}.so
18+
cc -shared -Wl,-whole-archive $archive "${SOLIB_BOOTSTRAP_OBJ}" -Wl,-no-whole-archive $(cat "ddtrace_$(uname -m)${suffix}.ldflags") "libddtrace_php_$(uname -m)${suffix}.a" -Wl,-e,_dd_solib_start -Wl,-soname -Wl,ddtrace.so -o ${archive%.a}.so
1119
objcopy --compress-debug-sections ${archive%.a}.so
1220
chmod +x ${archive%.a}.so
1321
) &
@@ -16,3 +24,4 @@ done
1624
for pid in "${pids[@]}"; do
1725
wait $pid
1826
done
27+
rm -f "${SOLIB_BOOTSTRAP_OBJ}"

libdatadog

0 commit comments

Comments
 (0)