BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@@ -130,7 +130,7 @@ InitializeElf32 (
|
||||
//
|
||||
// Initialize data pointer and structures.
|
||||
//
|
||||
mEhdr = (Elf_Ehdr*) FileBuffer;
|
||||
mEhdr = (Elf_Ehdr*) FileBuffer;
|
||||
|
||||
//
|
||||
// Check the ELF32 specific header information.
|
||||
@@ -142,12 +142,12 @@ InitializeElf32 (
|
||||
if (mEhdr->e_ident[EI_DATA] != ELFDATA2LSB) {
|
||||
Error (NULL, 0, 3000, "Unsupported", "ELF EI_DATA not ELFDATA2LSB");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if ((mEhdr->e_type != ET_EXEC) && (mEhdr->e_type != ET_DYN)) {
|
||||
Error (NULL, 0, 3000, "Unsupported", "ELF e_type not ET_EXEC or ET_DYN");
|
||||
return FALSE;
|
||||
}
|
||||
if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) {
|
||||
if (!((mEhdr->e_machine == EM_386) || (mEhdr->e_machine == EM_ARM))) {
|
||||
Error (NULL, 0, 3000, "Unsupported", "ELF e_machine not EM_386 or EM_ARM");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -155,13 +155,13 @@ InitializeElf32 (
|
||||
Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) mEhdr->e_version, EV_CURRENT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Update section header pointers
|
||||
//
|
||||
mShdrBase = (Elf_Shdr *)((UINT8 *)mEhdr + mEhdr->e_shoff);
|
||||
mPhdrBase = (Elf_Phdr *)((UINT8 *)mEhdr + mEhdr->e_phoff);
|
||||
|
||||
|
||||
//
|
||||
// Create COFF Section offset buffer and zero.
|
||||
//
|
||||
@@ -707,20 +707,20 @@ WriteSections32 (
|
||||
if ((RelShdr->sh_type != SHT_REL) && (RelShdr->sh_type != SHT_RELA)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Relocation section found. Now extract section information that the relocations
|
||||
// apply to in the ELF data and the new COFF data.
|
||||
//
|
||||
SecShdr = GetShdrByIndex(RelShdr->sh_info);
|
||||
SecOffset = mCoffSectionsOffset[RelShdr->sh_info];
|
||||
|
||||
|
||||
//
|
||||
// Only process relocations for the current filter type.
|
||||
//
|
||||
if (RelShdr->sh_type == SHT_REL && (*Filter)(SecShdr)) {
|
||||
UINT32 RelOffset;
|
||||
|
||||
|
||||
//
|
||||
// Determine the symbol table referenced by the relocation data.
|
||||
//
|
||||
@@ -735,18 +735,18 @@ WriteSections32 (
|
||||
// Set pointer to relocation entry
|
||||
//
|
||||
Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelOffset);
|
||||
|
||||
|
||||
//
|
||||
// Set pointer to symbol table entry associated with the relocation entry.
|
||||
//
|
||||
Elf_Sym *Sym = (Elf_Sym *)(Symtab + ELF_R_SYM(Rel->r_info) * SymtabShdr->sh_entsize);
|
||||
|
||||
|
||||
Elf_Shdr *SymShdr;
|
||||
UINT8 *Targ;
|
||||
UINT16 Address;
|
||||
|
||||
//
|
||||
// Check section header index found in symbol table and get the section
|
||||
// Check section header index found in symbol table and get the section
|
||||
// header location.
|
||||
//
|
||||
if (Sym->st_shndx == SHN_UNDEF
|
||||
@@ -768,7 +768,7 @@ WriteSections32 (
|
||||
//
|
||||
// Convert the relocation data to a pointer into the coff file.
|
||||
//
|
||||
// Note:
|
||||
// Note:
|
||||
// r_offset is the virtual address of the storage unit to be relocated.
|
||||
// sh_addr is the virtual address for the base of the section.
|
||||
//
|
||||
@@ -814,9 +814,9 @@ WriteSections32 (
|
||||
case R_ARM_THM_JUMP19:
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JMP24:
|
||||
case R_ARM_THM_JUMP24:
|
||||
case R_ARM_PREL31:
|
||||
case R_ARM_MOVW_PREL_NC:
|
||||
case R_ARM_THM_JUMP24:
|
||||
case R_ARM_PREL31:
|
||||
case R_ARM_MOVW_PREL_NC:
|
||||
case R_ARM_MOVT_PREL:
|
||||
case R_ARM_THM_MOVW_PREL_NC:
|
||||
case R_ARM_THM_MOVT_PREL:
|
||||
@@ -909,7 +909,7 @@ WriteRelocations32 (
|
||||
for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
|
||||
Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
|
||||
|
||||
if (mEhdr->e_machine == EM_386) {
|
||||
if (mEhdr->e_machine == EM_386) {
|
||||
switch (ELF_R_TYPE(Rel->r_info)) {
|
||||
case R_386_NONE:
|
||||
case R_386_PC32:
|
||||
@@ -941,9 +941,9 @@ WriteRelocations32 (
|
||||
case R_ARM_THM_JUMP19:
|
||||
case R_ARM_CALL:
|
||||
case R_ARM_JMP24:
|
||||
case R_ARM_THM_JUMP24:
|
||||
case R_ARM_PREL31:
|
||||
case R_ARM_MOVW_PREL_NC:
|
||||
case R_ARM_THM_JUMP24:
|
||||
case R_ARM_PREL31:
|
||||
case R_ARM_MOVW_PREL_NC:
|
||||
case R_ARM_MOVT_PREL:
|
||||
case R_ARM_THM_MOVW_PREL_NC:
|
||||
case R_ARM_THM_MOVT_PREL:
|
||||
@@ -1090,7 +1090,7 @@ WriteRelocations32 (
|
||||
case R_ARM_RABS32:
|
||||
CoffAddFixup (Rel->r_offset, EFI_IMAGE_REL_BASED_HIGHLOW);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Error (NULL, 0, 3000, "Invalid", "%s bad ARM dynamic relocations, unkown type %d.", mInImageName, ELF32_R_TYPE (Rel->r_info));
|
||||
break;
|
||||
@@ -1163,7 +1163,7 @@ SetImageSize32 (
|
||||
)
|
||||
{
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
|
||||
|
||||
|
||||
//
|
||||
// Set image size
|
||||
//
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
Header file for Elf32 Convert solution
|
||||
|
||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
|
@@ -800,24 +800,24 @@ WriteSections64 (
|
||||
// Absolute relocation.
|
||||
//
|
||||
VerboseMsg ("R_X86_64_64");
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
*(UINT64 *)Targ);
|
||||
*(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx];
|
||||
VerboseMsg ("Relocation: 0x%016LX", *(UINT64*)Targ);
|
||||
break;
|
||||
case R_X86_64_32:
|
||||
VerboseMsg ("R_X86_64_32");
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
*(UINT32 *)Targ);
|
||||
*(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
|
||||
VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
|
||||
break;
|
||||
case R_X86_64_32S:
|
||||
VerboseMsg ("R_X86_64_32S");
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
*(UINT32 *)Targ);
|
||||
*(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
|
||||
VerboseMsg ("Relocation: 0x%08X", *(UINT32*)Targ);
|
||||
@@ -838,8 +838,8 @@ WriteSections64 (
|
||||
// Relative relocation: Symbol - Ip + Addend
|
||||
//
|
||||
VerboseMsg ("R_X86_64_PC32");
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
|
||||
(UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
|
||||
*(UINT32 *)Targ);
|
||||
*(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
|
||||
+ (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
|
||||
@@ -986,7 +986,7 @@ WriteRelocations64 (
|
||||
case R_X86_64_PLT32:
|
||||
break;
|
||||
case R_X86_64_64:
|
||||
VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X",
|
||||
VerboseMsg ("EFI_IMAGE_REL_BASED_DIR64 Offset: 0x%08X",
|
||||
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
||||
CoffAddFixup(
|
||||
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
|
||||
@@ -995,7 +995,7 @@ WriteRelocations64 (
|
||||
break;
|
||||
case R_X86_64_32S:
|
||||
case R_X86_64_32:
|
||||
VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",
|
||||
VerboseMsg ("EFI_IMAGE_REL_BASED_HIGHLOW Offset: 0x%08X",
|
||||
mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
||||
CoffAddFixup(
|
||||
(UINT32) ((UINT64) mCoffSectionsOffset[RelShdr->sh_info]
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
Header file for Elf64 convert solution
|
||||
|
||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
|
@@ -3,9 +3,9 @@ Elf convert solution
|
||||
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@@ -92,7 +92,7 @@ CoffAddFixup(
|
||||
// Add a null entry (is it required ?)
|
||||
//
|
||||
CoffAddFixupEntry (0);
|
||||
|
||||
|
||||
//
|
||||
// Pad for alignment.
|
||||
//
|
||||
@@ -163,7 +163,7 @@ IsElfHeader (
|
||||
UINT8 *FileBuffer
|
||||
)
|
||||
{
|
||||
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
||||
return (FileBuffer[EI_MAG0] == ELFMAG0 &&
|
||||
FileBuffer[EI_MAG1] == ELFMAG1 &&
|
||||
FileBuffer[EI_MAG2] == ELFMAG2 &&
|
||||
FileBuffer[EI_MAG3] == ELFMAG3);
|
||||
@@ -199,7 +199,7 @@ ConvertElf (
|
||||
|
||||
//
|
||||
// Compute sections new address.
|
||||
//
|
||||
//
|
||||
VerboseMsg ("Compute sections new address.");
|
||||
ElfFunctions.ScanSections ();
|
||||
|
||||
@@ -246,6 +246,6 @@ ConvertElf (
|
||||
// Free resources used by ELF functions.
|
||||
//
|
||||
ElfFunctions.CleanUp ();
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@ Header file for Elf convert solution
|
||||
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
@@ -45,7 +45,7 @@ typedef enum {
|
||||
SECTION_TEXT,
|
||||
SECTION_HII,
|
||||
SECTION_DATA
|
||||
|
||||
|
||||
} SECTION_FILTER_TYPES;
|
||||
|
||||
//
|
||||
@@ -58,7 +58,7 @@ typedef struct {
|
||||
VOID (*WriteDebug) ();
|
||||
VOID (*SetImageSize) ();
|
||||
VOID (*CleanUp) ();
|
||||
|
||||
|
||||
} ELF_FUNCTION_TABLE;
|
||||
|
||||
//
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Converts a pe32+ image to an FW, Te image type, or other specific image.
|
||||
|
||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -169,7 +169,7 @@ Returns:
|
||||
//
|
||||
// Copyright declaration
|
||||
//
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.\n\n");
|
||||
fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");
|
||||
|
||||
//
|
||||
// Details Option
|
||||
@@ -242,7 +242,7 @@ Returns:
|
||||
If it is combined with other action options, the later\n\
|
||||
input action option will override the previous one.\n");
|
||||
fprintf (stdout, " -a NUM, --align NUM NUM is one HEX or DEC format alignment value.\n\
|
||||
This option is only used together with -j option.\n");
|
||||
This option is only used together with -j option.\n");
|
||||
fprintf (stdout, " -p NUM, --pad NUM NUM is one HEX or DEC format padding value.\n\
|
||||
This option is only used together with -j option.\n");
|
||||
fprintf (stdout, " --keepexceptiontable Don't clear exception table.\n\
|
||||
@@ -490,7 +490,7 @@ SetHiiResourceHeader (
|
||||
}
|
||||
|
||||
//
|
||||
// Now it ought to be resource Data and update its OffsetToData value
|
||||
// Now it ought to be resource Data and update its OffsetToData value
|
||||
//
|
||||
if (!ResourceDirectoryEntry->u2.s.DataIsDirectory) {
|
||||
ResourceDataEntry = (EFI_IMAGE_RESOURCE_DATA_ENTRY *) (HiiBinData + ResourceDirectoryEntry->u2.OffsetToData);
|
||||
@@ -501,7 +501,7 @@ SetHiiResourceHeader (
|
||||
}
|
||||
ResourceDirectoryEntry++;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ GetPeCoffHeader (
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return PeHdr;
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ PeCoffConvertImageToXip (
|
||||
if (PeHdr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (PeHdr->Pe32.OptionalHeader.SectionAlignment != PeHdr->Pe32.OptionalHeader.FileAlignment) {
|
||||
//
|
||||
// The only reason to expand zero fill sections is to make them compatible with XIP images.
|
||||
@@ -672,7 +672,7 @@ PeCoffConvertImageToXip (
|
||||
|
||||
UINT8 *
|
||||
CreateHiiResouceSectionHeader (
|
||||
UINT32 *pSectionHeaderSize,
|
||||
UINT32 *pSectionHeaderSize,
|
||||
UINT32 HiiDataSize
|
||||
)
|
||||
/*++
|
||||
@@ -705,8 +705,8 @@ Returns:
|
||||
// Calculate the total size for the resource header (include Type, Name and Language)
|
||||
// then allocate memory for the resource header.
|
||||
//
|
||||
HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY))
|
||||
+ 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16))
|
||||
HiiSectionHeaderSize = 3 * (sizeof (EFI_IMAGE_RESOURCE_DIRECTORY) + sizeof (EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY))
|
||||
+ 3 * (sizeof (UINT16) + 3 * sizeof (CHAR16))
|
||||
+ sizeof (EFI_IMAGE_RESOURCE_DATA_ENTRY);
|
||||
HiiSectionHeader = malloc (HiiSectionHeaderSize);
|
||||
if (HiiSectionHeader == NULL) {
|
||||
@@ -717,7 +717,7 @@ Returns:
|
||||
|
||||
HiiSectionOffset = 0;
|
||||
//
|
||||
// Create Type entry
|
||||
// Create Type entry
|
||||
//
|
||||
ResourceDirectory = (EFI_IMAGE_RESOURCE_DIRECTORY *) (HiiSectionHeader + HiiSectionOffset);
|
||||
HiiSectionOffset += sizeof (EFI_IMAGE_RESOURCE_DIRECTORY);
|
||||
@@ -877,7 +877,7 @@ Returns:
|
||||
|
||||
if (ImageContext.RelocationsStripped) {
|
||||
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -890,8 +890,8 @@ Returns:
|
||||
//
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||
(UINTN) ImgHdr +
|
||||
sizeof (UINT32) +
|
||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
sizeof (UINT32) +
|
||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||
);
|
||||
|
||||
@@ -957,7 +957,7 @@ Returns:
|
||||
|
||||
if (ImageContext.RelocationsStripped) {
|
||||
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -996,15 +996,15 @@ Returns:
|
||||
//
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
|
||||
(UINTN) ImgHdr +
|
||||
sizeof (UINT32) +
|
||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
sizeof (UINT32) +
|
||||
sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
|
||||
);
|
||||
|
||||
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
|
||||
CopyMem (
|
||||
FileBuffer + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||
FileBuffer + SectionHeader->PointerToRawData,
|
||||
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
|
||||
SectionHeader->SizeOfRawData
|
||||
);
|
||||
}
|
||||
@@ -2186,7 +2186,7 @@ Returns:
|
||||
goto Finish;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (NegativeAddr) {
|
||||
//
|
||||
// Set Base Address to a negative value.
|
||||
@@ -2534,7 +2534,7 @@ Returns:
|
||||
(TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress == 0) && \
|
||||
(TEImageHeader.DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC].Size == 0)) {
|
||||
//
|
||||
// PeImage can be loaded into memory, but it has no relocation section.
|
||||
// PeImage can be loaded into memory, but it has no relocation section.
|
||||
// Fix TeImage Header to set VA of relocation data directory to not zero, the size is still zero.
|
||||
//
|
||||
if (Optional32 != NULL) {
|
||||
@@ -2716,7 +2716,7 @@ Finish:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (InputFileBuffer != NULL) {
|
||||
free (InputFileBuffer);
|
||||
}
|
||||
@@ -2735,7 +2735,7 @@ Finish:
|
||||
ReportFileName = (CHAR8 *) malloc (FileLen + 1);
|
||||
if (ReportFileName != NULL) {
|
||||
strcpy (ReportFileName, OutImageName);
|
||||
strcpy (ReportFileName + (FileLen - 4), ".txt");
|
||||
strcpy (ReportFileName + (FileLen - 4), ".txt");
|
||||
ReportFile = fopen (LongFilePath (ReportFileName), "w+");
|
||||
if (ReportFile != NULL) {
|
||||
fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
|
||||
@@ -2789,7 +2789,7 @@ Returns:
|
||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||
EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
|
||||
EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY *RsdsEntry;
|
||||
UINT32 *NewTimeStamp;
|
||||
UINT32 *NewTimeStamp;
|
||||
|
||||
//
|
||||
// Init variable.
|
||||
@@ -2968,7 +2968,7 @@ Returns:
|
||||
EFI_IMAGE_OPTIONAL_HEADER64 *Optional64Hdr;
|
||||
EFI_IMAGE_SECTION_HEADER *SectionHeader;
|
||||
UINT32 *NewTimeStamp;
|
||||
|
||||
|
||||
//
|
||||
// Init variable.
|
||||
//
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
Header file for GenFw
|
||||
|
||||
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
|
@@ -48,38 +48,38 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
* ELF definitions common to all 32-bit architectures.
|
||||
*/
|
||||
|
||||
typedef UINT32 Elf32_Addr;
|
||||
typedef UINT16 Elf32_Half;
|
||||
typedef UINT32 Elf32_Off;
|
||||
typedef INT32 Elf32_Sword;
|
||||
typedef UINT32 Elf32_Word;
|
||||
typedef UINT64 Elf32_Lword;
|
||||
typedef UINT32 Elf32_Addr;
|
||||
typedef UINT16 Elf32_Half;
|
||||
typedef UINT32 Elf32_Off;
|
||||
typedef INT32 Elf32_Sword;
|
||||
typedef UINT32 Elf32_Word;
|
||||
typedef UINT64 Elf32_Lword;
|
||||
|
||||
typedef Elf32_Word Elf32_Hashelt;
|
||||
typedef Elf32_Word Elf32_Hashelt;
|
||||
|
||||
/* Non-standard class-dependent datatype used for abstraction. */
|
||||
typedef Elf32_Word Elf32_Size;
|
||||
typedef Elf32_Sword Elf32_Ssize;
|
||||
typedef Elf32_Word Elf32_Size;
|
||||
typedef Elf32_Sword Elf32_Ssize;
|
||||
|
||||
/*
|
||||
* ELF header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf32_Half e_type; /* File type. */
|
||||
Elf32_Half e_machine; /* Machine architecture. */
|
||||
Elf32_Word e_version; /* ELF format version. */
|
||||
Elf32_Addr e_entry; /* Entry point. */
|
||||
Elf32_Off e_phoff; /* Program header file offset. */
|
||||
Elf32_Off e_shoff; /* Section header file offset. */
|
||||
Elf32_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf32_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf32_Half e_phnum; /* Number of program header entries. */
|
||||
Elf32_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf32_Half e_shnum; /* Number of section header entries. */
|
||||
Elf32_Half e_shstrndx; /* Section name strings section. */
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf32_Half e_type; /* File type. */
|
||||
Elf32_Half e_machine; /* Machine architecture. */
|
||||
Elf32_Word e_version; /* ELF format version. */
|
||||
Elf32_Addr e_entry; /* Entry point. */
|
||||
Elf32_Off e_phoff; /* Program header file offset. */
|
||||
Elf32_Off e_shoff; /* Section header file offset. */
|
||||
Elf32_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf32_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf32_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf32_Half e_phnum; /* Number of program header entries. */
|
||||
Elf32_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf32_Half e_shnum; /* Number of section header entries. */
|
||||
Elf32_Half e_shstrndx; /* Section name strings section. */
|
||||
} Elf32_Ehdr;
|
||||
|
||||
/*
|
||||
@@ -87,17 +87,17 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf32_Word sh_type; /* Section type. */
|
||||
Elf32_Word sh_flags; /* Section flags. */
|
||||
Elf32_Addr sh_addr; /* Address in memory image. */
|
||||
Elf32_Off sh_offset; /* Offset in file. */
|
||||
Elf32_Word sh_size; /* Size in bytes. */
|
||||
Elf32_Word sh_link; /* Index of a related section. */
|
||||
Elf32_Word sh_info; /* Depends on section type. */
|
||||
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
||||
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
||||
Elf32_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf32_Word sh_type; /* Section type. */
|
||||
Elf32_Word sh_flags; /* Section flags. */
|
||||
Elf32_Addr sh_addr; /* Address in memory image. */
|
||||
Elf32_Off sh_offset; /* Offset in file. */
|
||||
Elf32_Word sh_size; /* Size in bytes. */
|
||||
Elf32_Word sh_link; /* Index of a related section. */
|
||||
Elf32_Word sh_info; /* Depends on section type. */
|
||||
Elf32_Word sh_addralign; /* Alignment in bytes. */
|
||||
Elf32_Word sh_entsize; /* Size of each entry in section. */
|
||||
} Elf32_Shdr;
|
||||
|
||||
/*
|
||||
@@ -105,14 +105,14 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word p_type; /* Entry type. */
|
||||
Elf32_Off p_offset; /* File offset of contents. */
|
||||
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf32_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf32_Word p_filesz; /* Size of contents in file. */
|
||||
Elf32_Word p_memsz; /* Size of contents in memory. */
|
||||
Elf32_Word p_flags; /* Access permission flags. */
|
||||
Elf32_Word p_align; /* Alignment in memory and file. */
|
||||
Elf32_Word p_type; /* Entry type. */
|
||||
Elf32_Off p_offset; /* File offset of contents. */
|
||||
Elf32_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf32_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf32_Word p_filesz; /* Size of contents in file. */
|
||||
Elf32_Word p_memsz; /* Size of contents in memory. */
|
||||
Elf32_Word p_flags; /* Access permission flags. */
|
||||
Elf32_Word p_align; /* Alignment in memory and file. */
|
||||
} Elf32_Phdr;
|
||||
|
||||
/*
|
||||
@@ -120,11 +120,11 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Sword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf32_Word d_val; /* Integer value. */
|
||||
Elf32_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
Elf32_Sword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf32_Word d_val; /* Integer value. */
|
||||
Elf32_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
} Elf32_Dyn;
|
||||
|
||||
/*
|
||||
@@ -133,60 +133,60 @@ typedef struct {
|
||||
|
||||
/* Relocations that don't need an addend field. */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
} Elf32_Rel;
|
||||
|
||||
/* Relocations that need an addend field. */
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
Elf32_Sword r_addend; /* Addend. */
|
||||
Elf32_Addr r_offset; /* Location to be relocated. */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index. */
|
||||
Elf32_Sword r_addend; /* Addend. */
|
||||
} Elf32_Rela;
|
||||
|
||||
/* Macros for accessing the fields of r_info. */
|
||||
#define ELF32_R_SYM(info) ((info) >> 8)
|
||||
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||||
#define ELF32_R_SYM(info) ((info) >> 8)
|
||||
#define ELF32_R_TYPE(info) ((unsigned char)(info))
|
||||
|
||||
/* Macro for constructing r_info from field values. */
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
||||
#define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
|
||||
|
||||
/*
|
||||
* Note entry header
|
||||
* Note entry header
|
||||
*/
|
||||
typedef Elf_Note Elf32_Nhdr;
|
||||
|
||||
/*
|
||||
* Move entry
|
||||
* Move entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Lword m_value; /* symbol value */
|
||||
Elf32_Word m_info; /* size + index */
|
||||
Elf32_Word m_poffset; /* symbol offset */
|
||||
Elf32_Half m_repeat; /* repeat count */
|
||||
Elf32_Half m_stride; /* stride info */
|
||||
Elf32_Lword m_value; /* symbol value */
|
||||
Elf32_Word m_info; /* size + index */
|
||||
Elf32_Word m_poffset; /* symbol offset */
|
||||
Elf32_Half m_repeat; /* repeat count */
|
||||
Elf32_Half m_stride; /* stride info */
|
||||
} Elf32_Move;
|
||||
|
||||
/*
|
||||
* The macros compose and decompose values for Move.r_info
|
||||
* The macros compose and decompose values for Move.r_info
|
||||
*
|
||||
* sym = ELF32_M_SYM(M.m_info)
|
||||
* size = ELF32_M_SIZE(M.m_info)
|
||||
* M.m_info = ELF32_M_INFO(sym, size)
|
||||
* sym = ELF32_M_SYM(M.m_info)
|
||||
* size = ELF32_M_SIZE(M.m_info)
|
||||
* M.m_info = ELF32_M_INFO(sym, size)
|
||||
*/
|
||||
#define ELF32_M_SYM(info) ((info)>>8)
|
||||
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
#define ELF32_M_SYM(info) ((info)>>8)
|
||||
#define ELF32_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF32_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
|
||||
/*
|
||||
* Hardware/Software capabilities entry
|
||||
* Hardware/Software capabilities entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf32_Word c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf32_Word c_val;
|
||||
Elf32_Addr c_ptr;
|
||||
} c_un;
|
||||
Elf32_Word c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf32_Word c_val;
|
||||
Elf32_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf32_Cap;
|
||||
|
||||
/*
|
||||
@@ -194,65 +194,65 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf32_Word st_name; /* String table index of name. */
|
||||
Elf32_Addr st_value; /* Symbol value. */
|
||||
Elf32_Word st_size; /* Size of associated object. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf32_Half st_shndx; /* Section index of symbol. */
|
||||
Elf32_Word st_name; /* String table index of name. */
|
||||
Elf32_Addr st_value; /* Symbol value. */
|
||||
Elf32_Word st_size; /* Size of associated object. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf32_Half st_shndx; /* Section index of symbol. */
|
||||
} Elf32_Sym;
|
||||
|
||||
/* Macros for accessing the fields of st_info. */
|
||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||
#define ELF32_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF32_ST_TYPE(info) ((info) & 0xf)
|
||||
|
||||
/* Macro for constructing st_info from field values. */
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Macro for accessing the fields of st_other. */
|
||||
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
#define ELF32_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
|
||||
/* Structures used by Sun & GNU symbol versioning. */
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Half vd_version;
|
||||
Elf32_Half vd_flags;
|
||||
Elf32_Half vd_ndx;
|
||||
Elf32_Half vd_cnt;
|
||||
Elf32_Word vd_hash;
|
||||
Elf32_Word vd_aux;
|
||||
Elf32_Word vd_next;
|
||||
Elf32_Half vd_version;
|
||||
Elf32_Half vd_flags;
|
||||
Elf32_Half vd_ndx;
|
||||
Elf32_Half vd_cnt;
|
||||
Elf32_Word vd_hash;
|
||||
Elf32_Word vd_aux;
|
||||
Elf32_Word vd_next;
|
||||
} Elf32_Verdef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word vda_name;
|
||||
Elf32_Word vda_next;
|
||||
Elf32_Word vda_name;
|
||||
Elf32_Word vda_next;
|
||||
} Elf32_Verdaux;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Half vn_version;
|
||||
Elf32_Half vn_cnt;
|
||||
Elf32_Word vn_file;
|
||||
Elf32_Word vn_aux;
|
||||
Elf32_Word vn_next;
|
||||
Elf32_Half vn_version;
|
||||
Elf32_Half vn_cnt;
|
||||
Elf32_Word vn_file;
|
||||
Elf32_Word vn_aux;
|
||||
Elf32_Word vn_next;
|
||||
} Elf32_Verneed;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf32_Word vna_hash;
|
||||
Elf32_Half vna_flags;
|
||||
Elf32_Half vna_other;
|
||||
Elf32_Word vna_name;
|
||||
Elf32_Word vna_next;
|
||||
Elf32_Word vna_hash;
|
||||
Elf32_Half vna_flags;
|
||||
Elf32_Half vna_other;
|
||||
Elf32_Word vna_name;
|
||||
Elf32_Word vna_next;
|
||||
} Elf32_Vernaux;
|
||||
|
||||
typedef Elf32_Half Elf32_Versym;
|
||||
|
||||
typedef struct {
|
||||
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf32_Half si_flags; /* per symbol flags */
|
||||
Elf32_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf32_Half si_flags; /* per symbol flags */
|
||||
} Elf32_Syminfo;
|
||||
|
||||
#endif /* !_SYS_ELF32_H_ */
|
||||
|
@@ -47,14 +47,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
* ELF definitions common to all 64-bit architectures.
|
||||
*/
|
||||
|
||||
typedef UINT64 Elf64_Addr;
|
||||
typedef UINT16 Elf64_Half;
|
||||
typedef UINT64 Elf64_Off;
|
||||
typedef INT32 Elf64_Sword;
|
||||
typedef INT64 Elf64_Sxword;
|
||||
typedef UINT32 Elf64_Word;
|
||||
typedef UINT64 Elf64_Lword;
|
||||
typedef UINT64 Elf64_Xword;
|
||||
typedef UINT64 Elf64_Addr;
|
||||
typedef UINT16 Elf64_Half;
|
||||
typedef UINT64 Elf64_Off;
|
||||
typedef INT32 Elf64_Sword;
|
||||
typedef INT64 Elf64_Sxword;
|
||||
typedef UINT32 Elf64_Word;
|
||||
typedef UINT64 Elf64_Lword;
|
||||
typedef UINT64 Elf64_Xword;
|
||||
|
||||
/*
|
||||
* Types of dynamic symbol hash table bucket and chain elements.
|
||||
@@ -63,31 +63,31 @@ typedef UINT64 Elf64_Xword;
|
||||
* typedef is required.
|
||||
*/
|
||||
|
||||
typedef Elf64_Word Elf64_Hashelt;
|
||||
typedef Elf64_Word Elf64_Hashelt;
|
||||
|
||||
/* Non-standard class-dependent datatype used for abstraction. */
|
||||
typedef Elf64_Xword Elf64_Size;
|
||||
typedef Elf64_Sxword Elf64_Ssize;
|
||||
typedef Elf64_Xword Elf64_Size;
|
||||
typedef Elf64_Sxword Elf64_Ssize;
|
||||
|
||||
/*
|
||||
* ELF header.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf64_Half e_type; /* File type. */
|
||||
Elf64_Half e_machine; /* Machine architecture. */
|
||||
Elf64_Word e_version; /* ELF format version. */
|
||||
Elf64_Addr e_entry; /* Entry point. */
|
||||
Elf64_Off e_phoff; /* Program header file offset. */
|
||||
Elf64_Off e_shoff; /* Section header file offset. */
|
||||
Elf64_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf64_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf64_Half e_phnum; /* Number of program header entries. */
|
||||
Elf64_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf64_Half e_shnum; /* Number of section header entries. */
|
||||
Elf64_Half e_shstrndx; /* Section name strings section. */
|
||||
unsigned char e_ident[EI_NIDENT]; /* File identification. */
|
||||
Elf64_Half e_type; /* File type. */
|
||||
Elf64_Half e_machine; /* Machine architecture. */
|
||||
Elf64_Word e_version; /* ELF format version. */
|
||||
Elf64_Addr e_entry; /* Entry point. */
|
||||
Elf64_Off e_phoff; /* Program header file offset. */
|
||||
Elf64_Off e_shoff; /* Section header file offset. */
|
||||
Elf64_Word e_flags; /* Architecture-specific flags. */
|
||||
Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
|
||||
Elf64_Half e_phentsize; /* Size of program header entry. */
|
||||
Elf64_Half e_phnum; /* Number of program header entries. */
|
||||
Elf64_Half e_shentsize; /* Size of section header entry. */
|
||||
Elf64_Half e_shnum; /* Number of section header entries. */
|
||||
Elf64_Half e_shstrndx; /* Section name strings section. */
|
||||
} Elf64_Ehdr;
|
||||
|
||||
/*
|
||||
@@ -95,17 +95,17 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf64_Word sh_type; /* Section type. */
|
||||
Elf64_Xword sh_flags; /* Section flags. */
|
||||
Elf64_Addr sh_addr; /* Address in memory image. */
|
||||
Elf64_Off sh_offset; /* Offset in file. */
|
||||
Elf64_Xword sh_size; /* Size in bytes. */
|
||||
Elf64_Word sh_link; /* Index of a related section. */
|
||||
Elf64_Word sh_info; /* Depends on section type. */
|
||||
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
||||
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
||||
Elf64_Word sh_name; /* Section name (index into the
|
||||
section header string table). */
|
||||
Elf64_Word sh_type; /* Section type. */
|
||||
Elf64_Xword sh_flags; /* Section flags. */
|
||||
Elf64_Addr sh_addr; /* Address in memory image. */
|
||||
Elf64_Off sh_offset; /* Offset in file. */
|
||||
Elf64_Xword sh_size; /* Size in bytes. */
|
||||
Elf64_Word sh_link; /* Index of a related section. */
|
||||
Elf64_Word sh_info; /* Depends on section type. */
|
||||
Elf64_Xword sh_addralign; /* Alignment in bytes. */
|
||||
Elf64_Xword sh_entsize; /* Size of each entry in section. */
|
||||
} Elf64_Shdr;
|
||||
|
||||
/*
|
||||
@@ -113,14 +113,14 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word p_type; /* Entry type. */
|
||||
Elf64_Word p_flags; /* Access permission flags. */
|
||||
Elf64_Off p_offset; /* File offset of contents. */
|
||||
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf64_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf64_Xword p_filesz; /* Size of contents in file. */
|
||||
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
||||
Elf64_Xword p_align; /* Alignment in memory and file. */
|
||||
Elf64_Word p_type; /* Entry type. */
|
||||
Elf64_Word p_flags; /* Access permission flags. */
|
||||
Elf64_Off p_offset; /* File offset of contents. */
|
||||
Elf64_Addr p_vaddr; /* Virtual address in memory image. */
|
||||
Elf64_Addr p_paddr; /* Physical address (not used). */
|
||||
Elf64_Xword p_filesz; /* Size of contents in file. */
|
||||
Elf64_Xword p_memsz; /* Size of contents in memory. */
|
||||
Elf64_Xword p_align; /* Alignment in memory and file. */
|
||||
} Elf64_Phdr;
|
||||
|
||||
/*
|
||||
@@ -128,11 +128,11 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Sxword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf64_Xword d_val; /* Integer value. */
|
||||
Elf64_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
Elf64_Sxword d_tag; /* Entry type. */
|
||||
union {
|
||||
Elf64_Xword d_val; /* Integer value. */
|
||||
Elf64_Addr d_ptr; /* Address value. */
|
||||
} d_un;
|
||||
} Elf64_Dyn;
|
||||
|
||||
/*
|
||||
@@ -141,58 +141,58 @@ typedef struct {
|
||||
|
||||
/* Relocations that don't need an addend field. */
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
} Elf64_Rel;
|
||||
|
||||
/* Relocations that need an addend field. */
|
||||
typedef struct {
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
Elf64_Sxword r_addend; /* Addend. */
|
||||
Elf64_Addr r_offset; /* Location to be relocated. */
|
||||
Elf64_Xword r_info; /* Relocation type and symbol index. */
|
||||
Elf64_Sxword r_addend; /* Addend. */
|
||||
} Elf64_Rela;
|
||||
|
||||
/* Macros for accessing the fields of r_info. */
|
||||
#define ELF64_R_SYM(info) ((info) >> 32)
|
||||
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
||||
#define ELF64_R_SYM(info) ((info) >> 32)
|
||||
#define ELF64_R_TYPE(info) ((info) & 0xffffffffL)
|
||||
|
||||
/* Macro for constructing r_info from field values. */
|
||||
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
||||
#define ELF64_R_INFO(sym, type) (((sym) << 32) + ((type) & 0xffffffffL))
|
||||
|
||||
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
||||
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
||||
#define ELF64_R_TYPE_INFO(data, type) \
|
||||
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
||||
#define ELF64_R_TYPE_DATA(info) (((Elf64_Xword)(info)<<32)>>40)
|
||||
#define ELF64_R_TYPE_ID(info) (((Elf64_Xword)(info)<<56)>>56)
|
||||
#define ELF64_R_TYPE_INFO(data, type) \
|
||||
(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
|
||||
|
||||
/*
|
||||
* Note entry header
|
||||
* Note entry header
|
||||
*/
|
||||
typedef Elf_Note Elf64_Nhdr;
|
||||
|
||||
/*
|
||||
* Move entry
|
||||
* Move entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Lword m_value; /* symbol value */
|
||||
Elf64_Xword m_info; /* size + index */
|
||||
Elf64_Xword m_poffset; /* symbol offset */
|
||||
Elf64_Half m_repeat; /* repeat count */
|
||||
Elf64_Half m_stride; /* stride info */
|
||||
Elf64_Lword m_value; /* symbol value */
|
||||
Elf64_Xword m_info; /* size + index */
|
||||
Elf64_Xword m_poffset; /* symbol offset */
|
||||
Elf64_Half m_repeat; /* repeat count */
|
||||
Elf64_Half m_stride; /* stride info */
|
||||
} Elf64_Move;
|
||||
|
||||
#define ELF64_M_SYM(info) ((info)>>8)
|
||||
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
#define ELF64_M_SYM(info) ((info)>>8)
|
||||
#define ELF64_M_SIZE(info) ((unsigned char)(info))
|
||||
#define ELF64_M_INFO(sym, size) (((sym)<<8)+(unsigned char)(size))
|
||||
|
||||
/*
|
||||
* Hardware/Software capabilities entry
|
||||
* Hardware/Software capabilities entry
|
||||
*/
|
||||
typedef struct {
|
||||
Elf64_Xword c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf64_Xword c_val;
|
||||
Elf64_Addr c_ptr;
|
||||
} c_un;
|
||||
Elf64_Xword c_tag; /* how to interpret value */
|
||||
union {
|
||||
Elf64_Xword c_val;
|
||||
Elf64_Addr c_ptr;
|
||||
} c_un;
|
||||
} Elf64_Cap;
|
||||
|
||||
/*
|
||||
@@ -200,61 +200,61 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word st_name; /* String table index of name. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf64_Half st_shndx; /* Section index of symbol. */
|
||||
Elf64_Addr st_value; /* Symbol value. */
|
||||
Elf64_Xword st_size; /* Size of associated object. */
|
||||
Elf64_Word st_name; /* String table index of name. */
|
||||
unsigned char st_info; /* Type and binding information. */
|
||||
unsigned char st_other; /* Reserved (not used). */
|
||||
Elf64_Half st_shndx; /* Section index of symbol. */
|
||||
Elf64_Addr st_value; /* Symbol value. */
|
||||
Elf64_Xword st_size; /* Size of associated object. */
|
||||
} Elf64_Sym;
|
||||
|
||||
/* Macros for accessing the fields of st_info. */
|
||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||
#define ELF64_ST_BIND(info) ((info) >> 4)
|
||||
#define ELF64_ST_TYPE(info) ((info) & 0xf)
|
||||
|
||||
/* Macro for constructing st_info from field values. */
|
||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
#define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
|
||||
|
||||
/* Macro for accessing the fields of st_other. */
|
||||
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
#define ELF64_ST_VISIBILITY(oth) ((oth) & 0x3)
|
||||
|
||||
/* Structures used by Sun & GNU-style symbol versioning. */
|
||||
typedef struct {
|
||||
Elf64_Half vd_version;
|
||||
Elf64_Half vd_flags;
|
||||
Elf64_Half vd_ndx;
|
||||
Elf64_Half vd_cnt;
|
||||
Elf64_Word vd_hash;
|
||||
Elf64_Word vd_aux;
|
||||
Elf64_Word vd_next;
|
||||
Elf64_Half vd_version;
|
||||
Elf64_Half vd_flags;
|
||||
Elf64_Half vd_ndx;
|
||||
Elf64_Half vd_cnt;
|
||||
Elf64_Word vd_hash;
|
||||
Elf64_Word vd_aux;
|
||||
Elf64_Word vd_next;
|
||||
} Elf64_Verdef;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word vda_name;
|
||||
Elf64_Word vda_next;
|
||||
Elf64_Word vda_name;
|
||||
Elf64_Word vda_next;
|
||||
} Elf64_Verdaux;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half vn_version;
|
||||
Elf64_Half vn_cnt;
|
||||
Elf64_Word vn_file;
|
||||
Elf64_Word vn_aux;
|
||||
Elf64_Word vn_next;
|
||||
Elf64_Half vn_version;
|
||||
Elf64_Half vn_cnt;
|
||||
Elf64_Word vn_file;
|
||||
Elf64_Word vn_aux;
|
||||
Elf64_Word vn_next;
|
||||
} Elf64_Verneed;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Word vna_hash;
|
||||
Elf64_Half vna_flags;
|
||||
Elf64_Half vna_other;
|
||||
Elf64_Word vna_name;
|
||||
Elf64_Word vna_next;
|
||||
Elf64_Word vna_hash;
|
||||
Elf64_Half vna_flags;
|
||||
Elf64_Half vna_other;
|
||||
Elf64_Word vna_name;
|
||||
Elf64_Word vna_next;
|
||||
} Elf64_Vernaux;
|
||||
|
||||
typedef Elf64_Half Elf64_Versym;
|
||||
|
||||
typedef struct {
|
||||
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf64_Half si_flags; /* per symbol flags */
|
||||
Elf64_Half si_boundto; /* direct bindings - symbol bound to */
|
||||
Elf64_Half si_flags; /* per symbol flags */
|
||||
} Elf64_Syminfo;
|
||||
|
||||
#endif /* !_SYS_ELF64_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user