libdwelf: Add dwelf_elf_gnu_build_id.

Move internal function __libdwfl_find_build_id to libdwelf and use it to
add a public dwelf_elf_gnu_build_id function to extract the NT_GNU_BUILD_ID
from an ELF file using either the shdrs or phdrs. Adjust internal callers
and add a testcase.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 3152239..94ef03c 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2014-04-30  Mark Wielaard  <mjw@redhat.com>
+
+	* libdw.map (ELFUTILS_0.159): Add dwelf_elf_gnu_build_id.
+
 2014-04-15  Florian Weimer  <fweimer@redhat.com>
 
 	* dwarf_begin_elf.c (__check_build_id, try_debugaltlink)