mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-12 05:47:11 +03:00
[more liberal uclibc/newlib environment matching/patching]
To make e.g. `-mtriple=armv7-none-newlibeabi` work, where `newlibeabi` was previously apparently treated as OS component before normalization.
This commit is contained in:
parent
224217b193
commit
264776a3c9
1 changed files with 5 additions and 13 deletions
|
@ -585,22 +585,14 @@ static void registerMipsABI() {
|
|||
|
||||
// Handle target environments not directly supported by LLVM.
|
||||
void fixupTripleEnv(std::string &tripleString) {
|
||||
llvm::Triple triple(tripleString);
|
||||
llvm::StringRef env = triple.getEnvironmentName();
|
||||
std::string newEnv;
|
||||
|
||||
if (env.startswith("uclibc")) {
|
||||
size_t i;
|
||||
if ((i = tripleString.find("-uclibc")) != std::string::npos) {
|
||||
global.params.isUClibcEnvironment = true;
|
||||
newEnv = ("gnu" + env.substr(6)).str(); // uclibceabihf => gnueabihf
|
||||
} else if (env.startswith("newlib")) {
|
||||
tripleString.replace(i + 1, 6, "gnu"); // -uclibceabihf => -gnueabihf
|
||||
} else if ((i = tripleString.find("-newlib")) != std::string::npos) {
|
||||
global.params.isNewlibEnvironment = true;
|
||||
newEnv = env.substr(6).str(); // newlibeabi => eabi
|
||||
} else {
|
||||
return;
|
||||
tripleString.replace(i + 1, 6, ""); // -newlibeabi => -eabi
|
||||
}
|
||||
|
||||
triple.setEnvironmentName(newEnv);
|
||||
tripleString = triple.normalize();
|
||||
}
|
||||
|
||||
/// Register the float ABI.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue