diff --git a/README.md b/README.md index 0ce276f..3296d71 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,19 @@ Checkout only the changes to files in src/rust_wrapper: Merge those changes: `$ git commit` + + +Compilation +=========== + +Rust currently sets all library symbols visible, resulting is very bloated +libraries. If you are linking with GNU ld it is possible to restrict the visible +symbols to those required by the libretro API, using a version script. Cargo +does not support custom rustc parameters, so first run cargo with --verbose to +discover the cargo parameters. Then run rustc manually, passing the version +script in src/visible_symbols.script by appending: + +`-C link-args="-Wl,-version-script=src/visible_symbols.script -Wl,-gc-sections"` + +This will result in a much more reasonably sized core. The core size may be +futher reduced without loss of function by running `strip -s`. \ No newline at end of file diff --git a/src/visible_symbols.script b/src/visible_symbols.script new file mode 100644 index 0000000..14294fc --- /dev/null +++ b/src/visible_symbols.script @@ -0,0 +1,30 @@ +{ + global: + 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; + local: + *; +};