diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-05-10 04:45:28 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2016-05-10 04:45:28 +0000 |
commit | 63887f5469d954a9ed2c78c714d6393e93354df0 (patch) | |
tree | 1401764c3831c476ffa38de59c5b609f64e4a32e | |
parent | d88576313149ede12f6287a31fbb2526c43531d8 (diff) | |
download | meta-clang-63887f5469d954a9ed2c78c714d6393e93354df0.tar.gz |
clang: Fix ldso for musl based systems
Existing patches were fine however it was resetting
the ld.so since we were following through the musl
case and subsequent flow would overwrite the computed
value of ldso
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | recipes-devtools/clang/clang/0001-driver-Add-musl-ldso-support.patch | 28 | ||||
-rw-r--r-- | recipes-devtools/clang/clang/0001-triplet-Add-musl-support.patch | 22 |
2 files changed, 31 insertions, 19 deletions
diff --git a/recipes-devtools/clang/clang/0001-driver-Add-musl-ldso-support.patch b/recipes-devtools/clang/clang/0001-driver-Add-musl-ldso-support.patch index 494a671..89eb0b8 100644 --- a/recipes-devtools/clang/clang/0001-driver-Add-musl-ldso-support.patch +++ b/recipes-devtools/clang/clang/0001-driver-Add-musl-ldso-support.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 8fddf3128d740d2e8831367c827fa1b747364563 Mon Sep 17 00:00:00 2001 | 1 | From 2b8900f80027da90a41043f8d428c208cb6fdae2 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Wed, 30 Mar 2016 19:56:10 -0700 | 3 | Date: Wed, 30 Mar 2016 19:56:10 -0700 |
4 | Subject: [PATCH] driver: Add musl ldso support | 4 | Subject: [PATCH] driver: Add musl ldso support |
@@ -9,14 +9,14 @@ as a musl based Linux platform | |||
9 | 9 | ||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
11 | --- | 11 | --- |
12 | lib/Driver/Tools.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ | 12 | lib/Driver/Tools.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++----- |
13 | 1 file changed, 40 insertions(+) | 13 | 1 file changed, 42 insertions(+), 5 deletions(-) |
14 | 14 | ||
15 | diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp | 15 | diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp |
16 | index e72e4bd..968542c 100644 | 16 | index e45c5c5..34237c4 100644 |
17 | --- a/lib/Driver/Tools.cpp | 17 | --- a/lib/Driver/Tools.cpp |
18 | +++ b/lib/Driver/Tools.cpp | 18 | +++ b/lib/Driver/Tools.cpp |
19 | @@ -8240,6 +8240,46 @@ static std::string getLinuxDynamicLinker(const ArgList &Args, | 19 | @@ -8953,6 +8953,47 @@ static std::string getLinuxDynamicLinker(const ArgList &Args, |
20 | return "/system/bin/linker64"; | 20 | return "/system/bin/linker64"; |
21 | else | 21 | else |
22 | return "/system/bin/linker"; | 22 | return "/system/bin/linker"; |
@@ -58,11 +58,25 @@ index e72e4bd..968542c 100644 | |||
58 | + case llvm::Triple::mips64el: | 58 | + case llvm::Triple::mips64el: |
59 | + return "/lib/ld-musl-mipsel64el.so.1"; | 59 | + return "/lib/ld-musl-mipsel64el.so.1"; |
60 | + default: | 60 | + default: |
61 | + llvm_unreachable("unsupported musl architecture"); | ||
61 | + break; | 62 | + break; |
62 | + } | 63 | + } |
63 | } else if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::sparc || | 64 | } else if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::sparc || |
64 | Arch == llvm::Triple::sparcel) | 65 | Arch == llvm::Triple::sparcel) |
65 | return "/lib/ld-linux.so.2"; | 66 | return "/lib/ld-linux.so.2"; |
67 | @@ -8981,11 +9022,7 @@ static std::string getLinuxDynamicLinker(const ArgList &Args, | ||
68 | bool IsNaN2008 = mips::isNaN2008(Args, ToolChain.getTriple()); | ||
69 | if (mips::isUCLibc(Args)) | ||
70 | LibName = IsNaN2008 ? "ld-uClibc-mipsn8.so.0" : "ld-uClibc.so.0"; | ||
71 | - else if (!ToolChain.getTriple().hasEnvironment()) { | ||
72 | - bool LE = (ToolChain.getTriple().getArch() == llvm::Triple::mipsel) || | ||
73 | - (ToolChain.getTriple().getArch() == llvm::Triple::mips64el); | ||
74 | - LibName = LE ? "ld-musl-mipsel.so.1" : "ld-musl-mips.so.1"; | ||
75 | - } else | ||
76 | + else | ||
77 | LibName = IsNaN2008 ? "ld-linux-mipsn8.so.1" : "ld.so.1"; | ||
78 | |||
79 | return (LibDir + "/" + LibName).str(); | ||
66 | -- | 80 | -- |
67 | 2.7.4 | 81 | 2.8.2 |
68 | 82 | ||
diff --git a/recipes-devtools/clang/clang/0001-triplet-Add-musl-support.patch b/recipes-devtools/clang/clang/0001-triplet-Add-musl-support.patch index 9888a5d..3fdf4b6 100644 --- a/recipes-devtools/clang/clang/0001-triplet-Add-musl-support.patch +++ b/recipes-devtools/clang/clang/0001-triplet-Add-musl-support.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 31a62e652efc8e582e3febda0a300fd3f345e260 Mon Sep 17 00:00:00 2001 | 1 | From 6ea56dabfd56ad4d1f994378b3f5ce46c02cb85c Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Wed, 30 Mar 2016 19:55:41 -0700 | 3 | Date: Wed, 30 Mar 2016 19:55:41 -0700 |
4 | Subject: [PATCH] triplet: Add musl support | 4 | Subject: [PATCH] triplet: Add musl support |
@@ -6,13 +6,13 @@ Subject: [PATCH] triplet: Add musl support | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
7 | --- | 7 | --- |
8 | include/llvm/ADT/Triple.h | 13 +++++++++++++ | 8 | include/llvm/ADT/Triple.h | 13 +++++++++++++ |
9 | lib/Support/Triple.cpp | 10 +++++++++- | 9 | lib/Support/Triple.cpp | 8 ++++++++ |
10 | lib/Target/ARM/ARMSubtarget.h | 3 +++ | 10 | lib/Target/ARM/ARMSubtarget.h | 3 +++ |
11 | lib/Target/ARM/ARMTargetMachine.cpp | 2 ++ | 11 | lib/Target/ARM/ARMTargetMachine.cpp | 2 ++ |
12 | 4 files changed, 27 insertions(+), 1 deletion(-) | 12 | 4 files changed, 26 insertions(+) |
13 | 13 | ||
14 | diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h | 14 | diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h |
15 | index d163ac7..a4ffc55 100644 | 15 | index c89cf4d..29ec600 100644 |
16 | --- a/include/llvm/ADT/Triple.h | 16 | --- a/include/llvm/ADT/Triple.h |
17 | +++ b/include/llvm/ADT/Triple.h | 17 | +++ b/include/llvm/ADT/Triple.h |
18 | @@ -175,6 +175,10 @@ public: | 18 | @@ -175,6 +175,10 @@ public: |
@@ -32,7 +32,7 @@ index d163ac7..a4ffc55 100644 | |||
32 | 32 | ||
33 | + /// Checks if the environment is Linux with musl | 33 | + /// Checks if the environment is Linux with musl |
34 | + bool isLinuxMuslEnvironment() const { | 34 | + bool isLinuxMuslEnvironment() const { |
35 | + return getOS() == Triple::Linux && | 35 | + return isOSLinux() && |
36 | + (getEnvironment() == Triple::MUSL || | 36 | + (getEnvironment() == Triple::MUSL || |
37 | + getEnvironment() == Triple::MUSLX32 || | 37 | + getEnvironment() == Triple::MUSLX32 || |
38 | + getEnvironment() == Triple::MUSLEABI || | 38 | + getEnvironment() == Triple::MUSLEABI || |
@@ -43,7 +43,7 @@ index d163ac7..a4ffc55 100644 | |||
43 | bool isOSCygMing() const { | 43 | bool isOSCygMing() const { |
44 | return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment(); | 44 | return isWindowsCygwinEnvironment() || isWindowsGNUEnvironment(); |
45 | diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp | 45 | diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp |
46 | index 1967fac..146ed82 100644 | 46 | index 1967fac..f8b6236 100644 |
47 | --- a/lib/Support/Triple.cpp | 47 | --- a/lib/Support/Triple.cpp |
48 | +++ b/lib/Support/Triple.cpp | 48 | +++ b/lib/Support/Triple.cpp |
49 | @@ -201,6 +201,10 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { | 49 | @@ -201,6 +201,10 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { |
@@ -57,16 +57,14 @@ index 1967fac..146ed82 100644 | |||
57 | case CODE16: return "code16"; | 57 | case CODE16: return "code16"; |
58 | case EABI: return "eabi"; | 58 | case EABI: return "eabi"; |
59 | case EABIHF: return "eabihf"; | 59 | case EABIHF: return "eabihf"; |
60 | @@ -460,7 +464,11 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { | 60 | @@ -461,6 +465,10 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { |
61 | .StartsWith("eabi", Triple::EABI) | ||
62 | .StartsWith("gnueabihf", Triple::GNUEABIHF) | 61 | .StartsWith("gnueabihf", Triple::GNUEABIHF) |
63 | .StartsWith("gnueabi", Triple::GNUEABI) | 62 | .StartsWith("gnueabi", Triple::GNUEABI) |
64 | - .StartsWith("gnux32", Triple::GNUX32) | 63 | .StartsWith("gnux32", Triple::GNUX32) |
65 | + .StartsWith("musl", Triple::MUSL) | 64 | + .StartsWith("musl", Triple::MUSL) |
66 | + .StartsWith("gnux32", Triple::MUSLX32) | ||
67 | + .StartsWith("musleabihf", Triple::MUSLEABIHF) | 65 | + .StartsWith("musleabihf", Triple::MUSLEABIHF) |
68 | + .StartsWith("musleabi", Triple::MUSLEABI) | 66 | + .StartsWith("musleabi", Triple::MUSLEABI) |
69 | + .StartsWith("muslx32", Triple::GNUX32) | 67 | + .StartsWith("muslx32", Triple::MUSLX32) |
70 | .StartsWith("code16", Triple::CODE16) | 68 | .StartsWith("code16", Triple::CODE16) |
71 | .StartsWith("gnu", Triple::GNU) | 69 | .StartsWith("gnu", Triple::GNU) |
72 | .StartsWith("android", Triple::Android) | 70 | .StartsWith("android", Triple::Android) |
@@ -107,5 +105,5 @@ index 390b39c..9840c11 100644 | |||
107 | case llvm::Triple::EABI: | 105 | case llvm::Triple::EABI: |
108 | TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS; | 106 | TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS; |
109 | -- | 107 | -- |
110 | 2.7.4 | 108 | 2.8.2 |
111 | 109 | ||