How To Build libelftc.a and libdwarf.a for Mach-O
by Derek Bruening

===========================================================================
64-bit:

I built on Mac OS X 10.14.2.

I have XCode 10.1 and this version of clang:
$ cc -v
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix

Install bsdmake:
$ brew install bsdmake

Check out the sources.  We have to stick with r3530 until
https://sourceforge.net/p/elftoolchain/tickets/581/ is fixed.
$ svn co -r 3530 svn://svn.code.sf.net/p/elftoolchain/code/trunk src

Apply the libelftc-macho.patch.
$ cd src
$ patch -p0 < <path-to-DR>/ext/drsyms/libelftc-macho/libelftc-macho.patch

Now build 64-bit:
% REDIR="-Dmalloc=__wrap_malloc -Dcalloc=__wrap_calloc -Drealloc=__wrap_realloc -Dfree=__wrap_free -Dstrdup=__wrap_strdup"
% cd libdwarf
% bsdmake EXTRA_CFLAGS="-O2 -g -fPIC ${REDIR} -Wno-system-headers -mmacosx-version-min=10.9" libdwarf.a
% cd ../libelftc
% bsdmake EXTRA_CFLAGS="-O2 -g -fPIC ${REDIR} -Wno-system-headers -mmacosx-version-min=10.9" libelftc.a

Then copy the resulting libelftc.a and libdwarf.a into the DR source tree
in ext/drsyms/libelftc-macho/lib64/.

===========================================================================
32-bit: No longer supported.

===========================================================================
