to print multibyte characters, it just interprets them as hex values. */
static const char *
-printable_section_name (Elf_Internal_Shdr * sec)
+printable_section_name (const Elf_Internal_Shdr * sec)
{
#define MAX_PRINT_SEC_NAME_LEN 128
static char sec_name_buf [MAX_PRINT_SEC_NAME_LEN + 1];
strcat (buf, ", pid");
if (e_flags & E_FLAG_RX_ABI)
strcat (buf, ", RX ABI");
+ if (e_flags & E_FLAG_RX_SINSNS_SET)
+ strcat (buf, e_flags & E_FLAG_RX_SINSNS_YES
+ ? ", uses String instructions" : ", bans String instructions");
break;
case EM_S390:
/* Generic. */
/* 18 */ { STRING_COMMA_LEN ("EXCLUDE") },
/* SPARC specific. */
- /* 19 */ { STRING_COMMA_LEN ("ORDERED") }
+ /* 19 */ { STRING_COMMA_LEN ("ORDERED") },
+ /* 20 */ { STRING_COMMA_LEN ("COMPRESSED") }
};
if (do_section_details)
case SHF_GROUP: sindex = 8; break;
case SHF_TLS: sindex = 9; break;
case SHF_EXCLUDE: sindex = 18; break;
+ case SHF_COMPRESSED: sindex = 20; break;
default:
sindex = -1;
case SHF_GROUP: *p = 'G'; break;
case SHF_TLS: *p = 'T'; break;
case SHF_EXCLUDE: *p = 'E'; break;
+ case SHF_COMPRESSED: *p = 'C'; break;
default:
if ((elf_header.e_machine == EM_X86_64
return buff;
}
+static unsigned int
+get_compression_header (Elf_Internal_Chdr *chdr, unsigned char *buf)
+{
+ if (is_32bit_elf)
+ {
+ Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) buf;
+ chdr->ch_type = BYTE_GET (echdr->ch_type);
+ chdr->ch_size = BYTE_GET (echdr->ch_size);
+ chdr->ch_addralign = BYTE_GET (echdr->ch_addralign);
+ return sizeof (*echdr);
+ }
+ else
+ {
+ Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) buf;
+ chdr->ch_type = BYTE_GET (echdr->ch_type);
+ chdr->ch_size = BYTE_GET (echdr->ch_size);
+ chdr->ch_addralign = BYTE_GET (echdr->ch_addralign);
+ return sizeof (*echdr);
+ }
+}
+
static int
process_section_headers (FILE * file)
{
}
if (do_section_details)
- printf (" %s\n", get_elf_section_flags (section->sh_flags));
+ {
+ printf (" %s\n", get_elf_section_flags (section->sh_flags));
+ if ((section->sh_flags & SHF_COMPRESSED) != 0)
+ {
+ /* Minimum section size is 12 bytes for 32-bit compression
+ header + 12 bytes for compressed data header. */
+ unsigned char buf[24];
+ assert (sizeof (buf) >= sizeof (Elf64_External_Chdr));
+ if (get_data (&buf, (FILE *) file, section->sh_offset, 1,
+ sizeof (buf), _("compression header")))
+ {
+ Elf_Internal_Chdr chdr;
+ get_compression_header (&chdr, buf);
+ if (chdr.ch_type == ELFCOMPRESS_ZLIB)
+ printf (" ZLIB, ");
+ else
+ printf (_(" [<unknown>: 0x%x], "),
+ chdr.ch_type);
+ print_vma (chdr.ch_size, LONG_HEX);
+ printf (", %lu\n", (unsigned long) chdr.ch_addralign);
+ }
+ }
+ }
}
if (!do_section_details)
static void
apply_relocations (void * file,
- Elf_Internal_Shdr * section,
- unsigned char * start)
+ const Elf_Internal_Shdr * section,
+ unsigned char * start, bfd_size_type size)
{
Elf_Internal_Shdr * relsec;
- unsigned char * end = start + section->sh_size;
+ unsigned char * end = start + size;
if (elf_header.e_type != ET_REL)
return;
if (relocate)
{
- apply_relocations (file, section, start);
+ apply_relocations (file, section, start, section->sh_size);
}
else
{
|| strm.avail_out != 0)
goto fail;
- free (compressed_buffer);
*buffer = uncompressed_buffer;
*size = uncompressed_size;
return 1;
static int
load_specific_debug_section (enum dwarf_section_display_enum debug,
- Elf_Internal_Shdr * sec, void * file)
+ const Elf_Internal_Shdr * sec, void * file)
{
struct dwarf_section * section = &debug_displays [debug].section;
char buf [64];
section->size = 0;
else
{
- section->size = sec->sh_size;
- if (uncompress_section_contents (§ion->start, §ion->size))
- sec->sh_size = section->size;
+ unsigned char *start = section->start;
+ dwarf_size_type size = sec->sh_size;
+
+ if ((sec->sh_flags & SHF_COMPRESSED) != 0)
+ {
+ Elf_Internal_Chdr chdr;
+ unsigned int compression_header_size
+ = get_compression_header (&chdr, start);
+ if (chdr.ch_type != ELFCOMPRESS_ZLIB
+ || chdr.ch_addralign != sec->sh_addralign)
+ return 0;
+ start += compression_header_size;
+ size -= compression_header_size;
+ }
+
+ if (uncompress_section_contents (&start, &size))
+ {
+ /* Free the compressed buffer, update the section buffer
+ and the section size if uncompress is successful. */
+ free (section->start);
+ section->start = start;
+ }
+ section->size = size;
}
if (section->start == NULL)
return 0;
if (debug_displays [debug].relocate)
- apply_relocations ((FILE *) file, sec, section->start);
+ apply_relocations ((FILE *) file, sec, section->start, section->size);
return 1;
}