Fix build failure on macOS
[deliverable/binutils-gdb.git] / include / elf / external.h
index 0a5d1762077f5d9b44472c527c1482d9dc38afd1..73e3cbf2f1cc0d69c2fff4be91b6f721576a9c99 100644 (file)
@@ -1,39 +1,52 @@
 /* ELF support for BFD.
-   Copyright (C) 1991, 92, 93, 95, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
    Programming Support Tools".
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 /* This file is part of ELF support for BFD, and contains the portions
    that describe how ELF is represented externally by the BFD library.
    I.E. it describes the in-file representation of ELF.  It requires
-   the elf-common.h file which contains the portions that are common to
-   both the internal and external representations. */
-   
+   the elf/common.h file which contains the portions that are common to
+   both the internal and external representations.  */
+
 /* The 64-bit stuff is kind of random.  Perhaps someone will publish a
    spec someday.  */
 
 #ifndef _ELF_EXTERNAL_H
 #define _ELF_EXTERNAL_H
 
+/* Special section indices, which may show up in st_shndx fields, among
+   other places.  */
+
+#define SHN_LORESERVE  0xFF00          /* Begin range of reserved indices */
+#define SHN_LOPROC     0xFF00          /* Begin range of appl-specific */
+#define SHN_HIPROC     0xFF1F          /* End range of appl-specific */
+#define SHN_LOOS       0xFF20          /* OS specific semantics, lo */
+#define SHN_HIOS       0xFF3F          /* OS specific semantics, hi */
+#define SHN_ABS                0xFFF1          /* Associated symbol is absolute */
+#define SHN_COMMON     0xFFF2          /* Associated symbol is in common */
+#define SHN_XINDEX     0xFFFF          /* Section index is held elsewhere */
+#define SHN_HIRESERVE  0xFFFF          /* End range of reserved indices */
+
 /* ELF Header (32-bit implementations) */
 
 typedef struct {
@@ -122,6 +135,21 @@ typedef struct {
   unsigned char        sh_entsize[8];          /* Entry size if section holds table */
 } Elf64_External_Shdr;
 
+/* Compression header */
+
+typedef struct {
+  unsigned char        ch_type[4];             /* Type of compression */
+  unsigned char        ch_size[4];             /* Size of uncompressed data in bytes */
+  unsigned char        ch_addralign[4];        /* Alignment of uncompressed data  */
+} Elf32_External_Chdr;
+
+typedef struct {
+  unsigned char        ch_type[4];             /* Type of compression */
+  unsigned char        ch_reserved[4];         /* Padding */
+  unsigned char        ch_size[8];             /* Size of uncompressed data in bytes */
+  unsigned char        ch_addralign[8];        /* Alignment of uncompressed data  */
+} Elf64_External_Chdr;
+
 /* Symbol table entry */
 
 typedef struct {
@@ -142,6 +170,10 @@ typedef struct {
   unsigned char        st_size[8];             /* Associated symbol size */
 } Elf64_External_Sym;
 
+typedef struct {
+  unsigned char est_shndx[4];          /* Section index */
+} Elf_External_Sym_Shndx;
+
 /* Note segments */
 
 typedef struct {
@@ -151,6 +183,22 @@ typedef struct {
   char         name[1];                /* Start of the name+desc data */
 } Elf_External_Note;
 
+/* Align an address upward to a boundary, expressed as a number of bytes.
+   E.g. align to an 8-byte boundary with argument of 8.  */
+#define ELF_ALIGN_UP(addr, boundary) \
+  (((bfd_vma) (addr) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary) -1))
+
+/* Compute the offset of the note descriptor from size of note entry's
+   owner string and note alignment.  */
+#define ELF_NOTE_DESC_OFFSET(namesz, align) \
+  ELF_ALIGN_UP (offsetof (Elf_External_Note, name) + (namesz), (align))
+
+/* Compute the offset of the next note entry from size of note entry's
+   owner string, size of the note descriptor and note alignment.  */
+#define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \
+  ELF_ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), \
+               (align))
+
 /* Relocation Entries */
 typedef struct {
   unsigned char r_offset[4];   /* Location at which to apply the action */
@@ -192,6 +240,10 @@ typedef struct {
   } d_un;
 } Elf64_External_Dyn;
 
+/* The version structures are currently size independent.  They are
+   named without a 32 or 64.  If that ever changes, these structures
+   will need to be renamed.  */
+
 /* This structure appears in a SHT_GNU_verdef section.  */
 
 typedef struct {
@@ -202,19 +254,15 @@ typedef struct {
   unsigned char                vd_hash[4];
   unsigned char                vd_aux[4];
   unsigned char                vd_next[4];
-} Elf32_External_Verdef;
-
-typedef Elf32_External_Verdef Elf64_External_Verdef;
+} Elf_External_Verdef;
 
 /* This structure appears in a SHT_GNU_verdef section.  */
 
 typedef struct {
   unsigned char                vda_name[4];
   unsigned char                vda_next[4];
-} Elf32_External_Verdaux;
+} Elf_External_Verdaux;
 
-typedef Elf32_External_Verdaux Elf64_External_Verdaux;
 /* This structure appears in a SHT_GNU_verneed section.  */
 
 typedef struct {
@@ -223,9 +271,7 @@ typedef struct {
   unsigned char                vn_file[4];
   unsigned char                vn_aux[4];
   unsigned char                vn_next[4];
-} Elf32_External_Verneed;
-
-typedef Elf32_External_Verneed Elf64_External_Verneed;
+} Elf_External_Verneed;
 
 /* This structure appears in a SHT_GNU_verneed section.  */
 
@@ -235,17 +281,38 @@ typedef struct {
   unsigned char                vna_other[2];
   unsigned char                vna_name[4];
   unsigned char                vna_next[4];
-} Elf32_External_Vernaux;
-
-typedef Elf32_External_Vernaux Elf64_External_Vernaux;
+} Elf_External_Vernaux;
 
 /* This structure appears in a SHT_GNU_versym section.  This is not a
    standard ELF structure; ELF just uses Elf32_Half.  */
 
 typedef struct {
   unsigned char                vs_vers[2];
-} Elf32_External_Versym;
+} ATTRIBUTE_PACKED  Elf_External_Versym;
+
+/* Structure for syminfo section.  */
+typedef struct
+{
+  unsigned char                si_boundto[2];
+  unsigned char                si_flags[2];
+} Elf_External_Syminfo;
+
+
+/* This structure appears on the stack and in NT_AUXV core file notes.  */
+typedef struct
+{
+  unsigned char                a_type[4];
+  unsigned char                a_val[4];
+} Elf32_External_Auxv;
+
+typedef struct
+{
+  unsigned char                a_type[8];
+  unsigned char                a_val[8];
+} Elf64_External_Auxv;
+
+/* Size of SHT_GROUP section entry.  */
 
-typedef Elf32_External_Versym Elf64_External_Versym;
+#define GRP_ENTRY_SIZE         4
 
 #endif /* _ELF_EXTERNAL_H */
This page took 0.030538 seconds and 4 git commands to generate.