| Index: lib/Target/X86/X86TargetObjectFile.cpp
|
| diff --git a/lib/Target/X86/X86TargetObjectFile.cpp b/lib/Target/X86/X86TargetObjectFile.cpp
|
| index f8bcd616e111780528368429cf1a6147146d82ae..9988e67ac267851c43060c0ba73266af10b3aa4c 100644
|
| --- a/lib/Target/X86/X86TargetObjectFile.cpp
|
| +++ b/lib/Target/X86/X86TargetObjectFile.cpp
|
| @@ -8,6 +8,7 @@
|
| //===----------------------------------------------------------------------===//
|
|
|
| #include "X86TargetObjectFile.h"
|
| +#include "X86Subtarget.h" // @LOCALMOD
|
| #include "llvm/ADT/StringExtras.h"
|
| #include "llvm/IR/Mangler.h"
|
| #include "llvm/IR/Operator.h"
|
| @@ -169,3 +170,30 @@ X86WindowsTargetObjectFile::getSectionForConstant(SectionKind Kind,
|
|
|
| return TargetLoweringObjectFile::getSectionForConstant(Kind, C);
|
| }
|
| +
|
| +// @LOCALMOD-START
|
| +// NOTE: this was largely lifted from
|
| +// lib/Target/ARM/ARMTargetObjectFile.cpp
|
| +//
|
| +// The default is .ctors/.dtors while the arm backend uses
|
| +// .init_array/.fini_array
|
| +//
|
| +// Without this the linker defined symbols __fini_array_start and
|
| +// __fini_array_end do not have useful values. c.f.:
|
| +// http://code.google.com/p/nativeclient/issues/detail?id=805
|
| +void TargetLoweringObjectFileNaCl::Initialize(MCContext &Ctx,
|
| + const TargetMachine &TM) {
|
| + TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
| +
|
| + StaticCtorSection =
|
| + getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
|
| + ELF::SHF_WRITE |
|
| + ELF::SHF_ALLOC,
|
| + SectionKind::getDataRel());
|
| + StaticDtorSection =
|
| + getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
|
| + ELF::SHF_WRITE |
|
| + ELF::SHF_ALLOC,
|
| + SectionKind::getDataRel());
|
| +}
|
| +// @LOCALMOD-END
|
|
|