This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/6] libelf: Add elf32_getchdr, elf64_getchdr and gelf_getchdr.


Elf_Data of a compressed section has type ELF_T_CHDR. This type can be
xlated to the file or memory representation. This will make sure the Chdr
is in the correct endianess. The compressed data following the Chdr isn't
translated.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libelf/ChangeLog                         |  26 +++++
 libelf/Makefile.am                       |   8 +-
 libelf/abstract.h                        |  20 +++-
 libelf/chdr_xlate.h                      |  33 ++++++
 libelf/elf32_getchdr.c                   |  73 ++++++++++++
 libelf/{gelf_xlate.h => elf64_getchdr.c} |  34 +-----
 libelf/elf_error.c                       |   8 +-
 libelf/elf_getdata.c                     |  20 +++-
 libelf/exttypes.h                        |   4 +-
 libelf/gelf.h                            |   8 +-
 libelf/gelf_fsize.c                      |   1 +
 libelf/{gelf_xlate.h => gelf_getchdr.c}  |  71 +++++++-----
 libelf/gelf_xlate.c                      |   4 +-
 libelf/gelf_xlate.h                      |   1 +
 libelf/libelf.h                          |   8 +-
 libelf/libelf.map                        |   7 ++
 libelf/libelfP.h                         |   3 +-
 tests/ChangeLog                          |  14 +++
 tests/Makefile.am                        |  11 +-
 tests/elfgetchdr.c                       | 124 ++++++++++++++++++++
 tests/msg_tst.c                          |   3 +-
 tests/run-elfgetchdr.sh                  | 188 +++++++++++++++++++++++++++++++
 tests/testfile-zgabi32.bz2               | Bin 0 -> 767 bytes
 tests/testfile-zgabi32be.bz2             | Bin 0 -> 769 bytes
 tests/testfile-zgabi64.bz2               | Bin 0 -> 795 bytes
 tests/testfile-zgabi64be.bz2             | Bin 0 -> 780 bytes
 26 files changed, 592 insertions(+), 77 deletions(-)
 create mode 100644 libelf/chdr_xlate.h
 create mode 100644 libelf/elf32_getchdr.c
 copy libelf/{gelf_xlate.h => elf64_getchdr.c} (53%)
 copy libelf/{gelf_xlate.h => gelf_getchdr.c} (53%)
 create mode 100644 tests/elfgetchdr.c
 create mode 100755 tests/run-elfgetchdr.sh
 create mode 100755 tests/testfile-zgabi32.bz2
 create mode 100755 tests/testfile-zgabi32be.bz2
 create mode 100755 tests/testfile-zgabi64.bz2
 create mode 100755 tests/testfile-zgabi64be.bz2

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index fbe8e3a..d8eff1a 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,29 @@
+2015-11-19  Mark Wielaard  <mjw@redhat.com>
+
+	* Makefile.am (libelf_a_SOURCES): Add elf32_getchdr.c, elf64_getchdr.c
+	and gelf_getchdr.c.
+	(noinst_HEADERS): Add chdr_xlate.h.
+	* abstract.h: Define Chdr32 and Chdr64.
+	* chdr_xlate.h: New file.
+	* elf32_getchdr.c: New file.
+	* elf64_getchdr.c: New file.
+	* elf_error.c: Add ELF_E_NOT_COMPRESSED.
+	* elf_getdata.c (__libelf_set_rawdata_wrlock): Set d_type to
+	ELF_T_CHDR for SHF_COMPRESSED sections.
+	* exttypes.h: Add Chdr32 and Chdr64.
+	* gelf.h (GElf_Chdr): New typedef.
+	(gelf_getchdr): New function definition.
+	* gelf_fsize.c (__libelf_type_sizes): Add ELF_T_CHDR.
+	* gelf_getchdr.c: New file.
+	* gelf_xlate.c (__elf_xfctstom): Add ELF_T_CHDR cvt_chdr.
+	* gelf_xlate.h: Add Chdr.
+	* libelf.h (Elf_Type): Add ELF_T_CHDR.
+	(elf32_getchdr): New function definition.
+	(elf64_getchdr): Likewise.
+	* libelf.map (ELFUTILS_1.7): New sections add elf32_getchdr,
+	elf64_getchdr and gelf_getchdr.
+	* libelfP.h: Add ELF_E_NOT_COMPRESSED.
+
 2015-10-16  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (libelf_so_LDLIBS): Add -lz.
diff --git a/libelf/Makefile.am b/libelf/Makefile.am
index 4a4131c..8a678b8 100644
--- a/libelf/Makefile.am
+++ b/libelf/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 ##
-## Copyright (C) 1996-2010 Red Hat, Inc.
+## Copyright (C) 1996-2010, 2015 Red Hat, Inc.
 ## This file is part of elfutils.
 ##
 ## This file is free software; you can redistribute it and/or modify
@@ -88,7 +88,8 @@ libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
 		   elf32_offscn.c elf64_offscn.c gelf_offscn.c \
 		   elf_getaroff.c \
 		   elf_gnu_hash.c \
-		   elf_scnshndx.c
+		   elf_scnshndx.c \
+		   elf32_getchdr.c elf64_getchdr.c gelf_getchdr.c
 
 libelf_pic_a_SOURCES =
 am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
@@ -118,7 +119,8 @@ uninstall: uninstall-am
 	rm -f $(DESTDIR)$(libdir)/libelf.so
 
 noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
-		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h
+		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h \
+		 chdr_xlate.h
 EXTRA_DIST = libelf.map
 
 CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)
