mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Protect user-supplied runtime library functions in LTO
Add user-supplied C runtime and compiler-rt library functions to llvm.compiler.used to protect them from premature optimization by passes like -globalopt and -ipsccp. Calls to (seemingly unused) runtime library functions can be added by -instcombine and instruction lowering. Patch by Duncan Exon Smith, thanks! Fixes <rdar://problem/14740087> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194514 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "llvm-c/lto.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/Linker.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include <string>
|
||||
@@ -48,6 +49,7 @@ namespace llvm {
|
||||
class GlobalValue;
|
||||
class Mangler;
|
||||
class MemoryBuffer;
|
||||
class TargetLibraryInfo;
|
||||
class TargetMachine;
|
||||
class raw_ostream;
|
||||
}
|
||||
@@ -125,6 +127,7 @@ private:
|
||||
std::string &errMsg);
|
||||
void applyScopeRestrictions();
|
||||
void applyRestriction(llvm::GlobalValue &GV,
|
||||
const llvm::ArrayRef<llvm::StringRef> &Libcalls,
|
||||
std::vector<const char*> &MustPreserveList,
|
||||
llvm::SmallPtrSet<llvm::GlobalValue*, 8> &AsmUsed,
|
||||
llvm::Mangler &Mangler);
|
||||
|
||||
Reference in New Issue
Block a user