From 9056e0b05fa26a6ef2af2e9297b48b40810530e1 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 17 Apr 2022 14:01:03 -0700 Subject: [PATCH] strat: fix linux clang build --- libraries/config/templates/stratosphere.mk | 2 +- .../fssystem/fssystem_sha_hash_generator.hpp | 4 +++- .../source/fssystem/fssystem_aes_ctr_storage.cpp | 16 ++++++++-------- .../source/fssystem/fssystem_aes_xts_storage.cpp | 16 ++++++++-------- .../fssystem_aes_xts_storage_external.cpp | 14 +++++++------- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/libraries/config/templates/stratosphere.mk b/libraries/config/templates/stratosphere.mk index 593258b40..39e83bc16 100644 --- a/libraries/config/templates/stratosphere.mk +++ b/libraries/config/templates/stratosphere.mk @@ -67,7 +67,7 @@ endif 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) -else ifeq ($(ATMOSPHERE_COMPILER_NAME),clang) +else ifeq ($(ATMOSPHERE_OS_NAME),macos) export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-map,$(notdir $@.map) else export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $@.map) diff --git a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sha_hash_generator.hpp b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sha_hash_generator.hpp index 89c10100c..a5aae0870 100644 --- a/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sha_hash_generator.hpp +++ b/libraries/libstratosphere/include/stratosphere/fssystem/fssystem_sha_hash_generator.hpp @@ -29,7 +29,9 @@ namespace ams::fssystem { NON_COPYABLE(ShaHashGenerator); NON_MOVEABLE(ShaHashGenerator); private: - Traits::Generator m_generator; + using Generator = typename Traits::Generator; + private: + Generator m_generator; public: ShaHashGenerator() = default; protected: diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp index 2594afc04..817900cb8 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp @@ -17,7 +17,7 @@ namespace ams::fssystem { - template + template void AesCtrStorage::MakeIv(void *dst, size_t dst_size, u64 upper, s64 offset) { AMS_ASSERT(dst != nullptr); AMS_ASSERT(dst_size == IvSize); @@ -30,7 +30,7 @@ namespace ams::fssystem { util::StoreBigEndian(reinterpret_cast(out_addr + sizeof(u64)), static_cast(offset / BlockSize)); } - template + template AesCtrStorage::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(key != nullptr); @@ -43,7 +43,7 @@ namespace ams::fssystem { std::memcpy(m_iv, iv, IvSize); } - template + template Result AesCtrStorage::Read(s64 offset, void *buffer, size_t size) { /* Allow zero-size reads. */ R_SUCCEED_IF(size == 0); @@ -73,7 +73,7 @@ namespace ams::fssystem { R_SUCCEED(); } - template + template Result AesCtrStorage::Write(s64 offset, const void *buffer, size_t size) { /* Allow zero-size writes. */ R_SUCCEED_IF(size == 0); @@ -127,23 +127,23 @@ namespace ams::fssystem { R_SUCCEED(); } - template + template Result AesCtrStorage::Flush() { R_RETURN(m_base_storage->Flush()); } - template + template Result AesCtrStorage::SetSize(s64 size) { AMS_UNUSED(size); R_THROW(fs::ResultUnsupportedSetSizeForAesCtrStorage()); } - template + template Result AesCtrStorage::GetSize(s64 *out) { R_RETURN(m_base_storage->GetSize(out)); } - template + template Result AesCtrStorage::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 (op_id != fs::OperationId::Invalidate) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage.cpp index ec6bbd4c9..c8a8326dc 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage.cpp @@ -17,7 +17,7 @@ namespace ams::fssystem { - template + template void AesXtsStorage::MakeAesXtsIv(void *dst, size_t dst_size, s64 offset, size_t block_size) { AMS_ASSERT(dst != nullptr); AMS_ASSERT(dst_size == IvSize); @@ -29,7 +29,7 @@ namespace ams::fssystem { util::StoreBigEndian(reinterpret_cast(out_addr + sizeof(s64)), offset / block_size); } - template + template AesXtsStorage::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(key1 != nullptr); @@ -45,7 +45,7 @@ namespace ams::fssystem { std::memcpy(m_iv, iv, IvSize); } - template + template Result AesXtsStorage::Read(s64 offset, void *buffer, size_t size) { /* Allow zero-size reads. */ R_SUCCEED_IF(size == 0); @@ -111,7 +111,7 @@ namespace ams::fssystem { R_SUCCEED(); } - template + template Result AesXtsStorage::Write(s64 offset, const void *buffer, size_t size) { /* Allow zero-size writes. */ R_SUCCEED_IF(size == 0); @@ -209,24 +209,24 @@ namespace ams::fssystem { R_SUCCEED(); } - template + template Result AesXtsStorage::Flush() { R_RETURN(m_base_storage->Flush()); } - template + template Result AesXtsStorage::SetSize(s64 size) { R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA()); R_RETURN(m_base_storage->SetSize(size)); } - template + template Result AesXtsStorage::GetSize(s64 *out) { R_RETURN(m_base_storage->GetSize(out)); } - template + template Result AesXtsStorage::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. */ if (op_id != fs::OperationId::Invalidate) { diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage_external.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage_external.cpp index 4f9a45fd2..a2741ec6a 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage_external.cpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_aes_xts_storage_external.cpp @@ -17,7 +17,7 @@ namespace ams::fssystem { - template + template AesXtsStorageExternal::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(iv_size == IvSize); @@ -34,7 +34,7 @@ namespace ams::fssystem { std::memcpy(m_iv, iv, IvSize); } - template + template Result AesXtsStorageExternal::Read(s64 offset, void *buffer, size_t size) { /* Allow zero size. */ R_SUCCEED_IF(size == 0); @@ -102,7 +102,7 @@ namespace ams::fssystem { R_SUCCEED(); } - template + template Result AesXtsStorageExternal::Write(s64 offset, const void *buffer, size_t size) { /* Allow zero-size writes. */ R_SUCCEED_IF(size == 0); @@ -195,7 +195,7 @@ namespace ams::fssystem { R_SUCCEED(); } - template + template Result AesXtsStorageExternal::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. */ 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)); } - template + template Result AesXtsStorageExternal::GetSize(s64 *out) { R_RETURN(m_base_storage->GetSize(out)); } - template + template Result AesXtsStorageExternal::Flush() { R_RETURN(m_base_storage->Flush()); } - template + template Result AesXtsStorageExternal::SetSize(s64 size) { R_UNLESS(util::IsAligned(size, AesBlockSize), fs::ResultUnexpectedInAesXtsStorageA());