Merge pull request #4054 from aliaspider/master

(WiiU) rpx related fixes. add rpx building to dist scripts.
This commit is contained in:
Andrés Suárez 2016-11-22 22:27:41 -05:00 committed by GitHub
commit c42d168a76
17 changed files with 374 additions and 131 deletions

View File

@ -1,5 +1,6 @@
TARGET := retroarch_wiiu
RPX_BUILD = 0
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
@ -14,11 +15,6 @@ OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/tex_shader.o
ifneq ($(RPX_BUILD), 1)
OBJ += wiiu/system/dynamic.o
OBJ += wiiu/system/dyn_stubs.o
endif
DEFINES :=
ifeq ($(GRIFFIN_BUILD), 1)
@ -140,30 +136,33 @@ ifeq ($(WHOLE_ARCHIVE_LINK), 1)
endif
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ifeq ($(RPX_BUILD), 1)
CFLAGS += -fno-builtin -ffreestanding -DRPX_BUILD
LIBDIRS += -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
LDFLAGS += -pie -fPIE
LDFLAGS += -z common-page-size=64 -z max-page-size=64
LDFLAGS += -lcoreinit -lgx2 -lnsysnet -lproc_ui -lsndcore2 -lsysapp -lvpad
LDFLAGS += -T $(WUT_ROOT)/rules/rpl.ld
# LDFLAGS += -T wiiu/link_rpl.ld
LDFLAGS += -nostartfiles
else
LDFLAGS += -T wiiu/link_elf.ld
endif
LDFLAGS += -Wl,--gc-sections
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
ifeq ($(RPX_BUILD), 1)
all: $(TARGET).elf $(TARGET).rpx
else
all: $(TARGET).elf
RPX_OBJ = wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = wiiu/system/dynamic.o wiiu/system/stubs_elf.o
RPX_LDFLAGS := -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib
RPX_LDFLAGS += -pie -fPIE
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
RPX_LDFLAGS += -T wiiu/link_rpl.ld
RPX_LDFLAGS += -nostartfiles
HBL_ELF_LDFLAGS := -T wiiu/link_elf.ld
TARGETS :=
ifeq ($(BUILD_RPX), 1)
TARGETS += $(TARGET).rpx
endif
ifeq ($(BUILD_HBL_ELF), 1)
TARGETS += $(TARGET).elf
endif
all: $(TARGETS)
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
@ -179,15 +178,21 @@ endif
%.a:
$(AR) -rc $@ $^
$(TARGET).elf: $(OBJ) libretro_wiiu.a wiiu/link_elf.ld wiiu/link_rpl.ld
$(LD) $(OBJ) $(LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
%.rpx: %.elf
$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(TARGET).rpx: $(TARGET).rpx.elf
$(ELF2RPL) $(notdir $<) $@
clean:
rm -f $(OBJ)
rm -f $(RPX_OBJ)
rm -f $(HBL_ELF_OBJ)
rm -f $(TARGET).elf
rm -f $(TARGET).rpx.elf
rm -f $(TARGET).rpx
.PHONY: clean all

View File

@ -21,47 +21,93 @@ gen_meta_xml()
display_name=`cat $info | grep "display_name = " | sed "s/display_name = \"//" | sed s/\"//`
corename=`cat $info | grep "corename = " | sed "s/corename = \"//" | sed s/\"//`
authors=`cat $info | grep "authors = " | sed "s/authors = \"//" | sed s/\"// | sed s/\|/\ -\ /g`
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' > "$libretro"_meta.xml
echo '<app version="1">' >> "$libretro"_meta.xml
echo ' <name>'$corename'</name>' >> "$libretro"_meta.xml
echo ' <coder>'$authors'</coder>' >> "$libretro"_meta.xml
echo ' <version>'$RARCH_VERSION'</version>' >> "$libretro"_meta.xml
echo ' <release_date>'`date +%Y%m%d%H%M%S`'</release_date>' >> "$libretro"_meta.xml
echo ' <short_description>RetroArch</short_description>' >> "$libretro"_meta.xml
echo ' <long_description>'$display_name'</long_description>' >> "$libretro"_meta.xml
echo '</app>' >> "$libretro"_meta.xml
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' > "$1"_meta.xml
echo '<app version="1">' >> "$1"_meta.xml
echo ' <name>'$corename'</name>' >> "$1"_meta.xml
echo ' <coder>'$authors'</coder>' >> "$1"_meta.xml
echo ' <version>'$RARCH_VERSION'</version>' >> "$1"_meta.xml
echo ' <release_date>'`date +%Y%m%d%H%M%S`'</release_date>' >> "$1"_meta.xml
echo ' <short_description>RetroArch</short_description>' >> "$1"_meta.xml
echo ' <long_description>'$display_name'</long_description>' >> "$1"_meta.xml
echo '</app>' >> "$1"_meta.xml
fi
}
for f in `ls -v *_${platform}.${EXT}`; do
name=`echo "$f" | sed "s/\(_libretro_${platform}\|\).${EXT}$//"`
whole_archive=
build_hbl_elf=1
build_rpx=1
if [ $name = "nxengine" ] ; then
echo "Applying whole archive linking..."
whole_archive="WHOLE_ARCHIVE_LINK=1"
fi
if [ $name = "mame2003" ] ; then
build_hbl_elf=0
fi
if [ $name = "fbalpha2012" ] ; then
build_hbl_elf=0
fi
if [ $name = "mame2003_midway" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_cps1" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_cps2" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_cps3" ] ; then
build_rpx=0
fi
if [ $name = "fbalpha2012_neogeo" ] ; then
build_rpx=0
fi
echo "-- Building core: $name --"
cp -f "$f" ../libretro_${platform}.${EXT}
echo NAME: $name
# Compile core
make -C ../ -f Makefile.${platform} LIBRETRO=$name $whole_archive -j3 || exit 1
mkdir -p ../pkg/wiiu/wiiu/apps/${name}_libretro
mv -f ../retroarch_wiiu.elf ../pkg/wiiu/wiiu/apps/${name}_libretro/${name}_libretro.elf
make -C ../ -f Makefile.${platform} LIBRETRO=$name BUILD_HBL_ELF=$build_hbl_elf BUILD_RPX=$build_rpx $whole_archive -j3 || exit 1
gen_meta_xml $name
if [ -e $info ] ; then
mv -f "$libretro"_meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
else
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
if [ -e ../retroarch_wiiu.elf ] ; then
mkdir -p ../pkg/wiiu/wiiu/apps/${name}_libretro
mv -f ../retroarch_wiiu.elf ../pkg/wiiu/wiiu/apps/${name}_libretro/${name}_libretro.elf
if [ -e ${name}_meta.xml ] ; then
cp -f ${name}_meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
else
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/wiiu/apps/${name}_libretro/meta.xml
fi
if [ -e $name.png ] ; then
cp -f $name.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
else
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
fi
fi
if [ -e $name.png ] ; then
cp -f $name.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
else
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/wiiu/apps/${name}_libretro/icon.png
if [ -e ../retroarch_wiiu.rpx ] ; then
mkdir -p ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro
mv -f ../retroarch_wiiu.rpx ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/${name}_libretro.rpx
rm -f ../retroarch_wiiu.rpx.elf
if [ -e ${name}_meta.xml ] ; then
cp -f ${name}_meta.xml ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/meta.xml
else
cp -f ../pkg/wiiu/meta.xml ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/meta.xml
fi
if [ -e $name.png ] ; then
cp -f $name.png ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/icon.png
else
cp -f ../pkg/wiiu/icon.png ../pkg/wiiu/rpx/wiiu/apps/${name}_libretro/icon.png
fi
fi
rm -rf ${name}_meta.xml
rm -rf $name.png
done
# Additional build step

View File

@ -273,6 +273,8 @@ int main(int argc, char **argv)
DEBUG_STR(argv[0]);
DEBUG_STR(argv[1]);
fflush(stdout);
#if 1
#if 0
int argc_ = 2;
// char* argv_[] = {WIIU_SD_PATH "retroarch/retroarch.elf", WIIU_SD_PATH "rom.nes", NULL};
@ -296,6 +298,7 @@ int main(int argc, char **argv)
}while(1);
main_exit(NULL);
#endif
fflush(stdout);
fflush(stderr);
ProcUIShutdown();
@ -316,8 +319,26 @@ void __eabi()
}
void __init();
void __fini();
__attribute__((weak))
void __init(void)
{
extern void(*__CTOR_LIST__[])(void);
void(**ctor)(void) = __CTOR_LIST__;
while(*ctor)
(*ctor++)();
}
__attribute__((weak))
void __fini(void)
{
extern void(*__DTOR_LIST__[])(void);
void(**ctor)(void) = __DTOR_LIST__;
while(*ctor)
(*ctor++)();
}
/* HBL elf entry point */
int __entry_menu(int argc, char **argv)
{
InitFunctionPointers();
@ -333,15 +354,16 @@ int __entry_menu(int argc, char **argv)
return ret;
}
/* RPX entry point */
__attribute__((noreturn))
void _start(int argc, char **argv)
{
memoryInitialize();
mount_sd_fat("sd");
// __init();
__init();
int ret = main(argc, argv);
// __fini();
__fini();
unmount_sd_fat("sd");
memoryRelease();

View File

@ -16,6 +16,7 @@
#include "../../driver.h"
#include "../../configuration.h"
#include "../../verbosity.h"
#include "performance_counters.h"
#include <string.h>
#include <coreinit/screen.h>
@ -474,6 +475,9 @@ static void* wiiu_gfx_init(const video_info_t* video,
wiiu->vp.full_height = 480;
video_driver_set_size(&wiiu->vp.width, &wiiu->vp.height);
float refresh_rate = 60.0f / 1.001f;
driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &refresh_rate);
return wiiu;
}
static void wiiu_gfx_free(void* data)
@ -582,6 +586,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
printf("\rfps: %8.8f frames : %5i", fps, wiiu->frames++);
fflush(stdout);
static struct retro_perf_counter gfx_frame_perf = {0};
performance_counter_init(&gfx_frame_perf, "gfx_frame");
performance_counter_start(&gfx_frame_perf);
if (wiiu->should_resize)
wiiu_gfx_update_viewport(wiiu);
@ -660,6 +668,7 @@ static bool wiiu_gfx_frame(void* data, const void* frame,
GX2SwapScanBuffers();
GX2Flush();
performance_counter_stop(&gfx_frame_perf);
return true;
}

View File

@ -112,18 +112,22 @@ SECTIONS {
.ctors ALIGN(256) :
{
__CTOR_LIST__ = .;
KEEP (*crtbegin.o(.ctors)) /* MUST be first -- GCC requires it */
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
} : hdr_data
.dtors ALIGN(256) :
{
__DTOR_LIST__ = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
} : hdr_data
__bss_start__ = .;

View File

@ -1,18 +1,19 @@
#include <coreinit/dynload.h>
#include <coreinit/debug.h>
#define EXPORT(name) void* addr_##name
#define EXPORT_BEGIN(lib)
#define EXPORT_END()
#include "exports/all.h"
#define IMPORT(name) void* addr_##name
#define IMPORT_BEGIN(lib)
#define IMPORT_END(lib)
#include "imports.h"
#undef EXPORT
#undef EXPORT_BEGIN
//#undef EXPORT_END
#undef IMPORT
#undef IMPORT_BEGIN
#undef IMPORT_END
#define EXPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0)
#define EXPORT_BEGIN(lib) OSDynLoad_Acquire(#lib, &handle)
//#define EXPORT_END() OSDynLoad_Release(handle)
#define IMPORT(name) do{if(OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0)OSFatal("Function " # name " is NULL");} while(0)
#define IMPORT_BEGIN(lib) OSDynLoad_Acquire(#lib ".rpl", &handle)
//#define IMPORT_END(lib) OSDynLoad_Release(handle)
#define IMPORT_END(lib)
void InitFunctionPointers(void)
{
@ -20,6 +21,6 @@ void InitFunctionPointers(void)
addr_OSDynLoad_Acquire = *(void**)0x00801500;
addr_OSDynLoad_FindExport = *(void**)0x00801504;
#include "exports/all.h"
#include "imports.h"
}

View File

@ -1,8 +0,0 @@
#include "libcoreinit.h"
#include "libnsysnet.h"
#include "libgx2.h"
#include "libproc_ui.h"
#include "libsndcore2.h"
#include "libsysapp.h"
#include "libvpad.h"

View File

@ -1,7 +0,0 @@
EXPORT_BEGIN(coreinit.rpl);
/* OSFatal should preferably be put first in the list */
#include "../rpl/libcoreinit/exports.h"
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(gx2.rpl);
#include "../rpl/libgx2/exports.h"
EXPORT(GX2GetSwapStatus);
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(nsysnet.rpl);
#include "../rpl/libnsysnet/exports.h"
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(proc_ui.rpl);
#include "../rpl/libproc_ui/exports.h"
EXPORT_END();

View File

@ -1,18 +0,0 @@
EXPORT_BEGIN(sndcore2.rpl);
#include "../rpl/libsndcore2/exports.h"
EXPORT(AXRegisterFrameCallback);
EXPORT(AXAcquireMultiVoice);
EXPORT(AXSetMultiVoiceDeviceMix);
EXPORT(AXSetMultiVoiceOffsets);
EXPORT(AXSetMultiVoiceState);
EXPORT(AXSetMultiVoiceVe);
EXPORT(AXSetMultiVoiceSrcType);
EXPORT(AXSetMultiVoiceSrcRatio);
EXPORT(AXIsMultiVoiceRunning);
EXPORT(AXFreeMultiVoice);
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(sysapp.rpl);
#include "../rpl/libsysapp/exports.h"
EXPORT_END();

View File

@ -1,6 +0,0 @@
EXPORT_BEGIN(vpad.rpl);
#include "../rpl/libvpad/exports.h"
EXPORT_END();

166
wiiu/system/imports.h Normal file
View File

@ -0,0 +1,166 @@
/* coreinit */
IMPORT_BEGIN(coreinit);
IMPORT(OSFatal);
IMPORT(OSDynLoad_Acquire);
IMPORT(OSDynLoad_FindExport);
IMPORT(OSDynLoad_Release);
IMPORT(OSSetExceptionCallback);
IMPORT(OSSavesDone_ReadyToRelease);
IMPORT(OSInitMutex);
IMPORT(OSLockMutex);
IMPORT(OSUnlockMutex);
IMPORT(OSInitSpinLock);
IMPORT(OSUninterruptibleSpinLock_Acquire);
IMPORT(OSUninterruptibleSpinLock_Release);
IMPORT(OSSleepTicks);
IMPORT(OSYieldThread);
IMPORT(OSGetSystemTime);
IMPORT(OSGetSystemTick);
IMPORT(exit);
IMPORT(_Exit);
IMPORT(__os_snprintf);
IMPORT(DCFlushRange);
IMPORT(DCStoreRange);
IMPORT(DCStoreRangeNoSync);
IMPORT(MEMGetBaseHeapHandle);
IMPORT(MEMCreateExpHeapEx);
IMPORT(MEMDestroyExpHeap);
IMPORT(MEMAllocFromExpHeapEx);
IMPORT(MEMFreeToExpHeap);
IMPORT(MEMGetSizeForMBlockExpHeap);
IMPORT(MEMAllocFromFrmHeapEx);
IMPORT(MEMFreeToFrmHeap);
IMPORT(MEMGetAllocatableSizeForFrmHeapEx);
IMPORT(FSInit);
IMPORT(FSShutdown);
IMPORT(FSAddClient);
IMPORT(FSDelClient);
IMPORT(FSInitCmdBlock);
IMPORT(FSChangeDir);
IMPORT(FSGetFreeSpaceSize);
IMPORT(FSGetStat);
IMPORT(FSRemove);
IMPORT(FSOpenFile);
IMPORT(FSCloseFile);
IMPORT(FSOpenDir);
IMPORT(FSMakeDir);
IMPORT(FSReadDir);
IMPORT(FSRewindDir);
IMPORT(FSCloseDir);
IMPORT(FSGetStatFile);
IMPORT(FSReadFile);
IMPORT(FSWriteFile);
IMPORT(FSSetPosFile);
IMPORT(FSFlushFile);
IMPORT(FSTruncateFile);
IMPORT(FSRename);
IMPORT(FSGetMountSource);
IMPORT(FSMount);
IMPORT(FSUnmount);
IMPORT_END(coreinit);
/* nsysnet */
IMPORT_BEGIN(nsysnet);
IMPORT(socket_lib_init);
IMPORT(socket);
IMPORT(socketclose);
IMPORT(connect);
IMPORT(send);
IMPORT(inet_aton);
IMPORT_END(nsysnet);
/* gx2 */
IMPORT_BEGIN(gx2);
IMPORT(GX2Invalidate);
IMPORT(GX2Init);
IMPORT(GX2GetSystemTVScanMode);
IMPORT(GX2CalcTVSize);
IMPORT(GX2SetTVBuffer);
IMPORT(GX2CalcDRCSize);
IMPORT(GX2SetDRCBuffer);
IMPORT(GX2CalcSurfaceSizeAndAlignment);
IMPORT(GX2InitColorBufferRegs);
IMPORT(GX2SetupContextStateEx);
IMPORT(GX2SetContextState);
IMPORT(GX2SetColorBuffer);
IMPORT(GX2SetViewport);
IMPORT(GX2SetScissor);
IMPORT(GX2SetDepthOnlyControl);
IMPORT(GX2SetColorControl);
IMPORT(GX2SetBlendControl);
IMPORT(GX2SetCullOnlyControl);
IMPORT(GX2CalcFetchShaderSizeEx);
IMPORT(GX2InitFetchShaderEx);
IMPORT(GX2SetFetchShader);
IMPORT(GX2SetVertexShader);
IMPORT(GX2SetPixelShader);
IMPORT(GX2SetAttribBuffer);
IMPORT(GX2InitTextureRegs);
IMPORT(GX2InitSampler);
IMPORT(GX2SetPixelTexture);
IMPORT(GX2SetPixelSampler);
IMPORT(GX2ClearColor);
IMPORT(GX2CopyColorBufferToScanBuffer);
IMPORT(GX2SwapScanBuffers);
IMPORT(GX2Flush);
IMPORT(GX2WaitForVsync);
IMPORT(GX2SetTVEnable);
IMPORT(GX2SetDRCEnable);
IMPORT(GX2SetSwapInterval);
IMPORT(GX2DrawDone);
IMPORT(GX2Shutdown);
IMPORT(GX2DrawEx);
IMPORT(GX2WaitForFlip);
IMPORT(GX2GetSwapStatus);
IMPORT_END(gx2);
/* proc_ui */
IMPORT_BEGIN(proc_ui);
IMPORT(ProcUIInit);
IMPORT(ProcUIShutdown);
IMPORT_END(proc_ui);
/* sndcore2 */
IMPORT_BEGIN(sndcore2);
IMPORT(AXInitWithParams);
IMPORT(AXQuit);
IMPORT(AXRegisterFrameCallback);
IMPORT(AXAcquireMultiVoice);
IMPORT(AXSetMultiVoiceDeviceMix);
IMPORT(AXSetMultiVoiceOffsets);
IMPORT(AXSetMultiVoiceState);
IMPORT(AXSetMultiVoiceVe);
IMPORT(AXSetMultiVoiceSrcType);
IMPORT(AXSetMultiVoiceSrcRatio);
IMPORT(AXIsMultiVoiceRunning);
IMPORT(AXFreeMultiVoice);
IMPORT_END(sndcore2);
/* sysapp */
IMPORT_BEGIN(sysapp);
IMPORT(SYSRelaunchTitle);
IMPORT_END(sysapp);
/* vpad */
IMPORT_BEGIN(vpad);
IMPORT(VPADRead);
IMPORT(VPADInit);
IMPORT_END(vpad);

View File

@ -1,4 +1,4 @@
/*#define EXPORT(name) \
/*#define IMPORT(name) \
.global name; \
name: \
lis %r11, addr_##name@h; \
@ -6,7 +6,7 @@
mtctr %r11; \
bctr*/
#define EXPORT(name) \
#define IMPORT(name) \
.global name; \
name: \
lis %r11, addr_##name@h; \
@ -15,11 +15,11 @@
mtctr %r11; \
bctr
#define EXPORT_BEGIN(lib)
#define EXPORT_END()
#define IMPORT_BEGIN(lib)
#define IMPORT_END(lib)
.align 2;
.section ".text";
#include "exports/all.h"
#include "imports.h"

53
wiiu/system/stubs_rpl.S Normal file
View File

@ -0,0 +1,53 @@
/*#define IMPORT_BEGIN(lib) .align 2; .section .fimport_##lib,"ax";*/
#define IMPORT_BEGIN(lib)
/*#define IMPORT(name) \
.global name; \
name: \
nop; \
nop*/
#define IMPORT(name) \
.align 2; \
.section ".rplTramp.text","ax"; \
.global name; \
name: \
lis %r0, name##_stub@h; \
ori %r0, %r0, name##_stub@l; \
mtctr %r0; \
bctr;
/*#define IMPORT_END() .align 2;*/
#define IMPORT_END(lib)
#include "imports.h"
#undef IMPORT_BEGIN
#undef IMPORT
#undef IMPORT_END
#define IMPORT_BEGIN(lib) \
.section ".data.rplFuncStubs"; \
.align 2; \
fstubBegin_##lib:
#define IMPORT(name) \
.global name##_stub; \
name##_stub: \
.long name;
#define IMPORT_END(lib) \
fstubEnd_##lib: \
.section ".rodata.rplNames"; \
lib##_name: \
.string #lib; \
.section ".lib.rplLibs"; \
.align 2; \
.long lib##_name; \
.long fstubBegin_##lib; \
.long fstubEnd_##lib
#include "imports.h"