Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion images/Dockerfile.bottlecap.alpine.compile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ RUN --mount=type=cache,target=/root/.cargo/git \
else \
export FEATURES=default; \
fi; \
# Tune codegen for the known Lambda CPUs: arm64 is Graviton2 (neoverse-n1),
# x86_64 uses the universally-safe x86-64-v2 baseline (NOT v3, which risks SIGILL).
if [ "${PLATFORM}" = "aarch64" ]; then TARGET_CPU="neoverse-n1"; else TARGET_CPU="x86-64-v2"; fi; \
if [ "${PLATFORM}" = "x86_64" ]; then \
# The `libddwaf` crate links against static objects that require `libclang_rt.builtins`, but
# this is not presented to the linker by default on this platform, so we force it in.
export RUSTFLAGS="${RUSTFLAGS:-} -Clinker=clang -L$(dirname $(clang --print-file-name="libclang_rt.builtins-$(uname -m).a")) -lclang_rt.builtins-$(uname -m)"; \
export RUSTFLAGS="${RUSTFLAGS:-} -Clinker=clang -L$(dirname $(clang --print-file-name="libclang_rt.builtins-$(uname -m).a")) -lclang_rt.builtins-$(uname -m) -Ctarget-cpu=${TARGET_CPU}"; \
else \
export RUSTFLAGS="${RUSTFLAGS:-} -Ctarget-cpu=${TARGET_CPU}"; \
fi; \
# We use a wrapper to allow `libddwaf-sys`' build.rs to be compiled with
# -Ctarget-feature=-crt-static so that it is capable of dynamically loading
Expand Down
5 changes: 4 additions & 1 deletion images/Dockerfile.bottlecap.compile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ RUN --mount=type=cache,target=/usr/local/cargo/git \
export BUILD_MODE=debug; \
export BUILD_FLAG=""; \
fi; \
# Tune codegen for the known Lambda CPUs: arm64 is Graviton2 (neoverse-n1),
# x86_64 uses the universally-safe x86-64-v2 baseline (NOT v3, which risks SIGILL).
if [ "${PLATFORM}" = "aarch64" ]; then TARGET_CPU="neoverse-n1"; else TARGET_CPU="x86-64-v2"; fi; \
# The `libddwaf` crate links against static objects that require `libclang_rt.builtins`, but
# this is not presented to the linker by default on this platform, so we force it in.
export RUSTFLAGS="${RUSTFLAGS:-} -Clinker=clang -L$(dirname $(clang --print-file-name="libclang_rt.builtins-$(uname -m).a")) -lclang_rt.builtins-$(uname -m)"; \
export RUSTFLAGS="${RUSTFLAGS:-} -Clinker=clang -L$(dirname $(clang --print-file-name="libclang_rt.builtins-$(uname -m).a")) -lclang_rt.builtins-$(uname -m) -Ctarget-cpu=${TARGET_CPU}"; \
cargo +stable build --verbose --locked --no-default-features --features="${FEATURES}" ${BUILD_FLAG} && \
mkdir -p /tmp/out && cp "/tmp/dd/bottlecap/target/${BUILD_MODE}/bottlecap" /tmp/out/bottlecap

Expand Down
Loading