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 ELF_STRTAB_SECTION_NAME ".strtab" 38 #define MAX_COFF_ALIGNMENT 0x10000 39 40 // 41 // Filter Types 42 // 43 typedef enum { 44 SECTION_TEXT, 45 SECTION_HII, 46 SECTION_DATA 47 48 } SECTION_FILTER_TYPES; 49 50 // 51 // FunctionTalbe 52 // 53 typedef struct { 54 VOID (*ScanSections) (); 55 BOOLEAN (*WriteSections) (SECTION_FILTER_TYPES FilterType); 56 VOID (*WriteRelocations) (); 57 VOID (*WriteDebug) (); 58 VOID (*SetImageSize) (); 59 VOID (*CleanUp) (); 60 61 } ELF_FUNCTION_TABLE; 62 63 // 64 // Common functions 65 // 66 VOID 67 CoffAddFixup ( 68 UINT32 Offset, 69 UINT8 Type 70 ); 71 72 VOID 73 CoffAddFixupEntry ( 74 UINT16 Val 75 ); 76 77 78 VOID 79 CreateSectionHeader ( 80 const CHAR8 *Name, 81 UINT32 Offset, 82 UINT32 Size, 83 UINT32 Flags 84 ); 85 86 #endif 87