summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ELFWriter.h
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-07 21:22:38 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-07 21:22:38 +0000
commita029a27fae25628fa7805aba6d7ae3216a4e026b (patch)
tree5f353df4c5e7e55748682c997d11b1e0e014f36c /lib/CodeGen/ELFWriter.h
parentfaeedf1254a4f79004cb94c3d2b738f138af450e (diff)
downloadllvm-a029a27fae25628fa7805aba6d7ae3216a4e026b.tar.gz
llvm-a029a27fae25628fa7805aba6d7ae3216a4e026b.tar.bz2
llvm-a029a27fae25628fa7805aba6d7ae3216a4e026b.tar.xz
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
Diffstat (limited to 'lib/CodeGen/ELFWriter.h')
-rw-r--r--lib/CodeGen/ELFWriter.h28
1 files changed, 11 insertions, 17 deletions
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 <list>
@@ -46,15 +47,12 @@ 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
@@ -62,19 +60,8 @@ namespace llvm {
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<ELFSym> 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<GlobalValue*> 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();
};