Skip to content

Commit

Permalink
fix catching exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
john-tornblom committed Jun 15, 2024
1 parent 1a3d0a0 commit c699750
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion host/bin/prospero-clang++
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ SCRIPT_DIR="$(dirname "${SCRIPT_PATH}")"
PS5_PAYLOAD_SDK="$(realpath "${SCRIPT_DIR}/..")"

LIBS_C="-lSceLibcInternal -lScePosixForWebKit -lc"
LIBS_CXX="-lc++ -lc++abi -lunwind"

LIBS_CXX="-lc++"
LIBS_CXX="$LIBS_CXX -Wl,--whole-archive"
LIBS_CXX="$LIBS_CXX -lunwind -lc++abi"
LIBS_CXX="$LIBS_CXX -Wl,--no-whole-archive"

for ARG in "$@"; do
if [[ "$ARG" == "-c" || "$ARG" == "-nostdlib" ]]; then
LIBS_C=""
Expand All @@ -35,6 +40,7 @@ done

# ensure clang++ knows where prospero-lld is at
export PATH=${SCRIPT_DIR}:$PATH

exec -a "${SCRIPT_NAME}" "${SCRIPT_DIR}/clang++" \
-target x86_64-sie-ps5 \
-isysroot "${PS5_PAYLOAD_SDK}" \
Expand Down
2 changes: 1 addition & 1 deletion host/bin/prospero-lld
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ done

BIN_PATH="${LLVM_BINDIR}/ld.lld"
exec "${BIN_PATH}" \
-pie \
-pie --eh-frame-hdr \
-z max-page-size=0x4000 \
-T "${PS5_PAYLOAD_SDK}/ldscripts/elf_x86_64.x" \
-L "${PS5_PAYLOAD_SDK}/target/lib" \
Expand Down
3 changes: 2 additions & 1 deletion libcxx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ ${CMAKE} -S $TEMPDIR/llvm-project-$LLVM_VER.src/runtimes \
-DLIBCXX_ENABLE_STATIC=YES \
-DLIBCXX_ENABLE_RTTI=YES \
-DLIBCXX_ENABLE_EXCEPTIONS=YES \
-DLIBCXX_ENABLE_THREADS=YES \
-DLIBCXX_ENABLE_SHARED=NO \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=NO \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXXABI_ENABLE_STATIC=YES \
-DLIBCXXABI_ENABLE_EXCEPTIONS=YES \
-DLIBCXXABI_ENABLE_THREADS=YES \
-DLIBCXXABI_ENABLE_THREADS=NO \
-DLIBCXXABI_USE_LLVM_UNWINDER=YES \
-DLIBCXXABI_ENABLE_SHARED=NO \
-DLIBCXXABI_USE_COMPILER_RT=NO \
Expand Down
6 changes: 6 additions & 0 deletions samples/hello_cxx/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ void task(string prefix) {
cout << n << " ";
}
cout << endl;

try {
throw int(42);
} catch(int e) {
cout << "Caught exception: " << e << endl;
}
}


Expand Down

0 comments on commit c699750

Please sign in to comment.