strat: fix linux clang build

This commit is contained in:
Michael Scire 2022-04-17 14:01:03 -07:00
parent 895b6d0470
commit 9056e0b05f
5 changed files with 27 additions and 25 deletions

View file

@ -67,7 +67,7 @@ endif
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001) ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map) export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map)
else ifeq ($(ATMOSPHERE_COMPILER_NAME),clang) else ifeq ($(ATMOSPHERE_OS_NAME),macos)
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-map,$(notdir $@.map) export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-map,$(notdir $@.map)
else else
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $@.map) export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $@.map)

View file

@ -29,7 +29,9 @@ namespace ams::fssystem {
NON_COPYABLE(ShaHashGenerator); NON_COPYABLE(ShaHashGenerator);
NON_MOVEABLE(ShaHashGenerator); NON_MOVEABLE(ShaHashGenerator);
private: private:
Traits::Generator m_generator; using Generator = typename Traits::Generator;
private:
Generator m_generator;
public: public:
ShaHashGenerator() = default; ShaHashGenerator() = default;
protected: protected:

View file

@ -17,7 +17,7 @@
namespace ams::fssystem { namespace ams::fssystem {
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
void AesCtrStorage<BasePointer>::MakeIv(void *dst, size_t dst_size, u64 upper, s64 offset) { void AesCtrStorage<BasePointer>::MakeIv(void *dst, size_t dst_size, u64 upper, s64 offset) {
AMS_ASSERT(dst != nullptr); AMS_ASSERT(dst != nullptr);
AMS_ASSERT(dst_size == IvSize); AMS_ASSERT(dst_size == IvSize);
@ -30,7 +30,7 @@ namespace ams::fssystem {
util::StoreBigEndian(reinterpret_cast<s64 *>(out_addr + sizeof(u64)), static_cast<s64>(offset / BlockSize)); util::StoreBigEndian(reinterpret_cast<s64 *>(out_addr + sizeof(u64)), static_cast<s64>(offset / BlockSize));
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
AesCtrStorage<BasePointer>::AesCtrStorage(BasePointer base, const void *key, size_t key_size, const void *iv, size_t iv_size) : m_base_storage(std::move(base)) { AesCtrStorage<BasePointer>::AesCtrStorage(BasePointer base, const void *key, size_t key_size, const void *iv, size_t iv_size) : m_base_storage(std::move(base)) {
AMS_ASSERT(m_base_storage != nullptr); AMS_ASSERT(m_base_storage != nullptr);
AMS_ASSERT(key != nullptr); AMS_ASSERT(key != nullptr);
@ -43,7 +43,7 @@ namespace ams::fssystem {
std::memcpy(m_iv, iv, IvSize); std::memcpy(m_iv, iv, IvSize);
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::Read(s64 offset, void *buffer, size_t size) { Result AesCtrStorage<BasePointer>::Read(s64 offset, void *buffer, size_t size) {
/* Allow zero-size reads. */ /* Allow zero-size reads. */
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -73,7 +73,7 @@ namespace ams::fssystem {
R_SUCCEED(); R_SUCCEED();
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::Write(s64 offset, const void *buffer, size_t size) { Result AesCtrStorage<BasePointer>::Write(s64 offset, const void *buffer, size_t size) {
/* Allow zero-size writes. */ /* Allow zero-size writes. */
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -127,23 +127,23 @@ namespace ams::fssystem {
R_SUCCEED(); R_SUCCEED();
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::Flush() { Result AesCtrStorage<BasePointer>::Flush() {
R_RETURN(m_base_storage->Flush()); R_RETURN(m_base_storage->Flush());
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::SetSize(s64 size) { Result AesCtrStorage<BasePointer>::SetSize(s64 size) {
AMS_UNUSED(size); AMS_UNUSED(size);
R_THROW(fs::ResultUnsupportedSetSizeForAesCtrStorage()); R_THROW(fs::ResultUnsupportedSetSizeForAesCtrStorage());
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::GetSize(s64 *out) { Result AesCtrStorage<BasePointer>::GetSize(s64 *out) {
R_RETURN(m_base_storage->GetSize(out)); R_RETURN(m_base_storage->GetSize(out));
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesCtrStorage<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { Result AesCtrStorage<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
/* If operation isn't invalidate, special case. */ /* If operation isn't invalidate, special case. */
if (op_id != fs::OperationId::Invalidate) { if (op_id != fs::OperationId::Invalidate) {

View file

@ -17,7 +17,7 @@
namespace ams::fssystem { namespace ams::fssystem {
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
void AesXtsStorage<BasePointer>::MakeAesXtsIv(void *dst, size_t dst_size, s64 offset, size_t block_size) { void AesXtsStorage<BasePointer>::MakeAesXtsIv(void *dst, size_t dst_size, s64 offset, size_t block_size) {
AMS_ASSERT(dst != nullptr); AMS_ASSERT(dst != nullptr);
AMS_ASSERT(dst_size == IvSize); AMS_ASSERT(dst_size == IvSize);
@ -29,7 +29,7 @@ namespace ams::fssystem {
util::StoreBigEndian<s64>(reinterpret_cast<s64 *>(out_addr + sizeof(s64)), offset / block_size); util::StoreBigEndian<s64>(reinterpret_cast<s64 *>(out_addr + sizeof(s64)), offset / block_size);
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
AesXtsStorage<BasePointer>::AesXtsStorage(BasePointer base, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size) : m_base_storage(std::move(base)), m_block_size(block_size), m_mutex() { AesXtsStorage<BasePointer>::AesXtsStorage(BasePointer base, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size) : m_base_storage(std::move(base)), m_block_size(block_size), m_mutex() {
AMS_ASSERT(m_base_storage != nullptr); AMS_ASSERT(m_base_storage != nullptr);
AMS_ASSERT(key1 != nullptr); AMS_ASSERT(key1 != nullptr);
@ -45,7 +45,7 @@ namespace ams::fssystem {
std::memcpy(m_iv, iv, IvSize); std::memcpy(m_iv, iv, IvSize);
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::Read(s64 offset, void *buffer, size_t size) { Result AesXtsStorage<BasePointer>::Read(s64 offset, void *buffer, size_t size) {
/* Allow zero-size reads. */ /* Allow zero-size reads. */
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -111,7 +111,7 @@ namespace ams::fssystem {
R_SUCCEED(); R_SUCCEED();
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::Write(s64 offset, const void *buffer, size_t size) { Result AesXtsStorage<BasePointer>::Write(s64 offset, const void *buffer, size_t size) {
/* Allow zero-size writes. */ /* Allow zero-size writes. */
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -209,24 +209,24 @@ namespace ams::fssystem {
R_SUCCEED(); R_SUCCEED();
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::Flush() { Result AesXtsStorage<BasePointer>::Flush() {
R_RETURN(m_base_storage->Flush()); R_RETURN(m_base_storage->Flush());
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::SetSize(s64 size) { Result AesXtsStorage<BasePointer>::SetSize(s64 size) {
R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA()); R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA());
R_RETURN(m_base_storage->SetSize(size)); R_RETURN(m_base_storage->SetSize(size));
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::GetSize(s64 *out) { Result AesXtsStorage<BasePointer>::GetSize(s64 *out) {
R_RETURN(m_base_storage->GetSize(out)); R_RETURN(m_base_storage->GetSize(out));
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorage<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { Result AesXtsStorage<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
/* Unless invalidating cache, check the arguments. */ /* Unless invalidating cache, check the arguments. */
if (op_id != fs::OperationId::Invalidate) { if (op_id != fs::OperationId::Invalidate) {

View file

@ -17,7 +17,7 @@
namespace ams::fssystem { namespace ams::fssystem {
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
AesXtsStorageExternal<BasePointer>::AesXtsStorageExternal(BasePointer bs, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size, CryptAesXtsFunction ef, CryptAesXtsFunction df) : m_base_storage(std::move(bs)), m_block_size(block_size), m_encrypt_function(ef), m_decrypt_function(df) { AesXtsStorageExternal<BasePointer>::AesXtsStorageExternal(BasePointer bs, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size, CryptAesXtsFunction ef, CryptAesXtsFunction df) : m_base_storage(std::move(bs)), m_block_size(block_size), m_encrypt_function(ef), m_decrypt_function(df) {
AMS_ASSERT(key_size == KeySize); AMS_ASSERT(key_size == KeySize);
AMS_ASSERT(iv_size == IvSize); AMS_ASSERT(iv_size == IvSize);
@ -34,7 +34,7 @@ namespace ams::fssystem {
std::memcpy(m_iv, iv, IvSize); std::memcpy(m_iv, iv, IvSize);
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::Read(s64 offset, void *buffer, size_t size) { Result AesXtsStorageExternal<BasePointer>::Read(s64 offset, void *buffer, size_t size) {
/* Allow zero size. */ /* Allow zero size. */
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -102,7 +102,7 @@ namespace ams::fssystem {
R_SUCCEED(); R_SUCCEED();
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::Write(s64 offset, const void *buffer, size_t size) { Result AesXtsStorageExternal<BasePointer>::Write(s64 offset, const void *buffer, size_t size) {
/* Allow zero-size writes. */ /* Allow zero-size writes. */
R_SUCCEED_IF(size == 0); R_SUCCEED_IF(size == 0);
@ -195,7 +195,7 @@ namespace ams::fssystem {
R_SUCCEED(); R_SUCCEED();
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) { Result AesXtsStorageExternal<BasePointer>::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
/* Unless invalidating cache, check the arguments. */ /* Unless invalidating cache, check the arguments. */
if (op_id != fs::OperationId::Invalidate) { if (op_id != fs::OperationId::Invalidate) {
@ -210,17 +210,17 @@ namespace ams::fssystem {
R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size)); R_RETURN(m_base_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::GetSize(s64 *out) { Result AesXtsStorageExternal<BasePointer>::GetSize(s64 *out) {
R_RETURN(m_base_storage->GetSize(out)); R_RETURN(m_base_storage->GetSize(out));
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::Flush() { Result AesXtsStorageExternal<BasePointer>::Flush() {
R_RETURN(m_base_storage->Flush()); R_RETURN(m_base_storage->Flush());
} }
template<typename BasePointer> template<fs::PointerToStorage BasePointer>
Result AesXtsStorageExternal<BasePointer>::SetSize(s64 size) { Result AesXtsStorageExternal<BasePointer>::SetSize(s64 size) {
R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA()); R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA());