Non-alloc sections don't belong in PT_LOAD segments
[deliverable/binutils-gdb.git] / include / elf / internal.h
index 461503783040f252da0713129f8f5b3686d04fe6..b49dd61394065dbdde0b65ded15c659a472657cf 100644 (file)
@@ -1,6 +1,5 @@
 /* ELF support for BFD.
-   Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002,
-   2003, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1991-2015 Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -116,6 +115,14 @@ typedef struct elf_internal_shdr {
   unsigned char *contents;             /* Section contents.  */
 } Elf_Internal_Shdr;
 
+/* Compression header */
+
+typedef struct elf_internal_chdr {
+  unsigned int ch_type;                /* Type of compression */
+  bfd_size_type        ch_size;                /* Size of uncompressed data in bytes */
+  bfd_vma      ch_addralign;           /* Alignment of uncompressed data */
+} Elf_Internal_Chdr;
+
 /* Symbol table entry */
 
 struct elf_internal_sym {
@@ -318,6 +325,13 @@ struct elf_segment_map
     || (((sec_hdr)->sh_flags & SHF_TLS) == 0                           \
        && (segment)->p_type != PT_TLS                                  \
        && (segment)->p_type != PT_PHDR))                               \
+   /* PT_LOAD and similar segments only have SHF_ALLOC sections.  */   \
+   && !(((sec_hdr)->sh_flags & SHF_ALLOC) == 0                         \
+       && ((segment)->p_type == PT_LOAD                                \
+           || (segment)->p_type == PT_DYNAMIC                          \
+           || (segment)->p_type == PT_GNU_EH_FRAME                     \
+           || (segment)->p_type == PT_GNU_RELRO                        \
+           || (segment)->p_type == PT_GNU_STACK))                      \
    /* Any section besides one of type SHT_NOBITS must have file                \
       offsets within the segment.  */                                  \
    && ((sec_hdr)->sh_type == SHT_NOBITS                                        \
This page took 0.025275 seconds and 4 git commands to generate.