OLD | NEW |
1 //===-- X86TargetObjectFile.cpp - X86 Object Info -------------------------===// | 1 //===-- X86TargetObjectFile.cpp - X86 Object Info -------------------------===// |
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 #include "X86TargetObjectFile.h" | 10 #include "X86TargetObjectFile.h" |
| 11 #include "X86Subtarget.h" // @LOCALMOD |
11 #include "llvm/ADT/StringExtras.h" | 12 #include "llvm/ADT/StringExtras.h" |
12 #include "llvm/IR/Mangler.h" | 13 #include "llvm/IR/Mangler.h" |
13 #include "llvm/IR/Operator.h" | 14 #include "llvm/IR/Operator.h" |
14 #include "llvm/MC/MCContext.h" | 15 #include "llvm/MC/MCContext.h" |
15 #include "llvm/MC/MCExpr.h" | 16 #include "llvm/MC/MCExpr.h" |
16 #include "llvm/MC/MCSectionCOFF.h" | 17 #include "llvm/MC/MCSectionCOFF.h" |
17 #include "llvm/MC/MCSectionELF.h" | 18 #include "llvm/MC/MCSectionELF.h" |
18 #include "llvm/Support/Dwarf.h" | 19 #include "llvm/Support/Dwarf.h" |
19 #include "llvm/Target/TargetLowering.h" | 20 #include "llvm/Target/TargetLowering.h" |
20 | 21 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 COFF::IMAGE_SCN_LNK_COMDAT; | 163 COFF::IMAGE_SCN_LNK_COMDAT; |
163 return getContext().getCOFFSection(".rdata", Characteristics, Kind, | 164 return getContext().getCOFFSection(".rdata", Characteristics, Kind, |
164 COMDATSymName, | 165 COMDATSymName, |
165 COFF::IMAGE_COMDAT_SELECT_ANY); | 166 COFF::IMAGE_COMDAT_SELECT_ANY); |
166 } | 167 } |
167 } | 168 } |
168 } | 169 } |
169 | 170 |
170 return TargetLoweringObjectFile::getSectionForConstant(Kind, C); | 171 return TargetLoweringObjectFile::getSectionForConstant(Kind, C); |
171 } | 172 } |
| 173 |
| 174 // @LOCALMOD-START |
| 175 // NOTE: this was largely lifted from |
| 176 // lib/Target/ARM/ARMTargetObjectFile.cpp |
| 177 // |
| 178 // The default is .ctors/.dtors while the arm backend uses |
| 179 // .init_array/.fini_array |
| 180 // |
| 181 // Without this the linker defined symbols __fini_array_start and |
| 182 // __fini_array_end do not have useful values. c.f.: |
| 183 // http://code.google.com/p/nativeclient/issues/detail?id=805 |
| 184 void TargetLoweringObjectFileNaCl::Initialize(MCContext &Ctx, |
| 185 const TargetMachine &TM) { |
| 186 TargetLoweringObjectFileELF::Initialize(Ctx, TM); |
| 187 |
| 188 StaticCtorSection = |
| 189 getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY, |
| 190 ELF::SHF_WRITE | |
| 191 ELF::SHF_ALLOC, |
| 192 SectionKind::getDataRel()); |
| 193 StaticDtorSection = |
| 194 getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY, |
| 195 ELF::SHF_WRITE | |
| 196 ELF::SHF_ALLOC, |
| 197 SectionKind::getDataRel()); |
| 198 } |
| 199 // @LOCALMOD-END |
OLD | NEW |