pywrap icon indicating copy to clipboard operation
pywrap copied to clipboard

Use LIEF i.s.o. manually dumping symbols

Open adam-urbanczyk opened this issue 5 years ago • 3 comments

https://github.com/lief-project/LIEF

adam-urbanczyk avatar Apr 10 '20 16:04 adam-urbanczyk

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?

jmwright avatar May 01 '21 12:05 jmwright

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.

adam-urbanczyk avatar May 01 '21 15:05 adam-urbanczyk

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

greyltc avatar May 19 '21 14:05 greyltc