1/** @file
2Header file for Elf convert solution
3
4Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
5
6This program and the accompanying materials are licensed and made available
7under the terms and conditions of the BSD License which accompanies this
8distribution.  The full text of the license may be found at
9http://opensource.org/licenses/bsd-license.php
10
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12WITHOUT 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//
26extern UINT32 mCoffOffset;
27extern CHAR8  *mInImageName;
28extern UINT32 mImageTimeStamp;
29extern UINT8  *mCoffFile;
30extern UINT32 mTableOffset;
31extern 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//
42typedef enum {
43  SECTION_TEXT,
44  SECTION_HII,
45  SECTION_DATA
46
47} SECTION_FILTER_TYPES;
48
49//
50// FunctionTalbe
51//
52typedef 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//
65VOID
66CoffAddFixup (
67  UINT32 Offset,
68  UINT8  Type
69  );
70
71VOID
72CoffAddFixupEntry (
73  UINT16 Val
74  );
75
76
77VOID
78CreateSectionHeader (
79  const CHAR8 *Name,
80  UINT32      Offset,
81  UINT32      Size,
82  UINT32      Flags
83  );
84
85#endif
86