OLD | NEW |
1 //===-- llvm/MC/MCELFObjectWriter.h - ELF Object Writer ---------*- C++ -*-===// | 1 //===-- llvm/MC/MCELFObjectWriter.h - ELF Object Writer ---------*- C++ -*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 | 9 |
10 #ifndef LLVM_MC_MCELFOBJECTWRITER_H | 10 #ifndef LLVM_MC_MCELFOBJECTWRITER_H |
(...skipping 27 matching lines...) Expand all Loading... |
38 ELFRelocationEntry() | 38 ELFRelocationEntry() |
39 : r_offset(0), Index(0), Type(0), Symbol(0), r_addend(0), Fixup(0) {} | 39 : r_offset(0), Index(0), Type(0), Symbol(0), r_addend(0), Fixup(0) {} |
40 | 40 |
41 ELFRelocationEntry(uint64_t RelocOffset, int Idx, unsigned RelType, | 41 ELFRelocationEntry(uint64_t RelocOffset, int Idx, unsigned RelType, |
42 const MCSymbol *Sym, uint64_t Addend, const MCFixup &Fixup) | 42 const MCSymbol *Sym, uint64_t Addend, const MCFixup &Fixup) |
43 : r_offset(RelocOffset), Index(Idx), Type(RelType), Symbol(Sym), | 43 : r_offset(RelocOffset), Index(Idx), Type(RelType), Symbol(Sym), |
44 r_addend(Addend), Fixup(&Fixup) {} | 44 r_addend(Addend), Fixup(&Fixup) {} |
45 | 45 |
46 // Support lexicographic sorting. | 46 // Support lexicographic sorting. |
47 bool operator<(const ELFRelocationEntry &RE) const { | 47 bool operator<(const ELFRelocationEntry &RE) const { |
48 if (RE.r_offset != r_offset) | 48 return RE.r_offset < r_offset; |
49 return RE.r_offset < r_offset; | |
50 if (Type != RE.Type) | |
51 return Type < RE.Type; | |
52 if (Index != RE.Index) | |
53 return Index < RE.Index; | |
54 llvm_unreachable("ELFRelocs might be unstable!"); | |
55 return 0; | |
56 } | 49 } |
57 }; | 50 }; |
58 | 51 |
59 class MCELFObjectTargetWriter { | 52 class MCELFObjectTargetWriter { |
60 const uint8_t OSABI; | 53 const uint8_t OSABI; |
61 const uint16_t EMachine; | 54 const uint16_t EMachine; |
62 const unsigned HasRelocationAddend : 1; | 55 const unsigned HasRelocationAddend : 1; |
63 const unsigned Is64Bit : 1; | 56 const unsigned Is64Bit : 1; |
64 const unsigned IsN64 : 1; | 57 const unsigned IsN64 : 1; |
65 | 58 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 /// \brief Construct a new ELF writer instance. | 145 /// \brief Construct a new ELF writer instance. |
153 /// | 146 /// |
154 /// \param MOTW - The target specific ELF writer subclass. | 147 /// \param MOTW - The target specific ELF writer subclass. |
155 /// \param OS - The stream to write to. | 148 /// \param OS - The stream to write to. |
156 /// \returns The constructed object writer. | 149 /// \returns The constructed object writer. |
157 MCObjectWriter *createELFObjectWriter(MCELFObjectTargetWriter *MOTW, | 150 MCObjectWriter *createELFObjectWriter(MCELFObjectTargetWriter *MOTW, |
158 raw_ostream &OS, bool IsLittleEndian); | 151 raw_ostream &OS, bool IsLittleEndian); |
159 } // End llvm namespace | 152 } // End llvm namespace |
160 | 153 |
161 #endif | 154 #endif |
OLD | NEW |