ElfConvert.h 1.7 KB

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