]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/GenFw/ElfConvert.h
BaseTools: Fix Section header size larger than elf file size bug
[mirror_edk2.git] / BaseTools / Source / C / GenFw / ElfConvert.h
CommitLineData
f51461c8 1/** @file\r
97fa0ee9 2Header file for Elf convert solution\r
f51461c8 3\r
d78675d1 4Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
f51461c8
LG
5\r
6This program and the accompanying materials are licensed and made available \r
7under the terms and conditions of the BSD License which accompanies this \r
8distribution. The full text of the license may be found at \r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _ELF_CONVERT_H_\r
17#define _ELF_CONVERT_H_\r
18\r
19#include "elf_common.h"\r
20#include "elf32.h"\r
21#include "elf64.h"\r
22\r
23//\r
24// Externally defined variables\r
25//\r
26extern UINT32 mCoffOffset;\r
27extern CHAR8 *mInImageName;\r
28extern UINT32 mImageTimeStamp;\r
29extern UINT8 *mCoffFile;\r
30extern UINT32 mTableOffset;\r
31extern UINT32 mOutImageType;\r
d78675d1 32extern UINT32 mFileBufferSize;\r
f51461c8
LG
33\r
34//\r
35// Common EFI specific data.\r
36//\r
37#define ELF_HII_SECTION_NAME ".hii"\r
621bb723 38#define ELF_STRTAB_SECTION_NAME ".strtab"\r
54b1b57a 39#define MAX_COFF_ALIGNMENT 0x10000\r
f51461c8
LG
40\r
41//\r
42// Filter Types\r
43//\r
44typedef enum {\r
45 SECTION_TEXT,\r
46 SECTION_HII,\r
47 SECTION_DATA\r
48 \r
49} SECTION_FILTER_TYPES;\r
50\r
51//\r
52// FunctionTalbe\r
53//\r
54typedef struct {\r
55 VOID (*ScanSections) ();\r
56 BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType);\r
57 VOID (*WriteRelocations) ();\r
58 VOID (*WriteDebug) ();\r
59 VOID (*SetImageSize) ();\r
60 VOID (*CleanUp) ();\r
61 \r
62} ELF_FUNCTION_TABLE;\r
63\r
64//\r
65// Common functions\r
66//\r
67VOID\r
68CoffAddFixup (\r
69 UINT32 Offset,\r
70 UINT8 Type\r
71 );\r
72\r
73VOID\r
74CoffAddFixupEntry (\r
75 UINT16 Val\r
76 );\r
77\r
78\r
79VOID\r
80CreateSectionHeader (\r
81 const CHAR8 *Name,\r
82 UINT32 Offset,\r
83 UINT32 Size,\r
84 UINT32 Flags\r
85 );\r
86\r
87#endif\r