summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/llvm')
-rw-r--r--meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch31
-rw-r--r--meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch37
-rw-r--r--meta/recipes-devtools/llvm/llvm/llvm-config51
-rw-r--r--meta/recipes-devtools/llvm/llvm_git.bb178
4 files changed, 0 insertions, 297 deletions
diff --git a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch b/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch
deleted file mode 100644
index a5c53b6657..0000000000
--- a/meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 3b30a9bda88374e8f03bf96e972aee5bd214b98b Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 27 Nov 2020 10:11:08 +0000
4Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well
5
6Otherwise, there are instances which are identical in
7every other field and therefore sort non-reproducibly
8(which breaks binary and source reproducibiliy).
9
10Upstream-Status: Submitted [https://reviews.llvm.org/D97477]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12---
13 llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
17index 73724e662f9e..1ca9c73415db 100644
18--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
19+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
20@@ -361,7 +361,10 @@ public:
21 // name of a class shouldn't be significant. However, some of the backends
22 // accidentally rely on this behaviour, so it will have to stay like this
23 // until they are fixed.
24- return ValueName < RHS.ValueName;
25+ if (ValueName != RHS.ValueName)
26+ return ValueName < RHS.ValueName;
27+ // All else being equal, we should sort by name, for source and binary reproducibility
28+ return Name < RHS.Name;
29 }
30 };
31
diff --git a/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch b/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
deleted file mode 100644
index add38b3bb4..0000000000
--- a/meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 588a8694c6540e31140c7e242bfb5e279d6ca08c Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH] llvm: allow env override of exe and libdir path
5
6When using a native llvm-config from inside a sysroot, we need llvm-config to
7return the libraries, include directories, etc. from inside the sysroot rather
8than from the native sysroot. Thus provide an env override for calling
9llvm-config from a target sysroot.
10
11Upstream-Status: Inappropriate [OE-specific]
12
13Signed-off-by: Martin Kelly <mkelly@xevo.com>
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 llvm/tools/llvm-config/llvm-config.cpp | 25 +++++++++++++++++++------
17 1 file changed, 19 insertions(+), 6 deletions(-)
18
19diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
20index e86eb2b44b10..7b2abf318dbe 100644
21--- a/llvm/tools/llvm-config/llvm-config.cpp
22+++ b/llvm/tools/llvm-config/llvm-config.cpp
23@@ -246,6 +246,13 @@ Typical components:\n\
24
25 /// Compute the path to the main executable.
26 std::string GetExecutablePath(const char *Argv0) {
27+ // Hack for Yocto: we need to override the root path when we are using
28+ // llvm-config from within a target sysroot.
29+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
30+ if (Sysroot != nullptr) {
31+ return Sysroot;
32+ }
33+
34 // This just needs to be some symbol in the binary; C++ doesn't
35 // allow taking the address of ::main however.
36 void *P = (void *)(intptr_t)GetExecutablePath;
37
diff --git a/meta/recipes-devtools/llvm/llvm/llvm-config b/meta/recipes-devtools/llvm/llvm/llvm-config
deleted file mode 100644
index 5e4ded2da5..0000000000
--- a/meta/recipes-devtools/llvm/llvm/llvm-config
+++ /dev/null
@@ -1,51 +0,0 @@
1#!/bin/bash
2#
3# Copyright OpenEmbedded Contributors
4#
5# SPDX-License-Identifier: MIT
6#
7# Wrap llvm-config since the native llvm-config will remap some values correctly
8# if placed in the target sysroot but for flags, it would provide the native ones.
9# Provide ours from the environment instead.
10
11NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
12if [[ $# == 0 ]]; then
13 exec "$NEXT_LLVM_CONFIG"
14fi
15
16remain=""
17output=""
18for arg in "$@"; do
19 case "$arg" in
20 --cppflags)
21 output="${output} ${CPPFLAGS}"
22 ;;
23 --cflags)
24 output="${output} ${CFLAGS}"
25 ;;
26 --cxxflags)
27 output="${output} ${CXXFLAGS}"
28 ;;
29 --ldflags)
30 output="${output} ${LDFLAGS}"
31 ;;
32 --shared-mode)
33 output="${output} shared"
34 ;;
35 --libs)
36 output="${output} -lLLVM"
37 ;;
38 --link-shared)
39 break
40 ;;
41 *)
42 remain="${remain} ${arg}"
43 ;;
44 esac
45done
46
47if [ "${remain}" != "" ]; then
48 output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
49fi
50
51echo "${output}"
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
deleted file mode 100644
index 6413b041a8..0000000000
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ /dev/null
@@ -1,178 +0,0 @@
1# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "The LLVM Compiler Infrastructure"
5HOMEPAGE = "http://llvm.org"
6LICENSE = "Apache-2.0-with-LLVM-exception"
7SECTION = "devel"
8
9LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
10
11DEPENDS = "libffi libxml2 zlib zstd libedit ninja-native llvm-native"
12
13RDEPENDS:${PN}:append:class-target = " ncurses-terminfo"
14
15inherit cmake pkgconfig
16
17# could be 'rcX' or 'git' or empty ( for release )
18VER_SUFFIX = ""
19
20PV = "18.1.5${VER_SUFFIX}"
21
22MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}"
23
24LLVM_RELEASE = "${PV}"
25
26BRANCH = "release/${MAJOR_VERSION}.x"
27SRCREV = "617a15a9eac96088ae5e9134248d8236e34b91b1"
28SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH};protocol=https \
29 file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
30 file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \
31 file://llvm-config \
32 "
33
34UPSTREAM_CHECK_GITTAGREGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)"
35
36S = "${WORKDIR}/git/llvm"
37
38LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
39
40def get_llvm_arch(bb, d, arch_var):
41 import re
42 a = d.getVar(arch_var)
43 if re.match(r'(i.86|athlon|x86.64)$', a): return 'X86'
44 elif re.match(r'arm$', a): return 'ARM'
45 elif re.match(r'armeb$', a): return 'ARM'
46 elif re.match(r'aarch64$', a): return 'AArch64'
47 elif re.match(r'aarch64_be$', a): return 'AArch64'
48 elif re.match(r'mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
49 elif re.match(r'riscv(32|64)(eb|)$', a): return 'RISCV'
50 elif re.match(r'p(pc|owerpc)(|64)', a): return 'PowerPC'
51 else:
52 raise bb.parse.SkipRecipe("Cannot map '%s' to a supported LLVM architecture" % a)
53
54def get_llvm_host_arch(bb, d):
55 return get_llvm_arch(bb, d, 'HOST_ARCH')
56
57PACKAGECONFIG ??= "libllvm"
58PACKAGECONFIG:class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'libllvm', '', d)}"
59# if optviewer OFF, force the modules to be not found or the ones on the host would be found
60PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml"
61PACKAGECONFIG[libllvm] = ""
62
63#
64# Default to build all OE-Core supported target arches (user overridable).
65#
66LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}"
67
68ARM_INSTRUCTION_SET:armv5 = "arm"
69ARM_INSTRUCTION_SET:armv4t = "arm"
70
71EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
72 -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
73 -DLLVM_ENABLE_PIC=ON \
74 -DLLVM_BINDINGS_LIST='' \
75 -DLLVM_LINK_LLVM_DYLIB=ON \
76 -DLLVM_ENABLE_FFI=ON \
77 -DLLVM_ENABLE_RTTI=ON \
78 -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
79 -DLLVM_OPTIMIZED_TABLEGEN=ON \
80 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS}' \
81 -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \
82 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
83 -DCMAKE_BUILD_TYPE=Release \
84 "
85
86EXTRA_OECMAKE:append:class-target = "\
87 -DCMAKE_CROSSCOMPILING:BOOL=ON \
88 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
89 -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
90 "
91
92EXTRA_OECMAKE:append:class-nativesdk = "\
93 -DCMAKE_CROSSCOMPILING:BOOL=ON \
94 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
95 -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
96 "
97
98# patch out build host paths for reproducibility
99do_compile:prepend:class-target() {
100 sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc
101}
102
103do_compile() {
104 if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then
105 ninja -v ${PARALLEL_MAKE}
106 else
107 ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen
108 fi
109}
110
111do_install() {
112 if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then
113 DESTDIR=${D} ninja -v install
114
115 # llvm harcodes usr/lib as install path, so this corrects it to actual libdir
116 mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true
117
118 # Remove opt-viewer: https://llvm.org/docs/Remarks.html
119 rm -rf ${D}${datadir}/opt-viewer
120 rmdir ${D}${datadir}
121
122 # reproducibility
123 sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake
124 fi
125}
126
127do_install:append:class-native() {
128 install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
129 install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV}
130 ln -sf llvm-config${PV} ${D}${bindir}/llvm-config
131}
132
133SYSROOT_PREPROCESS_FUNCS:append:class-target = " llvm_sysroot_preprocess"
134
135llvm_sysroot_preprocess() {
136 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
137 install -m 0755 ${UNPACKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
138 ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
139}
140
141PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto"
142
143RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks"
144
145FILES:${PN}-bugpointpasses = "\
146 ${libdir}/BugpointPasses.so \
147"
148
149FILES:${PN}-libllvm = "\
150 ${libdir}/libLLVM-${MAJOR_VERSION}.so \
151 ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \
152"
153
154FILES:${PN}-liblto += "\
155 ${libdir}/libLTO.so.* \
156"
157
158FILES:${PN}-liboptremarks += "\
159 ${libdir}/libRemarks.so.* \
160"
161
162FILES:${PN}-llvmhello = "\
163 ${libdir}/LLVMHello.so \
164"
165
166FILES:${PN}-dev += " \
167 ${libdir}/llvm-config \
168 ${libdir}/libRemarks.so \
169 ${libdir}/libLLVM-${PV}.so \
170"
171
172FILES:${PN}-staticdev += "\
173 ${libdir}/*.a \
174"
175
176INSANE_SKIP:${PN}-libllvm += "dev-so"
177
178BBCLASSEXTEND = "native nativesdk"