You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/11/23 11:35:04 UTC

[incubator-nuttx] branch master updated (627eb08 -> 0f76ff4)

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 627eb08  boards/raspberrypi-pico: Fix some typos in README.txt
     new f33c46a  elf: add elf define of Note Section
     new 4c76c35  arch/arm: add more arch elf define
     new 0f76ff4  arch/sim: add arch elf define

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 arch/arm/include/elf.h                             |  24 +++-
 .../libc/net/lib_htonl.c => arch/sim/include/elf.h |  47 ++++----
 include/elf.h                                      | 134 ++++++++++++++++++++-
 include/elf32.h                                    |  11 ++
 include/elf64.h                                    |  11 ++
 5 files changed, 200 insertions(+), 27 deletions(-)
 copy libs/libc/net/lib_htonl.c => arch/sim/include/elf.h (62%)

[incubator-nuttx] 02/03: arch/arm: add more arch elf define

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 4c76c356ef55c7e4f2bb26dad3a69a3ceead6a92
Author: chao.an <an...@xiaomi.com>
AuthorDate: Mon Nov 22 10:08:31 2021 +0800

    arch/arm: add more arch elf define
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 arch/arm/include/elf.h | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/elf.h b/arch/arm/include/elf.h
index fb87e2c..e74fbf4 100644
--- a/arch/arm/include/elf.h
+++ b/arch/arm/include/elf.h
@@ -37,8 +37,13 @@
  *                     ELFDATA2MSB (big endian)
  */
 
-#if 0 /* Defined in include/elf32.h */
-#define EM_ARM                   40
+#define EM_ARCH                  EM_ARM
+#define ELF_CLASS                ELFCLASS32
+
+#ifdef CONFIG_ENDIAN_BIG
+#  define ELF_DATA               ELFDATA2MSB
+#else
+#  define ELF_DATA               ELFDATA2LSB
 #endif
 
 /* Table 4-2, ARM-specific e_flags */
@@ -53,6 +58,21 @@
 
 #define EF_ARM_BE8               0x00800000
 
+#define EF_ARM_ABI_FLOAT_SOFT    0x00000200
+#define EF_ARM_ABI_FLOAT_HARD    0x00000400
+
+#ifdef __VFP_FP__
+#  ifdef __ARM_PCS_VFP
+#    define EF_ARM_ABI_FLOAT     EF_ARM_ABI_FLOAT_HARD
+#  else
+#    define EF_ARM_ABI_FLOAT     EF_ARM_ABI_FLOAT_SOFT
+#  endif
+#else
+#  define EF_ARM_ABI_FLOAT       0
+#endif
+
+#define EF_FLAG                  (EF_ARM_EABI_VER5 | EF_ARM_ABI_FLOAT)
+
 /* Table 4-4, Processor specific section types */
 
 #define SHT_ARM_EXIDX            0x70000001 /* Exception Index table */

[incubator-nuttx] 03/03: arch/sim: add arch elf define

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 0f76ff42eb7ea87a34a3cd7aac9c933ba61f111c
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Nov 17 23:48:44 2021 +0800

    arch/sim: add arch elf define
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 arch/sim/include/elf.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/arch/sim/include/elf.h b/arch/sim/include/elf.h
new file mode 100644
index 0000000..800894a
--- /dev/null
+++ b/arch/sim/include/elf.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+ * arch/sim/include/elf.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_SIM_INCLUDE_ELF_H
+#define __ARCH_SIM_INCLUDE_ELF_H
+
+/****************************************************************************
+ * Pre-processor Prototypes
+ ****************************************************************************/
+
+/* 4.3.1 ELF Identification.  Should have:
+ *
+ * e_machine         = EM_386
+ * e_ident[EI_CLASS] = ELFCLASS32
+ * e_ident[EI_DATA]  = ELFDATA2LSB (little endian) or
+ *                     ELFDATA2MSB (big endian)
+ */
+
+#ifdef CONFIG_SIM_M32
+#  define EM_ARCH                EM_386
+#  define ELF_CLASS              ELFCLASS32
+#else
+#  define EM_ARCH                EM_X86_64
+#  define ELF_CLASS              ELFCLASS32
+#endif
+
+#ifdef CONFIG_ENDIAN_BIG
+#  define ELF_DATA               ELFDATA2MSB
+#else
+#  define ELF_DATA               ELFDATA2LSB
+#endif
+
+#define EF_FLAG                  0
+
+#endif /* __ARCH_SIM_INCLUDE_ELF_H */

