summaryrefslogtreecommitdiffstats
path: root/libelf
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2016-01-13 17:16:48 +0100
committerMark Wielaard <mjw@redhat.com>2016-01-14 14:26:22 +0100
commit344ca0775da729e1bfdd61bb88ba4c64befece07 (patch)
tree4982fb56b1ad079386a8672e84d698abb4de8433 /libelf
parent9b4bce40709611875754cf4931eb91d394042122 (diff)
downloadandroid_external_elfutils-344ca0775da729e1bfdd61bb88ba4c64befece07.tar.gz
android_external_elfutils-344ca0775da729e1bfdd61bb88ba4c64befece07.tar.bz2
android_external_elfutils-344ca0775da729e1bfdd61bb88ba4c64befece07.zip
libelf: Add ELF compression types and defines to libelf.h for older glibc.
Older glibc elf.h might not define the new ELF compression defines and types. If not just define them in libelf.h directly to make the libelf headers work on older glibc systems. Also include a testcase to check the libelf headers build against the system elf.h. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810885 Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libelf')
-rw-r--r--libelf/ChangeLog5
-rw-r--r--libelf/libelf.h28
2 files changed, 33 insertions, 0 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 3a1fe91d..aabf6f6d 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-13 Mark Wielaard <mjw@redhat.com>
+
+ * libelf.h: Check SHF_COMPRESSED is defined. If not define it and the
+ associated ELF compression types/defines.
+
2015-11-26 Mark Wielaard <mjw@redhat.com>
* elf_compress.c (__libelf_decompress_elf): New function, extracted
diff --git a/libelf/libelf.h b/libelf/libelf.h
index 364e7767..c0d6389f 100644
--- a/libelf/libelf.h
+++ b/libelf/libelf.h
@@ -35,6 +35,34 @@
/* Get the ELF types. */
#include <elf.h>
+#ifndef SHF_COMPRESSED
+ /* Older glibc elf.h might not yet define the ELF compression types. */
+ #define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */
+
+ /* Section compression header. Used when SHF_COMPRESSED is set. */
+
+ typedef struct
+ {
+ Elf32_Word ch_type; /* Compression format. */
+ Elf32_Word ch_size; /* Uncompressed data size. */
+ Elf32_Word ch_addralign; /* Uncompressed data alignment. */
+ } Elf32_Chdr;
+
+ typedef struct
+ {
+ Elf64_Word ch_type; /* Compression format. */
+ Elf64_Word ch_reserved;
+ Elf64_Xword ch_size; /* Uncompressed data size. */
+ Elf64_Xword ch_addralign; /* Uncompressed data alignment. */
+ } Elf64_Chdr;
+
+ /* Legal values for ch_type (compression algorithm). */
+ #define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */
+ #define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */
+ #define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */
+ #define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */
+ #define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */
+#endif
/* Known translation types. */
typedef enum