mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-08 03:46:02 +03:00
more cleanup and cmake fixes
This commit is contained in:
parent
e82aeb67d3
commit
cc1e8babbc
2 changed files with 34 additions and 34 deletions
|
@ -159,20 +159,20 @@ void fixupRtThunks(llvm::Module &newModule,
|
|||
assert(objectsFixed = thunk2func.size());
|
||||
}
|
||||
|
||||
void hideExternalSymbols(llvm::Module &newModule, const GlobalValsMap &filter) {
|
||||
std::set<std::string> externalSymbols;
|
||||
for (auto&& val: filter) {
|
||||
if(GlobalValVisibility::External == val.second) {
|
||||
externalSymbols.emplace(val.first->getName());
|
||||
}
|
||||
}
|
||||
for (auto& obj: newModule.global_objects()) {
|
||||
if ((llvm::GlobalValue::ExternalLinkage == obj.getLinkage()) &&
|
||||
(!contains(externalSymbols, obj.getName()))) {
|
||||
obj.setLinkage(llvm::GlobalValue::InternalLinkage);
|
||||
}
|
||||
}
|
||||
}
|
||||
//void hideExternalSymbols(llvm::Module &newModule, const GlobalValsMap &filter) {
|
||||
// std::set<std::string> externalSymbols;
|
||||
// for (auto&& val: filter) {
|
||||
// if(GlobalValVisibility::External == val.second) {
|
||||
// externalSymbols.emplace(val.first->getName());
|
||||
// }
|
||||
// }
|
||||
// for (auto& obj: newModule.global_objects()) {
|
||||
// if ((llvm::GlobalValue::ExternalLinkage == obj.getLinkage()) &&
|
||||
// (!contains(externalSymbols, obj.getName()))) {
|
||||
// obj.setLinkage(llvm::GlobalValue::InternalLinkage);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
llvm::Constant *getArrayPtr(llvm::Constant *array) {
|
||||
assert(nullptr != array);
|
||||
|
@ -242,24 +242,24 @@ llvm::Constant *createStringInitializer(llvm::Module &mod,
|
|||
llvm::Type::getInt8PtrTy(mod.getContext()));
|
||||
}
|
||||
|
||||
void createStaticString(llvm::Module& mod,
|
||||
llvm::GlobalVariable* var,
|
||||
llvm::GlobalVariable* varLen, //can be null
|
||||
llvm::StringRef str) {
|
||||
assert(nullptr != var);
|
||||
const auto dataLen = str.size() + 1;
|
||||
auto gvar = new llvm::GlobalVariable(
|
||||
mod,
|
||||
llvm::ArrayType::get(llvm::Type::getInt8Ty(mod.getContext()), dataLen),
|
||||
true,
|
||||
llvm::GlobalValue::InternalLinkage,
|
||||
llvm::ConstantDataArray::getString(mod.getContext(), str, true),
|
||||
".str");
|
||||
var->setInitializer(getArrayPtr(gvar));
|
||||
if (nullptr != varLen) {
|
||||
varLen->setInitializer(llvm::ConstantInt::get(mod.getContext(), APInt(32, dataLen)));
|
||||
}
|
||||
}
|
||||
//void createStaticString(llvm::Module& mod,
|
||||
// llvm::GlobalVariable* var,
|
||||
// llvm::GlobalVariable* varLen, //can be null
|
||||
// llvm::StringRef str) {
|
||||
// assert(nullptr != var);
|
||||
// const auto dataLen = str.size() + 1;
|
||||
// auto gvar = new llvm::GlobalVariable(
|
||||
// mod,
|
||||
// llvm::ArrayType::get(llvm::Type::getInt8Ty(mod.getContext()), dataLen),
|
||||
// true,
|
||||
// llvm::GlobalValue::InternalLinkage,
|
||||
// llvm::ConstantDataArray::getString(mod.getContext(), str, true),
|
||||
// ".str");
|
||||
// var->setInitializer(getArrayPtr(gvar));
|
||||
// if (nullptr != varLen) {
|
||||
// varLen->setInitializer(llvm::ConstantInt::get(mod.getContext(), APInt(32, dataLen)));
|
||||
// }
|
||||
//}
|
||||
|
||||
// struct RtCompileVarList
|
||||
// {
|
||||
|
|
|
@ -12,7 +12,7 @@ if(LDC_RUNTIME_COMPILE)
|
|||
set(JITRT_EXTRA_FLAGS "/Zl")
|
||||
|
||||
else()
|
||||
set(JITRT_EXTRA_FLAGS "-fPIC -O3")
|
||||
set(JITRT_EXTRA_FLAGS "-fPIC -O3 -std=c++11")
|
||||
endif()
|
||||
|
||||
# Sets up the targets for building the D-source jit-rt object files,
|
||||
|
@ -63,7 +63,7 @@ if(LDC_RUNTIME_COMPILE)
|
|||
ARCHIVE_OUTPUT_DIRECTORY ${output_path}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${output_path}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${output_path}
|
||||
COMPILE_FLAGS "${c_flags} ${JITRT_EXTRA_FLAGS} /Zl"
|
||||
COMPILE_FLAGS "${c_flags} ${JITRT_EXTRA_FLAGS}"
|
||||
LINK_FLAGS "${ld_flags} ${JITRT_EXTRA_LDFLAGS}"
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue