File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5959 shell : bash
6060 run : ./ci/integ/unit-test.sh ${{ matrix.os }}
6161
62+ pic-check :
63+ runs-on : ${{ matrix.runner }}
64+ timeout-minutes : 10
65+ container : ${{ matrix.container }}
66+ strategy :
67+ fail-fast : false
68+ matrix :
69+ include :
70+ - os : al2023
71+ container : public.ecr.aws/amazonlinux/amazonlinux:2023
72+ runner : ubuntu-latest
73+ - os : al2023-arm
74+ container : public.ecr.aws/amazonlinux/amazonlinux:2023
75+ runner : ubuntu-24.04-arm
76+ - os : alpine
77+ container : public.ecr.aws/docker/library/alpine:3.23
78+ runner : ubuntu-latest
79+
80+ steps :
81+ - name : Install checkout prerequisites
82+ shell : sh
83+ run : |
84+ if command -v dnf > /dev/null 2>&1; then
85+ dnf install -y tar gzip git
86+ elif command -v apk > /dev/null 2>&1; then
87+ apk add --no-cache bash tar git
88+ fi
89+
90+ - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
91+
92+ - name : Install dependencies
93+ shell : bash
94+ run : ./ci/integ/install-deps.sh ${{ matrix.os }}
95+
96+ - name : Position-independence check
97+ shell : bash
98+ run : ./ci/integ/pic-check.sh ${{ matrix.os }}
99+
62100 integration-test-oci :
63101 runs-on : ${{ matrix.build.runner }}
64102 timeout-minutes : 10
Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ add_library(${PROJECT_NAME}
1919
2020set_target_properties (${PROJECT_NAME } PROPERTIES
2121 SOVERSION 0
22- VERSION ${PROJECT_VERSION } -dev)
22+ VERSION ${PROJECT_VERSION } -dev
23+ # Emit position-independent code so the static archive can be linked into a
24+ # shared object (e.g. the Java runtime interface client's JNI .so).
25+ # PIC links fine into executables too, so this is safe for all consumers.
26+ POSITION_INDEPENDENT_CODE ON )
2327
2428target_include_directories (${PROJECT_NAME } PUBLIC
2529 $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR } /include >
Original file line number Diff line number Diff line change @@ -13,6 +13,13 @@ COPY main.cpp main.cpp
1313
1414RUN g++ -std=c++11 -O2 -Iinclude main.cpp runtime.a -lcurl -pthread -o bootstrap
1515
16+ # Position-independence guard. The link above only proves the archive works in a
17+ # position-dependent executable; it stays green even for a non-PIC build. But
18+ # downstream consumers embed this .a in a shared object -- e.g. the Java runtime
19+ # interface client's JNI .so
20+ RUN g++ -shared -Wl,--whole-archive runtime.a -Wl,--no-whole-archive \
21+ -lcurl -pthread -o /build/libaws-lambda-runtime-pic-check.so
22+
1623FROM public.ecr.aws/lambda/provided:al2023
1724
1825COPY --from=builder /build/bootstrap ${LAMBDA_RUNTIME_DIR}/bootstrap
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ OS=${1:- }
5+
6+ case " $OS " in
7+ ubuntu|arch)
8+ export CC=/usr/bin/clang CXX=/usr/bin/clang++
9+ ;;
10+ esac
11+
12+ BUILD_DIR=build-pic-check
13+ cmake -B " $BUILD_DIR " -GNinja -DCMAKE_BUILD_TYPE=Release
14+ cmake --build " $BUILD_DIR "
15+
16+ " ${CXX:- c++} " -shared \
17+ -Wl,--whole-archive " $BUILD_DIR /libaws-lambda-runtime.a" -Wl,--no-whole-archive \
18+ -lcurl -pthread \
19+ -o " $BUILD_DIR /libaws-lambda-runtime-pic-check.so"
20+
21+ echo " PIC check passed: static archive links into a shared object"
You can’t perform that action at this time.
0 commit comments