mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
If all linker input files are native object files then lto-bugpoint is not useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53777 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -13,7 +13,12 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "LTOBugPoint.h"
|
#include "LTOBugPoint.h"
|
||||||
|
#include "llvm/Support/SystemUtils.h"
|
||||||
|
#include "llvm/System/Path.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
/// LTOBugPoint -- Constructor. Popuate list of linker options and
|
||||||
|
/// list of linker input files.
|
||||||
LTOBugPoint::LTOBugPoint(std::istream &args, std::istream &ins) {
|
LTOBugPoint::LTOBugPoint(std::istream &args, std::istream &ins) {
|
||||||
|
|
||||||
// Read linker options. Order is important here.
|
// Read linker options. Order is important here.
|
||||||
@@ -26,3 +31,27 @@ LTOBugPoint::LTOBugPoint(std::istream &args, std::istream &ins) {
|
|||||||
while(getline(ins, inFile))
|
while(getline(ins, inFile))
|
||||||
LinkerInputFiles.push_back(inFile);
|
LinkerInputFiles.push_back(inFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// findTroubleMakers - Find minimum set of input files that causes error
|
||||||
|
/// identified by the script.
|
||||||
|
bool
|
||||||
|
LTOBugPoint::findTroubleMakers(llvm::SmallVector<std::string, 4> &TroubleMakers,
|
||||||
|
std::string &Script) {
|
||||||
|
|
||||||
|
// First, build native object files set.
|
||||||
|
bool bitcodeFileSeen = false;
|
||||||
|
for(llvm::SmallVector<std::string, 16>::iterator I = LinkerInputFiles.begin(),
|
||||||
|
E = LinkerInputFiles.end(); I != E; ++I) {
|
||||||
|
std::string &path = *I;
|
||||||
|
if (llvm::sys::Path(path.c_str()).isBitcodeFile())
|
||||||
|
bitcodeFileSeen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bitcodeFileSeen) {
|
||||||
|
std::cerr << "lto-bugpoint: Error: Unable to help!";
|
||||||
|
std::cerr << " Need at least one input file that contains llvm bitcode\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -21,10 +21,22 @@ class LTOBugPoint {
|
|||||||
|
|
||||||
LTOBugPoint(std::istream &args, std::istream &ins);
|
LTOBugPoint(std::istream &args, std::istream &ins);
|
||||||
|
|
||||||
|
/// findTroubleMakers - Find minimum set of input files that causes error
|
||||||
|
/// identified by the script.
|
||||||
|
bool findTroubleMakers(llvm::SmallVector<std::string, 4> &TroubleMakers,
|
||||||
|
std::string &Script);
|
||||||
private:
|
private:
|
||||||
/// LinkerInputFiles - This is a list of linker input files. Once populated
|
/// LinkerInputFiles - This is a list of linker input files. Once populated
|
||||||
/// this list is not modified.
|
/// this list is not modified.
|
||||||
llvm::SmallVector<std::string, 16> LinkerInputFiles;
|
llvm::SmallVector<std::string, 16> LinkerInputFiles;
|
||||||
|
|
||||||
|
/// LinkerOptions - List of linker command line options.
|
||||||
llvm::SmallVector<std::string, 16> LinkerOptions;
|
llvm::SmallVector<std::string, 16> LinkerOptions;
|
||||||
|
|
||||||
|
/// NativeInputFiles - This is a list of input files that are not llvm
|
||||||
|
/// bitcode files. The order in this list is important. The a file
|
||||||
|
/// in LinkerInputFiles at index 4 is a llvm bitcode file then the file
|
||||||
|
/// at index 4 in NativeInputFiles is corresponding native object file.
|
||||||
|
llvm::SmallVector<std::string, 16> NativeInputFiles;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -10,6 +10,8 @@ LEVEL = ../..
|
|||||||
|
|
||||||
TOOLNAME = lto-bugpoint
|
TOOLNAME = lto-bugpoint
|
||||||
|
|
||||||
|
LINK_COMPONENTS := system
|
||||||
|
|
||||||
REQUIRES_EH := 1
|
REQUIRES_EH := 1
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
@@ -47,16 +47,13 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Third argument is absolute path to the validation script. This
|
// Third argument is absolute path to the validation script. This
|
||||||
// script is used to validate LTO error under investigation.
|
// script is used to validate LTO error under investigation.
|
||||||
std::istream *ValidationScriptFile = new std::ifstream(argv[3], input_mode);
|
std::string ValidationScript = argv[3];
|
||||||
if (!ValidationScriptFile->good()) {
|
|
||||||
std::cerr << argv[0] << ": error opening " << argv[3] << "!\n";
|
|
||||||
delete LinkerArgsFile;
|
|
||||||
delete LinkerInputsFile;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
LTOBugPoint bugFinder(*LinkerArgsFile, *LinkerInputsFile);
|
LTOBugPoint bugFinder(*LinkerArgsFile, *LinkerInputsFile);
|
||||||
|
|
||||||
|
llvm::SmallVector<std::string, 4> TroubleMakers;
|
||||||
|
if (!bugFinder.findTroubleMakers(TroubleMakers, ValidationScript))
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} catch (const std::string& msg) {
|
} catch (const std::string& msg) {
|
||||||
std::cerr << argv[0] << ": " << msg << "\n";
|
std::cerr << argv[0] << ": " << msg << "\n";
|
||||||
|
Reference in New Issue
Block a user