https://sourceware.org/bugzilla/show_bug.cgi?id=23370
Mark Wielaard <mark at klomp dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at klomp dot org Summary|run-next-cfi-self.sh fails |run-next-cfi-self.sh |on armv7l |doesn't handle compressed | |ELF sections --- Comment #1 from Mark Wielaard <mark at klomp dot org> --- Although relocations in ET_REL files could be an issue, they aren't actually for this test, because the relocations that are there are against the addresses inside to .debug_frame section, and we don't care what they are in this test case. [We do really need some easier way to apply simple relocations when dealing with ET_REL files (currently you need to create a Dwfl, which is a bit overkill in this case).] The real issue in this case is that the toolchain that created this test file (size.o) used ELF debug section compression: [35] .debug_frame PROGBITS 00000000 0057e4 0000c5 0 C 0 0 4 [ELF ZLIB (1) 000154 4] (Oddly enough it seems it only does this for ET_REL files and the linker again decompresses again when creating the ET_EXEC/DYN files. Which seems horribly inefficient.) So the real fix is to just uncompress the section in the test: diff --git a/tests/next_cfi.c b/tests/next_cfi.c index b923744..ae324c4 100644 --- a/tests/next_cfi.c +++ b/tests/next_cfi.c @@ -33,7 +33,7 @@ #include <unistd.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); } } } -- You are receiving this mail because: You are on the CC list for the bug.