From dd131168e2abf2f0fc872829e1101366395cc390 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 8 Jan 2016 13:35:33 +0100 Subject: Simplify code and build now that zlib support is no longer optional. Now that we always require zlib support we don't need to conditionally build or compile code that depends on it. Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 9 +++++++++ libdwfl/Makefile.am | 6 ++---- libdwfl/linux-kernel-modules.c | 8 -------- libdwfl/open.c | 10 ++-------- tests/ChangeLog | 5 +++++ tests/Makefile.am | 7 ++----- 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 7bb9b355..94c58d90 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,12 @@ +2016-01-08 Mark Wielaard + + * libdwfl_a_SOURCES: Unconditionally add gzip.c. + * linux-kernel-modules.c (vmlinux_suffixes): We always have at least + .gz support. + (try_kernel_name): Likewise. + (check_suffix): Likewise. + * open.c (decompress): Likewise. + 2015-12-18 Mark Wielaard * dwfl_module_getdwarf.c (find_symtab): Uncompress symstr, xndx, sym diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am index 72c980bf..89ca92ed 100644 --- a/libdwfl/Makefile.am +++ b/libdwfl/Makefile.am @@ -68,11 +68,9 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c dwfl_version.c \ dwfl_segment_report_module.c \ link_map.c core-file.c open.c image-header.c \ dwfl_frame.c frame_unwind.c dwfl_frame_pc.c \ - linux-pid-attach.c linux-core-attach.c dwfl_frame_regs.c + linux-pid-attach.c linux-core-attach.c dwfl_frame_regs.c \ + gzip.c -if ZLIB -libdwfl_a_SOURCES += gzip.c -endif if BZLIB libdwfl_a_SOURCES += bzip2.c endif diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index 38b5170a..79faf994 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -64,12 +64,9 @@ #define MODULE_SECT_NAME_LEN 32 /* Minimum any linux/module.h has had. */ -#if defined (USE_ZLIB) || defined (USE_BZLIB) || defined (USE_LZMA) static const char *vmlinux_suffixes[] = { -#ifdef USE_ZLIB ".gz", -#endif #ifdef USE_BZLIB ".bz2", #endif @@ -77,7 +74,6 @@ static const char *vmlinux_suffixes[] = ".xz", #endif }; -#endif /* Try to open the given file as it is or under the debuginfo directory. */ static int @@ -114,7 +110,6 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug) } } -#if defined (USE_ZLIB) || defined (USE_BZLIB) || defined (USE_LZMA) if (fd < 0) for (size_t i = 0; i < sizeof vmlinux_suffixes / sizeof vmlinux_suffixes[0]; @@ -133,7 +128,6 @@ try_kernel_name (Dwfl *dwfl, char **fname, bool try_debug) } } } -#endif if (fd < 0) { @@ -303,9 +297,7 @@ check_suffix (const FTSENT *f, size_t namelen) return sizeof sfx - 1 TRY (".ko"); -#if USE_ZLIB TRY (".ko.gz"); -#endif #if USE_BZLIB TRY (".ko.bz2"); #endif diff --git a/libdwfl/open.c b/libdwfl/open.c index c1d0ed2b..92f2798b 100644 --- a/libdwfl/open.c +++ b/libdwfl/open.c @@ -1,5 +1,5 @@ -/* Decompression support for libdwfl: zlib (gzip) and/or bzlib (bzip2). - Copyright (C) 2009 Red Hat, Inc. +/* Decompression support for libdwfl: zlib (gzip), bzlib (bzip2) or lzma (xz). + Copyright (C) 2009, 2016 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -32,10 +32,6 @@ #include -#if !USE_ZLIB -# define __libdw_gunzip(...) DWFL_E_BADELF -#endif - #if !USE_BZLIB # define __libdw_bunzip2(...) DWFL_E_BADELF #endif @@ -52,7 +48,6 @@ decompress (int fd __attribute__ ((unused)), Elf **elf) void *buffer = NULL; size_t size = 0; -#if USE_ZLIB || USE_BZLIB || USE_LZMA const off_t offset = (*elf)->start_offset; void *const mapped = ((*elf)->map_address == NULL ? NULL : (*elf)->map_address + offset); @@ -65,7 +60,6 @@ decompress (int fd __attribute__ ((unused)), Elf **elf) error = __libdw_bunzip2 (fd, offset, mapped, mapped_size, &buffer, &size); if (error == DWFL_E_BADELF) error = __libdw_unlzma (fd, offset, mapped, mapped_size, &buffer, &size); -#endif if (error == DWFL_E_NOERROR) { diff --git a/tests/ChangeLog b/tests/ChangeLog index 3d912600..453c4186 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2016-01-08 Mark Wielaard + + * Makefile.am (TESTS): Always unconditionally add + run-readelf-zdebug.sh and run-readelf-zdebug-rel.sh. + 2015-12-16 Mark Wielaard * run-compress-test.sh: New test. diff --git a/tests/Makefile.am b/tests/Makefile.am index 819f2d1e..d09a6d7b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -124,7 +124,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \ elfshphehdr run-lfs-symbols.sh run-dwelfgnucompressed.sh \ run-elfgetchdr.sh \ run-elfgetzdata.sh run-elfputzdata.sh run-zstrptr.sh \ - run-compress-test.sh + run-compress-test.sh \ + run-readelf-zdebug.sh run-readelf-zdebug-rel.sh if !BIARCH export ELFUTILS_DISABLE_BIARCH = 1 @@ -143,10 +144,6 @@ if LZMA TESTS += run-readelf-s.sh run-dwflsyms.sh endif -if ZLIB -TESTS += run-readelf-zdebug.sh run-readelf-zdebug-rel.sh -endif - if HAVE_LIBASM check_PROGRAMS += $(asm_TESTS) TESTS += $(asm_TESTS) -- cgit v1.2.3