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