From 4ee622c82b11a5052943da91f555f484795a04f8 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Oct 04 2020 22:33:01 +0000 Subject: Fix annobin workaround to work properly. --- diff --git a/0006-Make-lib64-clang-include-path-check-more-robust.patch b/0006-Make-lib64-clang-include-path-check-more-robust.patch index 8aec989..1587772 100644 --- a/0006-Make-lib64-clang-include-path-check-more-robust.patch +++ b/0006-Make-lib64-clang-include-path-check-more-robust.patch @@ -1,4 +1,4 @@ -From b2fa3dbb22aa48cbd8e26487beb2b9312d80eb81 Mon Sep 17 00:00:00 2001 +From ffd6037f1c765686ea6d02e9f9fb599ed284f5be Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 4 Oct 2020 02:51:46 -0400 Subject: [PATCH 6/6] Make lib64 clang include path check more robust. @@ -13,11 +13,11 @@ To be more robust, check both `/usr/lib64/clang/{version}/include` and Signed-off-by: Elliott Sales de Andrade --- - builder/env.go | 42 +++++++++++++++++++++++++++++------------- - 1 file changed, 29 insertions(+), 13 deletions(-) + builder/env.go | 46 +++++++++++++++++++++++++++++++--------------- + 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/builder/env.go b/builder/env.go -index 91bc263..dde3504 100644 +index 91bc263..c93e988 100644 --- a/builder/env.go +++ b/builder/env.go @@ -6,6 +6,7 @@ import ( @@ -28,7 +28,7 @@ index 91bc263..dde3504 100644 ) // getClangHeaderPath returns the path to the built-in Clang headers. It tries -@@ -43,22 +44,37 @@ func getClangHeaderPath(TINYGOROOT string) string { +@@ -43,25 +44,40 @@ func getClangHeaderPath(TINYGOROOT string) string { // /usr/lib/llvm-9/lib64/clang/9.0.1/include/ llvmRoot := filepath.Dir(filepath.Dir(binpath)) clangVersionRoot := filepath.Join(llvmRoot, "lib64", "clang") @@ -50,17 +50,18 @@ index 91bc263..dde3504 100644 + if err64 != nil && err32 != nil { + // Unexpected. + continue ++ } ++ dirnames := make([]string, len(dirs64)+len(dirs32)) ++ for i, d := range dirs32 { ++ dirnames[i] = filepath.Join(llvmRoot, "lib", "clang", d.Name()) } - dirnames := make([]string, len(dirs)) - for i, d := range dirs { -+ dirnames := make([]string, len(dirs64)+len(dirs32)) -+ for i, d := range dirs32 { - dirnames[i] = d.Name() +- dirnames[i] = d.Name() ++ for i, d := range dirs64 { ++ dirnames[len(dirs32)+i] = filepath.Join(llvmRoot, "lib64", "clang", d.Name()) } - sort.Strings(dirnames) -+ for i, d := range dirs64 { -+ dirnames[len(dirs32)+i] = d.Name() -+ } + sort.SliceStable(dirnames, func(i, j int) bool { + // Sort by version directory, normalizing version components to 3 digits; + // stable sort ensures that lib64 remains after lib. @@ -78,7 +79,11 @@ index 91bc263..dde3504 100644 + }) // Check for the highest version first. for i := len(dirnames) - 1; i >= 0; i-- { - path := filepath.Join(clangVersionRoot, dirnames[i], "include") +- path := filepath.Join(clangVersionRoot, dirnames[i], "include") ++ path := filepath.Join(dirnames[i], "include") + _, err := os.Stat(filepath.Join(path, "stdint.h")) + if err == nil { + return path -- 2.26.2 diff --git a/tinygo.spec b/tinygo.spec index e6d3b4a..98bd5af 100644 --- a/tinygo.spec +++ b/tinygo.spec @@ -72,7 +72,7 @@ Patch0003: 0003-Skip-STM32-tests.patch Patch0004: 0004-Also-check-lib64-for-clang-include-path.patch # https://github.com/tinygo-org/tinygo/pull/1056 Patch0005: 0005-main-add-initial-support-for-in-development-LLVM-11.patch - +# https://github.com/tinygo-org/tinygo/pull/1424 Patch0006: 0006-Make-lib64-clang-include-path-check-more-robust.patch # Not supported upstream yet.