Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Keep build-machine paths out of the PS5 binary

Rafael Abud Ferreira3e1218898758
diff --git a/cmake/ps5.toolchain.cmake b/cmake/ps5.toolchain.cmake
index ab2a88a..a659f14 100644
--- a/cmake/ps5.toolchain.cmake
+++ b/cmake/ps5.toolchain.cmake
@@ -36,8 +36,12 @@ set(CMAKE_CXX_COMPILER_TARGET x86_64-sie-ps5)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+# Keep build-machine paths (assert/log file names) out of the binary.
+get_filename_component(XC_SOURCE_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
+set(XC_PATH_MAP "\"-ffile-prefix-map=${XC_SOURCE_ROOT}=.\" \"-ffile-prefix-map=$ENV{HOME}=~\"")
+
set(PS5_COMMON_FLAGS
- "-fPIC -ffunction-sections -fdata-sections -funwind-tables -fexceptions -march=znver2 -fvisibility-nodllstorageclass=default -fno-stack-protector -fno-plt -femulated-tls -fdenormal-fp-math=ieee -isysroot \"${PS5_SDK}\" -D_GNU_SOURCE -DXCLOUD_PS5=1 \"-include${CMAKE_CURRENT_LIST_DIR}/../ps5/compat/ps5_lfs.h\"")
+ "${XC_PATH_MAP} -fPIC -ffunction-sections -fdata-sections -funwind-tables -fexceptions -march=znver2 -fvisibility-nodllstorageclass=default -fno-stack-protector -fno-plt -femulated-tls -fdenormal-fp-math=ieee -isysroot \"${PS5_SDK}\" -D_GNU_SOURCE -DXCLOUD_PS5=1 \"-include${CMAKE_CURRENT_LIST_DIR}/../ps5/compat/ps5_lfs.h\"")
set(CMAKE_C_FLAGS_INIT "${PS5_COMMON_FLAGS} -isystem \"${PS5_SDK}/target/include\"")
set(CMAKE_CXX_FLAGS_INIT "${PS5_COMMON_FLAGS} -fcxx-exceptions -frtti -isystem \"${PS5_SDK}/target/include/c++/v1\" -isystem \"${PS5_SDK}/target/include\"")
diff --git a/tools/build-ffmpeg.sh b/tools/build-ffmpeg.sh
index 0f93b28..008a3bc 100755
--- a/tools/build-ffmpeg.sh
+++ b/tools/build-ffmpeg.sh
@@ -51,7 +51,7 @@ if [[ $target == ps5 ]]; then
export PS5_SDK=$vk/.deps/native/ps5-payload-sdk
cp "$root/ps5/compat/ps5_lfs.h" "$cache/ps5_lfs.h"
ln -sfn "$root/tools/ps5/configure-ld.sh" "$cache/configure-ld.sh"
- flags="-target x86_64-sie-ps5 -fPIC -march=znver2 -fvisibility-nodllstorageclass=default -fno-stack-protector -fno-plt -femulated-tls -fdenormal-fp-math=ieee -isysroot $PS5_SDK -isystem $PS5_SDK/target/include -D_GNU_SOURCE -include $cache/ps5_lfs.h"
+ flags="-target x86_64-sie-ps5 -fPIC -march=znver2 -fvisibility-nodllstorageclass=default -fno-stack-protector -fno-plt -femulated-tls -fdenormal-fp-math=ieee -isysroot $PS5_SDK -isystem $PS5_SDK/target/include -D_GNU_SOURCE -include $cache/ps5_lfs.h -ffile-prefix-map=$cache=ffmpeg -ffile-prefix-map=$HOME=~"
"$src/configure" "${common[@]}" \
--enable-cross-compile --target-os=freebsd --arch=x86_64 \
--cc=clang --ar=llvm-ar --ranlib=llvm-ranlib --nm=llvm-nm \
diff --git a/tools/ps5/link.sh b/tools/ps5/link.sh
index 5d00a01..fa929da 100755
--- a/tools/ps5/link.sh
+++ b/tools/ps5/link.sh
@@ -14,7 +14,8 @@ tool=$vk/build/host/ps5-native-tool
work=$build/ps5-link
mkdir -p "$work/obj" "$work/stubs"
-cc() { PS5_PAYLOAD_SDK="$sdk" sh "$vk/tooling/prospero-clang18" "$@"; }
+# Build-machine paths stay out of the binary.
+cc() { PS5_PAYLOAD_SDK="$sdk" sh "$vk/tooling/prospero-clang18" "-ffile-prefix-map=$HOME=~" "$@"; }
cc -std=c++20 -O2 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections \
-c "$native/app_crt.cpp" -o "$work/obj/app_crt.o"