diff options
| author | Mark Wielaard <[email protected]> | 2015-10-29 11:10:37 +0100 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-10-29 11:10:37 +0100 |
| commit | 72992c04e2f0a2d561624f45dd202c666265148d (patch) | |
| tree | 80da16f53179c2db0255d34d8b5ad909d1d4201d | |
| parent | 528cb45fc99a1f402ac153891ac7c007921699ef (diff) | |
libdwelf: Add dwelf_scn_getchdr and dwelf_scn_gnu_compressed_size.
Utility functions to get the ELF Chdr compression header of a section
and the size of the uncompressed data in GNU compressed .zdebug sections.
Signed-off-by: Mark Wielaard <[email protected]>
| -rw-r--r-- | libdw/ChangeLog | 5 | ||||
| -rw-r--r-- | libdw/libdw.map | 6 | ||||
| -rw-r--r-- | libdwelf/ChangeLog | 10 | ||||
| -rw-r--r-- | libdwelf/Makefile.am | 5 | ||||
| -rw-r--r-- | libdwelf/dwelf_scn_getchdr.c | 116 | ||||
| -rw-r--r-- | libdwelf/dwelf_scn_gnu_compressed_size.c | 77 | ||||
| -rw-r--r-- | libdwelf/libdwelf.h | 18 | ||||
| -rw-r--r-- | tests/ChangeLog | 14 | ||||
| -rw-r--r-- | tests/Makefile.am | 10 | ||||
| -rw-r--r-- | tests/dwelfgetchdr.c | 123 | ||||
| -rwxr-xr-x | tests/run-dwelfgetchdr.sh | 136 | ||||
| -rwxr-xr-x | tests/testfile-zgabi32.bz2 | bin | 0 -> 767 bytes | |||
| -rwxr-xr-x | tests/testfile-zgabi64.bz2 | bin | 0 -> 795 bytes | |||
| -rwxr-xr-x | tests/testfile-zgnu32.bz2 | bin | 0 -> 780 bytes | |||
| -rwxr-xr-x | tests/testfile-zgnu64.bz2 | bin | 0 -> 785 bytes |
15 files changed, 514 insertions, 6 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 99ec2e8c..f057421d 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2015-10-28 Mark Wielaard <[email protected]> + + * libdw.map (ELFUTILS_0.165): New. Add dwelf_scn_getchdr and + dwelf_scn_gnu_compressed_size. + 2015-10-16 Mark Wielaard <[email protected]> * Makefile.am (libdw.so): Add -lz. diff --git a/libdw/libdw.map b/libdw/libdw.map index 1d4cbb0c..6483b65b 100644 --- a/libdw/libdw.map +++ b/libdw/libdw.map @@ -322,3 +322,9 @@ ELFUTILS_0.161 { dwarf_macro_getparamcnt; dwarf_macro_param; } ELFUTILS_0.160; + +ELFUTILS_0.165 { + global: + dwelf_scn_getchdr; + dwelf_scn_gnu_compressed_size; +} ELFUTILS_0.161; diff --git a/libdwelf/ChangeLog b/libdwelf/ChangeLog index f182ecf4..621a6fff 100644 --- a/libdwelf/ChangeLog +++ b/libdwelf/ChangeLog @@ -1,3 +1,13 @@ +2015-10-28 Mark Wielaard <[email protected]> + + * Makefile.am (libdwelf_a_SOURCES): Add dwelf_scn_getchdr.c and + dwelf_scn_gnu_compressed_size.c. + * dwelf_scn_getchdr.c: New file. + * dwelf_scn_gnu_compressed_size.c: Likewise. + * libdwelf.h (DWElf_Chdr): New typedef. + (dwelf_scn_getchdr): New declaration. + (dwelf_scn_gnu_compressed_size): Likewise. + 2015-10-14 Chih-Hung Hsieh <[email protected]> * dwelf_elf_gnu_build_id.c (find_elf_build_id): Move nested function diff --git a/libdwelf/Makefile.am b/libdwelf/Makefile.am index cd4b7ddf..763e00b3 100644 --- a/libdwelf/Makefile.am +++ b/libdwelf/Makefile.am @@ -2,7 +2,7 @@ ## ## Process this file with automake to create Makefile.in ## -## Copyright (C) 2014 Red Hat, Inc. +## Copyright (C) 2014, 2015 Red Hat, Inc. ## This file is part of elfutils. ## ## This file is free software; you can redistribute it and/or modify @@ -40,7 +40,8 @@ pkginclude_HEADERS = libdwelf.h noinst_HEADERS = libdwelfP.h libdwelf_a_SOURCES = dwelf_elf_gnu_debuglink.c dwelf_dwarf_gnu_debugaltlink.c \ - dwelf_elf_gnu_build_id.c + dwelf_elf_gnu_build_id.c dwelf_scn_getchdr.c \ + dwelf_scn_gnu_compressed_size.c libdwelf = $(libdw) diff --git a/libdwelf/dwelf_scn_getchdr.c b/libdwelf/dwelf_scn_getchdr.c new file mode 100644 index 00000000..778049ac --- /dev/null +++ b/libdwelf/dwelf_scn_getchdr.c @@ -0,0 +1,116 @@ +/* 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 "libdwelfP.h" +#include "libelfP.h" +#include <gelf.h> +#include "common.h" + +DWElf_Chdr * +dwelf_scn_getchdr (Elf_Scn *scn, DWElf_Chdr *dest) +{ + if (scn == NULL || dest == NULL) + return NULL; + + GElf_Ehdr ehdr; + if (gelf_getehdr (scn->elf, &ehdr) == NULL) + return NULL; + + GElf_Shdr shdr; + if (gelf_getshdr (scn, &shdr) == NULL) + return NULL; + + /* Allocated or no bits sections can never be compressed. */ + if ((shdr.sh_flags & SHF_ALLOC) != 0 + || shdr.sh_type == SHT_NULL + || shdr.sh_type == SHT_NOBITS + || (shdr.sh_flags & SHF_COMPRESSED) == 0) + return NULL; + + Elf_Data *data = elf_rawdata (scn, NULL); + if (data == NULL) + return NULL; + + if (scn->elf->class == ELFCLASS32) + { + if (data->d_size < sizeof (Elf32_Chdr)) + return NULL; + + Elf32_Chdr chdr; + if (ehdr.e_ident[EI_DATA] == MY_ELFDATA + && (ALLOW_UNALIGNED + || (((uintptr_t) data->d_buf & (__alignof__ (Elf32_Chdr) - 1)) + == 0))) + chdr = *(Elf32_Chdr *) data->d_buf; + else + memcpy (&chdr, data->d_buf, sizeof (Elf32_Chdr)); + + if (ehdr.e_ident[EI_DATA] == MY_ELFDATA) + { + dest->ch_type = chdr.ch_type; + dest->ch_reserved = 0; + dest->ch_size = chdr.ch_size; + dest->ch_addralign = chdr.ch_addralign; + } + else + { + CONVERT_TO (dest->ch_type, chdr.ch_type); + dest->ch_reserved = 0; + CONVERT_TO (dest->ch_size, chdr.ch_size); + CONVERT_TO (dest->ch_addralign, chdr.ch_addralign); + } + } + else + { + if (data->d_size < sizeof (Elf64_Chdr)) + return NULL; + + if (ehdr.e_ident[EI_DATA] == MY_ELFDATA + && (ALLOW_UNALIGNED + || (((uintptr_t) data->d_buf & (__alignof__ (Elf64_Chdr) - 1)) + == 0))) + *dest = *(Elf64_Chdr *) data->d_buf; + else + { + memcpy (dest, data->d_buf, sizeof (Elf64_Chdr)); + if (ehdr.e_ident[EI_DATA] != MY_ELFDATA) + { + CONVERT (dest->ch_type); + CONVERT (dest->ch_reserved); + CONVERT (dest->ch_size); + CONVERT (dest->ch_addralign); + } + } + } + + return dest; +} diff --git a/libdwelf/dwelf_scn_gnu_compressed_size.c b/libdwelf/dwelf_scn_gnu_compressed_size.c new file mode 100644 index 00000000..d39b702a --- /dev/null +++ b/libdwelf/dwelf_scn_gnu_compressed_size.c @@ -0,0 +1,77 @@ +/* Return size of GNU compressed section. + 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 "libdwelfP.h" +#include "libelfP.h" + +ssize_t +dwelf_scn_gnu_compressed_size (Elf_Scn *scn) +{ + if (scn == NULL) + return -1; + + GElf_Shdr shdr; + if (gelf_getshdr (scn, &shdr) == NULL) + return -1; + + /* Allocated or no bits sections can never be compressed. */ + if ((shdr.sh_flags & SHF_ALLOC) != 0 + || shdr.sh_type == SHT_NULL + || shdr.sh_type == SHT_NOBITS) + return -1; + + Elf_Data *d = elf_rawdata (scn, NULL); + if (d == NULL) + return -1; + + if (d->d_size >= 4 + 8 + && memcmp (d->d_buf, "ZLIB", 4) == 0) + { + /* There is a 12-byte header of "ZLIB" followed by + an 8-byte big-endian size. There is only one type and + alignment isn't preserved separately. */ + uint64_t size; + memcpy (&size, d->d_buf + 4, sizeof size); + size = be64toh (size); + + /* One more sanity check, size should be bigger than original + data size plus some overhead (4 chars ZLIB + 8 bytes size + 6 + bytes zlib stream overhead + 5 bytes overhead max for one 16K + block) and should fit into a size_t. */ + if (size + 4 + 8 + 6 + 5 < d->d_size || size > SIZE_MAX) + return -1; + + return size; + } + + return -1; +} diff --git a/libdwelf/libdwelf.h b/libdwelf/libdwelf.h index e16dc0f3..5efe5512 100644 --- a/libdwelf/libdwelf.h +++ b/libdwelf/libdwelf.h @@ -1,5 +1,5 @@ /* Interfaces for libdwelf. DWARF ELF Low-level Functions. - Copyright (C) 2014 Red Hat, Inc. + Copyright (C) 2014, 2015 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -65,6 +65,22 @@ extern ssize_t dwelf_dwarf_gnu_debugaltlink (Dwarf *dwarf, note. Returns -1 in case of malformed data or other errors. */ extern ssize_t dwelf_elf_gnu_build_id (Elf *elf, const void **build_idp); +/* Can represent either an Elf32_Chdr or Elf64_Chdr. */ +typedef Elf64_Chdr DWElf_Chdr; + +/* Puts the compression header of a section into DEST and returns it. + Returns NULL if scn is NULL, or the section isn't compressed + (doesn't have SHF_COMPRESSED set). If an error occurs NULL is + returned and elf_errno is set. */ +extern DWElf_Chdr *dwelf_scn_getchdr (Elf_Scn *scn, DWElf_Chdr *dest); + + /* Returns the size of the uncompressed data of a GNU compressed + section. The section name should start with .zdebug (but this + isn't checked by this function). If the section isn't compressed + (the section data doesn't start with ZLIB) -1 is returned. If an + error occured -1 is returned and elf_errno is set. */ +extern ssize_t dwelf_scn_gnu_compressed_size (Elf_Scn *scn); + #ifdef __cplusplus } #endif diff --git a/tests/ChangeLog b/tests/ChangeLog index 69a25fc6..8a6f5083 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,17 @@ +2015-10-28 Mark Wielaard <[email protected]> + + * dwelfgetchdr.c: New file. + * run-dwelfgetchdr.sh: New test. + * testfile-zgnu32.bz2: New testfile. + * testfile-zgnu64.bz2: Likewise. + * testfile-zgabi32.bz2: Likewise. + * testfile-zgabi64.bz2: Likewise. + * Makefile.am (check_PROGRAMS): Add dwelfgetchdr. + (TESTS): Add run-dwelfgetchdr.sh. + (EXTRA_DIST): Add run-dwelfgetchdr.sh, testfile-zgnu32.bz2, + testfile-zgnu64.bz2, testfile-zgabi32.bz2 and testfile-zgabi64.bz2. + (dwelfgetchdr_LDADD): New variable. + 2015-10-16 Mark Wielaard <[email protected]> * Makefile.am [BUILD_STATIC] (libdw): Add -lz. diff --git a/tests/Makefile.am b/tests/Makefile.am index 30cf137c..a66b202c 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 + elfshphehdr elfstrmerge dwelfgetchdr asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \ asm-tst6 asm-tst7 asm-tst8 asm-tst9 @@ -120,7 +120,7 @@ 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 + elfshphehdr run-lfs-symbols.sh run-dwelfgetchdr.sh if !BIARCH export ELFUTILS_DISABLE_BIARCH = 1 @@ -304,7 +304,10 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \ testfile-x32-core.bz2 testfile-x32.bz2 \ backtrace.x32.core.bz2 backtrace.x32.exec.bz2 \ testfile-x32-s.bz2 testfile-x32-d.bz2 testfile-x32-debug.bz2 \ - run-lfs-symbols.sh lfs-symbols testfile-nolfs.bz2 + run-lfs-symbols.sh lfs-symbols testfile-nolfs.bz2 \ + testfile-zgnu32.bz2 testfile-zgnu64.bz2 \ + testfile-zgabi32.bz2 testfile-zgabi64.bz2 \ + run-dwelfgetchdr.sh if USE_VALGRIND valgrind_cmd='valgrind -q --error-exitcode=1 --run-libc-freeres=no' @@ -453,6 +456,7 @@ dwfl_proc_attach_LDADD = $(libdw) dwfl_proc_attach_LDFLAGS = -pthread $(AM_LDFLAGS) elfshphehdr_LDADD =$(libelf) elfstrmerge_LDADD = $(libebl) $(libelf) +dwelfgetchdr_LDADD = $(libelf) $(libdw) if GCOV check: check-am coverage diff --git a/tests/dwelfgetchdr.c b/tests/dwelfgetchdr.c new file mode 100644 index 00000000..839a6550 --- /dev/null +++ b/tests/dwelfgetchdr.c @@ -0,0 +1,123 @@ +/* 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) + { + DWElf_Chdr chdr; + if (dwelf_scn_getchdr (scn, &chdr) == NULL) + { + printf ("dwelf_scn_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; + } + + 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/run-dwelfgetchdr.sh b/tests/run-dwelfgetchdr.sh new file mode 100755 index 00000000..47b25318 --- /dev/null +++ b/tests/run-dwelfgetchdr.sh @@ -0,0 +1,136 @@ +#! /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 zgnu32 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/dwelfgetchdr 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/dwelfgetchdr 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/dwelfgetchdr 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/dwelfgetchdr 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 + +exit 0 diff --git a/tests/testfile-zgabi32.bz2 b/tests/testfile-zgabi32.bz2 Binary files differnew file mode 100755 index 00000000..6159dbce --- /dev/null +++ b/tests/testfile-zgabi32.bz2 diff --git a/tests/testfile-zgabi64.bz2 b/tests/testfile-zgabi64.bz2 Binary files differnew file mode 100755 index 00000000..3b44f089 --- /dev/null +++ b/tests/testfile-zgabi64.bz2 diff --git a/tests/testfile-zgnu32.bz2 b/tests/testfile-zgnu32.bz2 Binary files differnew file mode 100755 index 00000000..9d622cad --- /dev/null +++ b/tests/testfile-zgnu32.bz2 diff --git a/tests/testfile-zgnu64.bz2 b/tests/testfile-zgnu64.bz2 Binary files differnew file mode 100755 index 00000000..1bc2c090 --- /dev/null +++ b/tests/testfile-zgnu64.bz2 |
