summaryrefslogtreecommitdiffstats
path: root/libelf/abstract.h
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-11-20 00:12:37 +0100
committerMark Wielaard <[email protected]>2016-01-06 14:27:10 +0100
commit5ddb50af4a488fdec358570502cbe058acb8ae93 (patch)
tree050c8d623b4832395b39eeebc30ad8ad63e2f0cb /libelf/abstract.h
parent0c32b6f086b9838fe4b7d93575068554d0c420f7 (diff)
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 <[email protected]>
Diffstat (limited to 'libelf/abstract.h')
-rw-r--r--libelf/abstract.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/libelf/abstract.h b/libelf/abstract.h
index 53713eec..d4515f27 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 <[email protected]>, 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)