Bug 1786975 - Disable PIE when building cctools and dmg tools. r=firefox-build-system-reviewers,andi

clang 15 switched its default to enable PIE, but openssl in the
toolchain sysroot doesn't allow it.

Differential Revision: https://phabricator.services.mozilla.com/D155521
This commit is contained in:
Mike Hommey 2022-08-25 21:47:54 +00:00
parent 86a2f6ede8
commit 644bc56409
2 changed files with 4 additions and 1 deletions

View File

@ -84,7 +84,8 @@ make -j `nproc --all` install
# Build ldid
cd $LDID_SOURCE_DIR
make -j `nproc --all` install INSTALLPREFIX=$CROSSTOOLS_BUILD_DIR LDFLAGS="-Wl,-Bstatic -lcrypto -Wl,-Bdynamic -ldl -pthread"
# The crypto library in the sysroot cannot be linked in a PIE executable so we use -no-pie
make -j `nproc --all` install INSTALLPREFIX=$CROSSTOOLS_BUILD_DIR LDFLAGS="-no-pie -Wl,-Bstatic -lcrypto -Wl,-Bdynamic -ldl -pthread"
strip $CROSSTOOLS_BUILD_DIR/bin/*
# various build scripts based on cmake want to find `lipo` without a prefix

View File

@ -11,11 +11,13 @@ mkdir -p $UPLOAD_DIR $STAGE
cd $MOZ_FETCHES_DIR/libdmg-hfsplus
# The openssl libraries in the sysroot cannot be linked in a PIE executable so we use -no-pie
cmake \
-DCMAKE_C_COMPILER=$MOZ_FETCHES_DIR/clang/bin/clang \
-DCMAKE_CXX_COMPILER=$MOZ_FETCHES_DIR/clang/bin/clang++ \
-DCMAKE_SYSROOT=$MOZ_FETCHES_DIR/sysroot \
-DOPENSSL_USE_STATIC_LIBS=1 \
-DCMAKE_EXE_LINKER_FLAGS=-no-pie \
.
make VERBOSE=1 -j$(nproc)