3ds: try partial linking
authornotaz <notasas@gmail.com>
Tue, 15 Oct 2024 22:45:51 +0000 (01:45 +0300)
committernotaz <notasas@gmail.com>
Wed, 23 Oct 2024 21:17:35 +0000 (00:17 +0300)
Makefile
frontend/libretro-extern [new file with mode: 0644]
frontend/libretro-version-script [moved from frontend/link.T with 100% similarity]

index 69b7ab3..ac5eab9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -429,10 +429,20 @@ frontend/revision.h: FORCE
 target_: $(TARGET)
 
 $(TARGET): $(OBJS)
+ifeq ($(PARTIAL_LINKING), 1)
+       sed -e 's/.*/EXTERN(\0)/' frontend/libretro-extern > frontend/libretro-extern.T
+       $(LD) -o $(basename $(TARGET))1.o -r --gc-sections -T frontend/libretro-extern.T $^
+       $(OBJCOPY) --keep-global-symbols=frontend/libretro-extern $(basename $(TARGET))1.o $(basename $(TARGET)).o
+       $(AR) rcs $@ $(basename $(TARGET)).o
+else ifeq ($(STATIC_LINKING), 1)
+       $(AR) rcs $@ $^
+else
        $(CC_LINK) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(EXTRA_LDFLAGS)
+endif
 
 clean: $(PLAT_CLEAN) clean_plugins
-       $(RM) $(TARGET) $(OBJS) $(TARGET).map frontend/revision.h
+       $(RM) $(TARGET) *.o $(OBJS) $(TARGET).map frontend/revision.h
+       $(RM) frontend/libretro-extern.T
 
 ifneq ($(PLUGINS),)
 plugins_: $(PLUGINS)
diff --git a/frontend/libretro-extern b/frontend/libretro-extern
new file mode 100644 (file)
index 0000000..c3c490c
--- /dev/null
@@ -0,0 +1,25 @@
+retro_api_version
+retro_cheat_reset
+retro_cheat_set
+retro_deinit
+retro_get_memory_data
+retro_get_memory_size
+retro_get_region
+retro_get_system_av_info
+retro_get_system_info
+retro_init
+retro_load_game
+retro_load_game_special
+retro_reset
+retro_run
+retro_serialize
+retro_serialize_size
+retro_set_audio_sample
+retro_set_audio_sample_batch
+retro_set_controller_port_device
+retro_set_environment
+retro_set_input_poll
+retro_set_input_state
+retro_set_video_refresh
+retro_unload_game
+retro_unserialize