Skip to content

Commit 889d636

Browse files
committed
build: shrink profiling artifacts
ci: parameterized ZTS/NTS for build_profiler task
1 parent c067f72 commit 889d636

File tree

6 files changed

+26
-33
lines changed

6 files changed

+26
-33
lines changed

Diff for: .circleci/continue_config.yml

+18-24
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,13 @@ commands:
559559
parameters:
560560
prefix:
561561
type: string
562+
triplet:
563+
type: string
564+
flavour:
565+
type: string
562566
steps:
563567
- run:
564-
name: Build Profiler NTS
568+
name: Build Profiler << parameters.flavour >>
565569
command: |
566570
if [ -d '/opt/rh/devtoolset-7' ] ; then
567571
set +eo pipefail
@@ -570,33 +574,17 @@ commands:
570574
fi
571575
set -u
572576
prefix="<< parameters.prefix >>"
577+
triplet="<< parameters.triplet >>"
578+
flavour="<< parameters.flavour >>"
573579
mkdir -vp "${prefix}"
574-
command -v switch-php && switch-php "${PHP_VERSION}"
580+
command -v switch-php && switch-php "${PHP_VERSION}${flavour}"
575581
cd profiling
576582
echo "${CARGO_TARGET_DIR}"
577-
cargo build --release
583+
touch build.rs # make sure `build.rs` gets executed after `switch-php` call
584+
RUSTC_BOOTSTRAP=1 cargo rustc -p datadog-php-profiling --release --target "${triplet}" -Z build-std=panic_abort,core,std,alloc
578585
cd -
579-
cp -v "${CARGO_TARGET_DIR}/release/libdatadog_php_profiling.so" "${prefix}/datadog-profiling.so"
580-
objcopy --compress-debug-sections "${prefix}/datadog-profiling.so"
581-
- run:
582-
name: Build Profiler ZTS
583-
command: |
584-
if [ -d '/opt/rh/devtoolset-7' ] ; then
585-
set +eo pipefail
586-
source scl_source enable devtoolset-7
587-
set -eo pipefail
588-
fi
589-
set -u
590-
prefix="<< parameters.prefix >>"
591-
mkdir -vp "${prefix}"
592-
command -v switch-php && switch-php "${PHP_VERSION}-zts"
593-
cd profiling
594-
echo "${CARGO_TARGET_DIR}"
595-
touch build.rs #make sure `build.rs` gets executed after `switch-php` call
596-
cargo build --release
597-
cd -
598-
cp -v "${CARGO_TARGET_DIR}/release/libdatadog_php_profiling.so" "${prefix}/datadog-profiling-zts.so"
599-
objcopy --compress-debug-sections "${prefix}/datadog-profiling-zts.so"
586+
cp -v "${CARGO_TARGET_DIR}/${triplet}/release/libdatadog_php_profiling.so" "${prefix}/datadog-profiling${flavour}.so"
587+
objcopy --compress-debug-sections "${prefix}/datadog-profiling${flavour}.so"
600588
601589
executors:
602590
with_agent:
@@ -2883,6 +2871,12 @@ jobs:
28832871
- <<: *STEP_APPEND_BUILD_ID
28842872
- build_profiler:
28852873
prefix: datadog-profiling/<< parameters.triplet >>/lib/php/<< parameters.abi_no >>
2874+
triplet: << parameters.triplet >>
2875+
flavour: ""
2876+
- build_profiler:
2877+
prefix: datadog-profiling/<< parameters.triplet >>/lib/php/<< parameters.abi_no >>
2878+
triplet: << parameters.triplet >>
2879+
flavour: "-zts"
28862880
- persist_to_workspace:
28872881
root: .
28882882
paths:

Diff for: .github/workflows/prof_asan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
export LDFLAGS='-fsanitize=address'
4141
export RUSTC_LINKER=lld-16
4242
triplet=$(uname -m)-unknown-linux-gnu
43-
RUSTFLAGS='-Zsanitizer=address' cargo +nightly-2023-05-03 build -Zbuild-std --target $triplet --release
43+
RUSTFLAGS='-Zsanitizer=address' cargo +nightly-2023-05-03 build -Zbuild-std="panic_abort,core,alloc,std" --target $triplet --release
4444
cp -v "$CARGO_TARGET_DIR/$triplet/release/libdatadog_php_profiling.so" "$(php-config --extension-dir)/datadog-profiling.so"
4545
4646
- name: Cache build dependencies

Diff for: Cargo.toml

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ license = "Apache-2.0"
1313
debug = 2 # full debug info
1414

1515
[profile.release]
16-
debug = 1
17-
lto = "thin"
16+
codegen-units = 1
17+
debug = "line-tables-only"
1818
incremental = false
19+
lto = "fat"
20+
panic = "abort"
1921

2022
[profile.tracer-release]
21-
debug = 1 # line tables only
22-
lto = true
23-
codegen-units = 1
24-
panic = "abort"
2523
inherits = "release"

Diff for: dockerfiles/ci/alpine_compile_extension/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ RUN set -eux; \
2525
RUN apk add --no-cache llvm16-libs clang16-dev lld llvm16
2626
RUN apk add --no-cache rust-stdlib
2727
RUN apk add --no-cache cargo
28+
RUN apk add --no-cache rust-src
2829
RUN apk add --no-cache clang git protoc unzip
2930

3031
FROM base

Diff for: dockerfiles/ci/buster/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ RUN mkdir -p -v "${CARGO_HOME}" "${RUSTUP_HOME}" \
276276
&& printf '%s %s' "$RUST_SHA256" "$FILENAME" | sha256sum --check --status \
277277
&& tar -xf "$FILENAME" \
278278
&& cd ${FILENAME%.tar.gz} \
279-
&& ./install.sh --components="rustc,cargo,clippy-preview,rustfmt-preview,rust-std-${MARCH}-unknown-linux-gnu" \
279+
&& ./install.sh --components="rustc,cargo,clippy,rustfmt,rust-src,rust-std-${MARCH}-unknown-linux-gnu" \
280280
&& cd - \
281281
&& rm -fr "$FILENAME" "${FILENAME%.tar.gz}" \
282282
&& rm -rfv /tmp/*

Diff for: dockerfiles/ci/centos/7/base.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ RUN source scl_source enable devtoolset-7 \
168168
printf '%s %s' "$RUST_SHA256" "$FILENAME" | sha256sum --check --status && \
169169
tar -xf "$FILENAME" \
170170
&& cd ${FILENAME%.tar.gz} \
171-
&& ./install.sh --components="rustc,cargo,clippy-preview,rustfmt-preview,rust-std-${MARCH}-unknown-linux-gnu" \
171+
&& ./install.sh --components="rustc,cargo,clippy,rustfmt,rust-std-${MARCH}-unknown-linux-gnu,rust-src" \
172172
&& cd - \
173173
&& rm -fr "$FILENAME" "${FILENAME%.tar.gz}"
174174

0 commit comments

Comments
 (0)