1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 17:52:07 +02:00

elf: Clean up the ELF header file

Fix various style violations in elf.h
- use correct comment format if the comment fits in just one line
- remove the ending period for the one-line comment
- use tab for the indention instead of space
- put the opening brace at the same line of a typedef/union
- remove <name> in a 'typedef struct' for consistency

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
This commit is contained in:
Bin Meng
2018-04-11 22:02:12 -07:00
parent 45519924a0
commit df635df2e0

View File

@@ -5,10 +5,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* This is the ELF ABI header file
* formerly known as "elf_abi.h".
*/
/* This is the ELF ABI header file formerly known as "elf_abi.h" */
#ifndef _ELF_H
#define _ELF_H
@@ -16,20 +13,16 @@
#ifndef __ASSEMBLER__
#include "compiler.h"
/*
* This version doesn't work for 64-bit ABIs - Erik.
*/
/* This version doesn't work for 64-bit ABIs - Erik */
/*
* These typedefs need to be handled better.
*/
/* These typedefs need to be handled better */
typedef uint32_t Elf32_Addr; /* Unsigned program address */
typedef uint32_t Elf32_Off; /* Unsigned file offset */
typedef int32_t Elf32_Sword; /* Signed large integer */
typedef uint32_t Elf32_Word; /* Unsigned large integer */
typedef uint16_t Elf32_Half; /* Unsigned medium integer */
/* 64-bit ELF base types. */
/* 64-bit ELF base types */
typedef uint64_t Elf64_Addr;
typedef uint16_t Elf64_Half;
typedef int16_t Elf64_SHalf;
@@ -96,7 +89,7 @@ typedef int64_t Elf64_Sxword;
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
/* ELF Header */
typedef struct elfhdr{
typedef struct {
unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
Elf32_Half e_type; /* object file type */
Elf32_Half e_machine; /* machine */
@@ -327,7 +320,7 @@ typedef struct {
#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */
/* Symbol Table Entry */
typedef struct elf32_sym {
typedef struct {
Elf32_Word st_name; /* name - index into string table */
Elf32_Addr st_value; /* symbol value */
Elf32_Word st_size; /* symbol size */
@@ -374,17 +367,14 @@ typedef struct elf32_sym {
#define STV_HIDDEN 2 /* Symbol unavailable in other mods */
#define STV_PROTECTED 3 /* Not preemptible, not exported */
/* Relocation entry with implicit addend */
typedef struct
{
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
} Elf32_Rel;
/* Relocation entry with explicit addend */
typedef struct
{
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */
Elf32_Word r_info; /* symbol table index and type */
Elf32_Sword r_addend;
@@ -411,9 +401,9 @@ typedef struct {
Elf32_Word p_type; /* segment type */
Elf32_Off p_offset; /* segment offset */
Elf32_Addr p_vaddr; /* virtual address of segment */
Elf32_Addr p_paddr; /* physical address - ignored? */
Elf32_Word p_filesz; /* number of bytes in file for seg. */
Elf32_Word p_memsz; /* number of bytes in mem. for seg. */
Elf32_Addr p_paddr; /* physical address of segment */
Elf32_Word p_filesz; /* number of bytes in file for seg */
Elf32_Word p_memsz; /* number of bytes in mem. for seg */
Elf32_Word p_flags; /* flags */
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
@@ -441,11 +431,9 @@ typedef struct {
#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */
/* specific segment flags */
/* Dynamic structure */
typedef struct
{
typedef struct {
Elf32_Sword d_tag; /* controls meaning of d_val */
union
{
union {
Elf32_Word d_val; /* Multiple meanings - see d_tag */
Elf32_Addr d_ptr; /* program virtual address */
} d_un;
@@ -477,12 +465,12 @@ typedef struct {
#define DT_RELAENT 9 /* size of relocation entry */
#define DT_STRSZ 10 /* size of string table */
#define DT_SYMENT 11 /* size of symbol table entry */
#define DT_INIT 12 /* address of initialization func. */
#define DT_INIT 12 /* address of initialization func */
#define DT_FINI 13 /* address of termination function */
#define DT_SONAME 14 /* string table offset of shared obj */
#define DT_RPATH 15 /* string table offset of library
search path */
#define DT_SYMBOLIC 16 /* start sym search in shared obj. */
#define DT_SYMBOLIC 16 /* start sym search in shared obj */
#define DT_REL 17 /* address of rel. tbl. w addends */
#define DT_RELSZ 18 /* size of DT_REL relocation table */
#define DT_RELENT 19 /* size of DT_REL relocation entry */
@@ -500,7 +488,7 @@ typedef struct {
#define DT_ENCODING 32 /* Start of encoded range */
#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/
#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */
#define DT_NUM 34 /* Number used. */
#define DT_NUM 34 /* Number used */
#define DT_LOOS 0x60000000 /* reserved range for OS */
#define DT_HIOS 0x6fffffff /* specific dynamic array tags */
#define DT_LOPROC 0x70000000 /* reserved range for processor */
@@ -525,7 +513,7 @@ unsigned long elf_hash(const unsigned char *name);
* but we'll put them in for simplicity.
*/
/* Values for Elf32/64_Ehdr.e_flags. */
/* Values for Elf32/64_Ehdr.e_flags */
#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */
/* Cygnus local bits below */
@@ -536,7 +524,7 @@ unsigned long elf_hash(const unsigned char *name);
/* PowerPC relocations defined by the ABIs */
#define R_PPC_NONE 0
#define R_PPC_ADDR32 1 /* 32bit absolute address */
#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored */
#define R_PPC_ADDR16 3 /* 16bit absolute address */
#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
@@ -571,11 +559,13 @@ unsigned long elf_hash(const unsigned char *name);
#define R_PPC_SECTOFF_LO 34
#define R_PPC_SECTOFF_HI 35
#define R_PPC_SECTOFF_HA 36
/* Keep this the last entry. */
/* Keep this the last entry */
#define R_PPC_NUM 37
/* The remaining relocs are from the Embedded ELF ABI, and are not
in the SVR4 ELF ABI. */
/*
* The remaining relocs are from the Embedded ELF ABI, and are not
* in the SVR4 ELF ABI.
*/
#define R_PPC_EMB_NADDR32 101
#define R_PPC_EMB_NADDR16 102
#define R_PPC_EMB_NADDR16_LO 103
@@ -593,7 +583,7 @@ unsigned long elf_hash(const unsigned char *name);
#define R_PPC_EMB_BIT_FLD 115
#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
/* Diab tool relocations. */
/* Diab tool relocations */
#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
@@ -601,8 +591,10 @@ unsigned long elf_hash(const unsigned char *name);
#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
/* This is a phony reloc to handle any old fashioned TOC16 references
that may still be in object files. */
/*
* This is a phony reloc to handle any old fashioned TOC16 references
* that may still be in object files.
*/
#define R_PPC_TOC16 255
/* ARM relocs */
@@ -610,8 +602,8 @@ unsigned long elf_hash(const unsigned char *name);
#define R_ARM_RELATIVE 23 /* Adjust by program base */
/* AArch64 relocs */
#define R_AARCH64_NONE 0 /* No relocation. */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base. */
#define R_AARCH64_NONE 0 /* No relocation */
#define R_AARCH64_RELATIVE 1027 /* Adjust by program base */
/* RISC-V relocations */
#define R_RISCV_32 1