diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-08-05 06:57:03 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2009-08-05 06:57:03 +0000 |
commit | 52d0851446afe2ae923fc7e7ee56aa4c9d61c1e1 (patch) | |
tree | 356c393902662d4ed1137c0bd285643b2694f222 /lib/CodeGen/ELFWriter.h | |
parent | 61f4b721b2f268ffbd0be614a4f328d541fa1d81 (diff) |
- Remove custom handling of jumptables by the elf writter (this was
a dirty hack and isn't need anymore since the last x86 code emitter patch)
- Add a target-dependent modifier to addend calculation
- Use R_X86_64_32S relocation for X86::reloc_absolute_word_sext
- Use getELFSectionFlags whenever possible
- fix getTextSection to use TLOF and emit the right text section
- Handle global emission for static ctors, dtors and Type::PointerTyID
- Some minor fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ELFWriter.h')
-rw-r--r-- | lib/CodeGen/ELFWriter.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/CodeGen/ELFWriter.h b/lib/CodeGen/ELFWriter.h index ebcfe35eba..fe726524d3 100644 --- a/lib/CodeGen/ELFWriter.h +++ b/lib/CodeGen/ELFWriter.h @@ -33,6 +33,7 @@ namespace llvm { class ObjectCodeEmitter; class TargetAsmInfo; class TargetELFWriterInfo; + class TargetLoweringObjectFile; class raw_ostream; class SectionKind; class MCContext; @@ -66,6 +67,7 @@ namespace llvm { /// Target machine description. TargetMachine &TM; + /// Context object for machine code objects. MCContext &OutContext; /// Target Elf Writer description. @@ -78,6 +80,10 @@ namespace llvm { /// code for functions to the .o file. ELFCodeEmitter *ElfCE; + /// TLOF - Target Lowering Object File, provide section names for globals + /// and other object file specific stuff + const TargetLoweringObjectFile &TLOF; + /// TAI - Target Asm Info, provide information about section names for /// globals and other target specific stuff. const TargetAsmInfo *TAI; @@ -176,13 +182,6 @@ namespace llvm { return *SN; } - /// TODO: support mangled names here to emit the right .text section - /// for c++ object files. - ELFSection &getTextSection() { - return getSection(".text", ELFSection::SHT_PROGBITS, - ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC); - } - ELFSection &getNonExecStackSection() { return getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1); } @@ -213,21 +212,24 @@ namespace llvm { return getSection("", ELFSection::SHT_NULL, 0); } + ELFSection &getCtorSection(); + ELFSection &getDtorSection(); ELFSection &getJumpTableSection(); ELFSection &getConstantPoolSection(MachineConstantPoolEntry &CPE); + ELFSection &getTextSection(Function *F); ELFSection &getRelocSection(ELFSection &S); // Helpers for obtaining ELF specific info. unsigned getGlobalELFBinding(const GlobalValue *GV); unsigned getGlobalELFType(const GlobalValue *GV); unsigned getGlobalELFVisibility(const GlobalValue *GV); - unsigned getElfSectionFlags(SectionKind Kind); - - // addGlobalSymbol - Add a global to be processed and to the - // global symbol lookup, use a zero index for non private symbols - // because the table index will be determined later. - void addGlobalSymbol(const GlobalValue *GV); + unsigned getElfSectionFlags(SectionKind Kind, bool IsAlloc = true); + // addGlobalSymbol - Add a global to be processed and to + // the global symbol lookup, use a zero index because the table + // index will be determined later. + void addGlobalSymbol(const GlobalValue *GV, bool AddToLookup = false); + // addExternalSymbol - Add the external to be processed and to the // external symbol lookup, use a zero index because the symbol // table index will be determined later @@ -246,7 +248,10 @@ namespace llvm { void EmitGlobalConstant(const Constant *C, ELFSection &GblS); void EmitGlobalConstantStruct(const ConstantStruct *CVS, ELFSection &GblS); - ELFSection &getGlobalSymELFSection(const GlobalVariable *GV, ELFSym &Sym); + void emitGlobalDataRelocation(const GlobalValue *GV, unsigned Size, + ELFSection &GblS); + bool EmitSpecialLLVMGlobal(const GlobalVariable *GV); + void EmitXXStructorList(Constant *List, ELFSection &Xtor); void EmitRelocations(); void EmitRelocation(BinaryObject &RelSec, ELFRelocation &Rel, bool HasRelA); void EmitSectionHeader(BinaryObject &SHdrTab, const ELFSection &SHdr); |