Combine EntryPoint.cpp and enable dead stripping

This commit is contained in:
Charlotte Delenk 2021-10-20 21:13:54 +02:00
parent 829ac223d8
commit 862273029d
Signed by: darkkirb
GPG key ID: 015E3768A70AFBC5
23 changed files with 116 additions and 112 deletions

View file

@ -11,8 +11,7 @@
80006620,80006684,,,,,,,,,,,,,,,,,,,,,,,,,sdk/rvl/os/__ppc_eabi_init.o
,,,,,,80174ad8,80174af8,,,,,,,,,,,,,80556b70,80556b71,,,,,donut/Main.o
,,,,,,,,,,,,,,,,,,,,8055d120,8055d12c,,,,,donut/app/AppImpl.o
,,,,,,801776bc,80177810,,,,,,,80452cf7,80452d18,,,,,8055d13c,8055d141,,,,,donut/app/EntryPoint.o
,,,,,,801778d8,8017793c,,,,,,,,,,,,,,,,,,,donut/app/EntryPoint2.o
,,,,,,801776bc,8017793c,,,,,,,80452cf7,80452d18,,,,,8055d13c,8055d141,,,,,donut/app/EntryPoint.o
,,,,,,8017bbdc,8017bd88,,,,,,,,,,,,,,,,,,,donut/app/System.o
,,,,,,,,,,,,,,,,,,,,8055d1b0,8055d1b4,,,,,donut/g3d/Root.o
,,,,,,8019607c,801961fc,,,,,,,,,,,,,8055d1b4,8055d1b9,,,,,donut/gfx/GXFifoMemoryManager.o

1 .init start .init end extab start extab end extabindex start extabindex end .text start .text end .ctors start .ctors end .dtors start .dtors end .rodata start .rodata end .data start .data end .bss start .bss end .sdata start .sdata end .sbss start .sbss end .sdata2 start .sdata2 end .sbss2 start .sbss2 end File
11 80006620 80006684 sdk/rvl/os/__ppc_eabi_init.o
12 80174ad8 80174af8 80556b70 80556b71 donut/Main.o
13 8055d120 8055d12c donut/app/AppImpl.o
14 801776bc 80177810 8017793c 80452cf7 80452d18 8055d13c 8055d141 donut/app/EntryPoint.o
801778d8 8017793c donut/app/EntryPoint2.o
15 8017bbdc 8017bd88 donut/app/System.o
16 8055d1b0 8055d1b4 donut/g3d/Root.o
17 8019607c 801961fc 8055d1b4 8055d1b9 donut/gfx/GXFifoMemoryManager.o

View file

@ -38,10 +38,9 @@ Address,SymbolName
800dd3e0,__ct__Q33hel6common34PointerWrapper<Q23mem10IAllocator>Fv
800f16b0,G3dInit__Q24nw4r3g3dFb
801007e0,startAddress__Q23mem8MemBlockCFv
80175004,__dt__Q33hel6common43ExplicitSingleton<Q26freeze13FreezeManager>Fv
80175b68,__dt__Q33hel6common11NonCopyableFv
80176268,Run__Q23app11ApplicationFRQ23app6Systembbb
80177810,__dt__Q26freeze13FreezeManagerFv
8017786c,__dt__Q23gfx10XFBManagerFv
8018a900,__ct__Q26freeze13FreezeManagerFPUcPUc
80196404,__dt__Q23gfx13RenderSettingFv
80196468,rmode__Q23gfx13RenderSettingCFv

1 Address SymbolName
38 800dd3e0 __ct__Q33hel6common34PointerWrapper<Q23mem10IAllocator>Fv
39 800f16b0 G3dInit__Q24nw4r3g3dFb
40 801007e0 startAddress__Q23mem8MemBlockCFv
41 80175004 __dt__Q33hel6common43ExplicitSingleton<Q26freeze13FreezeManager>Fv
42 80175b68 __dt__Q33hel6common11NonCopyableFv
43 80176268 Run__Q23app11ApplicationFRQ23app6Systembbb
80177810 __dt__Q26freeze13FreezeManagerFv
8017786c __dt__Q23gfx10XFBManagerFv
44 8018a900 __ct__Q26freeze13FreezeManagerFPUcPUc
45 80196404 __dt__Q23gfx13RenderSettingFv
46 80196468 rmode__Q23gfx13RenderSettingCFv

