ams: basic support for compiling with gcc 15

This commit is contained in:
Michael Scire 2025-04-26 14:53:08 -07:00 committed by SciresM
parent 49058b204c
commit 29cadcd269
9 changed files with 11 additions and 16 deletions

View File

@ -18,6 +18,7 @@
#define _TYPES_H_ #define _TYPES_H_
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
@ -58,12 +59,6 @@ typedef u32 Result; ///< Function error code result type.
#define INVALID_HANDLE ((Handle) 0) #define INVALID_HANDLE ((Handle) 0)
#define CUR_PROCESS_HANDLE ((Handle) 0xFFFF8001) #define CUR_PROCESS_HANDLE ((Handle) 0xFFFF8001)
#ifndef __cplusplus
typedef int bool;
#define true 1
#define false 0
#endif /* __cplusplus */
#define BOOT_CFG_AUTOBOOT_EN (1 << 0) #define BOOT_CFG_AUTOBOOT_EN (1 << 0)
#define BOOT_CFG_FROM_LAUNCH (1 << 1) #define BOOT_CFG_FROM_LAUNCH (1 << 1)
#define BOOT_CFG_SEPT_RUN (1 << 7) #define BOOT_CFG_SEPT_RUN (1 << 7)

View File

@ -106,6 +106,7 @@ SECTIONS
.debug_code : { .debug_code : {
KEEP (*(.text._ZN3ams3log6PrintfEPKcz .text._ZN3ams3log7VPrintfEPKcSt9__va_list .text._ZN3ams3log4DumpEPKvm)) KEEP (*(.text._ZN3ams3log6PrintfEPKcz .text._ZN3ams3log7VPrintfEPKcSt9__va_list .text._ZN3ams3log4DumpEPKvm))
KEEP (*(.text._ZN3ams4util10TVSNPrintfEPcmPKcSt9__va_list .text._ZN3ams4util12_GLOBAL__N_114TVSNPrintfImplEPcmPKcSt9__va_list .text._ZZN3ams4util12_GLOBAL__N_114TVSNPrintfImplEPcmPKcSt9__va_listENKUlbmE3_clEbm)) KEEP (*(.text._ZN3ams4util10TVSNPrintfEPcmPKcSt9__va_list .text._ZN3ams4util12_GLOBAL__N_114TVSNPrintfImplEPcmPKcSt9__va_list .text._ZZN3ams4util12_GLOBAL__N_114TVSNPrintfImplEPcmPKcSt9__va_listENKUlbmE3_clEbm))
KEEP (*(.text._ZN3ams4util12_GLOBAL__N_1L14TVSNPrintfImplEPcmPKcSt9__va_list .text._ZZN3ams4util12_GLOBAL__N_1L14TVSNPrintfImplEPcmPKcSt9__va_listENKUlbmE_clEbm))
KEEP(secmon_exception_handler.o(.text*)) KEEP(secmon_exception_handler.o(.text*))
secmon_exception_handler.o(.rodata*) secmon_exception_handler.o(.rodata*)
secmon_exception_handler.o(.data*) secmon_exception_handler.o(.data*)

View File

@ -282,7 +282,7 @@ namespace ams::ncm {
} }
const FragmentSet *GetFragmentSet(s32 delta_index, s32 fragment_set_index) const { const FragmentSet *GetFragmentSet(s32 delta_index, s32 fragment_set_index) const {
return reinterpret_cast<const FragmentSet *>(this->GetFragmentSetIndex(delta_index, fragment_set_index)); return reinterpret_cast<const FragmentSet *>(this->GetFragmentSetAddress(delta_index, fragment_set_index));
} }
const FragmentIndicator *GetFragmentIndicator(s32 delta_index, s32 fragment_set_index, s32 index) const { const FragmentIndicator *GetFragmentIndicator(s32 delta_index, s32 fragment_set_index, s32 index) const {

View File

@ -33,14 +33,14 @@ namespace ams::fs {
} }
ALWAYS_INLINE ScopedSetter(ScopedSetter &&rhs) { ALWAYS_INLINE ScopedSetter(ScopedSetter &&rhs) {
m_ptr = rhs.ptr; m_ptr = rhs.m_ptr;
m_value = rhs.value; m_value = rhs.m_value;
rhs.Reset(); rhs.Reset();
} }
ALWAYS_INLINE ScopedSetter &operator=(ScopedSetter &&rhs) { ALWAYS_INLINE ScopedSetter &operator=(ScopedSetter &&rhs) {
m_ptr = rhs.ptr; m_ptr = rhs.m_ptr;
m_value = rhs.value; m_value = rhs.m_value;
rhs.Reset(); rhs.Reset();
return *this; return *this;
} }

View File

@ -21,7 +21,7 @@ namespace ams::sf::hipc {
#if AMS_SF_MITM_SUPPORTED #if AMS_SF_MITM_SUPPORTED
Result ServerManagerBase::InstallMitmServerImpl(os::NativeHandle *out_port_handle, sm::ServiceName service_name, ServerManagerBase::MitmQueryFunction query_func) { Result ServerManagerBase::InstallMitmServerImpl(os::NativeHandle *out_port_handle, sm::ServiceName service_name, ServerManagerBase::MitmQueryFunction query_func) {
/* Install the Mitm. */ /* Install the Mitm. */
os::NativeHandle query_handle; os::NativeHandle query_handle = os::InvalidNativeHandle;
R_TRY(sm::mitm::InstallMitm(out_port_handle, std::addressof(query_handle), service_name)); R_TRY(sm::mitm::InstallMitm(out_port_handle, std::addressof(query_handle), service_name));
/* Register the query handle. */ /* Register the query handle. */

View File

@ -16,7 +16,6 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
#include <cstdbool>
/* NOTE: This file serves as a substitute for libnx <switch/types.h>. */ /* NOTE: This file serves as a substitute for libnx <switch/types.h>. */

View File

@ -48,7 +48,7 @@ namespace ams::crypto {
" moveq %[result], #1\n" " moveq %[result], #1\n"
" movne %[result], #0\n" " movne %[result], #0\n"
: [result]"=r"(result), [lhs]"+r"(lhs), [rhs]"+r"(rhs), [xor_acc]"=&r"(xor_acc), [index]"=&r"(index), [ltmp]"=&r"(ltmp), [rtmp]"=&r"(rtmp) : [result]"=r"(result), [lhs]"+r"(lhs), [rhs]"+r"(rhs), [xor_acc]"=&r"(xor_acc), [index]"=&r"(index), [ltmp]"=&r"(ltmp), [rtmp]"=&r"(rtmp)
: [size]"r"(size) : "m"(*(const u8 (*)[size])lhs), "m"(*(const u8 (*)[size])rhs), [size]"r"(size)
: "cc" : "cc"
); );

View File

@ -47,7 +47,7 @@ namespace ams::crypto {
" cmp %w[xor_acc], #0\n" " cmp %w[xor_acc], #0\n"
" cset %w[result], eq\n" " cset %w[result], eq\n"
: [result]"=r"(result), [lhs]"+r"(lhs), [rhs]"+r"(rhs), [xor_acc]"=&r"(xor_acc), [index]"=&r"(index), [ltmp]"=&r"(ltmp), [rtmp]"=&r"(rtmp) : [result]"=r"(result), [lhs]"+r"(lhs), [rhs]"+r"(rhs), [xor_acc]"=&r"(xor_acc), [index]"=&r"(index), [ltmp]"=&r"(ltmp), [rtmp]"=&r"(rtmp)
: "m"(*(const u8 (*)[size])lhs), "m"(*(const u8 (*)[size])lhs), [size]"r"(size) : "m"(*(const u8 (*)[size])lhs), "m"(*(const u8 (*)[size])rhs), [size]"r"(size)
: "cc" : "cc"
); );

View File

@ -281,7 +281,7 @@ namespace ams::crypto::impl {
[cur_hash0]"+w"(cur_hash0), [cur_hash1]"+w"(cur_hash1), [cur_hash0]"+w"(cur_hash0), [cur_hash1]"+w"(cur_hash1),
[prev_hash0]"+w"(prev_hash0), [prev_hash1]"+w"(prev_hash1), [prev_hash0]"+w"(prev_hash0), [prev_hash1]"+w"(prev_hash1),
[tmp_hash]"=w"(tmp_hash), [data]"+r"(data) [tmp_hash]"=w"(tmp_hash), [data]"+r"(data)
: [round_constants]"r"(RoundConstants) : "m"(*(const u8 (*)[block_count*BlockSize])data), [round_constants]"r"(RoundConstants)
: :
); );
} while (--block_count != 0); } while (--block_count != 0);