[incubator-nuttx] 01/03: elf: add elf define of Note Section

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit f33c46af21830f5e350594ac7cc03292d8cfb32b
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Nov 17 23:28:21 2021 +0800

    elf: add elf define of Note Section
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 include/elf.h   | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 include/elf32.h |  11 +++++
 include/elf64.h |  11 +++++
 3 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/include/elf.h b/include/elf.h
index 8f599d7..1eb05d3 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -103,13 +103,20 @@
 #define EI_CLASS           4      /* File class */
 #define EI_DATA            5      /* Data encoding */
 #define EI_VERSION         6      /* File version */
-#define EI_PAD             7      /* Start of padding bytes */
+#define EI_OSABI           7      /* OS ABI */
+#define EI_PAD             8      /* Start of padding bytes */
 
 /* EI_NIDENT is defined in "Included Files" section */
 
 #define EI_MAGIC_SIZE      4
 #define EI_MAGIC           {0x7f, 'E', 'L', 'F'}
 
+#define ELFMAG0            0x7f    /* EI_MAG */
+#define ELFMAG1            'E'
+#define ELFMAG2            'L'
+#define ELFMAG3            'F'
+#define ELFMAG             "\177ELF"
+
 /* Table 3. Values for EI_CLASS */
 
 #define ELFCLASSNONE       0      /* Invalid class */
@@ -122,6 +129,30 @@
 #define ELFDATA2LSB        1     /* Least significant byte occupying the lowest address */
 #define ELFDATA2MSB        2     /* Most significant byte occupying the lowest address */
 
+/* Table 6. Values for EI_OSABI */
+
+#define ELFOSABI_NONE      0     /* UNIX System V ABI */
+#define ELFOSABI_SYSV      0     /* Alias.  */
+#define ELFOSABI_HPUX      1     /* HP-UX */
+#define ELFOSABI_NETBSD    2     /* NetBSD.  */
+#define ELFOSABI_GNU       3     /* Object uses GNU ELF extensions.  */
+#define ELFOSABI_LINUX     ELFOSABI_GNU
+                                 /* Compatibility alias.  */
+#define ELFOSABI_SOLARIS   6     /* Sun Solaris.  */
+#define ELFOSABI_AIX       7     /* IBM AIX.  */
+#define ELFOSABI_IRIX      8     /* SGI Irix.  */
+#define ELFOSABI_FREEBSD   9     /* FreeBSD.  */
+#define ELFOSABI_TRU64     10    /* Compaq TRU64 UNIX.  */
+#define ELFOSABI_MODESTO   11    /* Novell Modesto.  */
+#define ELFOSABI_OPENBSD   12    /* OpenBSD.  */
+#define ELFOSABI_ARM_AEABI 64    /* ARM EABI */
+#define ELFOSABI_ARM       97    /* ARM */
+#define ELFOSABI_STANDALONE 255  /* Standalone (embedded) application */
+
+#ifndef ELF_OSABI
+#define ELF_OSABI          ELFOSABI_NONE
+#endif
+
 /* Table 7: Special Section Indexes */
 
 #define SHN_UNDEF          0
@@ -223,4 +254,105 @@
 #define DT_LOPROC          0x70000000 /* d_un=unspecified */
 #define DT_HIPROC          0x7fffffff /* d_un= unspecified */
 
+/* Legal values for note segment descriptor types for core files. */
+
+#define NT_PRSTATUS        1      /* Contains copy of prstatus struct */
+#define NT_PRFPREG         2      /* Contains copy of fpregset struct. */
+#define NT_FPREGSET        2      /* Contains copy of fpregset struct */
+#define NT_PRPSINFO        3      /* Contains copy of prpsinfo struct */
+#define NT_PRXREG          4      /* Contains copy of prxregset struct */
+#define NT_TASKSTRUCT      4      /* Contains copy of task structure */
+#define NT_PLATFORM        5      /* String from sysinfo(SI_PLATFORM) */
+#define NT_AUXV            6      /* Contains copy of auxv array */
+#define NT_GWINDOWS        7      /* Contains copy of gwindows struct */
+#define NT_ASRS            8      /* Contains copy of asrset struct */
+#define NT_PSTATUS         10     /* Contains copy of pstatus struct */
+#define NT_PSINFO          13     /* Contains copy of psinfo struct */
+#define NT_PRCRED          14     /* Contains copy of prcred struct */
+#define NT_UTSNAME         15     /* Contains copy of utsname struct */
+#define NT_LWPSTATUS       16     /* Contains copy of lwpstatus struct */
+#define NT_LWPSINFO        17     /* Contains copy of lwpinfo struct */
+#define NT_PRFPXREG        20     /* Contains copy of fprxregset struct */
+#define NT_SIGINFO         0x53494749
+                                  /* Contains copy of siginfo_t,
+                                   * size might increase
+                                   */
+#define NT_FILE            0x46494c45
+                                  /* Contains information about mapped
+                                   * files
+                                   */
+#define NT_PRXFPREG        0x46e62b7f
+                                  /* Contains copy of user_fxsr_struct */
+#define NT_PPC_VMX         0x100  /* PowerPC Altivec/VMX registers */
+#define NT_PPC_SPE         0x101  /* PowerPC SPE/EVR registers */
+#define NT_PPC_VSX         0x102  /* PowerPC VSX registers */
+#define NT_PPC_TAR         0x103  /* Target Address Register */
+#define NT_PPC_PPR         0x104  /* Program Priority Register */
+#define NT_PPC_DSCR        0x105  /* Data Stream Control Register */
+#define NT_PPC_EBB         0x106  /* Event Based Branch Registers */
+#define NT_PPC_PMU         0x107  /* Performance Monitor Registers */
+#define NT_PPC_TM_CGPR     0x108  /* TM checkpointed GPR Registers */
+#define NT_PPC_TM_CFPR     0x109  /* TM checkpointed FPR Registers */
+#define NT_PPC_TM_CVMX     0x10a  /* TM checkpointed VMX Registers */
+#define NT_PPC_TM_CVSX     0x10b  /* TM checkpointed VSX Registers */
+#define NT_PPC_TM_SPR      0x10c  /* TM Special Purpose Registers */
+#define NT_PPC_TM_CTAR     0x10d  /* TM checkpointed Target Address
+                                   * Register
+                                   */
+#define NT_PPC_TM_CPPR     0x10e  /* TM checkpointed Program Priority
+                                   * Register
+                                   */
+#define NT_PPC_TM_CDSCR    0x10f  /* TM checkpointed Data Stream Control
+                                   * Register
+                                   */
+#define NT_PPC_PKEY        0x110  /* Memory Protection Keys
+                                   * registers.
+                                   */
+#define NT_386_TLS         0x200  /* i386 TLS slots (struct user_desc) */
+#define NT_386_IOPERM      0x201  /* x86 io permission bitmap (1=deny) */
+#define NT_X86_XSTATE      0x202  /* x86 extended state using xsave */
+#define NT_S390_HIGH_GPRS  0x300  /* s390 upper register halves */
+#define NT_S390_TIMER      0x301  /* s390 timer register */
+#define NT_S390_TODCMP     0x302  /* s390 TOD clock comparator register */
+#define NT_S390_TODPREG    0x303  /* s390 TOD programmable register */
+#define NT_S390_CTRS       0x304  /* s390 control registers */
+#define NT_S390_PREFIX     0x305  /* s390 prefix register */
+#define NT_S390_LAST_BREAK 0x306  /* s390 breaking event address */
+#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
+#define NT_S390_TDB        0x308  /* s390 transaction diagnostic block */
+#define NT_S390_VXRS_LOW   0x309  /* s390 vector registers 0-15
+                                   * upper half.
+                                   */
+#define NT_S390_VXRS_HIGH  0x30a  /* s390 vector registers 16-31.  */
+#define NT_S390_GS_CB      0x30b  /* s390 guarded storage registers.  */
+#define NT_S390_GS_BC      0x30c  /* s390 guarded storage
+                                   * broadcast control block.
+                                   */
+#define NT_S390_RI_CB      0x30d  /* s390 runtime instrumentation.  */
+#define NT_ARM_VFP         0x400  /* ARM VFP/NEON registers */
+#define NT_ARM_TLS         0x401  /* ARM TLS register */
+#define NT_ARM_HW_BREAK    0x402  /* ARM hardware breakpoint registers */
+#define NT_ARM_HW_WATCH    0x403  /* ARM hardware watchpoint registers */
+#define NT_ARM_SYSTEM_CALL 0x404  /* ARM system call number */
+#define NT_ARM_SVE         0x405  /* ARM Scalable Vector Extension
+                                   * registers
+                                   */
+#define NT_ARM_PAC_MASK    0x406  /* ARM pointer authentication
+                                   * code masks.
+                                   */
+#define NT_ARM_PACA_KEYS   0x407  /* ARM pointer authentication
+                                   * address keys.
+                                   */
+#define NT_ARM_PACG_KEYS   0x408  /* ARM pointer authentication
+                                   * generic key.
+                                   */
+#define NT_VMCOREDD        0x700  /* Vmcore Device Dump Note.  */
+#define NT_MIPS_DSP        0x800  /* MIPS DSP ASE registers.  */
+#define NT_MIPS_FP_MODE    0x801  /* MIPS floating-point mode.  */
+#define NT_MIPS_MSA        0x802  /* MIPS SIMD registers.  */
+
+/* Legal values for the note segment descriptor types for object files.  */
+
+#define NT_VERSION         1      /* Contains a version string.  */
+
 #endif /* __INCLUDE_ELF_H */
