Skip to content

gst-plugins-rs: Fix superstripping for ELF breaking all plugins

amyspark requested to merge amyspark/cerbero:fix-superstripping-android into main

Hi all,

As it turns out, superstripping was doing a complete(ly wrong) job out of the static libraries generated by rust. Using strip with --keep-symbol looked sensible, but the utility did not truly parse all the symbols and constructed a dependency chain. Instead, placeholders to the next address were generated in place of all the rodata symbols referenced in the functions to be kept.

The result of this nightmare was crashes that looked completely senseless, until one checked the disassembly of the functions -- the gst_plugin_xxx_register function was there, but neither the call nor the parameters referenced anywhere valid in the data sections.

The fix here is to perform a Clang-style "Single-Object Prelinking", which is in fact called relocatable partial linking -- meld all the objects into one, stripping the unreferenced cruft, then marking only the functions we desire as global with objcopy.

I tried doing this with a version script, like FFmpeg, but it did not have any effect on the symbol visibility -- the --export-dynamic-symbol-list flag does not allow localising symbols' visibility.


Fixes gstreamer#3358 (closed)

cc @slomo @nirbheek -- this is required to unblock Android builds.

Merge request reports