pywrap
pywrap copied to clipboard
Use LIEF i.s.o. manually dumping symbols
https://github.com/lief-project/LIEF
I was going to ask how to generate symbols_mangled_*.dat, and found this issue. I'm trying to generate one for OpenBSD. How do you do it now? Will you just call leif.parse in a loop on all the OCCT .so files and collect the output into a file?
For OCP the script is here: https://github.com/CadQuery/OCP/blob/master/dump_symbols.py . For a general case you'd need to write your own.
I do it in Linux like this:
sed 's,7.5.1,7.5.2,g' -i dump_symbols.py
# get symbols
local _structure_needed="dummy/lib_linux/"
mkdir -p ${_structure_needed}
ln -s /usr/lib dummy/lib_linux/.
msg2 "Old symbols:"
ls -lh *.dat
rm *.dat
msg2 "Dumping symbols..."
python dump_symbols.py dummy
msg2 "Dump complete. New symbols:"
ls -lh *.dat
rm -rf ${_structure_needed}
find -maxdepth 1 -name '*.dat' -exec ln -sf ../{} pywrap/{} \;
which gives output that looks like this in my builds:
==> Starting build()...
-> Old symbols:
-rw-r--r-- 1 user user 4.6M May 19 16:36 symbols_mangled_linux.dat
-rw-r--r-- 1 user user 5.0M May 19 16:36 symbols_mangled_mac.dat
-rw-r--r-- 1 user user 3.8M May 19 16:36 symbols_mangled_win.dat
-> Dumping symbols...
-> Dump complete. New symbols:
-rw-r--r-- 1 user user 7.0M May 19 16:36 symbols_mangled_linux.dat
-rw-r--r-- 1 user user 0 May 19 16:36 symbols_mangled_mac.dat
-rw-r--r-- 1 user user 0 May 19 16:36 symbols_mangled_win.dat