From a029a27fae25628fa7805aba6d7ae3216a4e026b Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes Date: Sun, 7 Jun 2009 21:22:38 +0000 Subject: Simple ELF32/64 binary files can now be emitted for x86 and x86_64 without relocation sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73038 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/ELFWriter.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'lib/CodeGen/ELFWriter.h') diff --git a/lib/CodeGen/ELFWriter.h b/lib/CodeGen/ELFWriter.h index 0389185f1d..14a44f0240 100644 --- a/lib/CodeGen/ELFWriter.h +++ b/lib/CodeGen/ELFWriter.h @@ -14,6 +14,7 @@ #ifndef ELFWRITER_H #define ELFWRITER_H +#include "llvm/ADT/SetVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "ELF.h" #include @@ -46,35 +47,21 @@ namespace llvm { protected: /// Output stream to send the resultant object file to. - /// raw_ostream &O; /// Target machine description. - /// TargetMachine &TM; /// Mang - The object used to perform name mangling for this module. - /// Mangler *Mang; /// MCE - The MachineCodeEmitter object that we are exposing to emit machine /// code for functions to the .o file. ELFCodeEmitter *MCE; - //===------------------------------------------------------------------===// - // Properties to be set by the derived class ctor, used to configure the - // ELFWriter. - - // e_machine - This field is the target specific value to emit as the - // e_machine member of the ELF header. - unsigned short e_machine; - - // e_flags - The machine flags for the target. This defaults to zero. - unsigned e_flags; - //===------------------------------------------------------------------===// // Properties inferred automatically from the target machine. - // + //===------------------------------------------------------------------===// /// is64Bit/isLittleEndian - This information is inferred from the target /// machine directly, indicating whether to emit a 32- or 64-bit ELF file. @@ -95,6 +82,9 @@ namespace llvm { // as well!). DataBuffer FileHeader; + /// ElfHdr - Hold information about the ELF Header + ELFHeader *ElfHdr; + /// SectionList - This is the list of sections that we have emitted to the /// file. Once the file has been completely built, the section header table /// is constructed from this info. @@ -140,6 +130,11 @@ namespace llvm { /// local symbols first in the list). std::vector SymbolTable; + /// PendingSyms - This is a list of externally defined symbols that we have + /// been asked to emit, but have not seen a reference to. When a reference + /// is seen, the symbol will move from this list to the SymbolTable. + SetVector PendingGlobals; + // As we complete the ELF file, we need to update fields in the ELF header // (e.g. the location of the section table). These members keep track of // the offset in ELFHeader of these various pieces to update and other @@ -149,9 +144,8 @@ namespace llvm { unsigned ELFHdr_e_shnum_Offset; // e_shnum in ELF header. private: void EmitGlobal(GlobalVariable *GV); - void EmitSymbolTable(); - + void EmitRelocations(); void EmitSectionTableStringTable(); void OutputSectionsAndSectionTable(); }; -- cgit v1.2.3