diff options
-rw-r--r-- | lld/ELF/LTO.cpp | 3 | ||||
-rw-r--r-- | lld/test/ELF/lto/ctors.ll | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index abcafb15c15..180236c475f 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/CodeGen/CommandFlags.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/Linker/IRMover.h" #include "llvm/Support/StringSaver.h" @@ -167,7 +168,7 @@ TargetMachine *BitcodeCompiler::getTargetMachine() { const Target *T = TargetRegistry::lookupTarget(TripleStr, Msg); if (!T) fatal("target not found: " + Msg); - TargetOptions Options; + TargetOptions Options = InitTargetOptionsFromCodeGenFlags(); Reloc::Model R = Config->Pic ? Reloc::PIC_ : Reloc::Static; return T->createTargetMachine(TripleStr, "", "", Options, R); } diff --git a/lld/test/ELF/lto/ctors.ll b/lld/test/ELF/lto/ctors.ll index aaf9a133968..7fce645f28f 100644 --- a/lld/test/ELF/lto/ctors.ll +++ b/lld/test/ELF/lto/ctors.ll @@ -13,4 +13,6 @@ define void @ctor() { } ; The llvm.global_ctors should end up producing constructors. -; CHECK: Name: .ctors +; On x86-64 (linux) we should always emit .init_array and never .ctors. +; CHECK: Name: .init_array +; CHECK-NOT: Name: .ctors |