blob: 8cc6b3b1354497ab939d080be6ce9a7ecd614b45 [file] [log] [blame]
Jia Liu9f610112012-02-17 08:55:11 +00001//===-- MipsELFObjectWriter.cpp - Mips ELF Writer -------------------------===//
Rafael Espindola1dc45d82011-12-22 03:03:17 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Akira Hatanaka5ba593f2012-03-28 00:23:33 +000010#include "MCTargetDesc/MipsBaseInfo.h"
Rafael Espindola1dc45d82011-12-22 03:03:17 +000011#include "MCTargetDesc/MipsFixupKinds.h"
12#include "MCTargetDesc/MipsMCTargetDesc.h"
Petar Jovanovic0380d0b2015-04-14 13:23:34 +000013#include "llvm/ADT/STLExtras.h"
Akira Hatanaka5ba593f2012-03-28 00:23:33 +000014#include "llvm/MC/MCAssembler.h"
Zoran Jovanovic10646912014-12-30 22:04:16 +000015#include "llvm/MC/MCELF.h"
Rafael Espindola1dc45d82011-12-22 03:03:17 +000016#include "llvm/MC/MCELFObjectWriter.h"
17#include "llvm/MC/MCExpr.h"
18#include "llvm/MC/MCSection.h"
19#include "llvm/MC/MCValue.h"
20#include "llvm/Support/ErrorHandling.h"
Akira Hatanaka5ba593f2012-03-28 00:23:33 +000021#include <list>
Rafael Espindola1dc45d82011-12-22 03:03:17 +000022
23using namespace llvm;
24
25namespace {
Petar Jovanovic0380d0b2015-04-14 13:23:34 +000026// A helper structure based on ELFRelocationEntry, used for sorting entries in
27// the relocation table.
28struct MipsRelocationEntry {
29 MipsRelocationEntry(const ELFRelocationEntry &R)
30 : R(R), SortOffset(R.Offset), HasMatchingHi(false) {}
31 const ELFRelocationEntry R;
32 // SortOffset equals R.Offset except for the *HI16 relocations, for which it
33 // will be set based on the R.Offset of the matching *LO16 relocation.
34 int64_t SortOffset;
35 // True when this is a *LO16 relocation chosen as a match for a *HI16
36 // relocation.
37 bool HasMatchingHi;
38};
39
Rafael Espindola1dc45d82011-12-22 03:03:17 +000040 class MipsELFObjectWriter : public MCELFObjectTargetWriter {
41 public:
Akira Hatanaka111174b2012-08-17 21:28:04 +000042 MipsELFObjectWriter(bool _is64Bit, uint8_t OSABI,
43 bool _isN64, bool IsLittleEndian);
Rafael Espindola1dc45d82011-12-22 03:03:17 +000044
Alexander Kornienkof817c1c2015-04-11 02:11:45 +000045 ~MipsELFObjectWriter() override;
Rafael Espindola1dc45d82011-12-22 03:03:17 +000046
Rafael Espindola9ab38012014-03-27 20:41:17 +000047 unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
Rafael Espindolac03f44c2014-03-27 20:49:35 +000048 bool IsPCRel) const override;
Rafael Espindolaece40ca2015-05-29 18:26:09 +000049 bool needsRelocateWithSymbol(const MCSymbol &Sym,
Ulrich Weigand46797c62014-07-20 23:15:06 +000050 unsigned Type) const override;
Petar Jovanovic0380d0b2015-04-14 13:23:34 +000051 virtual void sortRelocs(const MCAssembler &Asm,
52 std::vector<ELFRelocationEntry> &Relocs) override;
Rafael Espindola1dc45d82011-12-22 03:03:17 +000053 };
54}
55
Jack Carter8ad0c272012-06-27 22:28:30 +000056MipsELFObjectWriter::MipsELFObjectWriter(bool _is64Bit, uint8_t OSABI,
Akira Hatanaka111174b2012-08-17 21:28:04 +000057 bool _isN64, bool IsLittleEndian)
Simon Atanasyanc99ce682015-03-24 12:24:56 +000058 : MCELFObjectTargetWriter(_is64Bit, OSABI, ELF::EM_MIPS,
59 /*HasRelocationAddend*/ _isN64,
60 /*IsN64*/ _isN64) {}
Rafael Espindola1dc45d82011-12-22 03:03:17 +000061
62MipsELFObjectWriter::~MipsELFObjectWriter() {}
63
Rafael Espindola1dc45d82011-12-22 03:03:17 +000064unsigned MipsELFObjectWriter::GetRelocType(const MCValue &Target,
65 const MCFixup &Fixup,
Rafael Espindolac03f44c2014-03-27 20:49:35 +000066 bool IsPCRel) const {
Rafael Espindola1dc45d82011-12-22 03:03:17 +000067 // determine the type of the relocation
68 unsigned Type = (unsigned)ELF::R_MIPS_NONE;
69 unsigned Kind = (unsigned)Fixup.getKind();
70
71 switch (Kind) {
72 default:
73 llvm_unreachable("invalid fixup kind!");
Daniel Sanders60f1db02015-03-13 12:45:09 +000074 case Mips::fixup_Mips_32:
Rafael Espindola1dc45d82011-12-22 03:03:17 +000075 case FK_Data_4:
76 Type = ELF::R_MIPS_32;
77 break;
Daniel Sanders60f1db02015-03-13 12:45:09 +000078 case Mips::fixup_Mips_64:
Jack Carter4c583812012-08-07 00:01:14 +000079 case FK_Data_8:
80 Type = ELF::R_MIPS_64;
81 break;
Rafael Espindola1dc45d82011-12-22 03:03:17 +000082 case FK_GPRel_4:
Jack Carterf2385102013-01-15 01:08:02 +000083 if (isN64()) {
84 Type = setRType((unsigned)ELF::R_MIPS_GPREL32, Type);
85 Type = setRType2((unsigned)ELF::R_MIPS_64, Type);
86 Type = setRType3((unsigned)ELF::R_MIPS_NONE, Type);
87 }
88 else
89 Type = ELF::R_MIPS_GPREL32;
Rafael Espindola1dc45d82011-12-22 03:03:17 +000090 break;
91 case Mips::fixup_Mips_GPREL16:
92 Type = ELF::R_MIPS_GPREL16;
93 break;
94 case Mips::fixup_Mips_26:
95 Type = ELF::R_MIPS_26;
96 break;
97 case Mips::fixup_Mips_CALL16:
98 Type = ELF::R_MIPS_CALL16;
99 break;
100 case Mips::fixup_Mips_GOT_Global:
101 case Mips::fixup_Mips_GOT_Local:
102 Type = ELF::R_MIPS_GOT16;
103 break;
104 case Mips::fixup_Mips_HI16:
105 Type = ELF::R_MIPS_HI16;
106 break;
107 case Mips::fixup_Mips_LO16:
108 Type = ELF::R_MIPS_LO16;
109 break;
110 case Mips::fixup_Mips_TLSGD:
111 Type = ELF::R_MIPS_TLS_GD;
112 break;
113 case Mips::fixup_Mips_GOTTPREL:
114 Type = ELF::R_MIPS_TLS_GOTTPREL;
115 break;
116 case Mips::fixup_Mips_TPREL_HI:
117 Type = ELF::R_MIPS_TLS_TPREL_HI16;
118 break;
119 case Mips::fixup_Mips_TPREL_LO:
120 Type = ELF::R_MIPS_TLS_TPREL_LO16;
121 break;
122 case Mips::fixup_Mips_TLSLDM:
123 Type = ELF::R_MIPS_TLS_LDM;
124 break;
125 case Mips::fixup_Mips_DTPREL_HI:
126 Type = ELF::R_MIPS_TLS_DTPREL_HI16;
127 break;
128 case Mips::fixup_Mips_DTPREL_LO:
129 Type = ELF::R_MIPS_TLS_DTPREL_LO16;
130 break;
131 case Mips::fixup_Mips_Branch_PCRel:
132 case Mips::fixup_Mips_PC16:
133 Type = ELF::R_MIPS_PC16;
134 break;
Jack Carterb9f9de92012-06-27 22:48:25 +0000135 case Mips::fixup_Mips_GOT_PAGE:
136 Type = ELF::R_MIPS_GOT_PAGE;
137 break;
138 case Mips::fixup_Mips_GOT_OFST:
139 Type = ELF::R_MIPS_GOT_OFST;
140 break;
Jack Carter5ddcfda2012-07-13 19:15:47 +0000141 case Mips::fixup_Mips_GOT_DISP:
142 Type = ELF::R_MIPS_GOT_DISP;
143 break;
Jack Carterb9f9de92012-06-27 22:48:25 +0000144 case Mips::fixup_Mips_GPOFF_HI:
145 Type = setRType((unsigned)ELF::R_MIPS_GPREL16, Type);
146 Type = setRType2((unsigned)ELF::R_MIPS_SUB, Type);
147 Type = setRType3((unsigned)ELF::R_MIPS_HI16, Type);
148 break;
149 case Mips::fixup_Mips_GPOFF_LO:
150 Type = setRType((unsigned)ELF::R_MIPS_GPREL16, Type);
151 Type = setRType2((unsigned)ELF::R_MIPS_SUB, Type);
152 Type = setRType3((unsigned)ELF::R_MIPS_LO16, Type);
153 break;
Jack Carter84491ab2012-08-06 21:26:03 +0000154 case Mips::fixup_Mips_HIGHER:
155 Type = ELF::R_MIPS_HIGHER;
156 break;
157 case Mips::fixup_Mips_HIGHEST:
158 Type = ELF::R_MIPS_HIGHEST;
159 break;
Jack Carterb05cb672012-11-21 23:38:59 +0000160 case Mips::fixup_Mips_GOT_HI16:
161 Type = ELF::R_MIPS_GOT_HI16;
162 break;
163 case Mips::fixup_Mips_GOT_LO16:
164 Type = ELF::R_MIPS_GOT_LO16;
165 break;
166 case Mips::fixup_Mips_CALL_HI16:
167 Type = ELF::R_MIPS_CALL_HI16;
168 break;
169 case Mips::fixup_Mips_CALL_LO16:
170 Type = ELF::R_MIPS_CALL_LO16;
171 break;
Zoran Jovanovic507e0842013-10-29 16:38:59 +0000172 case Mips::fixup_MICROMIPS_26_S1:
173 Type = ELF::R_MICROMIPS_26_S1;
174 break;
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000175 case Mips::fixup_MICROMIPS_HI16:
176 Type = ELF::R_MICROMIPS_HI16;
177 break;
178 case Mips::fixup_MICROMIPS_LO16:
179 Type = ELF::R_MICROMIPS_LO16;
180 break;
181 case Mips::fixup_MICROMIPS_GOT16:
182 Type = ELF::R_MICROMIPS_GOT16;
183 break;
Jozef Kolek9761e962015-01-12 12:03:34 +0000184 case Mips::fixup_MICROMIPS_PC7_S1:
185 Type = ELF::R_MICROMIPS_PC7_S1;
186 break;
Jozef Kolek5cfebdd2015-01-21 12:39:30 +0000187 case Mips::fixup_MICROMIPS_PC10_S1:
188 Type = ELF::R_MICROMIPS_PC10_S1;
189 break;
Zoran Jovanovic8a80aa72013-11-04 14:53:22 +0000190 case Mips::fixup_MICROMIPS_PC16_S1:
191 Type = ELF::R_MICROMIPS_PC16_S1;
192 break;
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000193 case Mips::fixup_MICROMIPS_CALL16:
194 Type = ELF::R_MICROMIPS_CALL16;
195 break;
196 case Mips::fixup_MICROMIPS_GOT_DISP:
197 Type = ELF::R_MICROMIPS_GOT_DISP;
198 break;
199 case Mips::fixup_MICROMIPS_GOT_PAGE:
200 Type = ELF::R_MICROMIPS_GOT_PAGE;
201 break;
202 case Mips::fixup_MICROMIPS_GOT_OFST:
203 Type = ELF::R_MICROMIPS_GOT_OFST;
204 break;
Zoran Jovanovic69be8112013-12-19 16:02:32 +0000205 case Mips::fixup_MICROMIPS_TLS_GD:
206 Type = ELF::R_MICROMIPS_TLS_GD;
207 break;
208 case Mips::fixup_MICROMIPS_TLS_LDM:
209 Type = ELF::R_MICROMIPS_TLS_LDM;
210 break;
Zoran Jovanovice7ae8af2013-10-23 16:14:44 +0000211 case Mips::fixup_MICROMIPS_TLS_DTPREL_HI16:
212 Type = ELF::R_MICROMIPS_TLS_DTPREL_HI16;
213 break;
214 case Mips::fixup_MICROMIPS_TLS_DTPREL_LO16:
215 Type = ELF::R_MICROMIPS_TLS_DTPREL_LO16;
216 break;
217 case Mips::fixup_MICROMIPS_TLS_TPREL_HI16:
218 Type = ELF::R_MICROMIPS_TLS_TPREL_HI16;
219 break;
220 case Mips::fixup_MICROMIPS_TLS_TPREL_LO16:
221 Type = ELF::R_MICROMIPS_TLS_TPREL_LO16;
222 break;
Zoran Jovanovicb9c07f32014-06-12 12:40:00 +0000223 case Mips::fixup_MIPS_PC19_S2:
224 Type = ELF::R_MIPS_PC19_S2;
225 break;
Zoran Jovanovica5acdcf2014-06-13 14:26:47 +0000226 case Mips::fixup_MIPS_PC18_S3:
227 Type = ELF::R_MIPS_PC18_S3;
228 break;
Zoran Jovanovic10e06da2014-05-27 12:55:40 +0000229 case Mips::fixup_MIPS_PC21_S2:
230 Type = ELF::R_MIPS_PC21_S2;
231 break;
232 case Mips::fixup_MIPS_PC26_S2:
233 Type = ELF::R_MIPS_PC26_S2;
234 break;
Zoran Jovanovicb355e8f2014-05-27 14:58:51 +0000235 case Mips::fixup_MIPS_PCHI16:
236 Type = ELF::R_MIPS_PCHI16;
237 break;
238 case Mips::fixup_MIPS_PCLO16:
239 Type = ELF::R_MIPS_PCLO16;
240 break;
Rafael Espindola1dc45d82011-12-22 03:03:17 +0000241 }
Rafael Espindola1dc45d82011-12-22 03:03:17 +0000242 return Type;
243}
244
Petar Jovanovic0380d0b2015-04-14 13:23:34 +0000245// Sort entries by SortOffset in descending order.
246// When there are more *HI16 relocs paired with one *LO16 reloc, the 2nd rule
247// sorts them in ascending order of R.Offset.
248static int cmpRelMips(const MipsRelocationEntry *AP,
249 const MipsRelocationEntry *BP) {
250 const MipsRelocationEntry &A = *AP;
251 const MipsRelocationEntry &B = *BP;
252 if (A.SortOffset != B.SortOffset)
253 return B.SortOffset - A.SortOffset;
254 if (A.R.Offset != B.R.Offset)
255 return A.R.Offset - B.R.Offset;
256 if (B.R.Type != A.R.Type)
257 return B.R.Type - A.R.Type;
258 //llvm_unreachable("ELFRelocs might be unstable!");
259 return 0;
260}
261
262// For the given Reloc.Type, return the matching relocation type, as in the
263// table below.
264static unsigned getMatchingLoType(const MCAssembler &Asm,
265 const ELFRelocationEntry &Reloc) {
266 unsigned Type = Reloc.Type;
267 if (Type == ELF::R_MIPS_HI16)
268 return ELF::R_MIPS_LO16;
269 if (Type == ELF::R_MICROMIPS_HI16)
270 return ELF::R_MICROMIPS_LO16;
271 if (Type == ELF::R_MIPS16_HI16)
272 return ELF::R_MIPS16_LO16;
273
Rafael Espindolae3b2acf2015-05-29 18:47:23 +0000274 if (MCELF::GetBinding(*Reloc.Symbol) != ELF::STB_LOCAL)
Petar Jovanovic0380d0b2015-04-14 13:23:34 +0000275 return ELF::R_MIPS_NONE;
276
277 if (Type == ELF::R_MIPS_GOT16)
278 return ELF::R_MIPS_LO16;
279 if (Type == ELF::R_MICROMIPS_GOT16)
280 return ELF::R_MICROMIPS_LO16;
281 if (Type == ELF::R_MIPS16_GOT16)
282 return ELF::R_MIPS16_LO16;
283
284 return ELF::R_MIPS_NONE;
285}
286
287// Return true if First needs a matching *LO16, its matching *LO16 type equals
288// Second's type and both relocations are against the same symbol.
289static bool areMatchingHiAndLo(const MCAssembler &Asm,
290 const ELFRelocationEntry &First,
291 const ELFRelocationEntry &Second) {
292 return getMatchingLoType(Asm, First) != ELF::R_MIPS_NONE &&
293 getMatchingLoType(Asm, First) == Second.Type &&
294 First.Symbol && First.Symbol == Second.Symbol;
295}
296
297// Return true if MipsRelocs[Index] is a *LO16 preceded by a matching *HI16.
298static bool
299isPrecededByMatchingHi(const MCAssembler &Asm, uint32_t Index,
300 std::vector<MipsRelocationEntry> &MipsRelocs) {
301 return Index < MipsRelocs.size() - 1 &&
302 areMatchingHiAndLo(Asm, MipsRelocs[Index + 1].R, MipsRelocs[Index].R);
303}
304
305// Return true if MipsRelocs[Index] is a *LO16 not preceded by a matching *HI16
306// and not chosen by a *HI16 as a match.
307static bool isFreeLo(const MCAssembler &Asm, uint32_t Index,
308 std::vector<MipsRelocationEntry> &MipsRelocs) {
309 return Index < MipsRelocs.size() && !MipsRelocs[Index].HasMatchingHi &&
310 !isPrecededByMatchingHi(Asm, Index, MipsRelocs);
311}
312
313// Lo is chosen as a match for Hi, set their fields accordingly.
314// Mips instructions have fixed length of at least two bytes (two for
315// micromips/mips16, four for mips32/64), so we can set HI's SortOffset to
316// matching LO's Offset minus one to simplify the sorting function.
317static void setMatch(MipsRelocationEntry &Hi, MipsRelocationEntry &Lo) {
318 Lo.HasMatchingHi = true;
319 Hi.SortOffset = Lo.R.Offset - 1;
320}
321
322// We sort relocation table entries by offset, except for one additional rule
323// required by MIPS ABI: every *HI16 relocation must be immediately followed by
324// the corresponding *LO16 relocation. We also support a GNU extension that
325// allows more *HI16s paired with one *LO16.
326//
327// *HI16 relocations and their matching *LO16 are:
328//
329// +---------------------------------------------+-------------------+
330// | *HI16 | matching *LO16 |
331// |---------------------------------------------+-------------------|
332// | R_MIPS_HI16, local R_MIPS_GOT16 | R_MIPS_LO16 |
333// | R_MICROMIPS_HI16, local R_MICROMIPS_GOT16 | R_MICROMIPS_LO16 |
334// | R_MIPS16_HI16, local R_MIPS16_GOT16 | R_MIPS16_LO16 |
335// +---------------------------------------------+-------------------+
336//
337// (local R_*_GOT16 meaning R_*_GOT16 against the local symbol.)
338//
339// To handle *HI16 and *LO16 relocations, the linker needs a combined addend
340// ("AHL") calculated from both *HI16 ("AHI") and *LO16 ("ALO") relocations:
341// AHL = (AHI << 16) + (short)ALO;
342//
343// We are reusing gnu as sorting algorithm so we are emitting the relocation
344// table sorted the same way as gnu as would sort it, for easier comparison of
345// the generated .o files.
346//
347// The logic is:
348// search the table (starting from the highest offset and going back to zero)
349// for all *HI16 relocations that don't have a matching *LO16.
350// For every such HI, find a matching LO with highest offset that isn't already
351// matched with another HI. If there are no free LOs, match it with the first
352// found (starting from lowest offset).
353// When there are more HIs matched with one LO, sort them in descending order by
354// offset.
355//
356// In other words, when searching for a matching LO:
357// - don't look for a 'better' match for the HIs that are already followed by a
358// matching LO;
359// - prefer LOs without a pair;
360// - prefer LOs with higher offset;
361void MipsELFObjectWriter::sortRelocs(const MCAssembler &Asm,
362 std::vector<ELFRelocationEntry> &Relocs) {
363 if (Relocs.size() < 2)
364 return;
365
366 // The default function sorts entries by Offset in descending order.
367 MCELFObjectTargetWriter::sortRelocs(Asm, Relocs);
368
369 // Init MipsRelocs from Relocs.
370 std::vector<MipsRelocationEntry> MipsRelocs;
371 for (unsigned I = 0, E = Relocs.size(); I != E; ++I)
372 MipsRelocs.push_back(MipsRelocationEntry(Relocs[I]));
373
374 // Find a matching LO for all HIs that need it.
375 for (int32_t I = 0, E = MipsRelocs.size(); I != E; ++I) {
376 if (getMatchingLoType(Asm, MipsRelocs[I].R) == ELF::R_MIPS_NONE ||
377 (I > 0 && isPrecededByMatchingHi(Asm, I - 1, MipsRelocs)))
378 continue;
379
380 int32_t MatchedLoIndex = -1;
381
382 // Search the list in the ascending order of Offset.
383 for (int32_t J = MipsRelocs.size() - 1, N = -1; J != N; --J) {
384 // check for a match
385 if (areMatchingHiAndLo(Asm, MipsRelocs[I].R, MipsRelocs[J].R) &&
386 (MatchedLoIndex == -1 || // first match
387 // or we already have a match,
388 // but this one is with higher offset and it's free
389 (MatchedLoIndex > J && isFreeLo(Asm, J, MipsRelocs))))
390 MatchedLoIndex = J;
391 }
392
393 if (MatchedLoIndex != -1)
394 // We have a match.
395 setMatch(MipsRelocs[I], MipsRelocs[MatchedLoIndex]);
396 }
397
398 // SortOffsets are calculated, call the sorting function.
399 array_pod_sort(MipsRelocs.begin(), MipsRelocs.end(), cmpRelMips);
400
401 // Copy sorted MipsRelocs back to Relocs.
402 for (unsigned I = 0, E = MipsRelocs.size(); I != E; ++I)
403 Relocs[I] = MipsRelocs[I].R;
404}
405
Rafael Espindolaece40ca2015-05-29 18:26:09 +0000406bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
407 unsigned Type) const {
Mohit K. Bhakkade38c32f2014-12-09 06:31:07 +0000408 // FIXME: This is extremely conservative. This really needs to use a
Rafael Espindola5904e122014-03-29 06:26:49 +0000409 // whitelist with a clear explanation for why each realocation needs to
410 // point to the symbol, not to the section.
411 switch (Type) {
412 default:
413 return true;
414
Rafael Espindolaee1c3422014-03-31 19:00:23 +0000415 case ELF::R_MIPS_GOT16:
416 case ELF::R_MIPS16_GOT16:
417 case ELF::R_MICROMIPS_GOT16:
418 llvm_unreachable("Should have been handled already");
419
420 // These relocations might be paired with another relocation. The pairing is
421 // done by the static linker by matching the symbol. Since we only see one
422 // relocation at a time, we have to force them to relocate with a symbol to
423 // avoid ending up with a pair where one points to a section and another
424 // points to a symbol.
Rafael Espindola5904e122014-03-29 06:26:49 +0000425 case ELF::R_MIPS_HI16:
Rafael Espindolaee1c3422014-03-31 19:00:23 +0000426 case ELF::R_MIPS16_HI16:
427 case ELF::R_MICROMIPS_HI16:
428 case ELF::R_MIPS_LO16:
429 case ELF::R_MIPS16_LO16:
430 case ELF::R_MICROMIPS_LO16:
431 return true;
432
Rafael Espindola5904e122014-03-29 06:26:49 +0000433 case ELF::R_MIPS_32:
Rafael Espindolae3b2acf2015-05-29 18:47:23 +0000434 if (MCELF::getOther(Sym) & (ELF::STO_MIPS_MICROMIPS >> 2))
Zoran Jovanovic10646912014-12-30 22:04:16 +0000435 return true;
436 // falltrough
437 case ELF::R_MIPS_26:
Rafael Espindola5904e122014-03-29 06:26:49 +0000438 case ELF::R_MIPS_64:
439 case ELF::R_MIPS_GPREL16:
Akira Hatanaka5ba593f2012-03-28 00:23:33 +0000440 return false;
Akira Hatanaka5ba593f2012-03-28 00:23:33 +0000441 }
Akira Hatanaka5ba593f2012-03-28 00:23:33 +0000442}
443
Rafael Espindola5560a4c2015-04-14 22:14:34 +0000444MCObjectWriter *llvm::createMipsELFObjectWriter(raw_pwrite_stream &OS,
445 uint8_t OSABI,
Akira Hatanakab1f68f92012-04-02 19:25:22 +0000446 bool IsLittleEndian,
447 bool Is64Bit) {
Simon Atanasyanc99ce682015-03-24 12:24:56 +0000448 MCELFObjectTargetWriter *MOTW =
449 new MipsELFObjectWriter(Is64Bit, OSABI, Is64Bit, IsLittleEndian);
Rafael Espindola1dc45d82011-12-22 03:03:17 +0000450 return createELFObjectWriter(MOTW, OS, IsLittleEndian);
451}