add the ability to call InitTargetOptionsFromCodeGenFlags from multiple objects

Summary: llvm/CodeGen/CommandFlags.h a utility function InitTargetOptionsFromCodeGenFlags which is used to set target options from flags based on the command line. The command line flags are stored in globals defined in the same file, and including the file in multiple places causes the globals to be defined multiple times, leading to linker errors. This change adds a single place in lld where these globals are defined and exports only the utility function. This makes it possible to call InitTargetOptionsFromCodeGenFlags from multiple places in lld, which a follow-up change will do.

Reviewers: davide, ruiu

Reviewed By: davide, ruiu

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D29058

llvm-svn: 293965
This commit is contained in:
Bob Haarman 2017-02-02 23:49:16 +00:00
parent 803b141f32
commit 35989d6be5
2 changed files with 2 additions and 1 deletions

View File

@ -12,11 +12,11 @@
#include "Error.h"
#include "InputFiles.h"
#include "Symbols.h"
#include "lld/Core/TargetOptionsCommandFlags.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/CommandFlags.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/LTO/Config.h"
#include "llvm/LTO/LTO.h"

View File

@ -7,6 +7,7 @@ add_lld_library(lldCore
Reproduce.cpp
Resolver.cpp
SymbolTable.cpp
TargetOptionsCommandFlags.cpp
Writer.cpp
ADDITIONAL_HEADER_DIRS