Fixing build issues with llvm-20 and latest ps5 sdk (#53)

* Fixes some build issues when using latest ps5 sdk and llvm-20

* Changed Makefile to work with ps5-payload-sdk/bin/clang++
This commit is contained in:
Adam Furtenbach
2025-09-11 16:56:32 +02:00
committed by GitHub
parent 03d016fd31
commit f446ee1ee5
6 changed files with 52 additions and 8 deletions

View File

@@ -0,0 +1,42 @@
PS5_HOST ?= ps5
PS5_PORT ?= 9021
ELF := hen.elf
BIN := hen.bin
CFLAGS := -std=c++11 -Wall -Werror -D_KERNEL -I./include -O2 -fno-builtin -nostdlib -fno-stack-protector -fno-plt -fPIC -Wno-error=frame-address -Wno-unused-const-variable
#SFLAGS := -nostartfiles -nostdlib -fPIC
LFLAGS := -Xlinker -T ./link.x -Wl,--build-id=none -nostartfiles
ODIR := build
SDIR := src
CXXFILES := $(wildcard $(SDIR)/*.cpp)
SFILES := $(wildcard $(SDIR)/*.s)
OBJS := $(patsubst $(SDIR)/%.cpp, $(ODIR)/%.o, $(CXXFILES)) $(patsubst $(SDIR)/%.s, $(ODIR)/%.o, $(SFILES))
$(ELF): $(ODIR) $(OBJS)
$(CXX) $(ODIR)/*.o -o $(ELF) $(CFLAGS) $(LFLAGS)
objcopy -O binary $(ELF) $(BIN)
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CXX) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.o: $(SDIR)/%.s
$(AS) -c -o $@ $< $(SFLAGS)
$(ODIR):
@mkdir $@
clean:
rm -f $(ELF) $(BIN) $(ODIR)/*.o
test: $(ELF)
$(PS5_DEPLOY) -h $(PS5_HOST) -p $(PS5_PORT) $^
debug: $(ELF)
gdb \
-ex "target extended-remote $(PS5_HOST):2159" \
-ex "file $(ELF)" \
-ex "remote put $(ELF) /data/$(ELF)" \
-ex "set remote exec-file /data/$(ELF)" \
-ex "start"

View File

@@ -119,7 +119,7 @@ struct NonStupidIovec {
: iov_base(str), iov_length(length) {}
};
constexpr NonStupidIovec operator"" _iov(const char *str, unsigned long len) {
constexpr NonStupidIovec operator""_iov(const char *str, unsigned long len) {
return {str, len + 1};
}
static bool remount(const char *dev, const char *path, int mnt_flag) {

View File

@@ -839,7 +839,7 @@ class Vector {
constexpr void pop_back() noexcept {
last--;
if constexpr(!__is_trivially_destructible(T)) {
*last.~T();
(*last)->~T();
}
}

View File

@@ -3,7 +3,7 @@
#include "ps5/kernel.h"
#include <ps5/klog.h>
/*
static const unsigned long KERNEL_OFFSET_PROC_P_VMSPACE = 0x200;
static unsigned long KERNEL_OFFSET_VMSPACE_P_ROOT = 0x1c8;
@@ -159,3 +159,4 @@ static int kernel_mprotect(int pid, unsigned long addr, unsigned long len, int p
return -1;
}
*/

View File

@@ -24311,7 +24311,7 @@ inline namespace json_literals
/// @brief user-defined string literal for JSON values
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json/
JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json operator "" _json(const char* s, std::size_t n)
inline nlohmann::json operator""_json(const char* s, std::size_t n)
{
return nlohmann::json::parse(s, s + n);
}
@@ -24319,7 +24319,7 @@ inline nlohmann::json operator "" _json(const char* s, std::size_t n)
/// @brief user-defined string literal for JSON pointer
/// @sa https://json.nlohmann.me/api/basic_json/operator_literal_json_pointer/
JSON_HEDLEY_NON_NULL(1)
inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)
inline nlohmann::json::json_pointer operator""_json_pointer(const char* s, std::size_t n)
{
return nlohmann::json::json_pointer(std::string(s, n));
}
@@ -24383,8 +24383,8 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
} // namespace std
#if JSON_USE_GLOBAL_UDLS
using nlohmann::literals::json_literals::operator "" _json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator "" _json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator""_json; // NOLINT(misc-unused-using-decls,google-global-names-in-headers)
using nlohmann::literals::json_literals::operator""_json_pointer; //NOLINT(misc-unused-using-decls,google-global-names-in-headers)
#endif
// #include <nlohmann/detail/macro_unscope.hpp>

View File

@@ -972,7 +972,8 @@ static enum MHD_Result dpiv2_on_request(void *cls, struct MHD_Connection *conn,
}
arg1.uri = temp_path;
arg1.content_name = req->orig_filename ? std::string("etaHEN DPIv2 | " + std::string(req->orig_filename)).c_str() : "etaHEN DPIv2";
std::string tempstr = std::string("etaHEN DPIv2 | " + std::string(req->orig_filename));
arg1.content_name = req->orig_filename ? tempstr.c_str() : "etaHEN DPIv2";
const char *display_filename =
req->orig_filename ? req->orig_filename : temp_path;