summaryrefslogtreecommitdiffstats
path: root/tests/next_cfi.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/next_cfi.c')
-rw-r--r--tests/next_cfi.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/tests/next_cfi.c b/tests/next_cfi.c
index 2b633577..0b171ecc 100644
--- a/tests/next_cfi.c
+++ b/tests/next_cfi.c
@@ -18,7 +18,6 @@
#include <config.h>
#include <assert.h>
#include <inttypes.h>
-#include <error.h>
#include ELFUTILS_HEADER(dw)
#include <dwarf.h>
#include <argp.h>
@@ -31,9 +30,10 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include "system.h"
void
-handle_section (const unsigned char e_ident[],
+handle_section (char *name, const unsigned char e_ident[],
Elf_Scn *scn, const bool is_eh)
{
if (is_eh)
@@ -41,6 +41,24 @@ handle_section (const unsigned char e_ident[],
else
printf (".debug_frame\n");
+ GElf_Shdr mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &mem);
+ if (shdr == NULL)
+ error (EXIT_FAILURE, 0, "Couldn't get section header: %s",
+ elf_errmsg (-1));
+ if ((shdr->sh_flags & SHF_COMPRESSED) != 0)
+ {
+ if (elf_compress (scn, 0, 0) < 0)
+ error (EXIT_FAILURE, 0, "Couldn't decompress section: %s",
+ elf_errmsg (-1));
+ }
+ else if (name[0] == '.' && name[1] == 'z')
+ {
+ if (elf_compress_gnu (scn, 0, 0) < 0)
+ error (EXIT_FAILURE, 0, "Couldn't decompress section: %s",
+ elf_errmsg (-1));
+ }
+
Elf_Data *data = elf_getdata (scn, NULL);
if (data == NULL || data->d_buf == NULL)
error (EXIT_FAILURE, 0, "no section data");
@@ -117,9 +135,10 @@ main (int argc, char *argv[])
if (name != NULL && shdr.sh_type == SHT_PROGBITS)
{
if (strcmp (name, ".eh_frame") == 0)
- handle_section (ident, scn, true);
- if (strcmp (name, ".debug_frame") == 0)
- handle_section (ident, scn, false);
+ handle_section (name, ident, scn, true);
+ if (strcmp (name, ".debug_frame") == 0
+ || strcmp (name, ".zdebug_frame") == 0)
+ handle_section (name, ident, scn, false);
}
}
}