1 /** @file
2 Header file for Elf convert solution
3 
4 Copyright (c) 2010 - 2014, 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 
33 //
34 // Common EFI specific data.
35 //
36 #define ELF_HII_SECTION_NAME ".hii"
37 #define MAX_COFF_ALIGNMENT 0x10000
38 
39 //
40 // Filter Types
41 //
42 typedef enum {
43   SECTION_TEXT,
44   SECTION_HII,
45   SECTION_DATA
46 
47 } SECTION_FILTER_TYPES;
48 
49 //
50 // FunctionTalbe
51 //
52 typedef struct {
53   VOID    (*ScanSections) ();
54   BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES  FilterType);
55   VOID    (*WriteRelocations) ();
56   VOID    (*WriteDebug) ();
57   VOID    (*SetImageSize) ();
58   VOID    (*CleanUp) ();
59 
60 } ELF_FUNCTION_TABLE;
61 
62 //
63 // Common functions
64 //
65 VOID
66 CoffAddFixup (
67   UINT32 Offset,
68   UINT8  Type
69   );
70 
71 VOID
72 CoffAddFixupEntry (
73   UINT16 Val
74   );
75 
76 
77 VOID
78 CreateSectionHeader (
79   const CHAR8 *Name,
80   UINT32      Offset,
81   UINT32      Size,
82   UINT32      Flags
83   );
84 
85 #endif
86