diff --git a/libelf/abstract.h b/libelf/abstract.h
index 53713ee..d4515f2 100644
--- a/libelf/abstract.h
+++ b/libelf/abstract.h
@@ -1,5 +1,5 @@
 /* Abstract description of component ELF types.
-   Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007 Red Hat, Inc.
+   Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007, 2015 Red Hat, Inc.
    This file is part of elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 1998.
 
@@ -310,3 +310,21 @@ START (64, auxv_t, Ext##auxv_t)						      \
   TYPE_XLATE (Elf64_cvt_Addr1 (&tdest->a_un.a_val, &tsrc->a_un.a_val);)	      \
   TYPE_EXTRA (} a_un;)							      \
 END (64, Ext##auxv_t)
+
+/* Note that there is actual compression data right after the Chdr.
+   So we also have a separate conversion function for the whole
+   section.  */
+#define Chdr32(Ext) \
+START (32, Chdr, Ext##Chdr)						\
+  TYPE_NAME (ElfW2(32, Ext##Word), ch_type)				\
+  TYPE_NAME (ElfW2(32, Ext##Word), ch_size)				\
+  TYPE_NAME (ElfW2(32, Ext##Word), ch_addralign)			\
+END (32, Ext##Chdr)
+
+#define Chdr64(Ext) \
+START (64, Chdr, Ext##Chdr)						\
+  TYPE_NAME (ElfW2(64, Ext##Word), ch_type)				\
+  TYPE_NAME (ElfW2(64, Ext##Word), ch_reserved)				\
+  TYPE_NAME (ElfW2(64, Ext##Xword), ch_size)				\
+  TYPE_NAME (ElfW2(64, Ext##Xword), ch_addralign)			\
+END (64, Ext##Chdr)
diff --git a/libelf/chdr_xlate.h b/libelf/chdr_xlate.h
new file mode 100644
index 0000000..70782b4
--- /dev/null
+++ b/libelf/chdr_xlate.h
@@ -0,0 +1,33 @@
+#include "common.h"
+
+/* These functions convert a while section, one Chdr plus compression data.  */
+
+static void
+Elf32_cvt_chdr (void *dest, const void *src, size_t len, int encode)
+{
+  if (len == 0)
+    return;
+
+  /* Move everything over, if necessary, we only need to xlate the
+     header, not the compressed data following it.  */
+  if (dest != src)
+    memmove (dest, src, len);
+
+  if (len >= sizeof (Elf32_Chdr))
+    Elf32_cvt_Chdr (dest, src, sizeof (Elf32_Chdr), encode);
+}
+
+static void
+Elf64_cvt_chdr (void *dest, const void *src, size_t len, int encode)
+{
+  if (len == 0)
+    return;
+
+  /* Move everything over, if necessary, we only need to xlate the
+     header, not the compressed data following it.  */
+  if (dest != src)
+    memmove (dest, src, len);
+
+  if (len >= sizeof (Elf64_Chdr))
+    Elf64_cvt_Chdr (dest, src, sizeof (Elf64_Chdr), encode);
+}
diff --git a/libelf/elf32_getchdr.c b/libelf/elf32_getchdr.c
new file mode 100644
index 0000000..95cdd0c
--- /dev/null
+++ b/libelf/elf32_getchdr.c
@@ -0,0 +1,73 @@
+/* Return section compression header.
+   Copyright (C) 2015 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libelf.h>
+#include "libelfP.h"
+#include "common.h"
+
+#ifndef LIBELFBITS
+# define LIBELFBITS 32
+#endif
+
+
+ElfW2(LIBELFBITS,Chdr) *
+elfw2(LIBELFBITS,getchdr) (Elf_Scn *scn)
+{
+  ElfW2(LIBELFBITS,Shdr) *shdr = elfw2(LIBELFBITS,getshdr) (scn);
+  if (shdr == NULL)
+    return NULL;
+
+  /* Must have SHF_COMPRESSED flag set.  Allocated or no bits sections
+     can never be compressed.  */
+  if ((shdr->sh_flags & SHF_COMPRESSED) == 0
+      || (shdr->sh_flags & SHF_ALLOC) != 0
+      || shdr->sh_type == SHT_NULL
+      || shdr->sh_type == SHT_NOBITS)
+    {
+      __libelf_seterrno (ELF_E_NOT_COMPRESSED);
+      return NULL;
+    }
+
+  /* This makes sure the data is in the correct format, so we don't
+     need to swap fields. */
+  Elf_Data *d  = elf_getdata (scn, NULL);
+  if (d == NULL)
+    return NULL;
+
+  if (d->d_size < sizeof (ElfW2(LIBELFBITS,Chdr)) || d->d_buf == NULL)
+    {
+      __libelf_seterrno (ELF_E_INVALID_DATA);
+      return NULL;
+    }
+
+  return (ElfW2(LIBELFBITS,Chdr) *) d->d_buf;
+}
diff --git a/libelf/gelf_xlate.h b/libelf/elf64_getchdr.c
similarity index 53%
copy from libelf/gelf_xlate.h
copy to libelf/elf64_getchdr.c
index f11eb90..6588b79 100644
--- a/libelf/gelf_xlate.h
+++ b/libelf/elf64_getchdr.c
@@ -1,7 +1,6 @@
-/* Helper file for type conversion function generation.
-   Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007 Red Hat, Inc.
+/* Return section compression header.
+   Copyright (C) 2015 Red Hat, Inc.
    This file is part of elfutils.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
 
    This file is free software; you can redistribute it and/or modify
    it under the terms of either
@@ -27,30 +26,5 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
-
-/* Simple types.  */
-FUNDAMENTAL (ADDR, Addr, LIBELFBITS);
-FUNDAMENTAL (OFF, Off, LIBELFBITS);
-FUNDAMENTAL (HALF, Half, LIBELFBITS);
-FUNDAMENTAL (WORD, Word, LIBELFBITS);
-FUNDAMENTAL (SWORD, Sword, LIBELFBITS);
-FUNDAMENTAL (XWORD, Xword, LIBELFBITS);
-FUNDAMENTAL (SXWORD, Sxword, LIBELFBITS);
-
-/* The structured types.  */
-TYPE (Ehdr, LIBELFBITS)
-TYPE (Phdr, LIBELFBITS)
-TYPE (Shdr, LIBELFBITS)
-TYPE (Sym, LIBELFBITS)
-TYPE (Rel, LIBELFBITS)
-TYPE (Rela, LIBELFBITS)
-TYPE (Note, LIBELFBITS)
-TYPE (Dyn, LIBELFBITS)
-TYPE (Syminfo, LIBELFBITS)
-TYPE (Move, LIBELFBITS)
-TYPE (Lib, LIBELFBITS)
-TYPE (auxv_t, LIBELFBITS)
-
-
-/* Prepare for the next round.  */
-#undef LIBELFBITS
+#define LIBELFBITS 64
+#include "elf32_getchdr.c"
diff --git a/libelf/elf_error.c b/libelf/elf_error.c
index d6bdaab..c404590 100644
--- a/libelf/elf_error.c
+++ b/libelf/elf_error.c
@@ -230,6 +230,11 @@ core files")
   (ELF_E_NO_PHDR_IDX \
    + sizeof "file has no program header")
   N_("invalid offset")
+  "\0"
+#define ELF_E_NOT_COMPRESSED_IDX		\
+  (ELF_E_INVALID_OFFSET_IDX			\
+   + sizeof "invalid offset")
+  N_("section does not contain compressed data")
 };
 
 
@@ -277,7 +282,8 @@ static const uint_fast16_t msgidx[ELF_E_NUM] =
   [ELF_E_GROUP_NOT_REL] = ELF_E_GROUP_NOT_REL_IDX,
   [ELF_E_INVALID_PHDR] = ELF_E_INVALID_PHDR_IDX,
   [ELF_E_NO_PHDR] = ELF_E_NO_PHDR_IDX,
-  [ELF_E_INVALID_OFFSET] = ELF_E_INVALID_OFFSET_IDX
+  [ELF_E_INVALID_OFFSET] = ELF_E_INVALID_OFFSET_IDX,
+  [ELF_E_NOT_COMPRESSED] = ELF_E_NOT_COMPRESSED_IDX
 };
 #define nmsgidx ((int) (sizeof (msgidx) / sizeof (msgidx[0])))
 
diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c
index 9a567e5..bd1f068 100644
--- a/libelf/elf_getdata.c
+++ b/libelf/elf_getdata.c
@@ -106,6 +106,7 @@ const uint_fast8_t __libelf_type_aligns[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
       [ELF_T_NHDR] = __alignof__ (ElfW2(Bits,Nhdr)),			      \
       [ELF_T_GNUHASH] = __alignof__ (Elf32_Word),			      \
       [ELF_T_AUXV] = __alignof__ (ElfW2(Bits,auxv_t)),			      \
+      [ELF_T_CHDR] = __alignof__ (ElfW2(Bits,Chdr)),			      \
     }
     [EV_CURRENT - 1] =
     {
@@ -204,6 +205,7 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn)
   Elf64_Off offset;
   Elf64_Xword size;
   Elf64_Xword align;
+  Elf64_Xword flags;
   int type;
   Elf *elf = scn->elf;
 
@@ -220,6 +222,7 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn)
       size = shdr->sh_size;
       type = shdr->sh_type;
       align = shdr->sh_addralign;
+      flags = shdr->sh_flags;
     }
   else
     {
@@ -234,6 +237,7 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn)
       size = shdr->sh_size;
       type = shdr->sh_type;
       align = shdr->sh_addralign;
+      flags = shdr->sh_flags;
     }
 
   /* If the section has no data (for whatever reason), leave the `d_buf'
@@ -243,7 +247,10 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn)
       /* First a test whether the section is valid at all.  */
       size_t entsize;
 
-      if (type == SHT_HASH)
+      /* Compressed data has a header, but then compressed data.  */
+      if ((flags & SHF_COMPRESSED) != 0)
+	entsize = 1;
+      else if (type == SHT_HASH)
 	{
 	  GElf_Ehdr ehdr_mem;
 	  GElf_Ehdr *ehdr = __gelf_getehdr_rdlock (elf, &ehdr_mem);
@@ -320,10 +327,15 @@ __libelf_set_rawdata_wrlock (Elf_Scn *scn)
     }
 
   scn->rawdata.d.d_size = size;
-  /* Some broken ELF ABI for 64-bit machines use the wrong hash table
-     entry size.  See elf-knowledge.h for more information.  */
-  if (type == SHT_HASH && elf->class == ELFCLASS64)
+
+  /* Compressed data always has type ELF_T_CHDR regardless of the
+     section type.  */
+  if ((flags & SHF_COMPRESSED) != 0)
+    scn->rawdata.d.d_type = ELF_T_CHDR;
+  else if (type == SHT_HASH && elf->class == ELFCLASS64)
     {
+      /* Some broken ELF ABI for 64-bit machines use the wrong hash table
+	 entry size.  See elf-knowledge.h for more information.  */
       GElf_Ehdr ehdr_mem;
       GElf_Ehdr *ehdr = __gelf_getehdr_rdlock (elf, &ehdr_mem);
       scn->rawdata.d.d_type
diff --git a/libelf/exttypes.h b/libelf/exttypes.h
index 8cb2aae..7bacd65 100644
--- a/libelf/exttypes.h
+++ b/libelf/exttypes.h
@@ -1,5 +1,5 @@
 /* External ELF types.
-   Copyright (C) 1998-2010 Red Hat, Inc.
+   Copyright (C) 1998-2010, 2015 Red Hat, Inc.
    This file is part of elfutils.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
 
@@ -75,6 +75,7 @@ Syminfo32 (Ext_);
 Move32 (Ext_);
 Lib32 (Ext_);
 auxv_t32 (Ext_);
+Chdr32 (Ext_);
 
 Ehdr64 (Ext_);
 Phdr64 (Ext_);
@@ -92,6 +93,7 @@ Syminfo64 (Ext_);
 Move64 (Ext_);
 Lib64 (Ext_);
 auxv_t64 (Ext_);
+Chdr64 (Ext_);
 
 #undef START
 #undef END
diff --git a/libelf/gelf.h b/libelf/gelf.h
index e3f0740..1bc7ee7 100644
--- a/libelf/gelf.h
+++ b/libelf/gelf.h
@@ -1,5 +1,5 @@
 /* This file defines generic ELF types, structures, and macros.
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007 Red Hat, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2015 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -85,6 +85,9 @@ typedef Elf64_Rela GElf_Rela;
 /* Program segment header.  */
 typedef Elf64_Phdr GElf_Phdr;
 
+/* Header of a compressed section.  */
+typedef Elf64_Chdr GElf_Chdr;
+
 /* Dynamic section entry.  */
 typedef Elf64_Dyn GElf_Dyn;
 
@@ -183,6 +186,9 @@ extern int gelf_update_phdr (Elf *__elf, int __ndx, GElf_Phdr *__src);
 /* Create new program header with PHNUM entries.  */
 extern unsigned long int gelf_newphdr (Elf *__elf, size_t __phnum);
 
+/* Get compression header of section if any.  Returns NULL and sets
+   elf_errno if the section isn't compressed or an error occurred.  */
+extern GElf_Chdr *gelf_getchdr (Elf_Scn *__scn, GElf_Chdr *__dst);
 
 /* Convert data structure from the representation in the file represented
    by ELF to their memory representation.  */
diff --git a/libelf/gelf_fsize.c b/libelf/gelf_fsize.c
index a124fa8..0c50926 100644
--- a/libelf/gelf_fsize.c
+++ b/libelf/gelf_fsize.c
@@ -68,6 +68,7 @@ const size_t __libelf_type_sizes[EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM] =
       [ELF_T_MOVE]	= sizeof (ElfW2(LIBELFBITS, Ext_Move)),		      \
       [ELF_T_LIB]	= sizeof (ElfW2(LIBELFBITS, Ext_Lib)),		      \
       [ELF_T_AUXV]	= sizeof (ElfW2(LIBELFBITS, Ext_auxv_t)),	      \
+      [ELF_T_CHDR]	= sizeof (ElfW2(LIBELFBITS, Ext_Chdr)),		      \
       [ELF_T_GNUHASH]	= ELFW2(LIBELFBITS, FSZ_WORD)
       TYPE_SIZES (32)
     },
diff --git a/libelf/gelf_xlate.h b/libelf/gelf_getchdr.c
similarity index 53%
copy from libelf/gelf_xlate.h
copy to libelf/gelf_getchdr.c
index f11eb90..394bf4b 100644
--- a/libelf/gelf_xlate.h
+++ b/libelf/gelf_getchdr.c
@@ -1,7 +1,6 @@
-/* Helper file for type conversion function generation.
-   Copyright (C) 1998, 1999, 2000, 2002, 2004, 2007 Red Hat, Inc.
+/* Return section compression header.
+   Copyright (C) 2015 Red Hat, Inc.
    This file is part of elfutils.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
 
    This file is free software; you can redistribute it and/or modify
    it under the terms of either
@@ -27,30 +26,44 @@
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
-/* Simple types.  */
-FUNDAMENTAL (ADDR, Addr, LIBELFBITS);
-FUNDAMENTAL (OFF, Off, LIBELFBITS);
-FUNDAMENTAL (HALF, Half, LIBELFBITS);
-FUNDAMENTAL (WORD, Word, LIBELFBITS);
-FUNDAMENTAL (SWORD, Sword, LIBELFBITS);
-FUNDAMENTAL (XWORD, Xword, LIBELFBITS);
-FUNDAMENTAL (SXWORD, Sxword, LIBELFBITS);
-
-/* The structured types.  */
-TYPE (Ehdr, LIBELFBITS)
-TYPE (Phdr, LIBELFBITS)
-TYPE (Shdr, LIBELFBITS)
-TYPE (Sym, LIBELFBITS)
-TYPE (Rel, LIBELFBITS)
-TYPE (Rela, LIBELFBITS)
-TYPE (Note, LIBELFBITS)
-TYPE (Dyn, LIBELFBITS)
-TYPE (Syminfo, LIBELFBITS)
-TYPE (Move, LIBELFBITS)
-TYPE (Lib, LIBELFBITS)
-TYPE (auxv_t, LIBELFBITS)
-
-
-/* Prepare for the next round.  */
-#undef LIBELFBITS
+#include "libelfP.h"
+#include <gelf.h>
+#include <stddef.h>
+
+
+GElf_Chdr *
+gelf_getchdr (Elf_Scn *scn, GElf_Chdr *dest)
+{
+  if (scn == NULL)
+    return NULL;
+
+  if (dest == NULL)
+    {
+      __libelf_seterrno (ELF_E_INVALID_OPERAND);
+      return NULL;
+    }
+
+  if (scn->elf->class == ELFCLASS32)
+    {
+      Elf32_Chdr *chdr = elf32_getchdr (scn);
+      if (chdr == NULL)
+	return NULL;
+      dest->ch_type = chdr->ch_type;
+      dest->ch_size = chdr->ch_size;
+      dest->ch_addralign = chdr->ch_addralign;
+    }
+  else
+    {
+      Elf64_Chdr *chdr = elf64_getchdr (scn);
+      if (chdr == NULL)
+	return NULL;
+      *dest = *chdr;
+    }
+
+  return dest;
+}
+INTDEF(gelf_getchdr)
diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c
index c5805e7..f3d3b7a 100644
--- a/libelf/gelf_xlate.c
+++ b/libelf/gelf_xlate.c
@@ -166,6 +166,7 @@ union unaligned
 #include "version_xlate.h"
 #include "gnuhash_xlate.h"
 #include "note_xlate.h"
+#include "chdr_xlate.h"
 
 
 /* Now the externally visible table with the function pointers.  */
@@ -198,7 +199,8 @@ const xfct_t __elf_xfctstom[EV_NUM - 1][EV_NUM - 1][ELFCLASSNUM - 1][ELF_T_NUM]
 	[ELF_T_SYMINFO] = ElfW2(Bits, cvt_Syminfo),			      \
 	[ELF_T_MOVE]	= ElfW2(Bits, cvt_Move),			      \
 	[ELF_T_LIB]	= ElfW2(Bits, cvt_Lib),				      \
-	[ELF_T_AUXV]	= ElfW2(Bits, cvt_auxv_t)
+	[ELF_T_AUXV]	= ElfW2(Bits, cvt_auxv_t),			      \
+	[ELF_T_CHDR]	= ElfW2(Bits, cvt_chdr)
         define_xfcts (32),
 	[ELF_T_GNUHASH] = Elf32_cvt_Word
       },
diff --git a/libelf/gelf_xlate.h b/libelf/gelf_xlate.h
index f11eb90..3c0e4bf 100644
--- a/libelf/gelf_xlate.h
+++ b/libelf/gelf_xlate.h
@@ -50,6 +50,7 @@ TYPE (Syminfo, LIBELFBITS)
 TYPE (Move, LIBELFBITS)
 TYPE (Lib, LIBELFBITS)
 TYPE (auxv_t, LIBELFBITS)
+TYPE (Chdr, LIBELFBITS)
 
 
 /* Prepare for the next round.  */
diff --git a/libelf/libelf.h b/libelf/libelf.h
index 54f7c29..49234c8 100644
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -1,5 +1,5 @@
 /* Interface for libelf.
-   Copyright (C) 1998-2010 Red Hat, Inc.
+   Copyright (C) 1998-2010, 2015 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -64,6 +64,7 @@ typedef enum
   ELF_T_LIB,			/* Elf32_Lib, Elf64_Lib, ... */
   ELF_T_GNUHASH,		/* GNU-style hash section.  */
   ELF_T_AUXV,			/* Elf32_auxv_t, Elf64_auxv_t, ... */
+  ELF_T_CHDR,			/* Compressed, Elf32_Chdr, Elf64_Chdr, ... */
   /* Keep this the last entry.  */
   ELF_T_NUM
 } Elf_Type;
@@ -267,6 +268,11 @@ extern Elf32_Shdr *elf32_getshdr (Elf_Scn *__scn);
 /* Similar for ELFCLASS64.  */
 extern Elf64_Shdr *elf64_getshdr (Elf_Scn *__scn);
 
+/* Returns compression header for a section if section data is
+   compressed.  Returns NULL and sets elf_errno if the section isn't
+   compressed or an error occurred.  */
+extern Elf32_Chdr *elf32_getchdr (Elf_Scn *__scn);
+extern Elf64_Chdr *elf64_getchdr (Elf_Scn *__scn);
 
 /* Set or clear flags for ELF file.  */
 extern unsigned int elf_flagelf (Elf *__elf, Elf_Cmd __cmd,
diff --git a/libelf/libelf.map b/libelf/libelf.map
index de6d912..d402ccc 100644
--- a/libelf/libelf.map
+++ b/libelf/libelf.map
@@ -138,3 +138,10 @@ ELFUTILS_1.6 {
   global:
     elf_getphdrnum;
 } ELFUTILS_1.5;
+
+ELFUTILS_1.7 {
+  global:
+    elf32_getchdr;
+    elf64_getchdr;
+    gelf_getchdr;
+} ELFUTILS_1.6;
\ No newline at end of file
diff --git a/libelf/libelfP.h b/libelf/libelfP.h
index 993c655..73fd765 100644
--- a/libelf/libelfP.h
+++ b/libelf/libelfP.h
@@ -1,5 +1,5 @@
 /* Internal interfaces for libelf.
-   Copyright (C) 1998-2010 Red Hat, Inc.
+   Copyright (C) 1998-2010, 2015 Red Hat, Inc.
    This file is part of elfutils.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 1998.
 
@@ -138,6 +138,7 @@ enum
   ELF_E_INVALID_PHDR,
   ELF_E_NO_PHDR,
   ELF_E_INVALID_OFFSET,
+  ELF_E_NOT_COMPRESSED,
   /* Keep this as the last entry.  */
   ELF_E_NUM
 };
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 64889d4..5620ea1 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,19 @@
 2015-10-28  Mark Wielaard  <mjw@redhat.com>
 
+	* elfgetchdr.c: New file.
+	* run-elfgetchdr.sh: New test.
+	* testfile-zgabi32.bz2: New testfile.
+	* testfile-zgabi32be.bz2: Likewise.
+	* testfile-zgabi64.bz2: Likewise.
+	* testfile-zgabi64be.bz2: Likewise.
+	* Makefile.am (check_PROGRAMS): Add elfgetchdr.
+	(TESTS): Add run-elfgetchdr.sh.
+	(EXTRA_DIST): Add run-elfgetchdr.sh, testfile-zgabi32.bz2,
+	testfile-zgabi32be.bz2, testfile-zgabi64.bz2, testfile-zgabi64be.bz2.
+	(welfgetchdr_LDADD): New variable.
+
+2015-10-28  Mark Wielaard  <mjw@redhat.com>
+
 	* dwelfgnucompressed.c: New file.
 	* run-dwelfgnucompressed.sh: New test.
 	* testfile-zgnu32.bz2: New testfile.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 349f88f..11f64b1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -52,7 +52,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
 		  backtrace-data backtrace-dwarf debuglink debugaltlink \
 		  buildid deleted deleted-lib.so aggregate_size vdsosyms \
 		  getsrc_die strptr newdata elfstrtab dwfl-proc-attach \
-		  elfshphehdr elfstrmerge dwelfgnucompressed
+		  elfshphehdr elfstrmerge dwelfgnucompressed elfgetchdr
 
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
 	    asm-tst6 asm-tst7 asm-tst8 asm-tst9
@@ -120,7 +120,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
 	run-readelf-dwz-multi.sh run-allfcts-multi.sh run-deleted.sh \
 	run-linkmap-cut.sh run-aggregate-size.sh vdsosyms run-readelf-A.sh \
 	run-getsrc-die.sh run-strptr.sh newdata elfstrtab dwfl-proc-attach \
-	elfshphehdr run-lfs-symbols.sh run-dwelfgnucompressed.sh
+	elfshphehdr run-lfs-symbols.sh run-dwelfgnucompressed.sh \
+	run-elfgetchdr.sh
 
 if !BIARCH
 export ELFUTILS_DISABLE_BIARCH = 1
@@ -307,7 +308,10 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 	     run-lfs-symbols.sh lfs-symbols testfile-nolfs.bz2 \
 	     testfile-zgnu32.bz2 testfile-zgnu64.bz2 \
 	     testfile-zgnu32be.bz2 testfile-zgnu64be.bz2 \
-	     run-dwelfgnucompressed.sh
+	     run-dwelfgnucompressed.sh \
+	     testfile-zgabi32.bz2 testfile-zgabi64.bz2 \
+	     testfile-zgabi32be.bz2 testfile-zgabi64be.bz2 \
+	     run-elfgetchdr.sh
 
 if USE_VALGRIND
 valgrind_cmd='valgrind -q --error-exitcode=1 --run-libc-freeres=no'
@@ -457,6 +461,7 @@ dwfl_proc_attach_LDFLAGS = -pthread $(AM_LDFLAGS)
 elfshphehdr_LDADD =$(libelf)
 elfstrmerge_LDADD = $(libebl) $(libelf)
 dwelfgnucompressed_LDADD = $(libelf) $(libdw)
+elfgetchdr_LDADD = $(libelf) $(libdw)
 
 if GCOV
 check: check-am coverage
diff --git a/tests/elfgetchdr.c b/tests/elfgetchdr.c
new file mode 100644
index 0000000..44ba178
--- /dev/null
+++ b/tests/elfgetchdr.c
@@ -0,0 +1,124 @@
+/* Copyright (C) 2015 Red Hat, Inc.
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <inttypes.h>
+
+#include ELFUTILS_HEADER(elf)
+#include ELFUTILS_HEADER(dwelf)
+#include <gelf.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+int
+main (int argc, char *argv[])
+{
+  int result = 0;
+  int cnt;
+
+  elf_version (EV_CURRENT);
+
+  for (cnt = 1; cnt < argc; ++cnt)
+    {
+      int fd = open (argv[cnt], O_RDONLY);
+
+      Elf *elf = elf_begin (fd, ELF_C_READ, NULL);
+      if (elf == NULL)
+	{
+	  printf ("%s not usable %s\n", argv[cnt], elf_errmsg (-1));
+	  result = 1;
+	  close (fd);
+	  continue;
+	}
+
+      size_t shdrstrndx;
+      if (elf_getshdrstrndx (elf, &shdrstrndx) == -1)
+	{
+	  printf ("elf_getshdrstrnd failed %s\n", elf_errmsg (-1));
+	  result = 1;
+	  close (fd);
+	  continue;
+	}
+
+      Elf_Scn *scn = NULL;
+      while ((scn = elf_nextscn (elf, scn)) != NULL)
+	{
+	  int idx = elf_ndxscn (scn);
+	  GElf_Shdr shdr;
+	  if (gelf_getshdr (scn, &shdr) == NULL)
+	    {
+	      printf ("gelf_getshdr failed: %s\n", elf_errmsg (-1));
+	      result = 1;
+	      break;
+	    }
+
+	  if ((shdr.sh_flags & SHF_COMPRESSED) != 0)
+	    {
+	      GElf_Chdr chdr;
+	      if (gelf_getchdr (scn, &chdr) == NULL)
+		{
+		  printf ("gelf_getchdr failed: %s\n", elf_errmsg (-1));
+		  result = 1;
+		  break;
+		}
+
+	      printf ("section %d: ELF Compressed ch_type: %" PRId32
+		      ", ch_size: %" PRIx64 ", ch_addralign: %" PRIx64 "\n",
+		      idx, chdr.ch_type, chdr.ch_size, chdr.ch_addralign);
+	    }
+	  else
+	    {
+	      const char *sname = elf_strptr (elf, shdrstrndx, shdr.sh_name);
+	      if (sname == NULL)
+		{
+		  printf ("couldn't get section name: %s\n", elf_errmsg (-1));
+		  result = 1;
+		  break;
+		}
+
+	      /* This duplicates what the dwelfgnucompressed testcase does.  */
+	      if (strncmp(".zdebug", sname, strlen (".zdebug")) == 0)
+		{
+		  ssize_t size;
+		  if ((size = dwelf_scn_gnu_compressed_size (scn)) == -1)
+		    {
+		      printf ("dwelf_scn_gnu_compressed_size failed: %s\n",
+			      elf_errmsg (-1));
+		      result = 1;
+		      break;
+		    }
+		  printf ("section %d: GNU Compressed size: %zx\n", idx, size);
+		}
+	      else
+		printf ("section %d: NOT Compressed\n", idx);
+	    }
+	}
+
+      elf_end (elf);
+      close (fd);
+    }
+
+  return result;
+}
diff --git a/tests/msg_tst.c b/tests/msg_tst.c
index 10ff0f7..b10c7c5 100644
--- a/tests/msg_tst.c
+++ b/tests/msg_tst.c
@@ -74,7 +74,8 @@ static struct
       "program header only allowed in executables, shared objects, \
 and core files" },
     { ELF_E_NO_PHDR, "file has no program header" },
-    { ELF_E_INVALID_OFFSET, "invalid offset" }
+    { ELF_E_INVALID_OFFSET, "invalid offset" },
+    { ELF_E_NOT_COMPRESSED, "section does not contain compressed data" }
   };
 
 
diff --git a/tests/run-elfgetchdr.sh b/tests/run-elfgetchdr.sh
new file mode 100755
index 0000000..7a422f3
--- /dev/null
+++ b/tests/run-elfgetchdr.sh
@@ -0,0 +1,188 @@
+#! /bin/sh
+# Copyright (C) 2015 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+# = funcs.s =
+# .globl testfunc
+# testfunc:
+# 	nop
+# 	ret
+# .type testfunc, @function
+# .size testfunc, .-testfunc
+#
+# .globl testfunc2
+# testfunc2:
+# 	call testfunc
+# 	nop
+# 	nop
+# 	ret
+# .type testfunc2, @function
+# .size testfunc2, .-testfunc2
+#
+# .globl functest3
+# functest3:
+# 	jmp local
+# 	nop
+# 	nop
+# local:
+# 	call testfunc2
+# 	ret
+# .type functest3, @function
+# .size functest3, .-functest3
+
+# = start.s =
+# .global _start
+# _start:
+# 	call functest3
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	nop
+# 	ret
+# .type _start, @function
+# .size _start, .-_start
+
+# gas --compress-debug-sections=zlib-gnu -32 -g -o start.o start.s
+# gas --compress-debug-sections=zlib-gnu -32 -g -o funcs.o funcs.s
+# ld --compress-debug-sections=zlib-gnu -melf_i386 -g -o zgnu32 funcs.o start.o
+
+# gas --compress-debug-sections=zlib-gnu -64 -g -o start.o start.s
+# gas --compress-debug-sections=zlib-gnu -64 -g -o funcs.o funcs.s
+# ld --compress-debug-sections=zlib-gnu -g -o zgnu64 funcs.o start.o
+
+# gas --compress-debug-sections=zlib-gabi -32 -g -o start.o start.s
+# gas --compress-debug-sections=zlib-gabi -32 -g -o funcs.o funcs.s
+# ld --compress-debug-sections=zlib-gabi -melf_i386 -g -o zgabi32 funcs.o start.o
+
+# gas --compress-debug-sections=zlib-gabi -64 -g -o start.o start.s
+# gas --compress-debug-sections=zlib-gabi -64 -g -o funcs.o funcs.s
+# ld --compress-debug-sections=zlib-gabi -g -o zgabi64 funcs.o start.o
+
+testfiles testfile-zgnu64
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu64 <<\EOF
+section 1: NOT Compressed
+section 2: GNU Compressed size: 60
+section 3: GNU Compressed size: aa
+section 4: NOT Compressed
+section 5: GNU Compressed size: 8d
+section 6: NOT Compressed
+section 7: NOT Compressed
+section 8: NOT Compressed
+EOF
+
+testfiles testfile-zgabi64
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi64 <<\EOF
+section 1: NOT Compressed
+section 2: ELF Compressed ch_type: 1, ch_size: 60, ch_addralign: 10
+section 3: ELF Compressed ch_type: 1, ch_size: aa, ch_addralign: 1
+section 4: NOT Compressed
+section 5: ELF Compressed ch_type: 1, ch_size: 8d, ch_addralign: 1
+section 6: NOT Compressed
+section 7: NOT Compressed
+section 8: NOT Compressed
+EOF
+
+testfiles testfile-zgnu32
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu32 <<\EOF
+section 1: NOT Compressed
+section 2: GNU Compressed size: 40
+section 3: GNU Compressed size: 9a
+section 4: NOT Compressed
+section 5: GNU Compressed size: 85
+section 6: NOT Compressed
+section 7: NOT Compressed
+section 8: NOT Compressed
+EOF
+
+testfiles testfile-zgabi32
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi32 <<\EOF
+section 1: NOT Compressed
+section 2: ELF Compressed ch_type: 1, ch_size: 40, ch_addralign: 8
+section 3: ELF Compressed ch_type: 1, ch_size: 9a, ch_addralign: 1
+section 4: NOT Compressed
+section 5: ELF Compressed ch_type: 1, ch_size: 85, ch_addralign: 1
+section 6: NOT Compressed
+section 7: NOT Compressed
+section 8: NOT Compressed
+EOF
+
+testfiles testfile-zgnu64be
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu64be <<\EOF
+section 1: NOT Compressed
+section 2: NOT Compressed
+section 3: GNU Compressed size: 60
+section 4: GNU Compressed size: 7e
+section 5: NOT Compressed
+section 6: GNU Compressed size: 8d
+section 7: NOT Compressed
+section 8: NOT Compressed
+section 9: NOT Compressed
+EOF
+
+testfiles testfile-zgabi64be
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi64be <<\EOF
+section 1: NOT Compressed
+section 2: NOT Compressed
+section 3: ELF Compressed ch_type: 1, ch_size: 60, ch_addralign: 10
+section 4: ELF Compressed ch_type: 1, ch_size: 7e, ch_addralign: 1
+section 5: NOT Compressed
+section 6: ELF Compressed ch_type: 1, ch_size: 8d, ch_addralign: 1
+section 7: NOT Compressed
+section 8: NOT Compressed
+section 9: NOT Compressed
+EOF
+
+testfiles testfile-zgnu32be
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgnu32be <<\EOF
+section 1: NOT Compressed
+section 2: NOT Compressed
+section 3: GNU Compressed size: 40
+section 4: GNU Compressed size: 6e
+section 5: NOT Compressed
+section 6: GNU Compressed size: 85
+section 7: NOT Compressed
+section 8: NOT Compressed
+section 9: NOT Compressed
+EOF
+
+testfiles testfile-zgabi32be
+testrun_compare ${abs_top_builddir}/tests/elfgetchdr testfile-zgabi32be <<\EOF
+section 1: NOT Compressed
+section 2: NOT Compressed
+section 3: ELF Compressed ch_type: 1, ch_size: 40, ch_addralign: 8
+section 4: ELF Compressed ch_type: 1, ch_size: 6e, ch_addralign: 1
+section 5: NOT Compressed
+section 6: ELF Compressed ch_type: 1, ch_size: 85, ch_addralign: 1
+section 7: NOT Compressed
+section 8: NOT Compressed
+section 9: NOT Compressed
+EOF
+
+exit 0
diff --git a/tests/testfile-zgabi32.bz2 b/tests/testfile-zgabi32.bz2
new file mode 100755
index 0000000000000000000000000000000000000000..6159dbcea3a74cc1851ac69e8d985d3224b9fe3f
GIT binary patch
literal 767
zcmV<b0s#F&T4*^jL0KkKSu?W*00050|NsB@{V8s7d~EmpWmW(8|9$6Wcs(<4h;aTe
z5FikJ=rF(nGl7hZHB3r+Owu%H(0Z8-83CXH=?sQ|Gy_0nXaS~%fEo=LjRQ?I$QqiO
zG>n98A(KNRO&S0V0iXZ?00000003wJ03g#N38PFP#4$9$5s{`LiGUL(011$2zyJ}G
z36lU!BLt?Rnx^#x^){o_)6`~w6DB5src6vs6B9#CFeVcqWYEBx01X%dG|0&#AtP84
z2+AmAh{6?1>!;MnfJ-$c%yXTxV0GETe=$D)H(|(ZxHGvVfDVf&lp`3&`J{fB4hRJ#
zWt^rf;I8rX36>`i)Po&r?#x3kkiZ1WdJ-Ix9E5<5n2RCQDJF^0I*4%o;GjSyDw&*_
zA~I$QWD(a)C#B4OOb;U!Oti;XaBDNa-_Nh;Je^sV<cA!Lp^g9*b)K|u`D=@WIvQBz1z
zAkO>aKl=ljr6^~I{$!3b(HjqI*Gs9!4c+G#sfu7zA_!>QO(I1T*)Tlqh&l#$so>MB
zCWR5x!t_(ch~r^F#F)p1Ps=N7Qa(%df0E!*#+xh1fZ;_y5z2Tm`4pejY68R&jtcJv
z3V?iGVu>UThy#KEi;~}vH-3v#;lEO0+Qinmn!XI-DS)>_#uZ!b?)k=KN1Kvl&XVYI
zcrgc=9`#e0c8<b=hGp_`qXG_iIprKyp3zEj%P3_qMNn3AQY42c3s8nOh;+G*P!6~Z
zgQlizUWiCE5I{S#jRt);*)d6>;=nhC5TnNp9^s-ig8^vf8KF3UK=8}C$W>&!h~a3E
zslbNN2H-Rw%9-l5xPv?4xTTF9RiOm5*k)nRy)0Lhz{-U-saEpkx{#Y~Y;-4gpp5&%
z4ZwoK3Kt1|JW`<Q1EVX5)iGC{vm(a)-XG?+AFJ$UNg&5IAYM_jM`Us(a)6+VhouHPnU(J
x5(a)fLs)tWGq0%19=(faJX>8_VVz=f!nIAj-AL5RFEq~iaJxgwk>NEz9JfB?<JRQUh^

literal 0
HcmV?d00001

diff --git a/tests/testfile-zgabi32be.bz2 b/tests/testfile-zgabi32be.bz2
new file mode 100755
index 0000000000000000000000000000000000000000..f1f5eb5c7928ee9b3c91d5770da6008f9444df94
GIT binary patch
literal 769
zcmV+c1OEI%T4*^jL0KkKSyL6bcK`wWfB*mg|LcBleUoo*9A*FKpLO#^dXzUvV8UnW
z7(gQnAvVAQGlf~2!X}eM%6ggx)Bp_t27^EzpbZ9q&;T?5(?dW5LqkmljUH3d4NWGd
zr<C%Tk5JQ0Kmnit05s4vXaE2J0000DGyniWh{7@$34&x|V3-6j0T=>dF*Gom88AZ#
z!Z1TaCPqvGQ&5CzpOrkLO#^8IM$`Z_22BU30qST!Q~&?~0BF(b28NGN00=zoFg}t7
zYNrUue$2(a)Q&T}q6s~^6`ww<P6D6>e0pgX)fX3u9PyC~~jOtV`PMCNcsBQlUNj!Yon
z0ISz&m%}969K!Dv0mmdxebsk8TYhvZQEz7k0!XEG!0h4+;7mOPs3C9;2O*nq=Lsak
zNXeMOLjdG37g+}k9APlcs7x`SOcjN4iRMi{?hP_I+8&2XO;E0+2BMVA_FSz!C^H3I
zDCB|5yo1oHyRZ)(dgAzHD!W2JlZe9*sH8#0<B(a)K%3>@6kJ$*pM@{Mp8Z*<9GFd|TZ
zi44$RsX>jPA)^yUvnjUd%c$*d9+NgWK-G|9stL;l2w;pLa-VRNgLMZYX)zc;VG~eB
z>cV!!AaXMsR=9qcIHg>BqKqXQo~j_(&f(~a!c7K{ILt?53N#n}Fan7?QIXha5F7{s
zc-Ae=Z(a)O8Hg0uH4KPU$UruV`RPw)OWC0qRIbYBTU<{`kal9W>tJQyg${J8U&j$VhE
z=rLhvlMVZ?dUIEb(Pk#k<0h#mtaJJBjHby;A51(vHEpcU_KMIu0&u4Vl&IBJ=hmEX
zGG_M_BAv#Hj}(hY_US-wg(a)A>C6LsYk9L)@!69HK0g;PX11f+?lOMgXIO6@*r3Qq}x
z9uq{i78G<=laFWlEhH>pLml6K>EVYT+7vq_Xn_wGD#_#JH7C#8IDc1{?Wf#CJ)`W1
z(a)LC8x{Iy9nioDPOHRV+m*kLAINyLk+!CeZji=Jz%0|J8-pW^OFrwS4ZVz&<9l~qNG

literal 0
HcmV?d00001

diff --git a/tests/testfile-zgabi64.bz2 b/tests/testfile-zgabi64.bz2
new file mode 100755
index 0000000000000000000000000000000000000000..3b44f089e98c7fe7f90969cbbefbca5d8a16c36a
GIT binary patch
literal 795
zcmV+$1LXWdT4*^jL0KkKSwf>T@&EzcfB*k~{cnC*dPo0UO(_58-}tj`bSHOEd`9o2
z7zTBCrZ&I=90EiYH87LZ{YIvkO$`HTG|<8g0BAG;qfImb292TyhCl(ML7)eudYWxd
zQ2-elX{II-iIIt;O)@etBLZLu(WXWwfr2zLFhe5~0x$qf2mr{_O))TxOpHw$X_1kE
z7!v?SjWRJb3=yG`f*BZ?5r6_<5}Kxv)bvbA;+PptG{`hygFrOXPe?Q#riM*4$kC%f
zWFDhKL7|`;001U};A;hb{Aj`zK81A|M7&D~BuA$);<a{EMD*FL{Y>Q~N{<g+k8OQZ
zwM3-f=@m84&3P)XEi3zrxOW!yfaJu41)ZzF!;(T(sghxvZFxn_U2S!C`A~)!Yb9TK
zby}KxL=GUCpF;@)2{KKjLr*{i!82(a)D9xg64CR(V}L2r?h)E$(n(a)g(9{>&=G)Md{J8
z;Tl>ZrExv>#+y8LL>HquUpxblMMMH(m5B3wQBQMeP8fyKxJC*L<@UL+!hNYts%H`e
z8Oe;q&DuqRXmVaKL{7+f(u)ro>C#Y8#4L-`+l1(>Mob23JD#b|A{keX4t+(dnu;wQ
z0lXh(xp7N=YL7Bh1j2Tl4M-^#=5v!qLySIdDC$62yrKfVcgQOM9)ti_2KC|Y#G?Kh
zp$WSE(n)3!hAlG@#$}5v<mK5tkFdj_$gCf(>RK7^7L&Co{7Ee9>&hKtzVPv^dU|Rf
zEZP*{u^K+Fh4gu(>vP_5Q2`5k)&yL(a)iTA+s87Zvd_=BSTNJ34N($qv%))V~UqZYz`
z1dRH~T&4PBgv|mrgy{0$uSCKL^5Ba6p$_V-y0SDcdJ~9d5u6diP)Boaop?xUIMW`4
z>SnHDu#pB$bk^XB2cG&$mgx-`3XB{crG5W8SpXn{+b?QDku3zT$LpIpD_A9_lN3(a)P
z85`aa?w`5Yi9<-p_IMk|gAt`rA03fx4Gb18K9E6zO&7`<AnDpHJP(a)hn4v9gQi02TZ
Z%-Q_&a*{Ly1>#@g?ntK!5(rdgen5r;U~B*Y

literal 0
HcmV?d00001

diff --git a/tests/testfile-zgabi64be.bz2 b/tests/testfile-zgabi64be.bz2
new file mode 100755
index 0000000000000000000000000000000000000000..d819ae3d48dcf1bd15dfb5ef86f6101dce5c8e9d
GIT binary patch
literal 780
zcmV+n1M~bsT4*^jL0KkKS;4%Z*8l=8fB*mg{{4RKcv9bAL{$Ih-)YKTQXY3fU|LL$
zP!uyxem1}YD}l6-H8g`tnVM7bnomtkBNG}ClOCy&gkTc(a)28p#BLS}@-dW}5*MgVBh
zhNgp21jI5jH5*9NMw$Qs13)qW0B8UJ000Jn000OXFh&4_Oay6yGz?5eOax&XVqpvf
z$Y{hgVqlCW089WRQAU#lo=9YRjEy}_4FEL6Xc_|{k)}W%pwIvSX`lvx1|S5f10-P<
z)o#|6H`hqv)CZ7nVLQWzznFOLW<=0<>5_C`l5+J$2;u}$UJB6GqiRfsA-wi_Ku0bV
zF;cgCK-xNH1RJ_aE8AIRl`5qKYps9^Eg+4}yhH|x;91<p)d<*BWJb~<F+nIW6KS@<
z35*a=Vp4=OmGctg4FS|>4SPr`u_a7sv}GV?I(a)1@UrJ#5m$@HL#(pHFrgZHC13l=~#
zte&+H1+~pE+eR*{k>``HHxTO7Dtx73+LRnoaTpftRj5-UxB6m|h^dSejY!B}LR6EY
zW6OZu7ELec#U+m}gw+W~@$kr(2MY>aMv~^$oJ6zC&Z1vO^@s)o-EOau=${QR#x7gr
z2L{_FK{&NM2-Y*o`E|3_e+`Tk!S+xL138Bcu(a)B}*dhPwNy6h()lR!vC0r6_<vgzM?
zLUxL3m#nJ<)3(s?P$;BJWty=@OfK0aGMLZT!AwUgXERk6YC#{fjg*BN%%}z#Hbw(a)M
zk9;XjkrBpVH6(H~2;K)u7b=Jo2J1Q8t(pe_*EIw)NOtfJqmJcn12#o+u^bn{6U`bf
z+S!1D3O%=Gx<(Ypi2#H^bHz|e`NyzTLQ$$SWO9WDzbe~HqR_`hHKTBepj0LUU=w82
zf!Y*nejiXFUJx}j7cD(54$db2|Nnn6T{7{XZKSK%ujUa*YoP<Xt^Dc+H$-LvWI7jj
z77J1D-%m-A8^L`!_VJ=wZs$soFU_#rk6y2!9UtV3c~aX}U-!=~3oh;ALBTyYh`W+0
K!i0tm<p#KZ=uF1|

literal 0
HcmV?d00001

-- 
1.8.3.1

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]