View file

@ -1,3 +1,4 @@
#include <defines.h>
#include <gfx/VISetting.hpp>
#include <hel/common/ExplicitSingleton.hpp>
#include <mem/Memory.hpp>
@ -10,7 +11,7 @@
namespace hel {
namespace common {
mem::Memory *ExplicitSingleton<mem::Memory>::object_;
snd::SoundManager *ExplicitSingleton<snd::SoundManager>::object_;
USED snd::SoundManager *ExplicitSingleton<snd::SoundManager>::object_;
gfx::VISetting *ExplicitSingleton<gfx::VISetting>::object_;
} // namespace common
} // namespace hel

View file

@ -27,5 +27,6 @@ void EntryPoint::Run(bool debug, const char *arg) {
namespace hel {
namespace common {
bool PrivateSingleton<app::System>::isExist_;
}
} // namespace hel
PrivateSingleton<app::System>::~PrivateSingleton() { isExist_ = false; }
} // namespace common
} // namespace hel

View file

@ -1,8 +0,0 @@
#include <app/System.hpp>
#include <hel/common/PrivateSingleton.hpp>
namespace hel {
namespace common {
PrivateSingleton<app::System>::~PrivateSingleton() { isExist_ = false; }
} // namespace common
} // namespace hel

View file

@ -1,6 +1,7 @@
#include <ai.h>
#include <app/System.hpp>
#include <ax.h>
#include <defines.h>
#include <dvd.h>
#include <gx.h>
#include <nw4r/g3d.hpp>
@ -23,8 +24,8 @@ System::System()
nw4r::g3d::tmem::SetTMemLayout(nw4r::g3d::tmem::TMEM_LAYOUT_1);
}
gfx::RenderSetting &System::renderSetting() { return renderSetting_; }
gfx::XFBManager &System::xfbManager() { return xfbManager_; }
USED gfx::RenderSetting &System::renderSetting() { return renderSetting_; }
USED gfx::XFBManager &System::xfbManager() { return xfbManager_; }
System::SDKInitializer::SDKInitializer() {
SCInit();

View file

@ -1,4 +1,5 @@
#include <dc.h>
#include <defines.h>
#include <gfx/GXFifoMemoryManager.hpp>
#include <mem/Memory.hpp>
@ -30,5 +31,5 @@ void *GXFifoMemoryManager::data() {
return (void *)(((u32)fifo_ + 0x3ff) & ~0x3ff);
}
void GXFifoMemoryManager::setWriteEnable() { writeEnable_ = true; }
USED void GXFifoMemoryManager::setWriteEnable() { writeEnable_ = true; }
} // namespace gfx

View file

