diff --git a/HACKING b/HACKING index ae59b24050..190dfd6674 100644 --- a/HACKING +++ b/HACKING @@ -161,3 +161,42 @@ This file needs to be cleaned up in two ways: 2/ There are a bunch of suppressions which need to not be supressions, but instead just not be generated by valgrind. + + +Look up exported and imported symbols +------------------------------------- +These commands may be useful to find out the library that actually +exported a particular symbol, and to check which import symbol one +particular library depends upon and where they are imported +from. Run these from the top-level of the build tree. + +# Create a table of all exported symbols and where they come from +nm -A `find . -name '*.so'` | grep ' T ' | \ + sed 's/^\([^:]*\).* \([^ ]*\)$/\1: \2/' > exportedsymbols + +# For a particular library, check symbol import requirements, +# listing all symbols (needs the file from above) +A=src/gnc-module/.libs/libgw-gnc-module.so && echo "$A requirements:" \ + && nm $A | grep ' U ' | sed 's/^.* \([^ ]*\)$/\1/' | \ + grep -wFf- exportedsymbols + +# For a particular library, check import requirements, +# summarized by library +A=src/gnc-module/.libs/libgw-gnc-module.so && echo "$A requirements:" \ + && nm $A | grep ' U ' | sed 's/^.* \([^ ]*\)$/\1/' | \ + grep -wFf- exportedsymbols | cut -d: -f1 | sort | uniq + +# For a particular library, check import requirements, +# summarized by library, formatted for Makefile.am +A=src/gnc-module/.libs/libgw-gnc-module.so && echo "$A requirements:" \ + && nm $A | grep ' U ' | sed 's/^.* \([^ ]*\)$/\1/' | \ + grep -wFf- exportedsymbols | cut -d: -f1 | sort | uniq | \ + sed 's!.libs/!!' | sed 's/.so$/.la \\/' | sed 's!^.! \${top_builddir}!' + +# List all import requirements summarized by library for a full +# recursive directory tree +for A in `find src/business/business-core -name '*.so'`; do \ + echo -e "\n##$A requirements:" && nm $A | grep ' U ' | \ + sed 's/^.* \([^ ]*\)$/\1/' | grep -wFf- exportedsymbols | \ + cut -d: -f1 | sort | uniq; done +