diff --git a/include/elf32.h b/include/elf32.h
index f09b5e4..ef4d511 100644
--- a/include/elf32.h
+++ b/include/elf32.h
@@ -135,6 +135,15 @@ typedef struct
   Elf32_Word   p_align;
 } Elf32_Phdr;
 
+/* Figure 5-7: Note Information */
+
+typedef struct
+{
+  Elf32_Word   n_namesz; /* Length of the note's name.  */
+  Elf32_Word   n_descsz; /* Length of the note's descriptor.  */
+  Elf32_Word   n_type;   /* Type of the note.  */
+} Elf32_Nhdr;
+
 /* Figure 5-9: Dynamic Structure */
 
 typedef struct
@@ -151,6 +160,8 @@ typedef Elf32_Addr  Elf_Addr;
 typedef Elf32_Ehdr  Elf_Ehdr;
 typedef Elf32_Rel   Elf_Rel;
 typedef Elf32_Rela  Elf_Rela;
+typedef Elf32_Nhdr  Elf_Nhdr;
+typedef Elf32_Phdr  Elf_Phdr;
 typedef Elf32_Sym   Elf_Sym;
 typedef Elf32_Shdr  Elf_Shdr;
 typedef Elf32_Word  Elf_Word;
diff --git a/include/elf64.h b/include/elf64.h
index 007d650..1f6da82 100644
--- a/include/elf64.h
+++ b/include/elf64.h
@@ -135,6 +135,15 @@ typedef struct
   Elf64_Word   p_align;    /* Alignment of segment */
 } Elf64_Phdr;
 
+/* Figure 7. Format of a Note Section */
+
+typedef struct
+{
+  Elf64_Word   n_namesz;   /* Length of the note's name.  */
+  Elf64_Word   n_descsz;   /* Length of the note's descriptor.  */
+  Elf64_Word   n_type;     /* Type of the note.  */
+} Elf64_Nhdr;
+
 /* Figure 8: Dynamic Table Structure */
 
 typedef struct
@@ -151,6 +160,8 @@ typedef Elf64_Addr  Elf_Addr;
 typedef Elf64_Ehdr  Elf_Ehdr;
 typedef Elf64_Rel   Elf_Rel;
 typedef Elf64_Rela  Elf_Rela;
+typedef Elf64_Nhdr  Elf_Nhdr;
+typedef Elf64_Phdr  Elf_Phdr;
 typedef Elf64_Sym   Elf_Sym;
 typedef Elf64_Shdr  Elf_Shdr;
 typedef Elf64_Word  Elf_Word;