@ -1,7 +1,8 @@
#include <defines.h>
#include <gfx/RenderSetting.hpp>
#include <gx.h>
void setCopyClear(void) {
USED void setCopyClear(void) {
GXColor color = {0, 0, 0, 255};
GXSetCopyClear(color, 0xffffff);
}

View file

@ -1,7 +1,8 @@
#include <defines.h>
#include <mem/DataBlock.hpp>
namespace mem {
DataBlock::DataBlock(u32 size, s32 align, IAllocator &alloc)
: alloc_(alloc), block_(alloc.allocatorAlloc(size, align), size) {}
DataBlock::~DataBlock() { alloc_.allocatorFree(block_.ptr_); }
USED DataBlock::~DataBlock() { alloc_.allocatorFree(block_.ptr_); }
} // namespace mem

View file

@ -1,6 +1,7 @@
#include <defines.h>
#include <mem/MemBlock.hpp>
namespace mem {
MemBlock MemBlock::EmptyBlock() { return MemBlock(0, 0); }
USED MemBlock MemBlock::EmptyBlock() { return MemBlock(0, 0); }
MemBlock::MemBlock(void *ptr, u32 size) : size_(size), ptr_(ptr) {}
} // namespace mem

View file

@ -1,3 +1,4 @@
#include <defines.h>
#include <hel/common/PointerWrapper.hpp>
#include <mem/Memory.hpp>
#include <mem/OperatorNewDelete.hpp>
@ -45,22 +46,30 @@ void t_operatorDelete(void *ptr) {
} // namespace
void *operator new(u32 size, IAllocator &alloc) {
USED void *operator new(u32 size, IAllocator &alloc) {
return t_operatorNew(size, alloc);
}
void *operator new(u32 size) { return t_operatorNew(size); }
void *operator new[](u32 size, IAllocator &alloc) {
return t_operatorNew(size, alloc);
}
USED void *operator new(u32 size) { return t_operatorNew(size); }
void *operator new[](u32 size) { return t_operatorNew(size); }
void operator delete(void *ptr) { t_operatorDelete(ptr); }
void operator delete[](void *ptr) { t_operatorDelete(ptr); }
namespace mem {
void OperatorNewDelete::SetDefaultAllocator(IAllocator &alloc) {
USED void OperatorNewDelete::SetDefaultAllocator(IAllocator &alloc) {
t_allocator.ptr_ = &alloc;
}
void OperatorNewDelete::SetGlobalNewDeleteAllocator(IAllocator &alloc) {
USED void OperatorNewDelete::SetGlobalNewDeleteAllocator(IAllocator &alloc) {
t_globalNewDeleteAllocator.ptr_ = &alloc;
}
void OperatorNewDelete::UnsetGlobalNewDeleteAllocator(IAllocator &alloc) {
USED void OperatorNewDelete::UnsetGlobalNewDeleteAllocator(IAllocator &alloc) {
// extraneous argument is not a copy-paste error
t_globalNewDeleteAllocator.ptr_ = 0;
}

View file

@ -1,3 +1,4 @@
#include <defines.h>
#include <util/Mutex.hpp>
#ifdef __CWCC__
@ -6,9 +7,9 @@
namespace util {
Mutex::Mutex() { OSInitMutex(&inner_); }
void Mutex::lock() { OSLockMutex(&inner_); }
void Mutex::unlock() { OSUnlockMutex(&inner_); }
USED void Mutex::lock() { OSLockMutex(&inner_); }
USED void Mutex::unlock() { OSUnlockMutex(&inner_); }
ScopedMutex::ScopedMutex(Mutex &mutex) : mutex_(mutex) { mutex.lock(); }
ScopedMutex::~ScopedMutex() { mutex_.unlock(); }
USED ScopedMutex::ScopedMutex(Mutex &mutex) : mutex_(mutex) { mutex.lock(); }
USED ScopedMutex::~ScopedMutex() { mutex_.unlock(); }
} // namespace util

View file

@ -1,7 +1,9 @@
#ifdef __CWCC__
#define AT(pos) : pos
#define SECTION(sect) __declspec(section sect)
#define USED __attribute__((used))
#else
#define AT(pos)
#define SECTION(sect)
#define USED
#endif

View file

@ -1,9 +1,10 @@
#pragma once
#include <hel/common/ExplicitSingleton.hpp>
namespace freeze {
struct FreezeManager {
struct FreezeManager : hel::common::ExplicitSingleton<FreezeManager> {
int unk[4];
FreezeManager(unsigned char *fb1, unsigned char *fb2);
~FreezeManager();
};
} // namespace freeze

View file

@ -9,7 +9,6 @@ struct XFBManager {
mem::DataBlock fb2_;
bool oddFb_;
XFBManager(const VISetting &);
~XFBManager();
unsigned char *target1();
unsigned char *target2();
unsigned char *drawTargetXFB();

View file

@ -2,13 +2,13 @@
// https://github.com/doldecomp/ogws/blob/82dbeac2267170fc5cef7e67a6d8c31c5ff45d69/src/RevoSDK/TRK/__mem.c
// Decompiled by GibHaltmannKill.
#include <string.h>
#include <defines.h>
#include <string.h>
#ifdef __CWCC__
SECTION(".init") asm void *memcpy(register void *dest,
register const void *src,
register size_t size) {
SECTION(".init")
asm void *memcpy(register void *dest, register const void *src,
register size_t size) {
// clang-format off
nofralloc;
cmplwi cr1, size, 0x0;
@ -204,8 +204,7 @@ LAB_8000428c:
}
#endif
SECTION(".init") static void __fill_mem(void *dest, int val,
size_t count) {
SECTION(".init") static void __fill_mem(void *dest, int val, size_t count) {
char *cdest = (char *)dest;
int cval = (unsigned char)val;
int *idest = (int *)dest;
@ -267,7 +266,7 @@ SECTION(".init") void *memset(void *dest, int val, size_t count) {
return dest;
}
size_t strlen(const char *s) {
USED size_t strlen(const char *s) {
unsigned char *p = (unsigned char *)s - 1;
size_t n = ~0;
do {

View file

@ -1,3 +1,5 @@
#include <defines.h>
const double __constants[] = {0.0, 4294967296.0, 2147483648.0};
#ifdef __CWCC__
@ -108,7 +110,7 @@ void _restgpr_30(void);
void _restgpr_31(void);
#ifdef __CWCC__
asm void __save_fpr(void) {
USED asm void __save_fpr(void) {
// clang-format off
nofralloc;
@ -155,7 +157,7 @@ entry _savefpr_31;
#endif
#ifdef __CWCC__
asm void __restore_fpr(void) {
USED asm void __restore_fpr(void) {
// clang-format off
nofralloc;
@ -296,7 +298,7 @@ entry _restgpr_31;
#endif
#ifdef __CWCC__
asm void __div2u() {
USED asm void __div2u() {
// clang-format off
nofralloc;
cmpwi r3, 0;
@ -372,7 +374,7 @@ LAB_80007480:
#endif
#ifdef __CWCC__
asm void __div2i() {
USED asm void __div2i() {
// clang-format off
nofralloc;
@ -476,7 +478,7 @@ LAB_800075bc:
#endif
#ifdef __CWCC__
asm void __mod2u() {
USED asm void __mod2u() {
// clang-format off
nofralloc;
cmpwi r3, 0;
@ -550,7 +552,7 @@ LAB_800076a4:
#endif
#ifdef __CWCC__
asm void __mod2i() {
USED asm void __mod2i() {
// clang-format off
nofralloc;
@ -640,7 +642,7 @@ LAB_800077b0:
#endif
#ifdef __CWCC__
asm void __shl2i() {
USED asm void __shl2i() {
// clang-format off
nofralloc;
subfic r8, r5, 0x20;
@ -657,7 +659,7 @@ asm void __shl2i() {
#endif
#ifdef __CWCC__
asm void __cvt_sll_dbl() {
USED asm void __cvt_sll_dbl() {
// clang-format off
stwu r1, -0x10(r1);
rlwinm. r5, r3, 0, 0, 0;
@ -712,7 +714,7 @@ LAB_80007874:
#endif
#ifdef __CWCC__
asm void __cvt_dbl_usll() {
USED asm void __cvt_dbl_usll() {
// clang-format off
nofralloc;
@ -778,7 +780,7 @@ LAB_8000794c:
#endif
#ifdef __CWCC__
asm void __cvt_dbl_ull() {
USED asm void __cvt_dbl_ull() {
// clang-format off
nofralloc;
stwu r1, -0x10(r1);

View file

@ -1,4 +1,5 @@
#include <base.h>
#include <defines.h>
#include <os.h>
#ifdef __CWCC__
@ -32,7 +33,7 @@ asm u32 PPCMfhid0(void) {
#endif
#ifdef __CWCC__
asm void PPCMthid0(register u32 val) {
USED asm void PPCMthid0(register u32 val) {
// clang-format off
nofralloc;
mtspr 1008, val;
@ -62,7 +63,7 @@ asm void PPCMtl2cr(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCMtdec(register u32 val) {
USED asm void PPCMtdec(register u32 val) {
// clang-format off
nofralloc;
mtdec val;
@ -72,7 +73,7 @@ asm void PPCMtdec(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCSync(void) {
USED asm void PPCSync(void) {
// clang-format off
nofralloc;
sc;
@ -96,7 +97,7 @@ LAB_8001a134:
#endif
#ifdef __CWCC__
asm void PPCMtmmcr0(register u32 val) {
USED asm void PPCMtmmcr0(register u32 val) {
// clang-format off
nofralloc;
mtspr 952, val;
@ -106,7 +107,7 @@ asm void PPCMtmmcr0(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCMtmmcr1(register u32 val) {
USED asm void PPCMtmmcr1(register u32 val) {
// clang-format off
nofralloc;
mtspr 956, val;
@ -116,7 +117,7 @@ asm void PPCMtmmcr1(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCMtpmc1(register u32 val) {
USED asm void PPCMtpmc1(register u32 val) {
// clang-format off
nofralloc;
mtspr 953, val;
@ -126,7 +127,7 @@ asm void PPCMtpmc1(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCMtpmc2(register u32 val) {
USED asm void PPCMtpmc2(register u32 val) {
// clang-format off
nofralloc;
mtspr 954, val;
@ -136,7 +137,7 @@ asm void PPCMtpmc2(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCMtpmc3(register u32 val) {
USED asm void PPCMtpmc3(register u32 val) {
// clang-format off
nofralloc;
mtspr 957, val;
@ -144,7 +145,7 @@ asm void PPCMtpmc3(register u32 val) {
// clang-format on
}
asm void PPCMtpmc4(register u32 val) {
USED asm void PPCMtpmc4(register u32 val) {
// clang-format off
nofralloc;
mtspr 958, val;
@ -154,7 +155,7 @@ asm void PPCMtpmc4(register u32 val) {
#endif
#ifdef __CWCC__
asm u32 PPCMffpscr(void) {
USED asm u32 PPCMffpscr(void) {
// clang-format off
nofralloc;
stwu r1, -0x20(r1);
@ -170,7 +171,7 @@ asm u32 PPCMffpscr(void) {
#endif
#ifdef __CWCC__
asm void PPCMtfpscr(register u32 val) {
USED asm void PPCMtfpscr(register u32 val) {
// clang-format off
nofralloc;
stwu r1, -0x20(r1);
@ -208,7 +209,7 @@ asm void PPCMthid2(register u32 val) {
#endif
#ifdef __CWCC__
asm void PPCMtwpar(register u32 val) {
USED asm void PPCMtwpar(register u32 val) {
// clang-format off
nofralloc;
mtspr 921, val;
@ -217,10 +218,10 @@ asm void PPCMtwpar(register u32 val) {
}
#endif
void PPCDisableSpeculation(void) { PPCMthid0(PPCMfhid0() | 0x200); }
USED void PPCDisableSpeculation(void) { PPCMthid0(PPCMfhid0() | 0x200); }
#ifdef __CWCC__
asm void PPCSetFpNonIEEEMode(void) {
USED asm void PPCSetFpNonIEEEMode(void) {
// clang-format off
nofralloc;
mtfsb1 29;
@ -228,7 +229,7 @@ asm void PPCSetFpNonIEEEMode(void) {
// clang-format on
}
#endif
void PPCMthid4(register u32 val) {
USED void PPCMthid4(register u32 val) {
if (val & 0x80000000) {
#ifdef __CWCC__
asm {

View file

@ -1,3 +1,4 @@
#include <defines.h>
#include <ic.h>
#include <os.h>
#include <os/osContext.h>
@ -37,7 +38,7 @@ LAB_8001c9fc:
#endif
#ifdef __CWCC__
asm void DCFlushRange(register void *addr, register u32 len) {
USED asm void DCFlushRange(register void *addr, register u32 len) {
// clang-format off
nofralloc;
cmplwi len, 0;
@ -58,7 +59,7 @@ LAB_8001c99c:
#endif
#ifdef __CWCC__
asm void DCStoreRange(register void *addr, register u32 len) {
USED asm void DCStoreRange(register void *addr, register u32 len) {
// clang-format off
nofralloc;
cmplwi len, 0;
@ -79,7 +80,7 @@ LAB_8001c9cc:
#endif
#ifdef __CWCC__
asm void DCFlushRangeNoSync(register void *addr, register u32 len) {
USED asm void DCFlushRangeNoSync(register void *addr, register u32 len) {
// clang-format off
nofralloc;
cmplwi len, 0;
@ -99,7 +100,7 @@ LAB_8001c9fc:
#endif
#ifdef __CWCC__
asm void DCStoreRangeNoSync(register void *addr, register u32 len) {
USED asm void DCStoreRangeNoSync(register void *addr, register u32 len) {
// clang-format off
nofralloc;
cmplwi len, 0;
@ -119,7 +120,7 @@ LAB_8001ca2c:
#endif
#ifdef __CWCC__
asm void DCZeroRange(register void *addr, register u32 len) {
USED asm void DCZeroRange(register void *addr, register u32 len) {
// clang-format off
nofralloc;
cmplwi len, 0;
@ -139,7 +140,7 @@ LAB_8001ca5c:
#endif
#ifdef __CWCC__
asm void ICInvalidateRange(register void *addr, register u32 len) {
USED asm void ICInvalidateRange(register void *addr, register u32 len) {
// clang-format off
nofralloc;
cmplwi len, 0;
@ -224,7 +225,7 @@ LAB_8001cb6c:
}
#endif
void LCEnable(void) {
USED void LCEnable(void) {
BOOL enabled;
enabled = OSDisableInterrupts();
@ -233,7 +234,7 @@ void LCEnable(void) {
}
#ifdef __CWCC__
asm void LCDisable(void) {
USED asm void LCDisable(void) {
// clang-format off
nofralloc;
@ -254,8 +255,8 @@ LAB_8001cbfc:
#endif
#ifdef __CWCC__
asm void LCLoadBlocks(register void *dest, register void *src,
register u32 num) {
USED asm void LCLoadBlocks(register void *dest, register void *src,
register u32 num) {
// clang-format off
nofralloc;
@ -274,8 +275,8 @@ asm void LCLoadBlocks(register void *dest, register void *src,
#endif
#ifdef __CWCC__
asm void LCStoreBlocks(register void *dest, register void *src,
register u32 num) {
USED asm void LCStoreBlocks(register void *dest, register void *src,
register u32 num) {
// clang-format off
nofralloc;
@ -293,7 +294,7 @@ asm void LCStoreBlocks(register void *dest, register void *src,
}
#endif
u32 LCStoreData(void *dest, void *src, u32 n) {
USED u32 LCStoreData(void *dest, void *src, u32 n) {
u32 num;
u32 xacts;
@ -314,7 +315,7 @@ u32 LCStoreData(void *dest, void *src, u32 n) {
}
#ifdef __CWCC__
asm u32 LCQueueLength(void) {
USED asm u32 LCQueueLength(void) {
// clang-format off
nofralloc;
mfspr r4, 920;
@ -325,7 +326,7 @@ asm u32 LCQueueLength(void) {
#endif
#ifdef __CWCC__
asm u32 LCQueueWait(register u32 len) {
USED asm u32 LCQueueWait(register u32 len) {
// clang-format off
nofralloc;
mfspr r4, 920;
@ -373,9 +374,11 @@ void __OSCacheInit(void) {
msr = PPCMfmsr();
__sync();
PPCMtmsr(0x30);
__sync(); __sync();
__sync();
__sync();
PPCMtl2cr(PPCMfl2cr() & 0x7FFFFFFF);
__sync(); __sync();
__sync();
__sync();
PPCMtl2cr(PPCMfl2cr() & 0x7FFFFFFF);
__sync();
PPCMtl2cr(PPCMfl2cr() | 0x200000);

View file

@ -1,3 +1,4 @@
#include <defines.h>
#include <os.h>
#include <os/osContext.h>
#include <os/osError.h>
@ -171,7 +172,7 @@ LAB_8001d1e4:
#endif
#ifdef __CWCC__
asm void OSSaveFPUContext(register OSContext *context) {
USED asm void OSSaveFPUContext(register OSContext *context) {
// clang-format off
nofralloc;
addi r5, context, 0;
@ -212,10 +213,10 @@ LAB_8001d238:
}
#endif
OSContext *OSGetCurrentContext(void) { return __OSCurrentContext; }
USED OSContext *OSGetCurrentContext(void) { return __OSCurrentContext; }
#ifdef __CWCC__
asm u32 OSSaveContext(register OSContext *context) {
USED asm u32 OSSaveContext(register OSContext *context) {
// clang-format off
stmw r13, 0x034(context);
mfspr r0, 913;
@ -257,7 +258,7 @@ extern u32 __RAS_OSDisableInterrupts_begin;
extern u32 __RAS_OSDisableInterrupts_end;
#ifdef __CWCC__
asm void OSLoadContext(register OSContext *context) {
USED asm void OSLoadContext(register OSContext *context) {
// clang-format off
nofralloc;
@ -325,7 +326,7 @@ LAB_8001d344:
#endif
#ifdef __CWCC__
asm void *OSGetStackPointer(void) {
USED asm void *OSGetStackPointer(void) {
// clang-format off
nofralloc;
mr r3, r1;
@ -335,7 +336,7 @@ asm void *OSGetStackPointer(void) {
#endif
#ifdef __CWCC__
asm void OSSwitchFiber(register u32 code, register u32 stack) {
USED asm void OSSwitchFiber(register u32 code, register u32 stack) {
// clang-format off
nofralloc;
mflr r0;
@ -355,9 +356,9 @@ asm void OSSwitchFiber(register u32 code, register u32 stack) {
#endif
#ifdef __CWCC__
asm void OSSwitchFiberEx(register u32 a0, register u32 a1, register u32 a2,
register u32 a3, register u32 code,
register u32 stack) {
USED asm void OSSwitchFiberEx(register u32 a0, register u32 a1, register u32 a2,
register u32 a3, register u32 code,
register u32 stack) {
// clang-format off
nofralloc;
mflr r0;
@ -376,7 +377,7 @@ asm void OSSwitchFiberEx(register u32 a0, register u32 a1, register u32 a2,
}
#endif
void OSClearContext(OSContext *context) {
USED void OSClearContext(OSContext *context) {
context->mode = 0;
context->state = 0;
if (context == __OSFPUContext)
@ -384,8 +385,8 @@ void OSClearContext(OSContext *context) {
}
#ifdef __CWCC__
asm void OSInitContext(register OSContext *context, register u32 code,
register u32 stack) {
USED asm void OSInitContext(register OSContext *context, register u32 code,
register u32 stack) {
// clang-format off
nofralloc;
stw code, 0x198(context);
@ -496,8 +497,8 @@ void OSDumpContext(OSContext *context) {
}
#ifdef __CWCC__
static asm void OSSwitchFPUContext(register u32 unk,
register OSContext *context) {
USED static asm void OSSwitchFPUContext(register u32 unk,
register OSContext *context) {
// clang-format off
nofralloc;
mfmsr r5;
@ -538,17 +539,16 @@ LAB_8001d7d0:
// clang-format on
}
#else
void OSSwitchFPUContext(register u32 unk,
register OSContext *context);
void OSSwitchFPUContext(register u32 unk, register OSContext *context);
#endif
void __OSContextInit(void) {
USED void __OSContextInit(void) {
__OSSetExceptionHandler(7, OSSwitchFPUContext);
__OSFPUContext = NULL;
}
#ifdef __CWCC__
asm void OSFillFPUContext(register OSContext *context) {
USED asm void OSFillFPUContext(register OSContext *context) {
// clang-format off
nofralloc;
mfmsr r5;

View file

@ -23,7 +23,6 @@ const SOURCES: &[(&str, &str)] = &[
("donut/Main.cpp", "donut"),
("donut/app/AppImpl.cpp", "donut"),
("donut/app/EntryPoint.cpp", "donut"),
("donut/app/EntryPoint2.cpp", "donut"),
("donut/app/System.cpp", "donut"),
("donut/g3d/Root.cpp", "donut"),
("donut/gfx/GXFifoMemoryManager.cpp", "donut"),

View file

@ -75,13 +75,13 @@ MEMORY {
}
out.write_all(b"}\n")?;
let reader = BufReader::new(File::open("build/objects.txt")?);
/*let reader = BufReader::new(File::open("build/objects.txt")?);
out.write_all(b"FORCEFILES { \n")?;
for line in reader.lines() {
let line = line?;
out.write_all(format!("\"{}\"\n", line).as_bytes())?;
}
out.write_all(b"}\n")?;
out.write_all(b"}\n")?;*/
Ok(())
}

View file

@ -229,15 +229,6 @@ impl<R: Read + Seek> Dol<R> {
.wait()?;
fs::remove_file(&asmfile_name)?;
}
Command::new("llvm-objcopy")
.arg("--add-symbol")
.arg(format!(
"_LOC_{:08x}={}:0x{:08x},global",
address, SECTION_NAMES[section], address
))
.arg(outname)
.spawn()?
.wait()?;
Ok(())
}
pub fn extract_from_to(&mut self, start: u32, end: u32, outname: &str) -> Result<()> {