From patchwork Fri May 1 14:36:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 6520 Received: (qmail 81216 invoked by alias); 1 May 2015 14:36:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 81201 invoked by uid 89); 1 May 2015 14:36:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_20, SPF_PASS autolearn=ham version=3.3.2 X-HELO: gnu.wildebeest.org From: Mark Wielaard To: libc-alpha@sourceware.org Cc: Mark Wielaard Subject: [PATCH] elf.h: Add section compression constants and structures. Date: Fri, 1 May 2015 16:36:27 +0200 Message-Id: <1430490987-7174-1-git-send-email-mjw@redhat.com> X-Spam-Score: -2.9 (--) Hi, This adds the new gabi standardized ELF section compression constants and structures. This is currently being implemented in the binutils linkers and support in Solaris and elfutils libelf is being discussed here: https://groups.google.com/forum/#!topic/generic-abi/9ZgNqIC2X-4 If this looks OK could someone push this for me, I don't have glibc commit access. Thanks, Mark ChangeLog 2015-05-01 Mark Wielaard * elf/elf.h: Add SHF_COMPRESSED section flag, Elf32_Chdr and Elf64_Chdr structs and ELFCOMPRESS constants. --- ChangeLog | 5 +++++ elf/elf.h | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/elf/elf.h b/elf/elf.h index 39bafc2..12feb91 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -367,6 +367,7 @@ typedef struct required */ #define SHF_GROUP (1 << 9) /* Section is member of a group. */ #define SHF_TLS (1 << 10) /* Section hold thread-local data. */ +#define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */ #define SHF_MASKOS 0x0ff00000 /* OS-specific. */ #define SHF_MASKPROC 0xf0000000 /* Processor-specific */ #define SHF_ORDERED (1 << 30) /* Special ordering requirement @@ -374,6 +375,30 @@ typedef struct #define SHF_EXCLUDE (1U << 31) /* Section is excluded unless referenced or allocated (Solaris).*/ +/* Section compression header. Used when SHF_COMPRESSED is set. */ + +typedef struct +{ + Elf32_Word ch_type; /* Compression format. */ + Elf32_Word ch_size; /* Uncompressed data size. */ + Elf32_Word ch_addralign; /* Uncompressed data alignment. */ +} Elf32_Chdr; + +typedef struct +{ + Elf64_Word ch_type; /* Compression format. */ + Elf64_Word ch_reserved; + Elf64_Xword ch_size; /* Uncompressed data size. */ + Elf64_Xword ch_addralign; /* Uncompressed data alignment. */ +} Elf64_Chdr; + +/* Legal values for ch_type (compression algorithm). */ +#define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */ +#define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */ +#define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */ +#define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */ +#define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */ + /* Section group handling. */ #define GRP_COMDAT 0x1 /* Mark group as COMDAT. */