Skip to content

Instantly share code, notes, and snippets.

@crabtw
Last active March 31, 2020 08:59
Show Gist options
  • Save crabtw/4481604 to your computer and use it in GitHub Desktop.
Save crabtw/4481604 to your computer and use it in GitHub Desktop.
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp (revision 181993)
+++ lib/Driver/Tools.cpp (working copy)
@@ -6007,8 +6007,12 @@
CmdArgs.push_back("/lib/ld-linux.so.3");
}
else if (ToolChain.getArch() == llvm::Triple::mips ||
- ToolChain.getArch() == llvm::Triple::mipsel)
- CmdArgs.push_back("/lib/ld.so.1");
+ ToolChain.getArch() == llvm::Triple::mipsel) {
+ if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc)
+ CmdArgs.push_back("/lib/ld-uClibc.so.0");
+ else
+ CmdArgs.push_back("/lib/ld.so.1");
+ }
else if (ToolChain.getArch() == llvm::Triple::mips64 ||
ToolChain.getArch() == llvm::Triple::mips64el) {
if (hasMipsN32ABIArg(Args))
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp (revision 171840)
+++ lib/Support/Triple.cpp (working copy)
@@ -144,6 +144,7 @@
case MachO: return "macho";
case Android: return "android";
case ELF: return "elf";
+ case UClibc: return "uclibc";
}
llvm_unreachable("Invalid EnvironmentType!");
@@ -288,6 +289,7 @@
.StartsWith("macho", Triple::MachO)
.StartsWith("android", Triple::Android)
.StartsWith("elf", Triple::ELF)
+ .StartsWith("uclibc", Triple::UClibc)
.Default(Triple::UnknownEnvironment);
}
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h (revision 171840)
+++ include/llvm/ADT/Triple.h (working copy)
@@ -114,7 +114,8 @@
EABI,
MachO,
Android,
- ELF
+ ELF,
+ UClibc
};
private:
#!/bin/sh
TOOLCHAIN_PATH=$HOME/x-tools/mips-unknown-linux-uclibc
PATH=$HOME/src/llvm-svn/b/Release+Asserts/bin:$TOOLCHAIN_PATH/bin:$PATH
eval clang -target mips-unknown-linux-uclibc \
-msoft-float -mips32r2 -fPIC \
--sysroot $TOOLCHAIN_PATH/mips-unknown-linux-uclibc/sysroot \
-B$TOOLCHAIN_PATH/lib/gcc/mips-unknown-linux-uclibc/4.3.2 \
-L$TOOLCHAIN_PATH/lib/gcc/mips-unknown-linux-uclibc/4.3.2 \
-integrated-as -Qunused-arguments \
$*
@arajkumar
Copy link

Hello, Is this patch upstreamed to llvm/clang ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment