summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.drone.yml83
-rw-r--r--.github/workflows/yoe.yml79
-rw-r--r--README.md113
-rw-r--r--classes/clang.bbclass45
-rw-r--r--classes/lto.bbclass7
-rw-r--r--conf/layer.conf10
-rw-r--r--conf/nonclangable.conf138
-rw-r--r--dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland_%.bbappend6
-rw-r--r--dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-x11_%.bbappend6
-rw-r--r--dynamic-layers/chromium-browser-layer/recipes-browser/chromium/gn-native_%.bbappend6
-rw-r--r--dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk/intel-mediasdk-20.5.1-no-lgcc.patch30
-rw-r--r--dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk_%.bbappend3
-rw-r--r--dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp/optee-fix-build-with-clang.patch67
-rw-r--r--dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp_%.bbappend7
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch27
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch46
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch176
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch169
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch68
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch89
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch35
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch46
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch239
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch60
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch156
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch69
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb (renamed from dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb)26
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-bpforc.h-Include-optional-header.patch31
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.11.4.bb (renamed from dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb)7
-rw-r--r--recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch32
-rw-r--r--recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend2
-rw-r--r--recipes-connectivity/dhcp/dhcp/dhcp-4.4.2-clang-12.patch19
-rw-r--r--recipes-connectivity/dhcp/dhcp_4.4.2%.bbappend7
-rw-r--r--recipes-connectivity/openssh/openssh_%.bbappend3
-rw-r--r--recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const-1.31.1.patch177
-rw-r--r--recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch35
-rw-r--r--recipes-core/busybox/busybox_1.31.1%.bbappend (renamed from recipes-core/busybox/busybox_1.31.%.bbappend)2
-rw-r--r--recipes-core/meta/clang-environment.inc19
-rw-r--r--recipes-core/meta/meta-environment-extsdk.bbappend3
-rw-r--r--recipes-core/meta/meta-environment.bbappend20
-rw-r--r--recipes-core/musl/musl_%.bbappend10
-rw-r--r--recipes-core/packagegroups/packagegroup-core-buildessential.bbappend3
-rw-r--r--recipes-core/packagegroups/packagegroup-cross-canadian.bbappend5
-rw-r--r--recipes-devtools/castxml/castxml_git.bb29
-rw-r--r--recipes-devtools/clang/clang.inc9
-rwxr-xr-xrecipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch54
-rw-r--r--recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch20
-rw-r--r--recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch8
-rw-r--r--recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch8
-rw-r--r--recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch6
-rw-r--r--recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch40
-rw-r--r--recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch18
-rw-r--r--recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch6
-rw-r--r--recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch12
-rw-r--r--recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch6
-rw-r--r--recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch6
-rw-r--r--recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch10
-rw-r--r--recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch6
-rw-r--r--recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch38
-rw-r--r--recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch8
-rw-r--r--recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch4
-rw-r--r--recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch16
-rw-r--r--recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch (renamed from recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch)4
-rw-r--r--recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch33
-rw-r--r--recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch (renamed from recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch)7
-rw-r--r--recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch (renamed from recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch)65
-rw-r--r--recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch (renamed from recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch)24
-rw-r--r--recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch (renamed from recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch)26
-rw-r--r--recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch (renamed from recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch)14
-rw-r--r--recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch (renamed from recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch)10
-rw-r--r--recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch (renamed from recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch)16
-rw-r--r--recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch112
-rw-r--r--recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch70
-rw-r--r--recipes-devtools/clang/clang/0026-OpenCL-Fix-support-for-cl_khr_mipmap_image_writes.patch114
-rw-r--r--recipes-devtools/clang/clang/0027-InstCombine-visitBitCast-do-not-crash-on-weird-bitca.patch51
-rw-r--r--recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch27
-rw-r--r--recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch44
-rw-r--r--recipes-devtools/clang/clang/0028-nfc-Fix-missing-include.patch28
-rw-r--r--recipes-devtools/clang/clang/0029-OpenMP-link-fix.patch 26
-rw-r--r--recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch32
-rw-r--r--recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch32
-rw-r--r--recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch71
-rw-r--r--recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch28
-rw-r--r--recipes-devtools/clang/clang/llvm-config (renamed from recipes-devtools/clang/llvm-common/llvm-config)0
-rw-r--r--recipes-devtools/clang/clang_git.bb64
-rw-r--r--recipes-devtools/clang/common.inc33
-rw-r--r--recipes-devtools/clang/compiler-rt-sanitizers_git.bb97
-rw-r--r--recipes-devtools/clang/compiler-rt_git.bb10
-rw-r--r--recipes-devtools/clang/libclc_git.bb37
-rw-r--r--recipes-devtools/clang/libcxx_git.bb4
-rw-r--r--recipes-devtools/clang/llvm-common.bb22
-rw-r--r--recipes-devtools/clang/llvm-project-source.bbappend9
-rw-r--r--recipes-devtools/clang/llvm-project-source.inc36
-rw-r--r--recipes-devtools/clang/openmp_git.bb3
-rw-r--r--recipes-devtools/distcc/distcc/distcc-3.3.3-clang-12.patch19
-rw-r--r--recipes-devtools/distcc/distcc_3.3.3%.bbappend4
-rw-r--r--recipes-devtools/rpm/rpm_%.bbappend6
-rw-r--r--recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-Use-12.0.0-for-base-llvm-version.patch26
-rw-r--r--recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-cmake-allow-to-enable-disable-ccache.patch32
-rw-r--r--recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb42
-rw-r--r--recipes-devtools/valgrind/valgrind/aarch64-inline-asm-clang.patch643
-rw-r--r--recipes-devtools/valgrind/valgrind/builtin_setjmp.patch116
-rw-r--r--recipes-devtools/valgrind/valgrind_%.bbappend3
-rw-r--r--recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch30
-rw-r--r--recipes-extended/logrotate/logrotate_%.bbappend2
-rw-r--r--recipes-extended/ltp/ltp_%.bbappend4
-rw-r--r--recipes-graphics/mesa/mesa_%.bbappend3
-rw-r--r--recipes-kernel/lttng/babeltrace2/babeltrace2-2.0.2-fix-reserved-keywords.patch31
-rw-r--r--recipes-kernel/lttng/babeltrace2_%.bbappend2
109 files changed, 3572 insertions, 1025 deletions
diff --git a/.drone.yml b/.drone.yml
deleted file mode 100644
index 753dacb..0000000
--- a/.drone.yml
+++ /dev/null
@@ -1,83 +0,0 @@
1kind: pipeline
2type: exec
3name: arm64
4
5platform:
6 os: linux
7 arch: arm64
8
9clone:
10 disable: false
11
12trigger:
13 branch:
14 - dunfell
15 event:
16 - push
17 - pull_request
18
19steps:
20 - name: build
21 commands:
22 - git clone --recurse-submodules -j8 git://github.com/YoeDistro/yoe-distro.git yoe
23 - cd yoe
24 - git checkout -b test origin/dunfell
25 - git pull
26 - git submodule update --recursive --init
27 - rm -rf sources/meta-clang
28 - ln -sf `pwd`/../ sources/meta-clang
29 - export DOCKER_REPO=none
30 - export LANG=en_US.UTF-8
31 - export SSTATE_CACHE_DIR=/scratch/sstate-cache
32 - echo "Started build# $DRONE_BUILD_NUMBER"
33 - echo "sstate cache dir = $SSTATE_CACHE_DIR"
34 - echo "building $DRONE_GIT_HTTP_URL, branch $DRONE_SOURCE_BRANCH"
35 - echo export DOCKER_REPO=none > local.sh
36 - echo export LANG=en_US.UTF-8 >> local.sh
37 - echo export SSTATE_CACHE_DIR=/scratch/sstate-cache >> local.sh
38 - cp conf/local.conf.sample conf/local.conf
39 - echo SSTATE_DIR = \"$SSTATE_CACHE_DIR\" >> conf/local.conf
40 - echo IMAGE_CLASSES += \"testimage testsdk\" >> conf/local.conf
41 - echo INHERIT += \"report-error rm_work blacklist\" >> conf/local.conf
42 - echo ERR_REPORT_SERVER = \"errors.yoctoproject.org\" >> conf/local.conf
43 - echo ERR_REPORT_PORT = \"80\" >> conf/local.conf
44 - echo ERR_REPORT_USERNAME = \"Drone Autobuilder\" >> conf/local.conf
45 - echo ERR_REPORT_EMAIL = \"info@yoedistro.org\" >> conf/local.conf
46 - echo TOOLCHAIN = \"clang\" >> conf/local.conf
47 - echo CLANGSDK = \"1\" >> conf/local.conf
48 - echo IMAGE_INSTALL_append = \" clang \" >> conf/local.conf
49 - echo XZ_DEFAULTS = \"--threads=8\" >> conf/local.conf
50 - echo LICENSE_FLAGS_WHITELIST_append = \" commercial non-commercial\" >> conf/local.conf
51 #- echo TESTIMAGE_AUTO_qemuall = \"1\" >> conf/local.conf
52 - /bin/bash -c ". ./qemux86-64-envsetup.sh && bitbake yoe-debug-image -cpopulate_sdk"
53 - /bin/bash -c ". ./qemux86-64-envsetup.sh && ./sources/openembedded-core/scripts/sstate-cache-management.sh -d -y"
54---
55kind: pipeline
56type: exec
57name: cleanup
58
59platform:
60 os: linux
61 arch: arm64
62
63clone:
64 disable: true
65
66trigger:
67 branch:
68 - dunfell
69 event:
70 - push
71 - pull_request
72 status:
73 - success
74 - failure
75
76steps:
77- name: clean
78 commands:
79 - echo "Deleting tmpdir for build# $DRONE_BUILD_NUMBER"
80 - rm -rf /scratch/tmp-clang-$DRONE_BUILD_NUMBER
81
82depends_on:
83- arm64
diff --git a/.github/workflows/yoe.yml b/.github/workflows/yoe.yml
new file mode 100644
index 0000000..ca2885b
--- /dev/null
+++ b/.github/workflows/yoe.yml
@@ -0,0 +1,79 @@
1name: Yoe Distro CI
2
3on:
4 # Trigger the workflow on push or pull request,
5 # but only for the master branch
6 push:
7 branches:
8 - master
9 pull_request:
10 branches:
11 - master
12jobs:
13 build:
14 name: Yoe Build
15 runs-on: [self-hosted, Linux]
16 timeout-minutes: 720
17 steps:
18 - name: Checkout
19 uses: actions/checkout@v2
20 with:
21 fetch-depth: 0
22 submodules: recursive
23 - name: checkout yoe
24 run: |
25 git clone --recurse-submodules -j8 -b master git://github.com/YoeDistro/yoe-distro.git yoe
26 cd yoe
27 git checkout master
28 git pull
29 git submodule update --recursive --init
30 rm -rf sources/meta-clang
31 rsync -av --progress --exclude="yoe" `pwd`/../ sources/meta-clang/
32 - name: Setup
33 run: |
34 cd yoe
35 export DOCKER_REPO=none
36 export LANG=en_US.UTF-8
37 export SSTATE_CACHE_DIR=/scratch/sstate-cache
38 echo export DOCKER_REPO=none > local.sh
39 echo export LANG=en_US.UTF-8 >> local.sh
40 echo export SSTATE_CACHE_DIR=/scratch/sstate-cache >> local.sh
41 cp conf/local.conf.sample conf/local.conf
42 echo SSTATE_DIR = \"$SSTATE_CACHE_DIR\" >> conf/local.conf
43 echo IMAGE_CLASSES += \"testimage testsdk\" >> conf/local.conf
44 echo INHERIT += \"report-error rm_work\" >> conf/local.conf
45 echo ERR_REPORT_SERVER = \"errors.yoctoproject.org\" >> conf/local.conf
46 echo ERR_REPORT_PORT = \"80\" >> conf/local.conf
47 echo ERR_REPORT_USERNAME = \"Drone Autobuilder\" >> conf/local.conf
48 echo ERR_REPORT_EMAIL = \"info@yoedistro.org\" >> conf/local.conf
49 echo TOOLCHAIN = \"clang\" >> conf/local.conf
50 echo BB_NUMBER_THREADS = \"16\" >> conf/local.conf
51 echo PARALLEL_MAKE = \"-j 32\" >> conf/local.conf
52 echo CLANGSDK = \"1\" >> conf/local.conf
53 echo IMAGE_INSTALL_append = \" clang \" >> conf/local.conf
54 echo XZ_DEFAULTS = \"--threads=8\" >> conf/local.conf
55 echo SDKMACHINE = \"aarch64\" >> conf/local.conf
56 /bin/bash -c "sed -i -e 's/PACKAGE_FEED_URI.*$//' conf/site.conf"
57 /bin/bash -c "sed -i -e 's/SDK_UPDATE_URL.*$//' conf/site.conf"
58 - name: Build Image
59 run: |
60 cd yoe
61 /bin/bash -c ". ./qemuarm64-envsetup.sh && bitbake yoe-qt5-image yoe-sdk-image yoe-debug-image"
62 - name: Build SDK
63 run: |
64 cd yoe
65 /bin/bash -c ". ./qemuarm64-envsetup.sh && bitbake yoe-debug-image -cpopulate_sdk_ext"
66 - name: Test Image
67 run: |
68 cd yoe
69 export DISPLAY=":0"
70 echo TESTIMAGE_AUTO_qemuall = \"1\" >> conf/local.conf
71 /bin/bash -c ". ./qemuarm64-envsetup.sh && bitbake yoe-sdk-image"
72 - name: Prepare results
73 run: |
74 cd yoe
75 /bin/bash -c ". ./qemuarm64-envsetup.sh && resulttool report build/tmp/log/oeqa"
76 - name: Clean shared state
77 run: |
78 cd yoe
79 /bin/bash -c ". ./qemuarm64-envsetup.sh && ./sources/openembedded-core/scripts/sstate-cache-management.sh -d -y"
diff --git a/README.md b/README.md
index 5541396..3aa42da 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,10 @@
1[![Build Status](https://drone.yoedistro.org/api/badges/kraj/meta-clang/status.svg)](https://drone.yoedistro.org/kraj/meta-clang) 1[![Yoe Distro CI](https://github.com/kraj/meta-clang/workflows/Yoe%20Distro%20CI/badge.svg?branch=master)](https://github.com/kraj/meta-clang/actions/workflows/yoe.yml?query=workflow%3AYoe+branch%3Amaster)
2 2
3# meta-clang (a C language family frontend and LLVM compiler backend) 3# meta-clang (C/C++ frontend and LLVM compiler backend)
4 4
5This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to your system 5This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to system
6C/C++ compiler for OpenEmbedded based distributions along with gcc 6C/C++ compiler for OpenEmbedded/Yocto Project based distributions. This can cohabit
7with GNU Compiler and can be used for specific recipes or full system Compiler
7 8
8# Getting Started 9# Getting Started
9 10
@@ -15,6 +16,15 @@ git clone git://github.com/kraj/meta-clang.git
15 16
16$ . ./oe-init-build-env 17$ . ./oe-init-build-env
17``` 18```
19If using poky ( Yocto project reference Distribution )
20
21```shell
22git clone https://git.yoctoproject.org/git/poky
23cd poky
24git clone git://github.com/kraj/meta-clang.git
25
26$ . ./oe-init-build-env
27```
18 28
19Add meta-clang overlay 29Add meta-clang overlay
20``` 30```
@@ -23,7 +33,7 @@ bitbake-layers add-layer ../meta-clang
23 33
24Check `conf/bblayers.conf` to see that meta-clang is added to layer mix e.g. 34Check `conf/bblayers.conf` to see that meta-clang is added to layer mix e.g.
25 35
26# Default Compiler Switch 36# Default Compiler
27 37
28Note that by default gcc will remain the system compiler, however if you wish 38Note that by default gcc will remain the system compiler, however if you wish
29clang to be the default compiler then set 39clang to be the default compiler then set
@@ -38,45 +48,56 @@ you can select clang per recipe too by writing bbappends for them containing
38```shell 48```shell
39TOOLCHAIN = "clang" 49TOOLCHAIN = "clang"
40``` 50```
51also look at `conf/nonclangable.conf` for list of recipes which do not yet fully
52build with clang
41 53
42# Default C++ Standard Library Switch 54# Default Compiler Runtime
43 55
44Note that by default clang libc++ is default C++ standard library, however if you wish 56Default is to use GNU runtime `RUNTIME = "gnu"` which consists of libgcc, libstdc++ to provide C/C++
45to keep GNU libstdc++ to be the default then set 57runtime support. However its possible to use LLVM runtime to replace it where
58compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while
59GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang
60compiler, Switching to use LLVM runtime is done via a config metadata knob
46 61
47```shell 62```shell
48LIBCPLUSPLUS = "" 63RUNTIME = "llvm"
49``` 64```
50 65
51in `local.conf`. 66RUNTIME variable influences individual runtime elements and can be set explcitly as well
52You can select libstdc++ per package too by writing bbappends for them containing 67e.g. `LIBCPLUSPLUS` `COMPILER_RT` and `UNWINDLIB`
53 68
54```shell 69Please note that this will still use crt files from GNU compiler always, while llvm now
55LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = "" 70do provide crt files, they have not been yet intergrated into toolchain
56```
57 71
58# Default Compiler Runtime ( Compiler-rt + libc++ ) 72# Default C++ Standard Library Switch
59 73
60By default, clang build from meta-clang uses clang runtime ( compiler-rt + libc++ + libunwind ) out of box 74Using RUNTIME bariable will select which C++ runtime is used, however it can be overridden
61However, it is possible to switch to using gcc runtime as default, In order to do that 75if needed to by modifying `LIBCPLUSPLUS` variable, usually defaults used by `RUNTIME` is
62following settings are needed in site configurations e.g. in `local.conf` 76best fit. e.g. below we select LLVM C++ as default C++ runtime.
63 77
64```shell 78```shell
65TOOLCHAIN ?= "clang" 79LIBCPLUSPLUS = "-stdlib=libc++"
66LIBCPLUSPLUS = "" 80```
67COMPILER_RT = ""
68UNWINDLIB = ""
69 81
82in `local.conf`.
83You can select libstdc++ per package too by writing bbappends for them containing
84
85```shell
86LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = "-stdlibc=libc++"
70``` 87```
88Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. Its always
89good to use single runtime on a system, mixing runtimes can cause complications during
90compilation as well as runtime. However, its upto distribution policies to decide which runtime
91to use.
71 92
72# Removing clang from generated SDK toolchain 93# Adding clang in generated SDK toolchain
73 94
74clang based cross compiler is automatically included into the generated SDK using `bitbake meta-toolchain` or 95clang based cross compiler is not included into the generated SDK using `bitbake meta-toolchain` or
75`bitbake -cpopulate_sdk <image>` in circumstanced where clang is not expected to be part of SDK, then reset `CLANGSDK` 96`bitbake -cpopulate_sdk <image>` if clang is expected to be part of SDK, add `CLANGSDK = "1"`
76variable in `local.conf` 97in `local.conf`
77 98
78```shell 99```shell
79CLANGSDK = "" 100CLANGSDK = "1"
80``` 101```
81 102
82# Building 103# Building
@@ -95,7 +116,7 @@ $ runqemu nographic
95# Limitations 116# Limitations
96 117
97Few components do not build with clang, if you have a component to add to that list 118Few components do not build with clang, if you have a component to add to that list
98simply add it to conf/nonclangable.inc e.g. 119simply add it to `conf/nonclangable.inc` e.g.
99 120
100```shell 121```shell
101TOOLCHAIN_pn-<recipe> = "gcc" 122TOOLCHAIN_pn-<recipe> = "gcc"
@@ -103,12 +124,46 @@ TOOLCHAIN_pn-<recipe> = "gcc"
103 124
104and OE will start using gcc to cross compile that recipe. 125and OE will start using gcc to cross compile that recipe.
105 126
106And if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g. 127if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g.
107 128
108```shell 129```shell
109CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ " 130CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ "
110``` 131```
111 132
133# compiler-rt failing in do_configure with custom TARGET_VENDOR
134
135If your DISTRO sets own value of TARGET_VENDOR, then it's need to be added in
136CLANG_EXTRA_OE_VENDORS, it should be done automatically, but if compiler-rt fails
137like bellow, then check the end of work-shared/llvm-project-source-12.0.0-r0/temp/log.do_patch
138is should have line like:
139NOTE: Adding support following TARGET_VENDOR values: foo in
140 /OE/build/oe-core/tmp-glibc/work-shared/llvm-project-source-12.0.0-r0/git/llvm/lib/Support/Triple.cpp and
141 /OE/build/oe-core/tmp-glibc/work-shared/llvm-project-source-12.0.0-r0/git/clang/lib/Driver/ToolChains/Gnu.cpp
142and check these files if //CLANG_EXTRA_OE_VENDORS* strings were replaced correctly.
143Read add_more_target_vendors function in recipes-devtools/clang/llvm-project-source.inc for more details.
144
145http://errors.yoctoproject.org/Errors/Details/574365/
146```shell
147-- Found assembler: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang
148-- Detecting C compiler ABI info
149-- Detecting C compiler ABI info - failed
150-- Check for working C compiler: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang
151-- Check for working C compiler: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang - broken
152CMake Error at TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
153 The C compiler
154
155 "TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/recipe-sysroot-native/usr/bin/x86_64-foo-linux/x86_64-foo-linux-clang"
156
157 is not able to compile a simple test program.
158
159 It fails with the following output:
160
161 Change Dir: TOPDIR/tmp-glibc/work/core2-64-foo-linux/compiler-rt/12.0.0-r0/build/CMakeFiles/CMakeTmp
162
163 Run Build Command(s):ninja cmTC_928f4 && [1/2] Building C object CMakeFiles/cmTC_928f4.dir/testCCompiler.c.o
164 [2/2] Linking C executable cmTC_928f4
165```
166
112# Dependencies 167# Dependencies
113 168
114```shell 169```shell
diff --git a/classes/clang.bbclass b/classes/clang.bbclass
index a00eef6..a56084d 100644
--- a/classes/clang.bbclass
+++ b/classes/clang.bbclass
@@ -1,5 +1,5 @@
1# Add the necessary override 1# Add the necessary override
2CCACHE_COMPILERCHECK_toolchain-clang = "%compiler% -v" 2CCACHE_COMPILERCHECK_toolchain-clang ?= "%compiler% -v"
3HOST_CC_ARCH_prepend_toolchain-clang = "-target ${HOST_SYS} " 3HOST_CC_ARCH_prepend_toolchain-clang = "-target ${HOST_SYS} "
4CC_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" 4CC_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
5CXX_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" 5CXX_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
@@ -9,11 +9,12 @@ RANLIB_toolchain-clang = "${HOST_PREFIX}llvm-ranlib"
9AR_toolchain-clang = "${HOST_PREFIX}llvm-ar" 9AR_toolchain-clang = "${HOST_PREFIX}llvm-ar"
10NM_toolchain-clang = "${HOST_PREFIX}llvm-nm" 10NM_toolchain-clang = "${HOST_PREFIX}llvm-nm"
11 11
12export CLANG_TIDY_toolchain-clang = "${HOST_PREFIX}clang-tidy" 12LTO_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}"
13PACKAGE_DEBUG_SPLIT_STYLE_toolchain-clang = "debug-without-src"
13 14
14COMPILER_RT ??= "${@bb.utils.contains("RUNTIME", "llvm", "-rtlib=compiler-rt ${UNWINDLIB}", "", d)}" 15COMPILER_RT ??= "${@bb.utils.contains("RUNTIME", "llvm", "-rtlib=compiler-rt ${UNWINDLIB}", "", d)}"
15COMPILER_RT_powerpc = "--rtlib=libgcc ${UNWINDLIB}" 16COMPILER_RT_powerpc = "-rtlib=libgcc ${UNWINDLIB}"
16COMPILER_RT_armeb = "--rtlib=libgcc ${UNWINDLIB}" 17COMPILER_RT_armeb = "-rtlib=libgcc ${UNWINDLIB}"
17 18
18UNWINDLIB ??= "${@bb.utils.contains("RUNTIME", "llvm", "--unwindlib=libgcc", "", d)}" 19UNWINDLIB ??= "${@bb.utils.contains("RUNTIME", "llvm", "--unwindlib=libgcc", "", d)}"
19UNWINDLIB_riscv64 = "--unwindlib=libgcc" 20UNWINDLIB_riscv64 = "--unwindlib=libgcc"
@@ -21,7 +22,7 @@ UNWINDLIB_riscv32 = "--unwindlib=libgcc"
21UNWINDLIB_powerpc = "--unwindlib=libgcc" 22UNWINDLIB_powerpc = "--unwindlib=libgcc"
22UNWINDLIB_armeb = "--unwindlib=libgcc" 23UNWINDLIB_armeb = "--unwindlib=libgcc"
23 24
24LIBCPLUSPLUS ??= "${@bb.utils.contains("RUNTIME", "llvm", "--stdlib=libc++", "", d)}" 25LIBCPLUSPLUS ??= "${@bb.utils.contains("RUNTIME", "llvm", "-stdlib=libc++", "", d)}"
25 26
26TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}" 27TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}"
27TUNE_CCARGS_append_toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}" 28TUNE_CCARGS_append_toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}"
@@ -31,11 +32,18 @@ TUNE_CCARGS_remove_toolchain-clang = "-mel"
31TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", " -mbig-endian", " -mlittle-endian", d)}" 32TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", " -mbig-endian", " -mlittle-endian", d)}"
32 33
33# Clang does not yet support big.LITTLE performance tunes, so use the LITTLE for tunes 34# Clang does not yet support big.LITTLE performance tunes, so use the LITTLE for tunes
34TUNE_CCARGS_remove_toolchain-clang = "-mtune=cortex-a57.cortex-a53 -mtune=cortex-a72.cortex-a53 -mtune=cortex-a15.cortex-a7 -mtune=cortex-a17.cortex-a7 -mtune=cortex-a72.cortex-a35 -mtune=cortex-a73.cortex-a53 -mtune=cortex-a75.cortex-a55 -mtune=cortex-a76.cortex-a55" 35TUNE_CCARGS_remove_toolchain-clang = "-mcpu=cortex-a57.cortex-a53 -mcpu=cortex-a72.cortex-a53 -mcpu=cortex-a15.cortex-a7 -mcpu=cortex-a17.cortex-a7 -mcpu=cortex-a72.cortex-a35 -mcpu=cortex-a73.cortex-a53 -mcpu=cortex-a75.cortex-a55 -mcpu=cortex-a76.cortex-a55"
35TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mtune=cortex-a53", "", d)}" 36TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mcpu=cortex-a53", "", d)}"
36TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mtune=cortex-a7", "", d)}" 37TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mcpu=cortex-a7", "", d)}"
37TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35", " -mtune=cortex-a35", "", d)}" 38TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35", " -mcpu=cortex-a35", "", d)}"
38TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortex-a55 cortexa76-cortex-a55", " -mtune=cortex-a55", "", d)}" 39TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortex-a55 cortexa76-cortex-a55", " -mcpu=cortex-a55", "", d)}"
40
41# Clang does not support octeontx2 processor
42TUNE_CCARGS_remove_toolchain-clang = "-mcpu=octeontx2"
43
44# LLD does not yet support relaxation for RISCV e.g. https://reviews.freebsd.org/D25210
45TUNE_CCARGS_append_toolchain-clang_riscv32 = " -mno-relax"
46TUNE_CCARGS_append_toolchain-clang_riscv64 = " -mno-relax"
39 47
40TUNE_CCARGS_remove_toolchain-clang_powerpc = "-mhard-float" 48TUNE_CCARGS_remove_toolchain-clang_powerpc = "-mhard-float"
41TUNE_CCARGS_remove_toolchain-clang_powerpc = "-mno-spe" 49TUNE_CCARGS_remove_toolchain-clang_powerpc = "-mno-spe"
@@ -81,13 +89,13 @@ def clang_base_deps(d):
81 if not d.getVar('INHIBIT_DEFAULT_DEPS', False): 89 if not d.getVar('INHIBIT_DEFAULT_DEPS', False):
82 if not oe.utils.inherits(d, 'allarch') : 90 if not oe.utils.inherits(d, 'allarch') :
83 ret = " clang-cross-${TARGET_ARCH} virtual/libc " 91 ret = " clang-cross-${TARGET_ARCH} virtual/libc "
84 if (d.getVar('COMPILER_RT').find('--rtlib=compiler-rt') != -1): 92 if (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1):
85 ret += " compiler-rt " 93 ret += " compiler-rt "
86 else: 94 else:
87 ret += " libgcc " 95 ret += " libgcc "
88 if (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1): 96 if (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1):
89 ret += " libcxx " 97 ret += " libcxx "
90 if (d.getVar('LIBCPLUSPLUS').find('--stdlib=libc++') != -1): 98 if (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1):
91 ret += " libcxx " 99 ret += " libcxx "
92 else: 100 else:
93 ret += " virtual/${TARGET_PREFIX}compilerlibs " 101 ret += " virtual/${TARGET_PREFIX}compilerlibs "
@@ -98,7 +106,16 @@ BASE_DEFAULT_DEPS_toolchain-clang_class-target = "${@clang_base_deps(d)}"
98 106
99cmake_do_generate_toolchain_file_append_toolchain-clang () { 107cmake_do_generate_toolchain_file_append_toolchain-clang () {
100 cat >> ${WORKDIR}/toolchain.cmake <<EOF 108 cat >> ${WORKDIR}/toolchain.cmake <<EOF
101set( CMAKE_CLANG_TIDY ${CLANG_TIDY} ) 109set( CMAKE_CLANG_TIDY ${HOST_PREFIX}clang-tidy )
102EOF 110EOF
111 sed -i 's/ -mmusl / /g' ${WORKDIR}/toolchain.cmake
103} 112}
104 113#
114# dump recipes which still use gcc
115#python __anonymous() {
116# toolchain = d.getVar("TOOLCHAIN")
117# if not toolchain or toolchain == "clang" or 'class-target' not in d.getVar('OVERRIDES').split(':'):
118# return
119# pkgn = d.getVar("PN")
120# bb.warn("%s - %s" % (pkgn, toolchain))
121#}
diff --git a/classes/lto.bbclass b/classes/lto.bbclass
deleted file mode 100644
index 80a3d4d..0000000
--- a/classes/lto.bbclass
+++ /dev/null
@@ -1,7 +0,0 @@
1# Enable LTO based on global distro settings
2TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', ' -flto=thin -fuse-ld=gold', '', d)}"
3TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'full-lto', ' -flto=full -fuse-ld=gold', '', d)}"
4RANLIB_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib"
5AR_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar"
6NM_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm"
7
diff --git a/conf/layer.conf b/conf/layer.conf
index fdea56c..19e348b 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -7,7 +7,7 @@ BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
7BBFILE_COLLECTIONS += "clang-layer" 7BBFILE_COLLECTIONS += "clang-layer"
8BBFILE_PATTERN_clang-layer := "^${LAYERDIR}/" 8BBFILE_PATTERN_clang-layer := "^${LAYERDIR}/"
9BBFILE_PRIORITY_clang-layer = "7" 9BBFILE_PRIORITY_clang-layer = "7"
10LAYERSERIES_COMPAT_clang-layer = "zeus dunfell" 10LAYERSERIES_COMPAT_clang-layer = "dunfell hardknott honister"
11LAYERDEPENDS_clang-layer = "core" 11LAYERDEPENDS_clang-layer = "core"
12 12
13BBFILES_DYNAMIC += " \ 13BBFILES_DYNAMIC += " \
@@ -17,6 +17,10 @@ BBFILES_DYNAMIC += " \
17 openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/*/*/*.bbappend \ 17 openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/*/*/*.bbappend \
18 networking-layer:${LAYERDIR}/dynamic-layers/networking-layer/*/*/*.bb \ 18 networking-layer:${LAYERDIR}/dynamic-layers/networking-layer/*/*/*.bb \
19 networking-layer:${LAYERDIR}/dynamic-layers/networking-layer/*/*/*.bbappend \ 19 networking-layer:${LAYERDIR}/dynamic-layers/networking-layer/*/*/*.bbappend \
20 stm-st-stm32mp:${LAYERDIR}/dynamic-layers/meta-st-stm32mp/recipes-*/*/*.bb \
21 stm-st-stm32mp:${LAYERDIR}/dynamic-layers/meta-st-stm32mp/recipes-*/*/*.bbappend \
22 intel:${LAYERDIR}/dynamic-layers/meta-intel/recipes-*/*/*.bb \
23 intel:${LAYERDIR}/dynamic-layers/meta-intel/*/*/*.bbappend \
20" 24"
21 25
22PREFERRED_PROVIDER_libgcc-initial = "libgcc-initial" 26PREFERRED_PROVIDER_libgcc-initial = "libgcc-initial"
@@ -29,9 +33,7 @@ INHERIT += "clang"
29# Do not include clang in SDK unless user wants to 33# Do not include clang in SDK unless user wants to
30CLANGSDK ??= "0" 34CLANGSDK ??= "0"
31 35
32LLVMVERSION = "10.0.1" 36LLVMVERSION = "12.0.0"
33 37
34require conf/nonclangable.conf 38require conf/nonclangable.conf
35require conf/nonscanable.conf 39require conf/nonscanable.conf
36
37NON_MULTILIB_RECIPES_append = " bcc bpftrace"
diff --git a/conf/nonclangable.conf b/conf/nonclangable.conf
index 6ef16fe..f2bee64 100644
--- a/conf/nonclangable.conf
+++ b/conf/nonclangable.conf
@@ -1,7 +1,4 @@
1#babeltrace2: ELF binary /usr/lib/babeltrace2/plugins/babeltrace-plugin-text.so has relocations in .text [textrel]
2TOOLCHAIN_pn-babeltrace2 = "gcc"
3TOOLCHAIN_pn-u-boot = "gcc" 1TOOLCHAIN_pn-u-boot = "gcc"
4TOOLCHAIN_pn-cpufrequtils = "gcc"
5# crash embeds version of gdb which is not buildable with clang 2# crash embeds version of gdb which is not buildable with clang
6TOOLCHAIN_pn-crash = "gcc" 3TOOLCHAIN_pn-crash = "gcc"
7TOOLCHAIN_pn-elfutils = "gcc" 4TOOLCHAIN_pn-elfutils = "gcc"
@@ -38,6 +35,15 @@ TOOLCHAIN_pn-libgcc = "gcc"
38TOOLCHAIN_pn-libgcc-initial = "gcc" 35TOOLCHAIN_pn-libgcc-initial = "gcc"
39TOOLCHAIN_pn-libgfortran = "gcc" 36TOOLCHAIN_pn-libgfortran = "gcc"
40TOOLCHAIN_pn-libssp-nonshared = "gcc" 37TOOLCHAIN_pn-libssp-nonshared = "gcc"
38
39# Dunfell is not affected by the ell and iwd breakages.
40# Once we update past dunfell, patches to fix it properly
41# can be found in OpenMandriva packages.
42# ell 0.39 introduced nested functions sadly
43#TOOLCHAIN_pn-ell = "gcc"
44# iwd 1.13 introduced nested functions sadly
45#TOOLCHAIN_pn-iwd = "gcc"
46
41#| cargo:warning=/mnt/a/yoe/build/tmp/work/cortexa7t2hf-neon-vfpv4-yoe-linux-gnueabi/libstd-rs/1.27.1-r0/re 47#| cargo:warning=/mnt/a/yoe/build/tmp/work/cortexa7t2hf-neon-vfpv4-yoe-linux-gnueabi/libstd-rs/1.27.1-r0/re
42#cipe-sysroot/usr/include/bits/stdlib.h:90:3: error: "Assumed value of MB_LEN_MAX wrong" 48#cipe-sysroot/usr/include/bits/stdlib.h:90:3: error: "Assumed value of MB_LEN_MAX wrong"
43#| cargo:warning=# error "Assumed value of MB_LEN_MAX wrong" 49#| cargo:warning=# error "Assumed value of MB_LEN_MAX wrong"
@@ -49,8 +55,6 @@ TOOLCHAIN_pn-m4_powerpc = "gcc"
49#TOOLCHAIN_pn-mesa_mipsel = "gcc" 55#TOOLCHAIN_pn-mesa_mipsel = "gcc"
50TOOLCHAIN_pn-mesa_riscv64 = "gcc" 56TOOLCHAIN_pn-mesa_riscv64 = "gcc"
51TOOLCHAIN_pn-mesa_powerpc = "gcc" 57TOOLCHAIN_pn-mesa_powerpc = "gcc"
52# multiple definition of 'mongo::error_details::isNamedCode<0>'
53TOOLCHAIN_pn-mongodb = "gcc"
54# variant-impl.hpp:309:36: error: 'is_variant' does not name a template but is followed by template arguments 58# variant-impl.hpp:309:36: error: 'is_variant' does not name a template but is followed by template arguments
55TOOLCHAIN_pn-omxplayer = "gcc" 59TOOLCHAIN_pn-omxplayer = "gcc"
56# error: return address can be determined only for current frame 60# error: return address can be determined only for current frame
@@ -63,14 +67,13 @@ TOOLCHAIN_pn-prelink = "gcc"
63# Qemu cant run profile tests run during build 67# Qemu cant run profile tests run during build
64# | *** stack smashing detected ***: terminated 68# | *** stack smashing detected ***: terminated
65# | ./pgo-wrapper: line 3: 3372346 Aborted 69# | ./pgo-wrapper: line 3: 3372346 Aborted
66TOOLCHAIN_pn-python3 = "gcc" 70#TOOLCHAIN_pn-python3 = "gcc"
67# has dpkg source which does not compile 71# has dpkg source which does not compile
68TOOLCHAIN_pn-start-stop-daemon = "gcc" 72TOOLCHAIN_pn-start-stop-daemon = "gcc"
69TOOLCHAIN_pn-syslinux = "gcc" 73TOOLCHAIN_pn-syslinux = "gcc"
70TOOLCHAIN_pn-systemtap = "gcc" 74TOOLCHAIN_pn-systemtap = "gcc"
71# v4l-utils uses nested functions 75# v4l-utils uses nested functions
72TOOLCHAIN_pn-v4l-utils = "gcc" 76TOOLCHAIN_pn-v4l-utils = "gcc"
73TOOLCHAIN_pn-valgrind = "gcc"
74# uses C++ which clang does not like 77# uses C++ which clang does not like
75TOOLCHAIN_pn-wvstreams = "gcc" 78TOOLCHAIN_pn-wvstreams = "gcc"
76TOOLCHAIN_pn-wvdial = "gcc" 79TOOLCHAIN_pn-wvdial = "gcc"
@@ -90,16 +93,16 @@ TOOLCHAIN_pn-icu_armv5 = "gcc"
90#../../libgcrypt-1.6.5/mpi/mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions 93#../../libgcrypt-1.6.5/mpi/mpih-div.c:98:3: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
91TOOLCHAIN_pn-libgcrypt_mips64 = "gcc" 94TOOLCHAIN_pn-libgcrypt_mips64 = "gcc"
92 95
93#| ../../pixman-0.34.0/test/utils-prng.c:131:29: error: cannot convert between vector type '__attribute__((__vector_size__(16 * sizeof(char)))) char' (vector of 16 'char' values) and vector type 'uint8x16' (vector of 16 'uint8_t' values) as implicit conversion would cause truncation 96# 32-bit assembly code in pixman uses gas specific extensions
94#| randdata.vb |= (t.vb >= const_C0#); 97CFLAGS_append_pn-pixman_toolchain-clang_arm = " -fno-integrated-as"
95#| ^ 98# debug information generated by clang 12 confuses the older
96# also see http://lists.llvm.org/pipermail/llvm-dev/2016-October/105997.html 99# external gas version
97TOOLCHAIN_pn-pixman = "gcc" 100DEBUG_FLAGS_remove_pn-pixman_toolchain-clang_arm = "-g"
98 101
99#recipe-sysroot/usr/include/mozjs-60/mozilla/Span.h:634:5: error: statement not allowed in constexpr function 102#recipe-sysroot/usr/include/mozjs-60/mozilla/Span.h:634:5: error: statement not allowed in constexpr function
100#| MOZ_RELEASE_ASSERT(aStart <= len && (aLength == dynamic_extent || 103#| MOZ_RELEASE_ASSERT(aStart <= len && (aLength == dynamic_extent ||
101#| ^ 104#| ^
102TOOLCHAIN_pn-polkit = "gcc" 105#TOOLCHAIN_pn-polkit = "gcc"
103 106
104#| ./ports/linux/pseudo_wrappers.c:80:14: error: use of unknown builtin '__builtin_apply' [-Wimplicit-function-declaration] 107#| ./ports/linux/pseudo_wrappers.c:80:14: error: use of unknown builtin '__builtin_apply' [-Wimplicit-function-declaration]
105#| void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7); 108#| void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7);
@@ -117,9 +120,6 @@ TOOLCHAIN_pn-pulseaudio_aarch64 = "gcc"
117TOOLCHAIN_pn-pulseaudio_armv7ve = "gcc" 120TOOLCHAIN_pn-pulseaudio_armv7ve = "gcc"
118TOOLCHAIN_pn-pulseaudio_armv7a = "gcc" 121TOOLCHAIN_pn-pulseaudio_armv7a = "gcc"
119 122
120# clang++ hangs see https://bugs.llvm.org/show_bug.cgi?id=45134
121DEBUG_FLAGS_remove_pn-sqlite-orm_toolchain-clang = "-g"
122
123#| /usr/src/debug/qemu/2.6.0-r1/qemu-2.6.0/util/bitmap.c:191: undefined reference to `__atomic_fetch_or_4' 123#| /usr/src/debug/qemu/2.6.0-r1/qemu-2.6.0/util/bitmap.c:191: undefined reference to `__atomic_fetch_or_4'
124#| /usr/src/debug/qemu/2.6.0-r1/qemu-2.6.0/util/bitmap.c:210: undefined reference to `__atomic_fetch_or_4' 124#| /usr/src/debug/qemu/2.6.0-r1/qemu-2.6.0/util/bitmap.c:210: undefined reference to `__atomic_fetch_or_4'
125#| libqemuutil.a(bitmap.o): In function `bitmap_test_and_clear_atomic': 125#| libqemuutil.a(bitmap.o): In function `bitmap_test_and_clear_atomic':
@@ -142,6 +142,10 @@ TOOLCHAIN_pn-lttng-ust_riscv64 = "gcc"
142#| ../libffi-3.3-rc0/src/arm/sysv.S:132: Error: selected processor does not support `vldmgt sp,{d0-d7}' in ARM mode 142#| ../libffi-3.3-rc0/src/arm/sysv.S:132: Error: selected processor does not support `vldmgt sp,{d0-d7}' in ARM mode
143TOOLCHAIN_pn-libffi_armeb = "gcc" 143TOOLCHAIN_pn-libffi_armeb = "gcc"
144 144
145# Clang/mips still generates __sync_fetch_and_add_8 instead of __atomic_fetch_add_8 so it can't even use
146# libatomic to provide these functions, therefore can not compile redis on mips
147TOOLCHAIN_pn-redis_mips = "gcc"
148
145CFLAGS_append_pn-liboil_toolchain-clang_x86-64 = " -fheinous-gnu-extensions " 149CFLAGS_append_pn-liboil_toolchain-clang_x86-64 = " -fheinous-gnu-extensions "
146 150
147#io_getevents.c:25:141: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions 151#io_getevents.c:25:141: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
@@ -151,10 +155,6 @@ CFLAGS_append_pn-libaio_toolchain-clang_mips = " -fheinous-gnu-extensions"
151#| error: unknown warning option '-Wimplicit-fallthrough=0'; did you mean '-Wimplicit-fallthrough'? [-Werror,-Wunknown-warning-option] 155#| error: unknown warning option '-Wimplicit-fallthrough=0'; did you mean '-Wimplicit-fallthrough'? [-Werror,-Wunknown-warning-option]
152CFLAGS_append_pn-mdadm_toolchain-clang = " -Wno-error=unknown-warning-option" 156CFLAGS_append_pn-mdadm_toolchain-clang = " -Wno-error=unknown-warning-option"
153 157
154#../libffi-3.2.1/src/arm/sysv.S:363:2: error: invalid instruction, did you mean: fldmiax?
155# fldmiadgt ip, {d0-d7}
156CFLAGS_append_pn-libffi_arm_toolchain-clang = " -no-integrated-as"
157
158# ../db-5.3.28/src/mutex/mut_tas.c:150:34: error: unknown directive 158# ../db-5.3.28/src/mutex/mut_tas.c:150:34: error: unknown directive
159#<inline asm>:9:2: note: instantiated into assembly here 159#<inline asm>:9:2: note: instantiated into assembly here
160# .force_thumb 160# .force_thumb
@@ -166,17 +166,6 @@ CFLAGS_append_pn-libffi_arm_toolchain-clang = " -no-integrated-as"
166#| ^ 166#| ^
167CFLAGS_append_pn-directfb_toolchain-clang_arm = " -no-integrated-as" 167CFLAGS_append_pn-directfb_toolchain-clang_arm = " -no-integrated-as"
168 168
169# Disable internal assembler for armv7 since it uses gnu assmebly syntax
170# which should be preprocessed via gcc/compiler
171#
172CFLAGS_append_pn-openssl_toolchain-clang_armv7ve = " -no-integrated-as"
173CFLAGS_append_pn-openssl_toolchain-clang_armv7a = " -no-integrated-as"
174
175#| crypto/bn/bn-mips.S:671:2: error: unknown instruction, did you mean: bgeu, sgtu, tgeu?
176#| sgeu $1,$4,$6
177#| ^
178CC_append_pn-openssl_toolchain-clang_mipsarch = " -no-integrated-as"
179
180CFLAGS_append_pn-userland_toolchain-clang = " -no-integrated-as" 169CFLAGS_append_pn-userland_toolchain-clang = " -no-integrated-as"
181 170
182# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S 171# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
@@ -207,12 +196,27 @@ CFLAGS_append_pn-tinymembench_toolchain-clang_mipsarch = " -no-integrated-as"
207CFLAGS_append_pn-ne10_toolchain-clang_arm = " -no-integrated-as" 196CFLAGS_append_pn-ne10_toolchain-clang_arm = " -no-integrated-as"
208CFLAGS_append_pn-libde265_toolchain-clang_arm = " -no-integrated-as" 197CFLAGS_append_pn-libde265_toolchain-clang_arm = " -no-integrated-as"
209 198
210# :5 : error: unknown directive 199# :5 : error: unknown directive
211#^ 200#^
212# .endfunc 201# .endfunc
213# ^ 202# ^
214CFLAGS_append_pn-libsdl2_toolchain-clang_arm = " -no-integrated-as" 203CFLAGS_append_pn-libsdl2_toolchain-clang_arm = " -no-integrated-as"
215 204
205#2816:2: error: changed section type for .debug_frame, expected: 0x7000001E
206# .section .debug_frame,"",@progbits
207# ^
208#lj_vm.S:2890:2: error: changed section flags for .eh_frame, expected: 0x2
209# .section .eh_frame,"aw",@progbits
210# ^
211CFLAGS_append_pn-luajit_toolchain-clang_mips = " -no-integrated-as"
212
213# Generated asm file can not be compiled with clang assembler due to presence of .0 label
214# and its references
215#| aes-decrypt-internal-2.s:368:1: error: unexpected token at start of statement
216#| .0:
217#| ^
218CFLAGS_append_pn-nettle_toolchain-clang_powerpc64le = " -no-integrated-as"
219
216# regtest.cc:374:39: error: invalid suffix on literal; C++11 requires a 220# regtest.cc:374:39: error: invalid suffix on literal; C++11 requires a
217# space between literal and identifier [-Wreserved-user-defined-literal] 221# space between literal and identifier [-Wreserved-user-defined-literal]
218#| snprintf_func (buf, sizeof(buf), "%"Q"u", x); 222#| snprintf_func (buf, sizeof(buf), "%"Q"u", x);
@@ -236,46 +240,53 @@ TUNE_CCARGS_remove_pn-nfs-utils_toolchain-clang = "-Qunused-arguments"
236 240
237# We want to error out when -msse option is used otherwise it enables sse on non-x86 arches 241# We want to error out when -msse option is used otherwise it enables sse on non-x86 arches
238TUNE_CCARGS_remove_pn-pipewire_toolchain-clang = "-Qunused-arguments" 242TUNE_CCARGS_remove_pn-pipewire_toolchain-clang = "-Qunused-arguments"
243TUNE_CCARGS_remove_pn-tesseract_toolchain-clang = "-Qunused-arguments"
244TUNE_CCARGS_remove_pn-pulseaudio_toolchain-clang = "-Qunused-arguments"
239 245
240#| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4' 246#| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4'
241#| clang-7: error: linker command failed with exit code 1 (use -v to see invocation) 247#| clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
242COMPILER_RT_pn-ruby_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}" 248COMPILER_RT_pn-ruby_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
243COMPILER_RT_pn-python3_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}" 249COMPILER_RT_pn-python3_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
244COMPILER_RT_pn-m4_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}" 250COMPILER_RT_pn-m4_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
245COMPILER_RT_pn-cpio_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}" 251COMPILER_RT_pn-cpio_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
246COMPILER_RT_pn-webkitgtk_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}" 252COMPILER_RT_pn-openssh_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
247COMPILER_RT_pn-wpewebkit_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}" 253COMPILER_RT_pn-webkitgtk_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
248COMPILER_RT_remove_pn-m4_powerpc = "--rtlib=compiler-rt" 254COMPILER_RT_pn-wpewebkit_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
249COMPILER_RT_remove_pn-ruby_powerpc = "--rtlib=compiler-rt" 255COMPILER_RT_pn-python3-numpy_toolchain-clang = "-rtlib=compiler-rt ${UNWINDLIB}"
250COMPILER_RT_remove_pn-webkitgtk_powerpc = "--rtlib=compiler-rt" 256COMPILER_RT_remove_pn-m4_powerpc = "-rtlib=compiler-rt"
251COMPILER_RT_remove_pn-m4_armeb = "--rtlib=compiler-rt" 257COMPILER_RT_remove_pn-ruby_powerpc = "-rtlib=compiler-rt"
252COMPILER_RT_remove_pn-ruby_armeb = "--rtlib=compiler-rt" 258COMPILER_RT_remove_pn-webkitgtk_powerpc = "-rtlib=compiler-rt"
253COMPILER_RT_remove_pn-webkitgtk_armeb = "--rtlib=compiler-rt" 259COMPILER_RT_remove_pn-m4_armeb = "-rtlib=compiler-rt"
260COMPILER_RT_remove_pn-ruby_armeb = "-rtlib=compiler-rt"
261COMPILER_RT_remove_pn-webkitgtk_armeb = "-rtlib=compiler-rt"
262
263# build/lib/libQt5Widgets.so: undefined reference to `__lshrti3'
264# __lshrti3 is missing in libgcc
265COMPILER_RT_pn-qtbase_toolchain-clang_riscv32 = "-rtlib=compiler-rt ${UNWINDLIB}"
254 266
255LDFLAGS_append_pn-gnutls_toolchain-clang_riscv64 = " -latomic" 267LDFLAGS_append_pn-gnutls_toolchain-clang_riscv64 = " -latomic"
256LDFLAGS_append_pn-harfbuzz_toolchain-clang_riscv64 = " -latomic" 268LDFLAGS_append_pn-harfbuzz_toolchain-clang_riscv64 = " -latomic"
257LDFLAGS_append_pn-qtwebengine_toolchain-clang_runtime-gnu_x86 = " -latomic" 269LDFLAGS_append_pn-qtwebengine_toolchain-clang_runtime-gnu_x86 = " -latomic"
270LDFLAGS_append_pn-qemu_toolchain-clang_runtime-gnu_x86 = " -latomic"
258 271
259# glibc is built with gcc and hence encodes some libgcc specific builtins which are not found 272# glibc is built with gcc and hence encodes some libgcc specific builtins which are not found
260# when doing static linking with clang using compiler-rt, so use libgcc 273# when doing static linking with clang using compiler-rt, so use libgcc
261# undefined reference to `__unordtf2' 274# undefined reference to `__unordtf2'
262COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc" 275COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_x86 = "-rtlib=libgcc"
263COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc" 276COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_x86 = "-rtlib=libgcc"
264COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc" 277COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_x86 = "-rtlib=libgcc"
265COMPILER_RT_pn-tsocks_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc" 278COMPILER_RT_pn-tsocks_libc-glibc_toolchain-clang_x86 = "-rtlib=libgcc"
266COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc" 279COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_x86-64 = "-rtlib=libgcc"
267COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc" 280COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_x86-64 = "-rtlib=libgcc"
268COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc" 281COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_x86-64 = "-rtlib=libgcc"
269COMPILER_RT_pn-tsocks_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc" 282COMPILER_RT_pn-tsocks_libc-glibc_toolchain-clang_x86-64 = "-rtlib=libgcc"
270 283
271#(unwind.o): in function `__pthread_unwind': 284#(unwind.o): in function `__pthread_unwind':
272#/usr/src/debug/glibc/2.29-r0/git/nptl/unwind.c:121: undefined reference to `_Unwind_ForcedUnwind' 285#/usr/src/debug/glibc/2.29-r0/git/nptl/unwind.c:121: undefined reference to `_Unwind_ForcedUnwind'
273#clang-8: error: linker command failed with exit code 1 (use -v to see invocation) 286#clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
274COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_arm = "--rtlib=libgcc" 287COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_arm = "-rtlib=libgcc"
275COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_arm = "--rtlib=libgcc" 288COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_arm = "-rtlib=libgcc"
276COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_arm = "--rtlib=libgcc" 289COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_arm = "-rtlib=libgcc"
277
278RUNTIME_pn-gerbera_toolchain-clang = "llvm"
279 290
280# Uses gcc for native tools, e.g. nsinstall and passes clang options which fails so 291# Uses gcc for native tools, e.g. nsinstall and passes clang options which fails so
281# let same compiler ( gcc or clang) be native/cross compiler 292# let same compiler ( gcc or clang) be native/cross compiler
@@ -291,3 +302,16 @@ BUILD_CC_pn-nss_toolchain-clang = "clang"
291CXXFLAGS_append_pn-apt_toolchain-clang = " -Wno-c++11-narrowing" 302CXXFLAGS_append_pn-apt_toolchain-clang = " -Wno-c++11-narrowing"
292lcl_maybe_fortify_pn-apt_toolchain-clang = "" 303lcl_maybe_fortify_pn-apt_toolchain-clang = ""
293 304
305# LTO
306# Seems to use symver ASMs see https://stackoverflow.com/questions/46304742/how-to-combine-lto-with-symbol-versioning
307# lib/puny_encode.c:136: multiple definition of `_idn2_punycode_encode'
308LTO_pn-libidn2_toolchain-clang = ""
309
310#libcairo.so: undefined reference to pthread_mutexattr_init [--no-allow-shlib-undefined]
311LTO_pn-cairo_toolchain-clang = ""
312
313# Hardcoded gcc use in makefiles
314TOOLCHAIN_pn-u-boot-stm32mp = "gcc"
315TOOLCHAIN_pn-tf-a-stm32mp = "gcc"
316TOOLCHAIN_pn-tf-a-stm32mp-serialboot = "gcc"
317TOOLCHAIN_pn-u-boot-seco-imx = "gcc"
diff --git a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland_%.bbappend b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland_%.bbappend
new file mode 100644
index 0000000..554578e
--- /dev/null
+++ b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland_%.bbappend
@@ -0,0 +1,6 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3DEPENDS_remove = "compiler-rt-native libcxx-native"
4
5BUILD_CPPFLAGS_remove = "-isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
6BUILD_LDFLAGS_remove = "-rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
diff --git a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-x11_%.bbappend b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-x11_%.bbappend
new file mode 100644
index 0000000..554578e
--- /dev/null
+++ b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-x11_%.bbappend
@@ -0,0 +1,6 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3DEPENDS_remove = "compiler-rt-native libcxx-native"
4
5BUILD_CPPFLAGS_remove = "-isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
6BUILD_LDFLAGS_remove = "-rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
diff --git a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/gn-native_%.bbappend b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/gn-native_%.bbappend
new file mode 100644
index 0000000..cd60c58
--- /dev/null
+++ b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/gn-native_%.bbappend
@@ -0,0 +1,6 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3DEPENDS_remove = "compiler-rt-native libcxx-native"
4
5CXXFLAGS_remove = "-isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
6LDFLAGS_remove = "-rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
diff --git a/dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk/intel-mediasdk-20.5.1-no-lgcc.patch b/dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk/intel-mediasdk-20.5.1-no-lgcc.patch
new file mode 100644
index 0000000..866dbcd
--- /dev/null
+++ b/dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk/intel-mediasdk-20.5.1-no-lgcc.patch
@@ -0,0 +1,30 @@
1Author: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
2
3Remove -lgcc -- it's unneeded and breaks building with compiler-rt.
4
5Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
6Upstream-Status: Pending
7
8diff -up git/builder/FindFunctions.cmake.omv~ git/builder/FindFunctions.cmake
9--- git/builder/FindFunctions.cmake.omv~ 2021-06-03 20:35:11.230895070 +0200
10+++ git/builder/FindFunctions.cmake 2021-06-03 20:35:49.750360067 +0200
11@@ -200,10 +200,6 @@ function( make_library name variant type
12 set_target_properties( ${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BIN_DIR}/${CMAKE_BUILD_TYPE} FOLDER ${folder} )
13 set_target_properties( ${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIB_DIR}/${CMAKE_BUILD_TYPE} FOLDER ${folder} )
14
15- if( Linux )
16- target_link_libraries( ${target} "-lgcc" )
17- endif()
18-
19 set( target ${target} PARENT_SCOPE )
20 endfunction()
21
22@@ -278,7 +274,7 @@ function( make_executable name variant )
23 endforeach()
24
25 if( Linux )
26- target_link_libraries( ${target} "-Xlinker --end-group -lgcc" )
27+ target_link_libraries( ${target} "-Xlinker --end-group" )
28 endif()
29
30 set( target ${target} PARENT_SCOPE )
diff --git a/dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk_%.bbappend b/dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk_%.bbappend
new file mode 100644
index 0000000..d070d03
--- /dev/null
+++ b/dynamic-layers/meta-intel/recipes-multimedia/mediasdk/intel-mediasdk_%.bbappend
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3SRC_URI_append_toolchain-clang = " file://intel-mediasdk-20.5.1-no-lgcc.patch"
diff --git a/dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp/optee-fix-build-with-clang.patch b/dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp/optee-fix-build-with-clang.patch
new file mode 100644
index 0000000..6581d77
--- /dev/null
+++ b/dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp/optee-fix-build-with-clang.patch
@@ -0,0 +1,67 @@
1From: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
2Subject: [optee-os-stm] Fix build with clang
3
4Fix build with clang: No suffix to RCC_MP_ENCLRR_OFFSET (it's used
5in assembly code), fix warning in mbedtls, look for compiler-rt
6inside the sysroot instead of on the system
7
8Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
9Upstream-Status: Pending
10
11diff -up git/core/include/drivers/stm32mp1_rcc.h.omv~ git/core/include/drivers/stm32mp1_rcc.h
12--- git/core/include/drivers/stm32mp1_rcc.h.omv~ 2021-06-04 23:35:39.741212399 +0200
13+++ git/core/include/drivers/stm32mp1_rcc.h 2021-06-04 23:37:28.856900701 +0200
14@@ -280,10 +280,10 @@
15 #define RCC_TIMGXPRER_TIMGXPRE BIT(0)
16
17 /* Offset between RCC_MP_xxxENSETR and RCC_MP_xxxENCLRR registers */
18-#define RCC_MP_ENCLRR_OFFSET 4u
19+#define RCC_MP_ENCLRR_OFFSET 4
20
21 /* Offset between RCC_MP_xxxRSTSETR and RCC_MP_xxxRSTCLRR registers */
22-#define RCC_MP_RSTCLRR_OFFSET 4u
23+#define RCC_MP_RSTCLRR_OFFSET 4
24
25 /* Fields of RCC_BDCR register */
26 #define RCC_BDCR_LSEON BIT(0)
27diff -up git/lib/libmbedtls/mbedtls/library/md5.c.omv~ git/lib/libmbedtls/mbedtls/library/md5.c
28--- git/lib/libmbedtls/mbedtls/library/md5.c.omv~ 2021-06-04 23:35:39.742212415 +0200
29+++ git/lib/libmbedtls/mbedtls/library/md5.c 2021-06-04 23:37:28.857900716 +0200
30@@ -428,8 +428,8 @@ static const unsigned char md5_test_buf[
31 { "message digest" },
32 { "abcdefghijklmnopqrstuvwxyz" },
33 { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
34- { "12345678901234567890123456789012345678901234567890123456789012"
35- "345678901234567890" }
36+ { ("12345678901234567890123456789012345678901234567890123456789012"
37+ "345678901234567890") }
38 };
39
40 static const size_t md5_test_buflen[7] =
41diff -up git/mk/clang.mk.omv~ git/mk/clang.mk
42--- git/mk/clang.mk.omv~ 2021-06-04 23:35:39.742212415 +0200
43+++ git/mk/clang.mk 2021-06-04 23:38:35.887937844 +0200
44@@ -25,10 +25,11 @@ nostdinc$(sm) := -nostdinc -isystem $(sh
45 comp-cflags-warns-clang := -Wno-language-extension-token \
46 -Wno-gnu-zero-variadic-macro-arguments
47
48+SYSROOT := $(shell echo $(CC) |sed -e 's,.*--sysroot=,,;s, .*,,g')
49 # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of
50 # libgcc for clang
51-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
52- -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null)
53+libgcc$(sm) := $(SYSROOT)/$(shell echo $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
54+ -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) |sed -e 's,-arm\.a,-armhf.a,')
55
56 # Core ASLR relies on the executable being ready to run from its preferred load
57 # address, because some symbols are used before the MMU is enabled and the
58@@ -36,7 +37,8 @@ libgcc$(sm) := $(shell $(CC$(sm)) $(CFLA
59 ldflag-apply-dynamic-relocs := --apply-dynamic-relocs
60
61 # Define these to something to discover accidental use
62-CC := false
63+# Not CC because we need it to determine SYSROOT
64+#CC := false
65 CXX := false
66 CPP := false
67 LD := false
diff --git a/dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp_%.bbappend b/dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp_%.bbappend
new file mode 100644
index 0000000..cb513d3
--- /dev/null
+++ b/dynamic-layers/meta-st-stm32mp/recipes-security/optee/optee-os-stm32mp_%.bbappend
@@ -0,0 +1,7 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3SRC_URI_append_toolchain-clang = " file://optee-fix-build-with-clang.patch"
4
5EXTRA_OEMAKE_append_toolchain-clang = "COMPILER=clang"
6
7DEPENDS_append_toolchain-clang = "compiler-rt"
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch
deleted file mode 100644
index 1ca73ba..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 9e2415679e41adacc59dd7a426d505232f0b7129 Mon Sep 17 00:00:00 2001
2From: William Findlay <william@williamfindlay.com>
3Date: Wed, 17 Jun 2020 12:07:48 -0400
4Subject: [PATCH 1/2] Add KBUILD_MODNAME flag to default cflags
5
6Upstream-Status: Backported [https://github.com/iovisor/bcc/pull/2974/commits/badd85c58549d0e7f0d536490c41213141e180c5]
7
8Signed-off-by: He Zhe <zhe.he@windriver.com>
9---
10 src/cc/frontends/clang/kbuild_helper.cc | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
14index db5ca7f6..e3aade89 100644
15--- a/src/cc/frontends/clang/kbuild_helper.cc
16+++ b/src/cc/frontends/clang/kbuild_helper.cc
17@@ -101,6 +101,7 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
18 cflags->push_back("-D__HAVE_BUILTIN_BSWAP16__");
19 cflags->push_back("-D__HAVE_BUILTIN_BSWAP32__");
20 cflags->push_back("-D__HAVE_BUILTIN_BSWAP64__");
21+ cflags->push_back("-DKBUILD_MODNAME=\"bcc\"");
22
23 // If ARCH env variable is set, pass this along.
24 if (archenv)
25--
262.26.2
27
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch
new file mode 100644
index 0000000..a08c109
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch
@@ -0,0 +1,46 @@
1From 4f64ed40e1ffea7ea278627f30a01018e57dcbcf Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Wed, 9 Sep 2020 05:48:19 +0000
4Subject: [PATCH] CMakeLists.txt: override the PY_CMD_ESCAPED
5
6Override the PY_CMD_ESCAPED as the PY_CMD_ESCAPED is constructed by
7the full path of the python3. In some cases, the path is so long and
8result in the PY_CMD_ESCAPED exceeds 255 characters and comes below
9do_configure error:
10 | CMake Error at src/python/CMakeLists.txt:18 (configure_file):
11 | configure_file Problem configuring file
12 |
13 | CMake Error: Could not open file for write in copy operation /buildarea1/test/wr_build/wr1020_20200909_bcc/bcc_long_Kernel/auto-standalone_next/200827/lxbuilds/Intel-Snow-Ridge-NS_platform_up/intel-x86-64-standard-glibc-std/wrlinux/build/tmp-glibc/work/corei7-64-wrs-linux/bcc/0.15.0-r0/build/src/python/bcc--buildarea1-test-wr_build-wr1020_20200909_bcc-bcc_long_Kernel-auto-standalone_next-200827-lxbuilds-Intel-Snow-Ridge-NS_platform_up-intel-x86-64-standard-glibc-std-wrlinux-build-tmp-glibc-work-corei7-64-wrs-linux-bcc-0.15.0-r0-recipe-sysroot-native-usr-bin-python3-native-python3/bcc/version.py.tmp
14
15Upstream-Status: Pending
16
17Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
18---
19 src/python/CMakeLists.txt | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
23index 797e0d14..8afa6ffa 100644
24--- a/src/python/CMakeLists.txt
25+++ b/src/python/CMakeLists.txt
26@@ -12,7 +12,7 @@ file(GLOB_RECURSE PYTHON_INCLUDES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
27
28 foreach(PY_CMD ${PYTHON_CMD})
29 string(REPLACE "/" "-" PY_CMD_ESCAPED ${PY_CMD})
30- set(PY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bcc-${PY_CMD_ESCAPED})
31+ set(PY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bcc-python3)
32
33 foreach(PY_SRC ${PYTHON_SOURCES})
34 configure_file(${PY_SRC} ${PY_DIRECTORY}/${PY_SRC} COPYONLY)
35@@ -31,7 +31,7 @@ foreach(PY_CMD ${PYTHON_CMD})
36 DEPENDS ${PYTHON_SOURCES} ${PYTHON_INCLUDES}
37 COMMENT "Building sdist for ${PY_CMD}"
38 )
39- add_custom_target(bcc_py_${PY_CMD_ESCAPED} ALL DEPENDS ${PIP_INSTALLABLE})
40+ add_custom_target(bcc_py_python3 ALL DEPENDS ${PIP_INSTALLABLE})
41
42 install(
43 CODE "
44--
452.26.2
46
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch
deleted file mode 100644
index dd87997..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch
+++ /dev/null
@@ -1,176 +0,0 @@
1From eb8b0487a05d650499b20fdd5edeb6e47c2c17a5 Mon Sep 17 00:00:00 2001
2From: William Findlay <william@williamfindlay.com>
3Date: Wed, 17 Jun 2020 18:59:43 -0400
4Subject: [PATCH 2/2] Delete existing kbuild_modname definitions
5
6Upstream-Status: Backported [https://github.com/iovisor/bcc/pull/2974/commits/a5bdc9c65746389d7072e1e8e583025dde78e91b]
7
8Adjust context
9
10Signed-off-by: He Zhe <zhe.he@windriver.com>
11---
12 examples/networking/xdp/xdp_drop_count.py | 1 -
13 examples/networking/xdp/xdp_macswap_count.py | 1 -
14 examples/networking/xdp/xdp_redirect_cpu.py | 1 -
15 examples/networking/xdp/xdp_redirect_map.py | 1 -
16 tests/python/test_clang.py | 8 --------
17 tools/tcplife.lua | 1 -
18 tools/tcplife.py | 1 -
19 tools/tcpstates.py | 1 -
20 8 files changed, 15 deletions(-)
21
22diff --git a/examples/networking/xdp/xdp_drop_count.py b/examples/networking/xdp/xdp_drop_count.py
23index f03273e9..512e0a20 100755
24--- a/examples/networking/xdp/xdp_drop_count.py
25+++ b/examples/networking/xdp/xdp_drop_count.py
26@@ -52,7 +52,6 @@ else:
27
28 # load BPF program
29 b = BPF(text = """
30-#define KBUILD_MODNAME "foo"
31 #include <uapi/linux/bpf.h>
32 #include <linux/in.h>
33 #include <linux/if_ether.h>
34diff --git a/examples/networking/xdp/xdp_macswap_count.py b/examples/networking/xdp/xdp_macswap_count.py
35index 0e2b21ca..770ce8ca 100755
36--- a/examples/networking/xdp/xdp_macswap_count.py
37+++ b/examples/networking/xdp/xdp_macswap_count.py
38@@ -50,7 +50,6 @@ else:
39
40 # load BPF program
41 b = BPF(text = """
42-#define KBUILD_MODNAME "foo"
43 #include <uapi/linux/bpf.h>
44 #include <linux/in.h>
45 #include <linux/if_ether.h>
46diff --git a/examples/networking/xdp/xdp_redirect_cpu.py b/examples/networking/xdp/xdp_redirect_cpu.py
47index 15b0d09b..470079f4 100755
48--- a/examples/networking/xdp/xdp_redirect_cpu.py
49+++ b/examples/networking/xdp/xdp_redirect_cpu.py
50@@ -30,7 +30,6 @@ if (cpu_id > max_cpu):
51
52 # load BPF program
53 b = BPF(text = """
54-#define KBUILD_MODNAME "foo"
55 #include <uapi/linux/bpf.h>
56 #include <linux/in.h>
57 #include <linux/if_ether.h>
58diff --git a/examples/networking/xdp/xdp_redirect_map.py b/examples/networking/xdp/xdp_redirect_map.py
59index 4a622723..4936ac1e 100755
60--- a/examples/networking/xdp/xdp_redirect_map.py
61+++ b/examples/networking/xdp/xdp_redirect_map.py
62@@ -29,7 +29,6 @@ out_idx = ip.link_lookup(ifname=out_if)[0]
63
64 # load BPF program
65 b = BPF(text = """
66-#define KBUILD_MODNAME "foo"
67 #include <uapi/linux/bpf.h>
68 #include <linux/in.h>
69 #include <linux/if_ether.h>
70diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py
71index 886eebed..648494cf 100755
72--- a/tests/python/test_clang.py
73+++ b/tests/python/test_clang.py
74@@ -78,7 +78,6 @@ int count_foo(struct pt_regs *ctx, unsigned long a, unsigned long b) {
75
76 def test_probe_read3(self):
77 text = """
78-#define KBUILD_MODNAME "foo"
79 #include <net/tcp.h>
80 #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
81 int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
82@@ -90,7 +89,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
83
84 def test_probe_read4(self):
85 text = """
86-#define KBUILD_MODNAME "foo"
87 #include <net/tcp.h>
88 #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
89 int test(struct pt_regs *ctx, struct sk_buff *skb) {
90@@ -102,7 +100,6 @@ int test(struct pt_regs *ctx, struct sk_buff *skb) {
91
92 def test_probe_read_whitelist1(self):
93 text = """
94-#define KBUILD_MODNAME "foo"
95 #include <net/tcp.h>
96 int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
97 // The below define is in net/tcp.h:
98@@ -120,7 +117,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
99
100 def test_probe_read_whitelist2(self):
101 text = """
102-#define KBUILD_MODNAME "foo"
103 #include <net/tcp.h>
104 int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
105 // The below define is in net/tcp.h:
106@@ -1072,7 +1068,6 @@ int test(struct __sk_buff *ctx) {
107
108 def test_probe_read_return(self):
109 text = """
110-#define KBUILD_MODNAME "foo"
111 #include <uapi/linux/ptrace.h>
112 #include <linux/tcp.h>
113 static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) {
114@@ -1088,7 +1083,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
115
116 def test_probe_read_multiple_return(self):
117 text = """
118-#define KBUILD_MODNAME "foo"
119 #include <uapi/linux/ptrace.h>
120 #include <linux/tcp.h>
121 static inline u64 error_function() {
122@@ -1109,7 +1103,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
123
124 def test_probe_read_return_expr(self):
125 text = """
126-#define KBUILD_MODNAME "foo"
127 #include <uapi/linux/ptrace.h>
128 #include <linux/tcp.h>
129 static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) {
130@@ -1125,7 +1118,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
131
132 def test_probe_read_return_call(self):
133 text = """
134-#define KBUILD_MODNAME "foo"
135 #include <uapi/linux/ptrace.h>
136 #include <linux/tcp.h>
137 static inline struct tcphdr *my_skb_transport_header(struct sk_buff *skb) {
138diff --git a/tools/tcplife.lua b/tools/tcplife.lua
139index 3f4f6afd..5e311631 100755
140--- a/tools/tcplife.lua
141+++ b/tools/tcplife.lua
142@@ -25,7 +25,6 @@ uint16_t ntohs(uint16_t netshort);
143
144 local program = [[
145 #include <uapi/linux/ptrace.h>
146-#define KBUILD_MODNAME "foo"
147 #include <linux/tcp.h>
148 #include <net/sock.h>
149 #include <bcc/proto.h>
150diff --git a/tools/tcplife.py b/tools/tcplife.py
151index d4e679dd..c2bd8236 100755
152--- a/tools/tcplife.py
153+++ b/tools/tcplife.py
154@@ -66,7 +66,6 @@ debug = 0
155 # define BPF program
156 bpf_text = """
157 #include <uapi/linux/ptrace.h>
158-#define KBUILD_MODNAME "foo"
159 #include <linux/tcp.h>
160 #include <net/sock.h>
161 #include <bcc/proto.h>
162diff --git a/tools/tcpstates.py b/tools/tcpstates.py
163index b9a64387..09bbe0ce 100755
164--- a/tools/tcpstates.py
165+++ b/tools/tcpstates.py
166@@ -61,7 +61,6 @@ debug = 0
167 # define BPF program
168 bpf_text = """
169 #include <uapi/linux/ptrace.h>
170-#define KBUILD_MODNAME "foo"
171 #include <linux/tcp.h>
172 #include <net/sock.h>
173 #include <bcc/proto.h>
174--
1752.26.2
176
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch
new file mode 100644
index 0000000..ef93296
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch
@@ -0,0 +1,169 @@
1From 95c9229ea9f029a1b9e8dcbe86fc67f037c0dfa2 Mon Sep 17 00:00:00 2001
2From: Chen HaoNing <owenchen1997@yeah.net>
3Date: Wed, 1 Jul 2020 15:49:17 -0500
4Subject: [PATCH] Replace kprobe function "blk_account_io_completion" to
5 "blk_account_io_done" for kernel version >= 5.8.0
6
7The kernel function "blk_account_io_completion" is not available anymore as attach point of Kprobe as of kernel version 5.8.0. Therefore, after discussions, we decided to use function "blk_account_io_done" instead in every kprobe attachment to "blk_account_io_completion".
8
9Upstream-Status: Backport
10
11---
12 docs/reference_guide.md | 4 ++--
13 docs/tutorial_bcc_python_developer.md | 6 +++---
14 examples/lua/kprobe-latency.lua | 2 +-
15 examples/tracing/bitehist.py | 2 +-
16 examples/tracing/disksnoop.py | 2 +-
17 tools/biosnoop.lua | 2 +-
18 tools/biosnoop.py | 2 +-
19 tools/biotop.py | 2 +-
20 tools/old/biosnoop.py | 2 +-
21 9 files changed, 12 insertions(+), 12 deletions(-)
22
23diff --git a/docs/reference_guide.md b/docs/reference_guide.md
24index 924fa203..9eaf27a5 100644
25--- a/docs/reference_guide.md
26+++ b/docs/reference_guide.md
27@@ -1784,7 +1784,7 @@ Example:
28 b = BPF(text="""
29 BPF_HISTOGRAM(dist);
30
31-int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req)
32+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req)
33 {
34 dist.increment(bpf_log2l(req->__data_len / 1024));
35 return 0;
36@@ -1835,7 +1835,7 @@ Example:
37 b = BPF(text="""
38 BPF_HISTOGRAM(dist);
39
40-int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req)
41+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req)
42 {
43 dist.increment(req->__data_len / 1024);
44 return 0;
45diff --git a/docs/tutorial_bcc_python_developer.md b/docs/tutorial_bcc_python_developer.md
46index 0cb0e780..b3b8ed6b 100644
47--- a/docs/tutorial_bcc_python_developer.md
48+++ b/docs/tutorial_bcc_python_developer.md
49@@ -220,7 +220,7 @@ void trace_completion(struct pt_regs *ctx, struct request *req) {
50
51 b.attach_kprobe(event="blk_start_request", fn_name="trace_start")
52 b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_start")
53-b.attach_kprobe(event="blk_account_io_completion", fn_name="trace_completion")
54+b.attach_kprobe(event="blk_account_io_done", fn_name="trace_completion")
55 [...]
56 ```
57
58@@ -351,7 +351,7 @@ b = BPF(text="""
59
60 BPF_HISTOGRAM(dist);
61
62-int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req)
63+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req)
64 {
65 dist.increment(bpf_log2l(req->__data_len / 1024));
66 return 0;
67@@ -374,7 +374,7 @@ b["dist"].print_log2_hist("kbytes")
68 A recap from earlier lessons:
69
70 - ```kprobe__```: This prefix means the rest will be treated as a kernel function name that will be instrumented using kprobe.
71-- ```struct pt_regs *ctx, struct request *req```: Arguments to kprobe. The ```ctx``` is registers and BPF context, the ```req``` is the first argument to the instrumented function: ```blk_account_io_completion()```.
72+- ```struct pt_regs *ctx, struct request *req```: Arguments to kprobe. The ```ctx``` is registers and BPF context, the ```req``` is the first argument to the instrumented function: ```blk_account_io_done()```.
73 - ```req->__data_len```: Dereferencing that member.
74
75 New things to learn:
76diff --git a/examples/lua/kprobe-latency.lua b/examples/lua/kprobe-latency.lua
77index 60ac2c1c..98464e5c 100644
78--- a/examples/lua/kprobe-latency.lua
79+++ b/examples/lua/kprobe-latency.lua
80@@ -30,7 +30,7 @@ local lat_map = bpf.map('array', bins)
81 local trace_start = bpf.kprobe('myprobe:blk_start_request', function (ptregs)
82 map[ptregs.parm1] = time()
83 end, false, -1, 0)
84-local trace_end = bpf.kprobe('myprobe2:blk_account_io_completion', function (ptregs)
85+local trace_end = bpf.kprobe('myprobe2:blk_account_io_done', function (ptregs)
86 -- The lines below are computing index
87 -- using log10(x)*10 = log2(x)*10/log2(10) = log2(x)*3
88 -- index = 29 ~ 1 usec
89diff --git a/examples/tracing/bitehist.py b/examples/tracing/bitehist.py
90index 4d7c7958..89ceb307 100755
91--- a/examples/tracing/bitehist.py
92+++ b/examples/tracing/bitehist.py
93@@ -25,7 +25,7 @@ b = BPF(text="""
94 BPF_HISTOGRAM(dist);
95 BPF_HISTOGRAM(dist_linear);
96
97-int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req)
98+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req)
99 {
100 dist.increment(bpf_log2l(req->__data_len / 1024));
101 dist_linear.increment(req->__data_len / 1024);
102diff --git a/examples/tracing/disksnoop.py b/examples/tracing/disksnoop.py
103index 1101e6f2..a35e1abd 100755
104--- a/examples/tracing/disksnoop.py
105+++ b/examples/tracing/disksnoop.py
106@@ -46,7 +46,7 @@ void trace_completion(struct pt_regs *ctx, struct request *req) {
107 if BPF.get_kprobe_functions(b'blk_start_request'):
108 b.attach_kprobe(event="blk_start_request", fn_name="trace_start")
109 b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_start")
110-b.attach_kprobe(event="blk_account_io_completion", fn_name="trace_completion")
111+b.attach_kprobe(event="blk_account_io_done", fn_name="trace_completion")
112
113 # header
114 print("%-18s %-2s %-7s %8s" % ("TIME(s)", "T", "BYTES", "LAT(ms)"))
115diff --git a/tools/biosnoop.lua b/tools/biosnoop.lua
116index 8d9b6a19..3e0441e2 100755
117--- a/tools/biosnoop.lua
118+++ b/tools/biosnoop.lua
119@@ -126,7 +126,7 @@ return function(BPF, utils)
120 bpf:attach_kprobe{event="blk_account_io_start", fn_name="trace_pid_start"}
121 bpf:attach_kprobe{event="blk_start_request", fn_name="trace_req_start"}
122 bpf:attach_kprobe{event="blk_mq_start_request", fn_name="trace_req_start"}
123- bpf:attach_kprobe{event="blk_account_io_completion",
124+ bpf:attach_kprobe{event="blk_account_io_done",
125 fn_name="trace_req_completion"}
126
127 print("%-14s %-14s %-6s %-7s %-2s %-9s %-7s %7s" % {"TIME(s)", "COMM", "PID",
128diff --git a/tools/biosnoop.py b/tools/biosnoop.py
129index ff9b842b..5bbc77cd 100755
130--- a/tools/biosnoop.py
131+++ b/tools/biosnoop.py
132@@ -160,7 +160,7 @@ b.attach_kprobe(event="blk_account_io_start", fn_name="trace_pid_start")
133 if BPF.get_kprobe_functions(b'blk_start_request'):
134 b.attach_kprobe(event="blk_start_request", fn_name="trace_req_start")
135 b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_req_start")
136-b.attach_kprobe(event="blk_account_io_completion",
137+b.attach_kprobe(event="blk_account_io_done",
138 fn_name="trace_req_completion")
139
140 # header
141diff --git a/tools/biotop.py b/tools/biotop.py
142index cad3759a..d3a42ef7 100755
143--- a/tools/biotop.py
144+++ b/tools/biotop.py
145@@ -178,7 +178,7 @@ b.attach_kprobe(event="blk_account_io_start", fn_name="trace_pid_start")
146 if BPF.get_kprobe_functions(b'blk_start_request'):
147 b.attach_kprobe(event="blk_start_request", fn_name="trace_req_start")
148 b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_req_start")
149-b.attach_kprobe(event="blk_account_io_completion",
150+b.attach_kprobe(event="blk_account_io_done",
151 fn_name="trace_req_completion")
152
153 print('Tracing... Output every %d secs. Hit Ctrl-C to end' % interval)
154diff --git a/tools/old/biosnoop.py b/tools/old/biosnoop.py
155index 37ee3f9c..847ab91b 100755
156--- a/tools/old/biosnoop.py
157+++ b/tools/old/biosnoop.py
158@@ -98,7 +98,7 @@ int trace_req_completion(struct pt_regs *ctx, struct request *req)
159 b.attach_kprobe(event="blk_account_io_start", fn_name="trace_pid_start")
160 b.attach_kprobe(event="blk_start_request", fn_name="trace_req_start")
161 b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_req_start")
162-b.attach_kprobe(event="blk_account_io_completion",
163+b.attach_kprobe(event="blk_account_io_done",
164 fn_name="trace_req_completion")
165
166 # header
167--
1682.17.1
169
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch
new file mode 100644
index 0000000..74b2e27
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch
@@ -0,0 +1,68 @@
1From f14f69d996ffc1c61dd523b839271d4a51328e4d Mon Sep 17 00:00:00 2001
2From: Luca Boccassi <bluca@debian.org>
3Date: Fri, 1 Jan 2021 19:04:37 +0000
4Subject: [PATCH 1/3] cmake: link dynamically to libclang-cpp if found and
5 ENABLE_LLVM_SHARED is set
6
7ENABLE_LLVM_SHARED allows to dynamically link against libLLVM, but
8libclang is still unconditionally linked statically.
9Search for libclang-cpp.so, and if it is found and ENABLE_LLVM_SHARED
10is set dynamically link against it.
11Also expand the libstdc++ static linking check to include this new
12condition.
13---
14 CMakeLists.txt | 1 +
15 cmake/clang_libs.cmake | 4 ++++
16 cmake/static_libstdc++.cmake | 2 +-
17 3 files changed, 6 insertions(+), 1 deletion(-)
18
19diff --git a/CMakeLists.txt b/CMakeLists.txt
20index 74fe4f19..b2e334e9 100644
21--- a/CMakeLists.txt
22+++ b/CMakeLists.txt
23@@ -76,6 +76,7 @@ find_library(libclangRewrite NAMES clangRewrite clang-cpp HINTS ${CLANG_SEARCH})
24 find_library(libclangSema NAMES clangSema clang-cpp HINTS ${CLANG_SEARCH})
25 find_library(libclangSerialization NAMES clangSerialization clang-cpp HINTS ${CLANG_SEARCH})
26 find_library(libclangASTMatchers NAMES clangASTMatchers clang-cpp HINTS ${CLANG_SEARCH})
27+find_library(libclang-shared libclang-cpp.so HINTS ${CLANG_SEARCH})
28 if(libclangBasic STREQUAL "libclangBasic-NOTFOUND")
29 message(FATAL_ERROR "Unable to find clang libraries")
30 endif()
31diff --git a/cmake/clang_libs.cmake b/cmake/clang_libs.cmake
32index c33b635c..3f1523b7 100644
33--- a/cmake/clang_libs.cmake
34+++ b/cmake/clang_libs.cmake
35@@ -26,6 +26,9 @@ llvm_map_components_to_libnames(_llvm_libs ${llvm_raw_libs})
36 llvm_expand_dependencies(llvm_libs ${_llvm_libs})
37 endif()
38
39+if(ENABLE_LLVM_SHARED AND NOT libclang-shared STREQUAL "libclang-shared-NOTFOUND")
40+set(clang_libs ${libclang-shared})
41+else()
42 # order is important
43 set(clang_libs
44 ${libclangFrontend}
45@@ -46,6 +49,7 @@ list(APPEND clang_libs
46 ${libclangAST}
47 ${libclangLex}
48 ${libclangBasic})
49+endif()
50
51 # prune unused llvm static library stuff when linking into the new .so
52 set(_exclude_flags)
53diff --git a/cmake/static_libstdc++.cmake b/cmake/static_libstdc++.cmake
54index 3c8ac179..787ed9ad 100644
55--- a/cmake/static_libstdc++.cmake
56+++ b/cmake/static_libstdc++.cmake
57@@ -1,7 +1,7 @@
58 # only turn on static-libstdc++ if also linking statically against clang
59 string(REGEX MATCH ".*[.]a$" LIBCLANG_ISSTATIC "${libclangBasic}")
60 # if gcc 4.9 or higher is used, static libstdc++ is a good option
61-if (CMAKE_COMPILER_IS_GNUCC AND LIBCLANG_ISSTATIC)
62+if (CMAKE_COMPILER_IS_GNUCC AND LIBCLANG_ISSTATIC AND (NOT ENABLE_LLVM_SHARED OR libclang-shared STREQUAL "libclang-shared-NOTFOUND"))
63 execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
64 if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9)
65 execute_process(COMMAND ${CMAKE_C_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIB)
66--
672.29.2
68
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch
new file mode 100644
index 0000000..b1f56e6
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch
@@ -0,0 +1,89 @@
1From 675fca6a646812361c16884ccd2ff789f40c4ce8 Mon Sep 17 00:00:00 2001
2From: Yonghong Song <yhs@fb.com>
3Date: Tue, 3 Nov 2020 22:11:57 -0800
4Subject: [PATCH 1/2] fix compilation issues with latest llvm12 trunk
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9With latest llvm12 trunk, we got two compilation bugs.
10
11Bug #1:
12 /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:
13 In member function ‘void ebpf::BFrontendAction::DoMiscWorkAround()’:
14 /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:1706:31:
15 error: ‘class clang::SourceManage’ has no member named ‘getBuffer’; did you mean ‘getBufferData’?
16 rewriter_->getSourceMgr().getBuffer(rewriter_->getSourceMgr().getMainFileID())->getBufferSize(),
17 ^~~~~~~~~
18 getBufferData
19
20 This is due to upstream change https://reviews.llvm.org/D89394.
21 To fix, follow upstream examples in https://reviews.llvm.org/D89394.
22
23Bug #2:
24 /home/yhs/work/bcc/src/cc/bpf_module.cc: In member function ‘int ebpf::BPFModule::finalize()’:
25 /home/yhs/work/bcc/src/cc/bpf_module.cc:470:11:
26 error: ‘class llvm::EngineBuilder’ has no member named ‘setUseOrcMCJITReplacement’
27 builder.setUseOrcMCJITReplacement(false);
28 ^~~~~~~~~~~~~~~~~~~~~~~~~
29
30 This is due to upstream
31 https://github.com/llvm/llvm-project/commit/6154c4115cd4b78d0171892aac21e340e72e32bd
32
33 It seems builder.setUseOrcMCJITReplacement() is not needed any more. So just remove it
34 from bcc.
35
36Signed-off-by: Yonghong Song <yhs@fb.com>
37---
38 src/cc/bpf_module.cc | 2 ++
39 src/cc/bpf_module_rw_engine.cc | 2 ++
40 src/cc/frontends/clang/b_frontend_action.cc | 4 ++++
41 3 files changed, 8 insertions(+)
42
43diff --git a/src/cc/bpf_module.cc b/src/cc/bpf_module.cc
44index 8fba8d27..c194b815 100644
45--- a/src/cc/bpf_module.cc
46+++ b/src/cc/bpf_module.cc
47@@ -466,7 +466,9 @@ int BPFModule::finalize() {
48 builder.setErrorStr(&err);
49 builder.setMCJITMemoryManager(ebpf::make_unique<MyMemoryManager>(sections_p));
50 builder.setMArch("bpf");
51+#if LLVM_MAJOR_VERSION <= 11
52 builder.setUseOrcMCJITReplacement(false);
53+#endif
54 engine_ = unique_ptr<ExecutionEngine>(builder.create());
55 if (!engine_) {
56 fprintf(stderr, "Could not create ExecutionEngine: %s\n", err.c_str());
57diff --git a/src/cc/bpf_module_rw_engine.cc b/src/cc/bpf_module_rw_engine.cc
58index d7e31a71..9890af69 100644
59--- a/src/cc/bpf_module_rw_engine.cc
60+++ b/src/cc/bpf_module_rw_engine.cc
61@@ -356,7 +356,9 @@ unique_ptr<ExecutionEngine> BPFModule::finalize_rw(unique_ptr<Module> m) {
62 string err;
63 EngineBuilder builder(move(m));
64 builder.setErrorStr(&err);
65+#if LLVM_MAJOR_VERSION <= 11
66 builder.setUseOrcMCJITReplacement(false);
67+#endif
68 auto engine = unique_ptr<ExecutionEngine>(builder.create());
69 if (!engine)
70 fprintf(stderr, "Could not create ExecutionEngine: %s\n", err.c_str());
71diff --git a/src/cc/frontends/clang/b_frontend_action.cc b/src/cc/frontends/clang/b_frontend_action.cc
72index 154a3794..80b03b9b 100644
73--- a/src/cc/frontends/clang/b_frontend_action.cc
74+++ b/src/cc/frontends/clang/b_frontend_action.cc
75@@ -1694,7 +1694,11 @@ void BFrontendAction::DoMiscWorkAround() {
76 false);
77
78 rewriter_->getEditBuffer(rewriter_->getSourceMgr().getMainFileID()).InsertTextAfter(
79+#if LLVM_MAJOR_VERSION >= 12
80+ rewriter_->getSourceMgr().getBufferOrFake(rewriter_->getSourceMgr().getMainFileID()).getBufferSize(),
81+#else
82 rewriter_->getSourceMgr().getBuffer(rewriter_->getSourceMgr().getMainFileID())->getBufferSize(),
83+#endif
84 "\n#include <bcc/footer.h>\n");
85 }
86
87--
882.30.0
89
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
index f2b1495..fb659cc 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
@@ -1,4 +1,4 @@
1From 935f7e47f54df1af30f4a1cdfd2f385863ab9dec Mon Sep 17 00:00:00 2001 1From 8e12b10e7576a6d47e0dc2cdc36caeb9ba26fa12 Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com> 2From: He Zhe <zhe.he@windriver.com>
3Date: Mon, 15 Jun 2020 07:05:24 +0000 3Date: Mon, 15 Jun 2020 07:05:24 +0000
4Subject: [PATCH] tools: opensnoop: snoop do_sys_openat2 for kernel v5.6 and 4Subject: [PATCH] tools: opensnoop: snoop do_sys_openat2 for kernel v5.6 and
@@ -12,14 +12,14 @@ Upstream-Status: Inappropriate, upstream context has changed and needs more
12 12
13Signed-off-by: He Zhe <zhe.he@windriver.com> 13Signed-off-by: He Zhe <zhe.he@windriver.com>
14--- 14---
15 tools/opensnoop.py | 13 +++++++++++-- 15 tools/opensnoop.py | 12 ++++++++++--
16 1 file changed, 11 insertions(+), 2 deletions(-) 16 1 file changed, 10 insertions(+), 2 deletions(-)
17 17
18diff --git a/tools/opensnoop.py b/tools/opensnoop.py 18diff --git a/tools/opensnoop.py b/tools/opensnoop.py
19index 6d1388b3..3f7e48a3 100755 19index 51d3dc05..522812d4 100755
20--- a/tools/opensnoop.py 20--- a/tools/opensnoop.py
21+++ b/tools/opensnoop.py 21+++ b/tools/opensnoop.py
22@@ -21,6 +21,8 @@ from bcc.utils import printb 22@@ -22,6 +22,8 @@ from bcc.utils import printb
23 import argparse 23 import argparse
24 from datetime import datetime, timedelta 24 from datetime import datetime, timedelta
25 import os 25 import os
@@ -28,24 +28,23 @@ index 6d1388b3..3f7e48a3 100755
28 28
29 # arguments 29 # arguments
30 examples = """examples: 30 examples = """examples:
31@@ -195,8 +197,15 @@ if debug or args.ebpf: 31@@ -235,8 +237,14 @@ if debug or args.ebpf:
32
33 # initialize BPF 32 # initialize BPF
34 b = BPF(text=bpf_text) 33 b = BPF(text=bpf_text)
35-b.attach_kprobe(event="do_sys_open", fn_name="trace_entry") 34 if not is_support_kfunc:
36-b.attach_kretprobe(event="do_sys_open", fn_name="trace_return") 35- b.attach_kprobe(event="do_sys_open", fn_name="trace_entry")
37+ 36- b.attach_kretprobe(event="do_sys_open", fn_name="trace_return")
38+# Since kernel v5.6, do_sys_openat2 instead of do_sys_open has been used as entry function for open 37+ # Since kernel v5.6, do_sys_openat2 instead of do_sys_open has been used as entry function for open
39+if parse_version(platform.uname().release.split('-')[0]) > parse_version('5.6.0'): 38+ if parse_version(platform.uname().release.split('-')[0]) > parse_version('5.6.0'):
40+ entry = "do_sys_openat2" 39+ entry = "do_sys_openat2"
41+else: 40+ else:
42+ entry = "do_sys_open" 41+ entry = "do_sys_open"
43+ 42+
44+b.attach_kprobe(event=entry, fn_name="trace_entry") 43+ b.attach_kprobe(event=entry, fn_name="trace_entry")
45+b.attach_kretprobe(event=entry, fn_name="trace_return") 44+ b.attach_kretprobe(event=entry, fn_name="trace_return")
46 45
47 initial_ts = 0 46 initial_ts = 0
48 47
49-- 48--
502.24.1 492.17.1
51 50
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch
new file mode 100644
index 0000000..e39e21f
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch
@@ -0,0 +1,46 @@
1From a9f59fc8605de1bcca0b6c2d8132585f40c3b9bc Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com>
3Date: Thu, 13 Aug 2020 11:25:58 +0800
4Subject: [PATCH] tools/trace.py: Fix failing to exit
5
6Class Probe::print_event is used as a callback of a ctypes wrapper. With
7Yocto latest python v3.8.5, the exception raised by exit() is ignored and
8thus trace cannot exit. Use os._exit(0) instead.
9
10$ /usr/share/bcc/tools/trace do_sys_open -M 1
11PID TID COMM FUNC
123740 3740 irqbalance do_sys_open
13Exception ignored on calling ctypes callback function:
14<function PerfEventArray.open_perf_buffer.<locals>.raw_cb at 0x7f7c9efea280>
15Traceback (most recent call last):
16File "/usr/lib64/python3.8/site-packages/bcc/table.py", line 685, in raw_cb_
17callback(cpu, data, size)
18File "/usr/share/bcc/tools/trace", line 630, in print_event
19exit()
20File "/usr/lib64/python3.8/sitebuiltins.py", line 26, in __call_
21raise SystemExit(code)
22SystemExit: None
23
24Upstream-Status: Pending
25
26Signed-off-by: He Zhe <zhe.he@windriver.com>
27---
28 tools/trace.py | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31diff --git a/tools/trace.py b/tools/trace.py
32index 7a61594f..d09dd2a8 100755
33--- a/tools/trace.py
34+++ b/tools/trace.py
35@@ -627,7 +627,7 @@ BPF_PERF_OUTPUT(%s);
36 Probe.event_count += 1
37 if Probe.max_events is not None and \
38 Probe.event_count >= Probe.max_events:
39- exit()
40+ os._exit(0)
41 sys.stdout.flush()
42
43 def attach(self, bpf, verbose):
44--
452.17.1
46
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch
new file mode 100644
index 0000000..0269fa4
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch
@@ -0,0 +1,239 @@
1From ab9a9dadf294f69e024a8b58c983a6c2085c223a Mon Sep 17 00:00:00 2001
2From: Luca Boccassi <bluca@debian.org>
3Date: Fri, 8 Jan 2021 16:58:56 +0000
4Subject: [PATCH 2/3] cmake: always link to packaged libbpf if
5 CMAKE_USE_LIBBPF_PACKAGE is set (#3210)
6
7Some of the executables still link to the local static versions
8even if the user requested CMAKE_USE_LIBBPF_PACKAGE. Fix this by
9using bcc-shared-no-libbpf more widely if the variable is set.
10
11Skip the git submodule and the extraction commands if the user
12set CMAKE_USE_LIBBPF_PACKAGE
13---
14 CMakeLists.txt | 2 +-
15 examples/cpp/CMakeLists.txt | 59 ++++++++----------------------
16 examples/cpp/pyperf/CMakeLists.txt | 5 +++
17 introspection/CMakeLists.txt | 8 +++-
18 src/cc/CMakeLists.txt | 29 ++++++++++-----
19 tests/cc/CMakeLists.txt | 22 +++++++----
20 6 files changed, 61 insertions(+), 64 deletions(-)
21
22diff --git a/CMakeLists.txt b/CMakeLists.txt
23index b2e334e9..b68571ea 100644
24--- a/CMakeLists.txt
25+++ b/CMakeLists.txt
26@@ -14,7 +14,7 @@ endif()
27 enable_testing()
28
29 # populate submodules (libbpf)
30-if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/src)
31+if(NOT CMAKE_USE_LIBBPF_PACKAGE AND NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/src)
32 execute_process(COMMAND git submodule update --init --recursive
33 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
34 endif()
35diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
36index dae0e9ce..dd343245 100644
37--- a/examples/cpp/CMakeLists.txt
38+++ b/examples/cpp/CMakeLists.txt
39@@ -11,49 +11,20 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
40
41 option(INSTALL_CPP_EXAMPLES "Install C++ examples. Those binaries are statically linked and can take plenty of disk space" OFF)
42
43-add_executable(HelloWorld HelloWorld.cc)
44-target_link_libraries(HelloWorld bcc-static)
45-
46-add_executable(CPUDistribution CPUDistribution.cc)
47-target_link_libraries(CPUDistribution bcc-static)
48-
49-add_executable(RecordMySQLQuery RecordMySQLQuery.cc)
50-target_link_libraries(RecordMySQLQuery bcc-static)
51-
52-add_executable(TCPSendStack TCPSendStack.cc)
53-target_link_libraries(TCPSendStack bcc-static)
54-
55-add_executable(RandomRead RandomRead.cc)
56-target_link_libraries(RandomRead bcc-static)
57-
58-add_executable(LLCStat LLCStat.cc)
59-target_link_libraries(LLCStat bcc-static)
60-
61-add_executable(FollyRequestContextSwitch FollyRequestContextSwitch.cc)
62-target_link_libraries(FollyRequestContextSwitch bcc-static)
63-
64-add_executable(UseExternalMap UseExternalMap.cc)
65-target_link_libraries(UseExternalMap bcc-static)
66-
67-add_executable(CGroupTest CGroupTest.cc)
68-target_link_libraries(CGroupTest bcc-static)
69-
70-add_executable(TaskIterator TaskIterator.cc)
71-target_link_libraries(TaskIterator bcc-static)
72-
73-add_executable(SkLocalStorageIterator SkLocalStorageIterator.cc)
74-target_link_libraries(SkLocalStorageIterator bcc-static)
75-
76-if(INSTALL_CPP_EXAMPLES)
77- install (TARGETS HelloWorld DESTINATION share/bcc/examples/cpp)
78- install (TARGETS CPUDistribution DESTINATION share/bcc/examples/cpp)
79- install (TARGETS RecordMySQLQuery DESTINATION share/bcc/examples/cpp)
80- install (TARGETS TCPSendStack DESTINATION share/bcc/examples/cpp)
81- install (TARGETS RandomRead DESTINATION share/bcc/examples/cpp)
82- install (TARGETS LLCStat DESTINATION share/bcc/examples/cpp)
83- install (TARGETS FollyRequestContextSwitch DESTINATION share/bcc/examples/cpp)
84- install (TARGETS UseExternalMap DESTINATION share/bcc/examples/cpp)
85- install (TARGETS CGroupTest DESTINATION share/bcc/examples/cpp)
86-endif(INSTALL_CPP_EXAMPLES)
87+file(GLOB EXAMPLES *.cc)
88+foreach(EXAMPLE ${EXAMPLES})
89+ get_filename_component(NAME ${EXAMPLE} NAME_WE)
90+ add_executable(${NAME} ${EXAMPLE})
91+
92+ if(NOT CMAKE_USE_LIBBPF_PACKAGE)
93+ target_link_libraries(${NAME} bcc-static)
94+ else()
95+ target_link_libraries(${NAME} bcc-shared-no-libbpf)
96+ endif()
97+
98+ if(INSTALL_CPP_EXAMPLES)
99+ install (TARGETS ${NAME} DESTINATION share/bcc/examples/cpp)
100+ endif(INSTALL_CPP_EXAMPLES)
101+endforeach()
102
103 add_subdirectory(pyperf)
104diff --git a/examples/cpp/pyperf/CMakeLists.txt b/examples/cpp/pyperf/CMakeLists.txt
105index 6f963c66..97420806 100644
106--- a/examples/cpp/pyperf/CMakeLists.txt
107+++ b/examples/cpp/pyperf/CMakeLists.txt
108@@ -7,6 +7,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi)
109
110 add_executable(PyPerf PyPerf.cc PyPerfUtil.cc PyPerfBPFProgram.cc PyPerfLoggingHelper.cc PyPerfDefaultPrinter.cc Py36Offsets.cc)
111 target_link_libraries(PyPerf bcc-static)
112+if(NOT CMAKE_USE_LIBBPF_PACKAGE)
113+ target_link_libraries(PyPerf bcc-static)
114+else()
115+ target_link_libraries(PyPerf bcc-shared-no-libbpf)
116+endif()
117
118 if(INSTALL_CPP_EXAMPLES)
119 install (TARGETS PyPerf DESTINATION share/bcc/examples/cpp)
120diff --git a/introspection/CMakeLists.txt b/introspection/CMakeLists.txt
121index 4328ee11..6c83f0c8 100644
122--- a/introspection/CMakeLists.txt
123+++ b/introspection/CMakeLists.txt
124@@ -8,7 +8,13 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi)
125 option(INSTALL_INTROSPECTION "Install BPF introspection tools" ON)
126 option(BPS_LINK_RT "Pass -lrt to linker when linking bps tool" ON)
127
128-set(bps_libs_to_link bpf-static elf z)
129+# Note that the order matters! bpf-static first, the rest later
130+if(CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND)
131+set(bps_libs_to_link bpf-shared ${LIBBPF_LIBRARIES})
132+else()
133+set(bps_libs_to_link bpf-static)
134+endif()
135+list(APPEND bps_libs_to_link elf z)
136 if(BPS_LINK_RT)
137 list(APPEND bps_libs_to_link rt)
138 endif()
139diff --git a/src/cc/CMakeLists.txt b/src/cc/CMakeLists.txt
140index 4021c662..c8ea63aa 100644
141--- a/src/cc/CMakeLists.txt
142+++ b/src/cc/CMakeLists.txt
143@@ -10,8 +10,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/clang)
144 include_directories(${LLVM_INCLUDE_DIRS})
145 include_directories(${LIBELF_INCLUDE_DIRS})
146 # todo: if check for kernel version
147-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include)
148-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include/uapi)
149+if (CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND)
150+ include_directories(${LIBBPF_INCLUDE_DIRS})
151+else()
152+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include)
153+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include/uapi)
154+endif()
155
156 # add_definitions has a problem parsing "-D_GLIBCXX_USE_CXX11_ABI=0", this is safer
157 separate_arguments(LLVM_DEFINITIONS)
158@@ -41,21 +45,26 @@ if(LIBBPF_INCLUDE_DIR)
159 add_definitions(-DHAVE_EXTERNAL_LIBBPF)
160 endif()
161
162-if(LIBBPF_FOUND)
163- set(extract_dir ${CMAKE_CURRENT_BINARY_DIR}/libbpf_a_extract)
164- execute_process(COMMAND sh -c "mkdir -p ${extract_dir} && cd ${extract_dir} && ${CMAKE_AR} x ${LIBBPF_STATIC_LIBRARIES}")
165- file(GLOB libbpf_sources "${extract_dir}/*.o")
166-else()
167- file(GLOB libbpf_sources "libbpf/src/*.c")
168-endif()
169+if(NOT CMAKE_USE_LIBBPF_PACKAGE)
170+ if(LIBBPF_FOUND)
171+ set(extract_dir ${CMAKE_CURRENT_BINARY_DIR}/libbpf_a_extract)
172+ execute_process(COMMAND sh -c "mkdir -p ${extract_dir} && cd ${extract_dir} && ${CMAKE_AR} x ${LIBBPF_STATIC_LIBRARIES}")
173+ file(GLOB libbpf_sources "${extract_dir}/*.o")
174+ else()
175+ file(GLOB libbpf_sources "libbpf/src/*.c")
176+ endif()
177
178-set(libbpf_uapi libbpf/include/uapi/linux/)
179+ set(libbpf_uapi libbpf/include/uapi/linux/)
180+endif()
181
182 add_library(bpf-static STATIC libbpf.c perf_reader.c ${libbpf_sources})
183 set_target_properties(bpf-static PROPERTIES OUTPUT_NAME bcc_bpf)
184 add_library(bpf-shared SHARED libbpf.c perf_reader.c ${libbpf_sources})
185 set_target_properties(bpf-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0)
186 set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bcc_bpf)
187+if(CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND)
188+ target_link_libraries(bpf-shared ${LIBBPF_LIBRARIES})
189+endif()
190
191 set(bcc_common_sources bcc_common.cc bpf_module.cc bcc_btf.cc exported_files.cc)
192 if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 6 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 6)
193diff --git a/tests/cc/CMakeLists.txt b/tests/cc/CMakeLists.txt
194index 528f1bda..b2fba5e3 100644
195--- a/tests/cc/CMakeLists.txt
196+++ b/tests/cc/CMakeLists.txt
197@@ -7,7 +7,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi)
198 include_directories(${CMAKE_SOURCE_DIR}/tests/python/include)
199
200 add_executable(test_static test_static.c)
201-target_link_libraries(test_static bcc-static)
202+if(NOT CMAKE_USE_LIBBPF_PACKAGE)
203+ target_link_libraries(test_static bcc-static)
204+else()
205+ target_link_libraries(test_static bcc-shared-no-libbpf)
206+endif()
207
208 add_test(NAME c_test_static COMMAND ${TEST_WRAPPER} c_test_static sudo ${CMAKE_CURRENT_BINARY_DIR}/test_static)
209
210@@ -35,17 +39,19 @@ set(TEST_LIBBCC_SOURCES
211 utils.cc
212 test_parse_tracepoint.cc)
213
214-add_executable(test_libbcc ${TEST_LIBBCC_SOURCES})
215-
216 file(COPY dummy_proc_map.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
217 add_library(usdt_test_lib SHARED usdt_test_lib.cc)
218
219-add_dependencies(test_libbcc bcc-shared)
220-target_link_libraries(test_libbcc ${PROJECT_BINARY_DIR}/src/cc/libbcc.so dl usdt_test_lib)
221-set_target_properties(test_libbcc PROPERTIES INSTALL_RPATH ${PROJECT_BINARY_DIR}/src/cc)
222-target_compile_definitions(test_libbcc PRIVATE -DLIBBCC_NAME=\"libbcc.so\")
223+if(NOT CMAKE_USE_LIBBPF_PACKAGE)
224+ add_executable(test_libbcc ${TEST_LIBBCC_SOURCES})
225+ add_dependencies(test_libbcc bcc-shared)
226
227-add_test(NAME test_libbcc COMMAND ${TEST_WRAPPER} c_test_all sudo ${CMAKE_CURRENT_BINARY_DIR}/test_libbcc)
228+ target_link_libraries(test_libbcc ${PROJECT_BINARY_DIR}/src/cc/libbcc.so dl usdt_test_lib)
229+ set_target_properties(test_libbcc PROPERTIES INSTALL_RPATH ${PROJECT_BINARY_DIR}/src/cc)
230+ target_compile_definitions(test_libbcc PRIVATE -DLIBBCC_NAME=\"libbcc.so\")
231+
232+ add_test(NAME test_libbcc COMMAND ${TEST_WRAPPER} c_test_all sudo ${CMAKE_CURRENT_BINARY_DIR}/test_libbcc)
233+endif()
234
235 if(LIBBPF_FOUND)
236 add_executable(test_libbcc_no_libbpf ${TEST_LIBBCC_SOURCES})
237--
2382.29.2
239
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch
new file mode 100644
index 0000000..ded9f28
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch
@@ -0,0 +1,60 @@
1From 35ff839b1b70b3cd7a9a025d0fd96173e7be566e Mon Sep 17 00:00:00 2001
2From: Yonghong Song <yhs@fb.com>
3Date: Mon, 4 Jan 2021 19:09:20 -0800
4Subject: [PATCH 2/2] fix compilation error with latest llvm12 trunk
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9With latest llvm trunk (llvm12), I hit the following compilation
10error:
11 ...
12 [ 17%] Building CXX object src/cc/frontends/b/CMakeFiles/b_frontend.dir/codegen_llvm.cc.o
13 /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function
14 ‘virtual ebpf::StatusTuple ebpf::cc::CodegenLLVM::visit_table_decl_stmt_node(ebpf::cc::TableDeclStmtNode*)’:
15 /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:1122:37:
16 error: ‘class llvm::Module’ has no member named ‘getTypeB yName’; did you mean ‘getName’?
17 StructType *decl_struct = mod_->getTypeByName("_struct." + n->id_->name_);
18 ^~~~~~~~~~~~~
19 getName
20
21This is due to llvm patch https://reviews.llvm.org/D78793 which
22changed how to use getTypeByName(). This patch adjusted the usage
23in bcc based on this patch.
24
25Signed-off-by: Yonghong Song <yhs@fb.com>
26---
27 src/cc/frontends/b/codegen_llvm.cc | 8 ++++++++
28 1 file changed, 8 insertions(+)
29
30diff --git a/src/cc/frontends/b/codegen_llvm.cc b/src/cc/frontends/b/codegen_llvm.cc
31index d8c9470a..71c83b41 100644
32--- a/src/cc/frontends/b/codegen_llvm.cc
33+++ b/src/cc/frontends/b/codegen_llvm.cc
34@@ -1119,7 +1119,11 @@ StatusTuple CodegenLLVM::visit_table_decl_stmt_node(TableDeclStmtNode *n) {
35 StructType *key_stype, *leaf_stype;
36 TRY2(lookup_struct_type(n->key_type_, &key_stype));
37 TRY2(lookup_struct_type(n->leaf_type_, &leaf_stype));
38+#if LLVM_MAJOR_VERSION >= 12
39+ StructType *decl_struct = StructType::getTypeByName(mod_->getContext(), "_struct." + n->id_->name_);
40+#else
41 StructType *decl_struct = mod_->getTypeByName("_struct." + n->id_->name_);
42+#endif
43 if (!decl_struct)
44 decl_struct = StructType::create(ctx(), "_struct." + n->id_->name_);
45 if (decl_struct->isOpaque())
46@@ -1182,7 +1186,11 @@ StatusTuple CodegenLLVM::visit_func_decl_stmt_node(FuncDeclStmtNode *n) {
47 StructType *stype;
48 //TRY2(lookup_struct_type(formal, &stype));
49 auto var = (StructVariableDeclStmtNode *)formal;
50+#if LLVM_MAJOR_VERSION >= 12
51+ stype = StructType::getTypeByName(mod_->getContext(), "_struct." + var->struct_id_->name_);
52+#else
53 stype = mod_->getTypeByName("_struct." + var->struct_id_->name_);
54+#endif
55 if (!stype) return mkstatus_(n, "could not find type %s", var->struct_id_->c_str());
56 formals.push_back(PointerType::getUnqual(stype));
57 } else {
58--
592.30.0
60
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch
new file mode 100644
index 0000000..25e744f
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch
@@ -0,0 +1,156 @@
1From c7509c9e6377a374ca28d73960d505e129aace7b Mon Sep 17 00:00:00 2001
2From: Luca Boccassi <bluca@debian.org>
3Date: Fri, 8 Jan 2021 17:04:03 +0000
4Subject: [PATCH 3/3] Remove libbcc-no-libbpf shared library, change libbcc
5 linkage instead
6
7The current upstream split does not work very well, as the SONAME is mangled so
8nothing recognises it. Applications link against libbcc, not libbcc_no_bpf.
9Remove it entirely, and switch the libbcc.so to dynamically
10link with libbpf if CMAKE_USE_LIBBPF_PACKAGE is set.
11---
12 examples/cpp/CMakeLists.txt | 2 +-
13 examples/cpp/pyperf/CMakeLists.txt | 2 +-
14 src/cc/CMakeLists.txt | 36 +++++++++++++-----------------
15 tests/cc/CMakeLists.txt | 8 +++----
16 4 files changed, 21 insertions(+), 27 deletions(-)
17
18diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
19index dd343245..45b30280 100644
20--- a/examples/cpp/CMakeLists.txt
21+++ b/examples/cpp/CMakeLists.txt
22@@ -19,7 +19,7 @@ foreach(EXAMPLE ${EXAMPLES})
23 if(NOT CMAKE_USE_LIBBPF_PACKAGE)
24 target_link_libraries(${NAME} bcc-static)
25 else()
26- target_link_libraries(${NAME} bcc-shared-no-libbpf)
27+ target_link_libraries(${NAME} bcc-shared)
28 endif()
29
30 if(INSTALL_CPP_EXAMPLES)
31diff --git a/examples/cpp/pyperf/CMakeLists.txt b/examples/cpp/pyperf/CMakeLists.txt
32index 97420806..618b4e75 100644
33--- a/examples/cpp/pyperf/CMakeLists.txt
34+++ b/examples/cpp/pyperf/CMakeLists.txt
35@@ -10,7 +10,7 @@ target_link_libraries(PyPerf bcc-static)
36 if(NOT CMAKE_USE_LIBBPF_PACKAGE)
37 target_link_libraries(PyPerf bcc-static)
38 else()
39- target_link_libraries(PyPerf bcc-shared-no-libbpf)
40+ target_link_libraries(PyPerf bcc-shared)
41 endif()
42
43 if(INSTALL_CPP_EXAMPLES)
44diff --git a/src/cc/CMakeLists.txt b/src/cc/CMakeLists.txt
45index c8ea63aa..931de2d9 100644
46--- a/src/cc/CMakeLists.txt
47+++ b/src/cc/CMakeLists.txt
48@@ -83,6 +83,9 @@ set(bcc_sym_sources bcc_syms.cc bcc_elf.c bcc_perf_map.c bcc_proc.c)
49 set(bcc_common_headers libbpf.h perf_reader.h "${CMAKE_CURRENT_BINARY_DIR}/bcc_version.h")
50 set(bcc_table_headers file_desc.h table_desc.h table_storage.h)
51 set(bcc_api_headers bcc_common.h bpf_module.h bcc_exception.h bcc_syms.h bcc_proc.h bcc_elf.h)
52+if(LIBBPF_FOUND)
53+ set(bcc_common_sources ${bcc_common_sources} libbpf.c perf_reader.c)
54+endif()
55
56 if(ENABLE_CLANG_JIT)
57 add_library(bcc-shared SHARED
58@@ -91,16 +94,6 @@ add_library(bcc-shared SHARED
59 set_target_properties(bcc-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0)
60 set_target_properties(bcc-shared PROPERTIES OUTPUT_NAME bcc)
61
62-# If there's libbpf detected we build the libbcc-no-libbpf.so library, that
63-# dynamicaly links libbpf.so, in comparison to static link in libbcc.so.
64-if(LIBBPF_FOUND)
65- add_library(bcc-shared-no-libbpf SHARED
66- link_all.cc ${bcc_common_sources} ${bcc_table_sources} ${bcc_sym_sources}
67- ${bcc_util_sources} libbpf.c perf_reader.c)
68- set_target_properties(bcc-shared-no-libbpf PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0)
69- set_target_properties(bcc-shared-no-libbpf PROPERTIES OUTPUT_NAME bcc-no-libbpf)
70-endif()
71-
72 if(ENABLE_USDT)
73 set(bcc_usdt_sources usdt/usdt.cc usdt/usdt_args.cc)
74 # else undefined
75@@ -123,18 +116,25 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_f
76 set(bcc_common_libs b_frontend clang_frontend
77 -Wl,--whole-archive ${clang_libs} ${llvm_libs} -Wl,--no-whole-archive
78 ${LIBELF_LIBRARIES})
79-set(bcc_common_libs_for_a ${bcc_common_libs} bpf-static)
80-set(bcc_common_libs_for_s ${bcc_common_libs} bpf-static)
81-set(bcc_common_libs_for_n ${bcc_common_libs})
82-set(bcc_common_libs_for_lua b_frontend clang_frontend bpf-static
83+set(bcc_common_libs_for_a ${bcc_common_libs})
84+set(bcc_common_libs_for_s ${bcc_common_libs})
85+set(bcc_common_libs_for_lua b_frontend clang_frontend
86 ${clang_libs} ${llvm_libs} ${LIBELF_LIBRARIES})
87+if(LIBBPF_FOUND)
88+ list(APPEND bcc_common_libs_for_a ${LIBBPF_LIBRARIES})
89+ list(APPEND bcc_common_libs_for_s ${LIBBPF_LIBRARIES})
90+ list(APPEND bcc_common_libs_for_lua ${LIBBPF_LIBRARIES})
91+else()
92+ list(APPEND bcc_common_libs_for_a bpf-static)
93+ list(APPEND bcc_common_libs_for_s bpf-static)
94+ list(APPEND bcc_common_libs_for_lua bpf-static)
95+endif()
96
97 if(ENABLE_CPP_API)
98 add_subdirectory(api)
99 list(APPEND bcc_common_libs_for_a api-static)
100 # Keep all API functions
101 list(APPEND bcc_common_libs_for_s -Wl,--whole-archive api-static -Wl,--no-whole-archive)
102- list(APPEND bcc_common_libs_for_n -Wl,--whole-archive api-static -Wl,--no-whole-archive)
103 endif()
104
105 if(ENABLE_USDT)
106@@ -142,7 +142,6 @@ if(ENABLE_USDT)
107 add_subdirectory(usdt)
108 list(APPEND bcc_common_libs_for_a usdt-static)
109 list(APPEND bcc_common_libs_for_s usdt-static)
110- list(APPEND bcc_common_libs_for_n usdt-static)
111 list(APPEND bcc_common_libs_for_lua usdt-static)
112 endif()
113
114@@ -153,11 +152,6 @@ target_link_libraries(bcc-shared ${bcc_common_libs_for_s})
115 target_link_libraries(bcc-static ${bcc_common_libs_for_a} bcc-loader-static)
116 set(bcc-lua-static ${bcc-lua-static} ${bcc_common_libs_for_lua})
117
118-if(LIBBPF_FOUND)
119- target_link_libraries(bcc-shared-no-libbpf ${bcc_common_libs_for_n} ${LIBBPF_LIBRARIES})
120- install(TARGETS bcc-shared-no-libbpf LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
121-endif()
122-
123 install(TARGETS bcc-shared bcc-static bcc-loader-static bpf-static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
124 install(FILES ${bcc_table_headers} DESTINATION include/bcc)
125 install(FILES ${bcc_api_headers} DESTINATION include/bcc)
126diff --git a/tests/cc/CMakeLists.txt b/tests/cc/CMakeLists.txt
127index b2fba5e3..58493248 100644
128--- a/tests/cc/CMakeLists.txt
129+++ b/tests/cc/CMakeLists.txt
130@@ -10,7 +10,7 @@ add_executable(test_static test_static.c)
131 if(NOT CMAKE_USE_LIBBPF_PACKAGE)
132 target_link_libraries(test_static bcc-static)
133 else()
134- target_link_libraries(test_static bcc-shared-no-libbpf)
135+ target_link_libraries(test_static bcc-shared)
136 endif()
137
138 add_test(NAME c_test_static COMMAND ${TEST_WRAPPER} c_test_static sudo ${CMAKE_CURRENT_BINARY_DIR}/test_static)
139@@ -55,11 +55,11 @@ endif()
140
141 if(LIBBPF_FOUND)
142 add_executable(test_libbcc_no_libbpf ${TEST_LIBBCC_SOURCES})
143- add_dependencies(test_libbcc_no_libbpf bcc-shared-no-libbpf)
144+ add_dependencies(test_libbcc_no_libbpf bcc-shared)
145
146- target_link_libraries(test_libbcc_no_libbpf ${PROJECT_BINARY_DIR}/src/cc/libbcc-no-libbpf.so dl usdt_test_lib ${LIBBPF_LIBRARIES})
147+ target_link_libraries(test_libbcc_no_libbpf ${PROJECT_BINARY_DIR}/src/cc/libbcc.so dl usdt_test_lib ${LIBBPF_LIBRARIES})
148 set_target_properties(test_libbcc_no_libbpf PROPERTIES INSTALL_RPATH ${PROJECT_BINARY_DIR}/src/cc)
149- target_compile_definitions(test_libbcc_no_libbpf PRIVATE -DLIBBCC_NAME=\"libbcc-no-libbpf.so\")
150+ target_compile_definitions(test_libbcc_no_libbpf PRIVATE -DLIBBCC_NAME=\"libbcc.so\")
151
152 add_test(NAME test_libbcc_no_libbpf COMMAND ${TEST_WRAPPER} c_test_all_no_libbpf sudo ${CMAKE_CURRENT_BINARY_DIR}/test_libbcc_no_libbpf)
153 endif()
154--
1552.29.2
156
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch
new file mode 100644
index 0000000..31bcbcd
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch
@@ -0,0 +1,69 @@
1From 6b4222cd41b3f5e833307aeff2b10c6b084d3f4f Mon Sep 17 00:00:00 2001
2From: Matteo Croce <mcroce@microsoft.com>
3Date: Wed, 27 Jan 2021 00:26:39 +0100
4Subject: [PATCH] cmake: look for either static or dynamic libraries
5
6On some distro, static libraries are shipped in a separate package.
7Look for either a static or dynamic libbpf, and only fail if neither is found.
8---
9 cmake/FindLibBpf.cmake | 23 ++++++++++++++++-------
10 1 file changed, 16 insertions(+), 7 deletions(-)
11
12diff --git a/cmake/FindLibBpf.cmake b/cmake/FindLibBpf.cmake
13index 75683ae3d..dc10dcee4 100644
14--- a/cmake/FindLibBpf.cmake
15+++ b/cmake/FindLibBpf.cmake
16@@ -28,9 +28,9 @@ find_path (LIBBPF_INCLUDE_DIR
17 /sw/include
18 ENV CPATH)
19
20-find_library (LIBBPF_STATIC_LIBRARIES
21+find_library (LIBBPF_LIBRARIES
22 NAMES
23- libbpf.a
24+ bpf
25 PATHS
26 /usr/lib
27 /usr/local/lib
28@@ -38,10 +38,13 @@ find_library (LIBBPF_STATIC_LIBRARIES
29 /sw/lib
30 ENV LIBRARY_PATH
31 ENV LD_LIBRARY_PATH)
32+if(LIBBPF_LIBRARIES)
33+list(APPEND PATHS LIBBPF_LIBRARIES)
34+endif()
35
36-find_library (LIBBPF_LIBRARIES
37+find_library (LIBBPF_STATIC_LIBRARIES
38 NAMES
39- bpf
40+ libbpf.a
41 PATHS
42 /usr/lib
43 /usr/local/lib
44@@ -49,13 +52,19 @@ find_library (LIBBPF_LIBRARIES
45 /sw/lib
46 ENV LIBRARY_PATH
47 ENV LD_LIBRARY_PATH)
48+if(LIBBPF_STATIC_LIBRARIES)
49+list(APPEND PATHS LIBBPF_STATIC_LIBRARIES)
50+endif()
51
52+if(LIBBPF_STATIC_LIBRARIES OR LIBBPF_LIBRARIES)
53 include (FindPackageHandleStandardArgs)
54
55 # handle the QUIETLY and REQUIRED arguments and set LIBBPF_FOUND to TRUE if all listed variables are TRUE
56 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBpf "Please install the libbpf development package"
57- LIBBPF_LIBRARIES
58- LIBBPF_STATIC_LIBRARIES
59+ ${PATHS}
60 LIBBPF_INCLUDE_DIR)
61
62-mark_as_advanced(LIBBPF_INCLUDE_DIR LIBBPF_STATIC_LIBRARIES LIBBPF_LIBRARIES)
63+mark_as_advanced(LIBBPF_INCLUDE_DIR ${PATHS})
64+else()
65+message(Please install the libbpf development package)
66+endif()
67--
682.29.2
69
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb
index 5a628db..8953fd4 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb
@@ -8,20 +8,33 @@ inherit cmake python3native manpages
8DEPENDS += "bison-native \ 8DEPENDS += "bison-native \
9 flex-native \ 9 flex-native \
10 elfutils \ 10 elfutils \
11 luajit \ 11 ${LUAJIT} \
12 clang \ 12 clang \
13 " 13 "
14 14
15LUAJIT ?= "luajit"
16LUAJIT_powerpc64le = ""
17LUAJIT_powerpc64 = ""
18
15RDEPENDS_${PN} += "bash python3 python3-core python3-setuptools xz" 19RDEPENDS_${PN} += "bash python3 python3-core python3-setuptools xz"
16 20
17SRC_URI = "gitsm://github.com/iovisor/bcc \ 21# Don't fetch submodules otherwise we fetch an older, vendored libbpf version
22# We use a dynamic libbpf library instead
23SRC_URI = "git://github.com/iovisor/bcc \
18 file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \ 24 file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \
19 file://0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch \ 25 file://0001-tools-trace.py-Fix-failing-to-exit.patch \
20 file://0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch \ 26 file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \
21 file://0001-Delete-existing-kbuild_modname-definitions.patch \ 27 file://0001-fix-compilation-issues-with-latest-llvm12-trunk.patch \
28 file://0002-fix-compilation-error-with-latest-llvm12-trunk.patch \
29 file://0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch \
30 file://0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch \
31 file://0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch \
32 file://0004-cmake-look-for-either-static-or-dynamic-libraries.patch \
22 " 33 "
23 34
24SRCREV = "942227484d3207f6a42103674001ef01fb5335a0" 35DEPENDS += "libbpf"
36
37SRCREV = "ad5b82a5196b222ed2cdc738d8444e8c9546a77f"
25 38
26S = "${WORKDIR}/git" 39S = "${WORKDIR}/git"
27 40
@@ -34,6 +47,7 @@ EXTRA_OECMAKE = " \
34 -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \ 47 -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
35 -DPYTHON_CMD=${PYTHON} \ 48 -DPYTHON_CMD=${PYTHON} \
36 -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \ 49 -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \
50 -DCMAKE_USE_LIBBPF_PACKAGE=ON \
37" 51"
38 52
39do_install_append() { 53do_install_append() {
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-bpforc.h-Include-optional-header.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-bpforc.h-Include-optional-header.patch
new file mode 100644
index 0000000..c666bfe
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-bpforc.h-Include-optional-header.patch
@@ -0,0 +1,31 @@
1From ec41ce71f8cd318ab3ca4ce727e7398289b5d7cf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 30 Mar 2021 17:25:10 -0700
4Subject: [PATCH] bpforc.h: Include <optional> header
5
6This is required since this header had std::optional<std::tuple<uint8_t *, uintptr_t>>
7
8Fixes buiild errors with clang-12 with gcc11-runtime
9
10Upstream-Status: Submitted [https://github.com/iovisor/bpftrace/pull/1762]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 src/bpforc.h | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/src/bpforc.h b/src/bpforc.h
17index da6345be..5634c544 100644
18--- a/src/bpforc.h
19+++ b/src/bpforc.h
20@@ -22,6 +22,8 @@
21 #include <llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h>
22 #endif
23
24+#include <optional>
25+
26 namespace bpftrace {
27
28 const std::string LLVMTargetTriple = "bpf-pc-linux";
29--
302.31.1
31
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.11.4.bb
index ad044fd..d6ab0ce 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.11.4.bb
@@ -10,17 +10,20 @@ DEPENDS += "bison-native \
10 bcc \ 10 bcc \
11 " 11 "
12 12
13PV .= "+git${SRCREV}"
13RDEPENDS_${PN} += "bash python3 xz" 14RDEPENDS_${PN} += "bash python3 xz"
14 15
15SRC_URI = "git://github.com/iovisor/bpftrace \ 16SRC_URI = "git://github.com/iovisor/bpftrace;branch=master \
17 file://0001-bpforc.h-Include-optional-header.patch \
16 " 18 "
17SRCREV = "b1200771b61fd77ed7c5b326e7960d24514dd961" 19SRCREV = "6bfa61f505b6b4215328f90762776edd8a22fdb7"
18 20
19S = "${WORKDIR}/git" 21S = "${WORKDIR}/git"
20 22
21inherit cmake 23inherit cmake
22 24
23EXTRA_OECMAKE = " \ 25EXTRA_OECMAKE = " \
26 -DCMAKE_ENABLE_EXPORTS=1 \
24 -DCMAKE_BUILD_TYPE=Release \ 27 -DCMAKE_BUILD_TYPE=Release \
25 -DBUILD_TESTING=OFF \ 28 -DBUILD_TESTING=OFF \
26" 29"
diff --git a/recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch b/recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch
new file mode 100644
index 0000000..0006add
--- /dev/null
+++ b/recipes-bsp/cpufrequtils/cpufrequtils/cpufrequtils-008-fix-build-on-non-x86.patch
@@ -0,0 +1,32 @@
1From: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
2Date: Thu, 27 May 2021 22:51:00 +0200
3Subject: [PATCH] utils: Fix build on non-x86 with clang
4
5Without this patch, there is an invalid asm construct (forcing EAX) on
6non-x86 architectures in unreachable code.
7
8gcc allows this (because it throws out the unreachable code before checking
9it), but clang does not.
10
11Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
12Upstream-Status: Pending
13
14diff -up git/utils/cpuid.h.omv~ git/utils/cpuid.h
15--- git/utils/cpuid.h.omv~ 2021-05-27 22:44:44.833614642 +0200
16+++ git/utils/cpuid.h 2021-05-27 22:45:25.546050445 +0200
17@@ -1,6 +1,8 @@
18 #ifndef _CPUFREQ_CPUID_H
19 #define _CPUFREQ_CPUID_H
20
21+#if defined(__i386__) || defined(__x86_64__)
22+
23 static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
24 unsigned int *ecx, unsigned int *edx)
25 {
26@@ -72,4 +74,6 @@ static inline unsigned int cpuid_edx(uns
27 return edx;
28 }
29
30+#endif /* i386 || x86_64 */
31+
32 #endif /* _CPUFREQ_CPUID_H */
diff --git a/recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend b/recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend
new file mode 100644
index 0000000..3b201f1
--- /dev/null
+++ b/recipes-bsp/cpufrequtils/cpufrequtils_%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append = " file://cpufrequtils-008-fix-build-on-non-x86.patch"
diff --git a/recipes-connectivity/dhcp/dhcp/dhcp-4.4.2-clang-12.patch b/recipes-connectivity/dhcp/dhcp/dhcp-4.4.2-clang-12.patch
new file mode 100644
index 0000000..4901b91
--- /dev/null
+++ b/recipes-connectivity/dhcp/dhcp/dhcp-4.4.2-clang-12.patch
@@ -0,0 +1,19 @@
1# SPDX-FileCopyrightText: Huawei Inc.
2# SPDX-License-Identifier: Apache-2.0
3
4Fix building with modern compilers, such as clang 12 and gcc 11.
5
6Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
7
8diff -up dhcp-4.4.2/server/mdb.c.omv~ dhcp-4.4.2/server/mdb.c
9--- dhcp-4.4.2/server/mdb.c.omv~ 2021-03-11 18:08:56.890166779 +0100
10+++ dhcp-4.4.2/server/mdb.c 2021-03-11 18:09:01.930189762 +0100
11@@ -67,7 +67,7 @@ static host_id_info_t *host_id_info = NU
12
13 int numclasseswritten;
14
15-omapi_object_type_t *dhcp_type_host;
16+extern omapi_object_type_t *dhcp_type_host;
17
18 isc_result_t enter_class(cd, dynamicp, commit)
19 struct class *cd;
diff --git a/recipes-connectivity/dhcp/dhcp_4.4.2%.bbappend b/recipes-connectivity/dhcp/dhcp_4.4.2%.bbappend
new file mode 100644
index 0000000..f1fffde
--- /dev/null
+++ b/recipes-connectivity/dhcp/dhcp_4.4.2%.bbappend
@@ -0,0 +1,7 @@
1# SPDX-FileCopyrightText: Huawei Inc.
2# SPDX-License-Identifier: Apache-2.0
3
4FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
5SRC_URI_append = "\
6 file://dhcp-4.4.2-clang-12.patch \
7"
diff --git a/recipes-connectivity/openssh/openssh_%.bbappend b/recipes-connectivity/openssh/openssh_%.bbappend
deleted file mode 100644
index 88966e5..0000000
--- a/recipes-connectivity/openssh/openssh_%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
1do_configure_prepend() {
2 sed -i -e '/-ftrapv/d' ${S}/configure.ac
3}
diff --git a/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const-1.31.1.patch b/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const-1.31.1.patch
new file mode 100644
index 0000000..35a419b
--- /dev/null
+++ b/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const-1.31.1.patch
@@ -0,0 +1,177 @@
1From d941b59087d34cb93053b638c066bf080122e7bb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 16 Jan 2019 22:39:24 -0800
4Subject: [PATCH] Turn ptr_to_globals and bb_errno to be non const
5
6writing to a const variable is undefined behavior
7
8This is undefined as per (C99 6.7.3 paragraph 5) see [1]
9
10errno and ptr_to_globals is written to in code, this fails with
11segfaults when compiled with clang
12
13unsigned FAST_FUNC bb_strtou(const char *arg, char **endp, int base)
14{
15 unsigned long v;
16 char *endptr;
17
18 if (!endp) endp = &endptr;
19 *endp = (char*) arg;
20
21 if (!isalnum(arg[0])) return ret_ERANGE();
22 errno = 0;
23 v = strtoul(arg, endp, base);
24 if (v > UINT_MAX) return ret_ERANGE();
25 return handle_errors(v, endp);
26 }
27
28without 'const' ( working code )
29
30Dump of assembler code for function bb_strtou:
31 0x0000555555568298 <+0>: push %rbx
32 0x0000555555568299 <+1>: sub $0x10,%rsp
33 0x000055555556829d <+5>: test %rsi,%rsi
34 0x00005555555682a0 <+8>: lea 0x8(%rsp),%rbx
35 0x00005555555682a5 <+13>: cmovne %rsi,%rbx
36 0x00005555555682a9 <+17>: mov %rdi,(%rbx)
37 0x00005555555682ac <+20>: mov (%rdi),%al
38 0x00005555555682ae <+22>: lea -0x30(%rax),%ecx
39 0x00005555555682b1 <+25>: cmp $0xa,%cl
40 0x00005555555682b4 <+28>: jb 0x5555555682be <bb_strtou+38>
41 0x00005555555682b6 <+30>: or $0x20,%al
42 0x00005555555682b8 <+32>: add $0x9f,%al
43 0x00005555555682ba <+34>: cmp $0x1a,%al
44 0x00005555555682bc <+36>: jae 0x5555555682dc <bb_strtou+68>
45 0x00005555555682be <+38>: mov 0x107da3(%rip),%rax # 0x555555670068 <bb_errno>
46=> 0x00005555555682c5 <+45>: movl $0x0,(%rax)
47 0x00005555555682cb <+51>: mov %rbx,%rsi
48 0x00005555555682ce <+54>: callq 0x555555564310 <strtoul@plt>
49 0x00005555555682d3 <+59>: mov %rax,%rcx
50 0x00005555555682d6 <+62>: shr $0x20,%rcx
51 0x00005555555682da <+66>: je 0x5555555682f0 <bb_strtou+88>
52 0x00005555555682dc <+68>: mov 0x107d85(%rip),%rax # 0x555555670068 <bb_errno>
53 0x00005555555682e3 <+75>: movl $0x22,(%rax)
54 0x00005555555682e9 <+81>: mov $0xffffffff,%eax
55 0x00005555555682ee <+86>: jmp 0x5555555682fb <bb_strtou+99>
56 0x00005555555682f0 <+88>: mov %rax,%rdi
57 0x00005555555682f3 <+91>: mov %rbx,%rsi
58 0x00005555555682f6 <+94>: callq 0x5555555681e8 <handle_errors>
59 0x00005555555682fb <+99>: add $0x10,%rsp
60 0x00005555555682ff <+103>: pop %rbx
61 0x0000555555568300 <+104>: retq
62
63here address of bb_errno is valid rax = 0x7ffff7cac6c0
64
65with 'const' ( non-working code )
66
67Dump of assembler code for function bb_strtou:
68 0x00005555555682a4 <+0>: push %r14
69 0x00005555555682a6 <+2>: push %rbx
70 0x00005555555682a7 <+3>: push %rax
71 0x00005555555682a8 <+4>: test %rsi,%rsi
72 0x00005555555682ab <+7>: mov %rsp,%rbx
73 0x00005555555682ae <+10>: cmovne %rsi,%rbx
74 0x00005555555682b2 <+14>: mov %rdi,(%rbx)
75 0x00005555555682b5 <+17>: mov (%rdi),%al
76 0x00005555555682b7 <+19>: lea -0x30(%rax),%ecx
77 0x00005555555682ba <+22>: cmp $0xa,%cl
78 0x00005555555682bd <+25>: jb 0x5555555682d6 <bb_strtou+50>
79 0x00005555555682bf <+27>: or $0x20,%al
80 0x00005555555682c1 <+29>: add $0x9f,%al
81 0x00005555555682c3 <+31>: cmp $0x1a,%al
82 0x00005555555682c5 <+33>: jb 0x5555555682d6 <bb_strtou+50>
83 0x00005555555682c7 <+35>: mov 0x107d9a(%rip),%rax # 0x555555670068 <bb_errno>
84 0x00005555555682ce <+42>: movl $0x22,(%rax)
85 0x00005555555682d4 <+48>: jmp 0x5555555682fc <bb_strtou+88>
86 0x00005555555682d6 <+50>: mov 0x107d8b(%rip),%r14 # 0x555555670068 <bb_errno>
87=> 0x00005555555682dd <+57>: movl $0x0,(%r14)
88 0x00005555555682e4 <+64>: mov %rbx,%rsi
89 0x00005555555682e7 <+67>: callq 0x555555564300 <strtoul@plt>
90 0x00005555555682ec <+72>: mov %rax,%rcx
91 0x00005555555682ef <+75>: shr $0x20,%rcx
92 0x00005555555682f3 <+79>: je 0x555555568303 <bb_strtou+95>
93 0x00005555555682f5 <+81>: movl $0x22,(%r14)
94 0x00005555555682fc <+88>: mov $0xffffffff,%eax
95 0x0000555555568301 <+93>: jmp 0x55555556830e <bb_strtou+106>
96 0x0000555555568303 <+95>: mov %rax,%rdi
97 0x0000555555568306 <+98>: mov %rbx,%rsi
98 0x0000555555568309 <+101>: callq 0x5555555681f4 <handle_errors>
99 0x000055555556830e <+106>: add $0x8,%rsp
100 0x0000555555568312 <+110>: pop %rbx
101 0x0000555555568313 <+111>: pop %r14
102 0x0000555555568315 <+113>: retq
103
104r14 is 0x0 and writing to this ofcourse ends up in segfault
105
106[1] https://bugs.llvm.org/show_bug.cgi?id=39919
107
108Signed-off-by: Khem Raj <raj.khem@gmail.com>
109[bero@lindev.ch: rebased to dunfell busybox]
110---
111 coreutils/test.c | 2 +-
112 include/libbb.h | 4 ++--
113 libbb/lineedit.c | 2 +-
114 shell/ash.c | 5 ++---
115 4 files changed, 6 insertions(+), 7 deletions(-)
116
117diff -up busybox-1.31.1/coreutils/test.c.omv~ busybox-1.31.1/coreutils/test.c
118--- busybox-1.31.1/coreutils/test.c.omv~ 2021-03-10 21:10:53.399954723 +0100
119+++ busybox-1.31.1/coreutils/test.c 2021-03-10 21:11:41.670409905 +0100
120@@ -401,7 +401,7 @@ struct test_statics {
121 };
122
123 /* See test_ptr_hack.c */
124-extern struct test_statics *const test_ptr_to_statics;
125+extern struct test_statics *test_ptr_to_statics;
126
127 #define S (*test_ptr_to_statics)
128 #define args (S.args )
129diff -up busybox-1.31.1/include/libbb.h.omv~ busybox-1.31.1/include/libbb.h
130--- busybox-1.31.1/include/libbb.h.omv~ 2021-03-10 21:11:09.916777141 +0100
131+++ busybox-1.31.1/include/libbb.h 2021-03-10 21:11:54.123860671 +0100
132@@ -341,7 +341,7 @@ struct BUG_off_t_size_is_misdetected {
133 #if defined(__GLIBC__)
134 /* glibc uses __errno_location() to get a ptr to errno */
135 /* We can just memorize it once - no multithreading in busybox :) */
136-extern int *const bb_errno;
137+extern int *bb_errno;
138 #undef errno
139 #define errno (*bb_errno)
140 #endif
141@@ -2109,7 +2109,7 @@ struct globals;
142 /* '*const' ptr makes gcc optimize code much better.
143 * Magic prevents ptr_to_globals from going into rodata.
144 * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */
145-extern struct globals *const ptr_to_globals;
146+extern struct globals *ptr_to_globals;
147 /* At least gcc 3.4.6 on mipsel system needs optimization barrier */
148 #define barrier() __asm__ __volatile__("":::"memory")
149 #define SET_PTR_TO_GLOBALS(x) do { \
150diff -up busybox-1.31.1/libbb/lineedit.c.omv~ busybox-1.31.1/libbb/lineedit.c
151--- busybox-1.31.1/libbb/lineedit.c.omv~ 2021-03-10 21:12:14.437385555 +0100
152+++ busybox-1.31.1/libbb/lineedit.c 2021-03-10 21:12:21.160782289 +0100
153@@ -181,7 +181,7 @@ struct lineedit_statics {
154 };
155
156 /* See lineedit_ptr_hack.c */
157-extern struct lineedit_statics *const lineedit_ptr_to_statics;
158+extern struct lineedit_statics *lineedit_ptr_to_statics;
159
160 #define S (*lineedit_ptr_to_statics)
161 #define state (S.state )
162diff -up busybox-1.31.1/shell/ash.c.omv~ busybox-1.31.1/shell/ash.c
163--- busybox-1.31.1/shell/ash.c.omv~ 2021-03-10 21:12:31.460879379 +0100
164+++ busybox-1.31.1/shell/ash.c 2021-03-10 21:13:24.368044942 +0100
165@@ -297,10 +297,8 @@ typedef long arith_t;
166 * set "-DBB_GLOBAL_CONST=''" in CONFIG_EXTRA_CFLAGS to disable
167 * this optimization.
168 */
169-#ifndef BB_GLOBAL_CONST
170-# define BB_GLOBAL_CONST const
171-#endif
172-
173+#undef BB_GLOBAL_CONST
174+#define BB_GLOBAL_CONST
175
176 /* ============ Hash table sizes. Configurable. */
177
diff --git a/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch b/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch
index c14950a..468a32d 100644
--- a/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch
+++ b/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch
@@ -113,11 +113,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
113 shell/ash.c | 5 ++--- 113 shell/ash.c | 5 ++---
114 4 files changed, 6 insertions(+), 7 deletions(-) 114 4 files changed, 6 insertions(+), 7 deletions(-)
115 115
116diff --git a/coreutils/test.c b/coreutils/test.c
117index 868ffbecb..d11fccf5b 100644
118--- a/coreutils/test.c 116--- a/coreutils/test.c
119+++ b/coreutils/test.c 117+++ b/coreutils/test.c
120@@ -401,7 +401,7 @@ struct test_statics { 118@@ -435,7 +435,7 @@ struct test_statics {
121 }; 119 };
122 120
123 /* See test_ptr_hack.c */ 121 /* See test_ptr_hack.c */
@@ -126,33 +124,29 @@ index 868ffbecb..d11fccf5b 100644
126 124
127 #define S (*test_ptr_to_statics) 125 #define S (*test_ptr_to_statics)
128 #define args (S.args ) 126 #define args (S.args )
129diff --git a/include/libbb.h b/include/libbb.h
130index 111d1b790..a52265e77 100644
131--- a/include/libbb.h 127--- a/include/libbb.h
132+++ b/include/libbb.h 128+++ b/include/libbb.h
133@@ -341,7 +341,7 @@ struct BUG_off_t_size_is_misdetected { 129@@ -342,7 +342,7 @@ struct BUG_off_t_size_is_misdetected {
134 #if defined(__GLIBC__) 130 #if defined(errno)
135 /* glibc uses __errno_location() to get a ptr to errno */ 131 /* If errno is a define, assume it's "define errno (*__errno_location())"
136 /* We can just memorize it once - no multithreading in busybox :) */ 132 * and we will cache it's result in this variable */
137-extern int *const bb_errno; 133-extern int *const bb_errno;
138+extern int *bb_errno; 134+extern int *bb_errno;
139 #undef errno 135 #undef errno
140 #define errno (*bb_errno) 136 #define errno (*bb_errno)
141 #endif 137 #define bb_cached_errno_ptr 1
142@@ -2152,7 +2152,7 @@ struct globals; 138@@ -2228,7 +2228,7 @@ struct globals;
143 /* '*const' ptr makes gcc optimize code much better. 139 /* '*const' ptr makes gcc optimize code much better.
144 * Magic prevents ptr_to_globals from going into rodata. 140 * Magic prevents ptr_to_globals from going into rodata.
145 * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ 141 * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */
146-extern struct globals *const ptr_to_globals; 142-extern struct globals *const ptr_to_globals;
147+extern struct globals *ptr_to_globals; 143+extern struct globals *ptr_to_globals;
148 /* At least gcc 3.4.6 on mipsel system needs optimization barrier */ 144
149 #define barrier() __asm__ __volatile__("":::"memory") 145 #if defined(__clang_major__) && __clang_major__ >= 9
150 #define SET_PTR_TO_GLOBALS(x) do { \ 146 /* Clang/llvm drops assignment to "constant" storage. Silently.
151diff --git a/libbb/lineedit.c b/libbb/lineedit.c
152index fbabc6c12..026c42c4c 100644
153--- a/libbb/lineedit.c 147--- a/libbb/lineedit.c
154+++ b/libbb/lineedit.c 148+++ b/libbb/lineedit.c
155@@ -181,7 +181,7 @@ struct lineedit_statics { 149@@ -192,7 +192,7 @@ struct lineedit_statics {
156 }; 150 };
157 151
158 /* See lineedit_ptr_hack.c */ 152 /* See lineedit_ptr_hack.c */
@@ -161,11 +155,9 @@ index fbabc6c12..026c42c4c 100644
161 155
162 #define S (*lineedit_ptr_to_statics) 156 #define S (*lineedit_ptr_to_statics)
163 #define state (S.state ) 157 #define state (S.state )
164diff --git a/shell/ash.c b/shell/ash.c
165index c5588ea66..6f07f7d6d 100644
166--- a/shell/ash.c 158--- a/shell/ash.c
167+++ b/shell/ash.c 159+++ b/shell/ash.c
168@@ -297,10 +297,9 @@ typedef long arith_t; 160@@ -300,10 +300,9 @@ typedef long arith_t;
169 * set "-DBB_GLOBAL_CONST=''" in CONFIG_EXTRA_CFLAGS to disable 161 * set "-DBB_GLOBAL_CONST=''" in CONFIG_EXTRA_CFLAGS to disable
170 * this optimization. 162 * this optimization.
171 */ 163 */
@@ -178,6 +170,3 @@ index c5588ea66..6f07f7d6d 100644
178 170
179 /* ============ Hash table sizes. Configurable. */ 171 /* ============ Hash table sizes. Configurable. */
180 172
181--
1822.23.0
183
diff --git a/recipes-core/busybox/busybox_1.31.%.bbappend b/recipes-core/busybox/busybox_1.31.1%.bbappend
index f26df7e..726ee76 100644
--- a/recipes-core/busybox/busybox_1.31.%.bbappend
+++ b/recipes-core/busybox/busybox_1.31.1%.bbappend
@@ -1,6 +1,6 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append_toolchain-clang = "\ 2SRC_URI_append_toolchain-clang = "\
3 file://0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch \ 3 file://0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const-1.31.1.patch \
4" 4"
5 5
6# networking/tls_pstm_sqr_comba.c:514:4: error: inline assembly requires more registers than available 6# networking/tls_pstm_sqr_comba.c:514:4: error: inline assembly requires more registers than available
diff --git a/recipes-core/meta/clang-environment.inc b/recipes-core/meta/clang-environment.inc
new file mode 100644
index 0000000..a238e49
--- /dev/null
+++ b/recipes-core/meta/clang-environment.inc
@@ -0,0 +1,19 @@
1export TARGET_CLANGCC_ARCH = "${TARGET_CC_ARCH}"
2TARGET_CLANGCC_ARCH_remove = "-mthumb-interwork"
3TARGET_CLANGCC_ARCH_remove = "-mmusl"
4TARGET_CLANGCC_ARCH_remove = "-muclibc"
5TARGET_CLANGCC_ARCH_remove = "-meb"
6TARGET_CLANGCC_ARCH_remove = "-mel"
7TARGET_CLANGCC_ARCH_append = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", " -mbig-endian", " -mlittle-endian", d)}"
8TARGET_CLANGCC_ARCH_remove_powerpc = "-mhard-float"
9TARGET_CLANGCC_ARCH_remove_powerpc = "-mno-spe"
10
11create_sdk_files_append() {
12 script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
13 if ${@bb.utils.contains('CLANGSDK', '1', 'true', 'false', d)}; then
14 echo 'export CLANGCC="${TARGET_PREFIX}clang --target=${TARGET_SYS} ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
15 echo 'export CLANGCXX="${TARGET_PREFIX}clang++ --target=${TARGET_SYS} ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
16 echo 'export CLANGCPP="${TARGET_PREFIX}clang -E --target=${TARGET_SYS} ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
17 echo 'export CLANG_TIDY_EXE="${TARGET_PREFIX}clang-tidy"' >> $script
18 fi
19}
diff --git a/recipes-core/meta/meta-environment-extsdk.bbappend b/recipes-core/meta/meta-environment-extsdk.bbappend
new file mode 100644
index 0000000..e867074
--- /dev/null
+++ b/recipes-core/meta/meta-environment-extsdk.bbappend
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3require clang-environment.inc
diff --git a/recipes-core/meta/meta-environment.bbappend b/recipes-core/meta/meta-environment.bbappend
index d59bfd6..e867074 100644
--- a/recipes-core/meta/meta-environment.bbappend
+++ b/recipes-core/meta/meta-environment.bbappend
@@ -1,19 +1,3 @@
1export TARGET_CLANGCC_ARCH = "${TARGET_CC_ARCH}" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2TARGET_CLANGCC_ARCH_remove = "-mthumb-interwork"
3TARGET_CLANGCC_ARCH_remove = "-mmusl"
4TARGET_CLANGCC_ARCH_remove = "-muclibc"
5TARGET_CLANGCC_ARCH_remove = "-meb"
6TARGET_CLANGCC_ARCH_remove = "-mel"
7TARGET_CLANGCC_ARCH_append = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", " -mbig-endian", " -mlittle-endian", d)}"
8TARGET_CLANGCC_ARCH_remove_powerpc = "-mhard-float"
9TARGET_CLANGCC_ARCH_remove_powerpc = "-mno-spe"
10 2
11create_sdk_files_append() { 3require clang-environment.inc
12 script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
13 if ${@bb.utils.contains('CLANGSDK', '1', 'true', 'false', d)}; then
14 echo 'export CLANGCC="${TARGET_PREFIX}clang ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
15 echo 'export CLANGCXX="${TARGET_PREFIX}clang++ ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
16 echo 'export CLANGCPP="${TARGET_PREFIX}clang -E ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
17 echo 'export CLANG_TIDY_EXE="${TARGET_PREFIX}clang-tidy"' >> $script
18 fi
19}
diff --git a/recipes-core/musl/musl_%.bbappend b/recipes-core/musl/musl_%.bbappend
index a6a1bf5..70fe10c 100644
--- a/recipes-core/musl/musl_%.bbappend
+++ b/recipes-core/musl/musl_%.bbappend
@@ -1,12 +1,4 @@
1DEPENDS_append_toolchain-clang = " clang-cross-${TARGET_ARCH}" 1DEPENDS_append_toolchain-clang = " clang-cross-${TARGET_ARCH}"
2DEPENDS_remove_toolchain-clang = "virtual/${TARGET_PREFIX}gcc"
2TOOLCHAIN_x86-x32 = "gcc" 3TOOLCHAIN_x86-x32 = "gcc"
3TOOLCHAIN_riscv64 = "gcc"
4TOOLCHAIN_powerpc64 = "gcc" 4TOOLCHAIN_powerpc64 = "gcc"
5
6inherit lto
7
8# workaround until https://bugs.llvm.org/show_bug.cgi?id=44384
9# is fixed
10do_configure_prepend_toolchain-clang () {
11 sed -i -e '/frounding-math/d' ${S}/configure
12}
diff --git a/recipes-core/packagegroups/packagegroup-core-buildessential.bbappend b/recipes-core/packagegroups/packagegroup-core-buildessential.bbappend
new file mode 100644
index 0000000..403af1a
--- /dev/null
+++ b/recipes-core/packagegroups/packagegroup-core-buildessential.bbappend
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3RDEPENDS_packagegroup-core-buildessential_append_toolchain-clang = " clang "
diff --git a/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend b/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend
index 4bbd4ab..5b397b5 100644
--- a/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend
+++ b/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend
@@ -1,2 +1,3 @@
1CLANGCROSSCANADIAN = "${@bb.utils.contains('CLANGSDK', '1', 'clang-cross-canadian-${TRANSLATED_TARGET_ARCH}', '', d)}" 1CLANGCROSSCANADIAN = "clang-cross-canadian-${TRANSLATED_TARGET_ARCH}"
2RDEPENDS_${PN} += "${@all_multilib_tune_values(d, 'CLANGCROSSCANADIAN')}" 2CLANGCROSSCANADIANDEPS += "${@all_multilib_tune_values(d, 'CLANGCROSSCANADIAN')}"
3RDEPENDS_${PN} += "${@bb.utils.contains('CLANGSDK', '1', '${CLANGCROSSCANADIANDEPS}', '', d)}"
diff --git a/recipes-devtools/castxml/castxml_git.bb b/recipes-devtools/castxml/castxml_git.bb
new file mode 100644
index 0000000..4d3aa8a
--- /dev/null
+++ b/recipes-devtools/castxml/castxml_git.bb
@@ -0,0 +1,29 @@
1SUMMARY = "C-family abstract syntax tree XML output tool."
2LICENSE = "Apache-2.0"
3LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
4
5SRC_URI = "git://github.com/CastXML/CastXML"
6
7# 0.3.6 is the release for LLVM/Clang v11.0.0
8SRCREV = "902ac163f0291fcfc459f58691481e88c9f91dea"
9PV = "0.3.6"
10
11S = "${WORKDIR}/git"
12
13DEPENDS = "clang"
14
15# Match clang's idea of what TOOLCHAIN should be.
16TOOLCHAIN = "clang"
17TOOLCHAIN_class-native = "gcc"
18TOOLCHAIN_class-nativesdk = "clang"
19
20BUILD_CC_class-nativesdk = "clang"
21BUILD_CXX_class-nativesdk = "clang++"
22BUILD_AR_class-nativesdk = "llvm-ar"
23BUILD_RANLIB_class-nativesdk = "llvm-ranlib"
24BUILD_NM_class-nativesdk = "llvm-nm"
25LDFLAGS_append_class-nativesdk = " -fuse-ld=gold"
26
27inherit cmake cmake-native pkgconfig python3native
28
29BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/clang/clang.inc b/recipes-devtools/clang/clang.inc
index a99049d..6a08046 100644
--- a/recipes-devtools/clang/clang.inc
+++ b/recipes-devtools/clang/clang.inc
@@ -4,11 +4,11 @@ LLVM_DIR = "llvm${LLVM_RELEASE}"
4LLVM_GIT ?= "git://github.com/llvm" 4LLVM_GIT ?= "git://github.com/llvm"
5LLVM_GIT_PROTOCOL ?= "https" 5LLVM_GIT_PROTOCOL ?= "https"
6 6
7MAJOR_VER = "10" 7MAJOR_VER = "12"
8MINOR_VER = "0" 8MINOR_VER = "0"
9PATCH_VER = "1" 9PATCH_VER = "0"
10 10
11SRCREV ?= "ef32c611aa214dea855364efd7ba451ec5ec3f74" 11SRCREV ?= "fa0971b87fb2c9d14d1bba2551e61f02f18f329b"
12 12
13PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}" 13PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}"
14BRANCH = "release/${MAJOR_VER}.x" 14BRANCH = "release/${MAJOR_VER}.x"
@@ -20,4 +20,7 @@ LLDBMD5SUM = "2e0d44968471fcde980034dbb826bea9"
20 20
21LLVM_LIBDIR_SUFFIX="${@d.getVar('baselib').replace('lib', '')}" 21LLVM_LIBDIR_SUFFIX="${@d.getVar('baselib').replace('lib', '')}"
22 22
23# set the default pigz thread
24export PIGZ = "-p ${@oe.utils.cpu_count(at_least=2)}"
25
23require common.inc 26require common.inc
diff --git a/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch b/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch
deleted file mode 100755
index 35e65d3..0000000
--- a/recipes-devtools/clang/clang/0001-compiler-rt-Fix-realpath-already-defined-error.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1From dde0be40b3628caa4abbb7ca367bc753f7b7e7a6 Mon Sep 17 00:00:00 2001
2From: Alexander Thoma <a.thoma@rational-online.com>
3Date: Wed, 22 Sep 2021 07:46:29 +0200
4Subject: [PATCH] compiler-rt Fix realpath already defined error
5
6---
7 compiler-rt/lib/tsan/dd/dd_interceptors.cpp | 10 +++++-----
8 1 file changed, 5 insertions(+), 5 deletions(-)
9
10diff --git a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
11index 35a0beb19196..ed819339f3cb 100644
12--- a/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
13+++ b/compiler-rt/lib/tsan/dd/dd_interceptors.cpp
14@@ -6,11 +6,11 @@
15 //
16 //===----------------------------------------------------------------------===//
17
18+#include <pthread.h>
19 #include "dd_rtl.h"
20 #include "interception/interception.h"
21 #include "sanitizer_common/sanitizer_procmaps.h"
22-#include <pthread.h>
23-#include <stdlib.h>
24+#include "sanitizer_common/sanitizer_allocator_internal.h"
25
26 using namespace __dsan;
27
28@@ -163,12 +163,12 @@ static pthread_cond_t *init_cond(pthread_cond_t *c, bool force = false) {
29 uptr cond = atomic_load(p, memory_order_acquire);
30 if (!force && cond != 0)
31 return (pthread_cond_t*)cond;
32- void *newcond = malloc(sizeof(pthread_cond_t));
33+ void *newcond = InternalAlloc(sizeof(pthread_cond_t));
34 internal_memset(newcond, 0, sizeof(pthread_cond_t));
35 if (atomic_compare_exchange_strong(p, &cond, (uptr)newcond,
36 memory_order_acq_rel))
37 return (pthread_cond_t*)newcond;
38- free(newcond);
39+ InternalFree(newcond);
40 return (pthread_cond_t*)cond;
41 }
42
43@@ -216,7 +216,7 @@ INTERCEPTOR(int, pthread_cond_destroy, pthread_cond_t *c) {
44 InitThread();
45 pthread_cond_t *cond = init_cond(c);
46 int res = REAL(pthread_cond_destroy)(cond);
47- free(cond);
48+ InternalFree(cond);
49 atomic_store((atomic_uintptr_t*)c, 0, memory_order_relaxed);
50 return res;
51 }
52--
532.25.1
54
diff --git a/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch b/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
index 1a606f4..c1ba432 100644
--- a/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
+++ b/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
@@ -1,4 +1,4 @@
1From 9f0c90da3de0706e3dd699ed0eb92744d4d9ea80 Mon Sep 17 00:00:00 2001 1From 42e6673563ca1d0e433e16c3eefa20b98e280ebd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 May 2017 17:36:16 -0700 3Date: Mon, 22 May 2017 17:36:16 -0700
4Subject: [PATCH] lldb: Add -lxml2 to linker cmdline of xml is found 4Subject: [PATCH] lldb: Add -lxml2 to linker cmdline of xml is found
@@ -23,15 +23,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
23 1 file changed, 1 insertion(+), 1 deletion(-) 23 1 file changed, 1 insertion(+), 1 deletion(-)
24 24
25diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt 25diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
26index 2e9bb402227..bfad6703c65 100644 26index 7456cb98bfa1..1a732ec5cb89 100644
27--- a/lldb/source/Host/CMakeLists.txt 27--- a/lldb/source/Host/CMakeLists.txt
28+++ b/lldb/source/Host/CMakeLists.txt 28+++ b/lldb/source/Host/CMakeLists.txt
29@@ -149,7 +149,7 @@ if (APPLE) 29@@ -138,7 +138,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
30 list(APPEND EXTRA_LIBS xml2) 30 list(APPEND EXTRA_LIBS kvm)
31 else () 31 endif()
32 if (LIBXML2_FOUND) 32 if (LLDB_ENABLE_LIBXML2)
33- list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES}) 33- list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES})
34+ list(APPEND EXTRA_LIBS xml2) 34+ list(APPEND EXTRA_LIBS xml2)
35 endif() 35 endif()
36 endif ()
37 if (HAVE_LIBDL) 36 if (HAVE_LIBDL)
37 list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
diff --git a/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch b/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
index 65fb23d..f101e77 100644
--- a/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
+++ b/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
@@ -1,4 +1,4 @@
1From a268e2fb21b30cce26f76536bf133b7a706e460f Mon Sep 17 00:00:00 2001 1From da63df8f02b3a767b68d6de730bb63bba6c3ce33 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 Aug 2017 10:37:49 -0700 3Date: Sun, 27 Aug 2017 10:37:49 -0700
4Subject: [PATCH] libcxxabi: Find libunwind headers when 4Subject: [PATCH] libcxxabi: Find libunwind headers when
@@ -17,10 +17,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
17 1 file changed, 11 insertions(+), 10 deletions(-) 17 1 file changed, 11 insertions(+), 10 deletions(-)
18 18
19diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt 19diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
20index 59d99971a76..b0f51ebee3e 100644 20index 426c855288fc..06a62c642898 100644
21--- a/libcxxabi/CMakeLists.txt 21--- a/libcxxabi/CMakeLists.txt
22+++ b/libcxxabi/CMakeLists.txt 22+++ b/libcxxabi/CMakeLists.txt
23@@ -497,14 +497,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") 23@@ -478,14 +478,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
24 # Setup Source Code 24 # Setup Source Code
25 #=============================================================================== 25 #===============================================================================
26 26
@@ -36,7 +36,7 @@ index 59d99971a76..b0f51ebee3e 100644
36 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} 36 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
37 ${LIBCXXABI_LIBUNWIND_PATH}/include 37 ${LIBCXXABI_LIBUNWIND_PATH}/include
38 ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES} 38 ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
39@@ -515,15 +510,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) 39@@ -496,15 +491,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
40 NO_CMAKE_FIND_ROOT_PATH 40 NO_CMAKE_FIND_ROOT_PATH
41 ) 41 )
42 42
diff --git a/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch b/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
index 4c8bc63..e8536d3 100644
--- a/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
+++ b/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
@@ -1,4 +1,4 @@
1From 57ba81bfe82f18899b1c846bee6276b1b43ce4cf Mon Sep 17 00:00:00 2001 1From cfeba7ac05c96abddfad1eeb827ba8d0c968ec94 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 19 Apr 2015 15:16:23 -0700 3Date: Sun, 19 Apr 2015 15:16:23 -0700
4Subject: [PATCH] compiler-rt: support a new embedded linux target 4Subject: [PATCH] compiler-rt: support a new embedded linux target
@@ -13,7 +13,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 create mode 100644 compiler-rt/make/platform/clang_linux_embedded_test_input.c 13 create mode 100644 compiler-rt/make/platform/clang_linux_embedded_test_input.c
14 14
15diff --git a/compiler-rt/lib/builtins/int_util.c b/compiler-rt/lib/builtins/int_util.c 15diff --git a/compiler-rt/lib/builtins/int_util.c b/compiler-rt/lib/builtins/int_util.c
16index 226a6e93440..efc977acbb3 100644 16index 226a6e93440d..efc977acbb39 100644
17--- a/compiler-rt/lib/builtins/int_util.c 17--- a/compiler-rt/lib/builtins/int_util.c
18+++ b/compiler-rt/lib/builtins/int_util.c 18+++ b/compiler-rt/lib/builtins/int_util.c
19@@ -54,7 +54,7 @@ void __compilerrt_abort_impl(const char *file, int line, const char *function) { 19@@ -54,7 +54,7 @@ void __compilerrt_abort_impl(const char *file, int line, const char *function) {
@@ -27,7 +27,7 @@ index 226a6e93440..efc977acbb3 100644
27 __attribute__((weak)) 27 __attribute__((weak))
28diff --git a/compiler-rt/make/platform/clang_linux_embedded.mk b/compiler-rt/make/platform/clang_linux_embedded.mk 28diff --git a/compiler-rt/make/platform/clang_linux_embedded.mk b/compiler-rt/make/platform/clang_linux_embedded.mk
29new file mode 100644 29new file mode 100644
30index 00000000000..d0a890075a1 30index 000000000000..d0a890075a1c
31--- /dev/null 31--- /dev/null
32+++ b/compiler-rt/make/platform/clang_linux_embedded.mk 32+++ b/compiler-rt/make/platform/clang_linux_embedded.mk
33@@ -0,0 +1,286 @@ 33@@ -0,0 +1,286 @@
@@ -319,4 +319,4 @@ index 00000000000..d0a890075a1
319+FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64) 319+FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64)
320diff --git a/compiler-rt/make/platform/clang_linux_embedded_test_input.c b/compiler-rt/make/platform/clang_linux_embedded_test_input.c 320diff --git a/compiler-rt/make/platform/clang_linux_embedded_test_input.c b/compiler-rt/make/platform/clang_linux_embedded_test_input.c
321new file mode 100644 321new file mode 100644
322index 00000000000..e69de29bb2d 322index 000000000000..e69de29bb2d1
diff --git a/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch b/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
index dfbfb53..8b8edd8 100644
--- a/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
+++ b/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
@@ -1,4 +1,4 @@
1From 1ecabb645e30330b82754b133f685d96c3e1ee42 Mon Sep 17 00:00:00 2001 1From 6c786d55d560abca076b7c1b718cdcb31ef5b388 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 May 2016 23:11:45 -0700 3Date: Thu, 19 May 2016 23:11:45 -0700
4Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use 4Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use
@@ -20,10 +20,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
20 1 file changed, 10 insertions(+), 1 deletion(-) 20 1 file changed, 10 insertions(+), 1 deletion(-)
21 21
22diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt 22diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
23index 8d768a404f2..1b1a29dc25a 100644 23index b44ad2c2118e..ed8f4bd80e93 100644
24--- a/compiler-rt/CMakeLists.txt 24--- a/compiler-rt/CMakeLists.txt
25+++ b/compiler-rt/CMakeLists.txt 25+++ b/compiler-rt/CMakeLists.txt
26@@ -74,7 +74,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL 26@@ -72,7 +72,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL
27 "Build for a bare-metal target.") 27 "Build for a bare-metal target.")
28 28
29 if (COMPILER_RT_STANDALONE_BUILD) 29 if (COMPILER_RT_STANDALONE_BUILD)
diff --git a/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch b/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch
new file mode 100644
index 0000000..97d57c2
--- /dev/null
+++ b/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch
@@ -0,0 +1,40 @@
1From 121a71a3923dbace24dbb7bd25f9f286fb9f91fb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 18 Jul 2016 08:05:02 +0000
4Subject: [PATCH] compiler-rt: Disable tsan on OE/glibc
5
6It does not build see
7http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 compiler-rt/cmake/config-ix.cmake | 2 +-
12 compiler-rt/test/sanitizer_common/CMakeLists.txt | 2 +-
13 2 files changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
16index f81b8384cbd5..196aa62fd01c 100644
17--- a/compiler-rt/cmake/config-ix.cmake
18+++ b/compiler-rt/cmake/config-ix.cmake
19@@ -723,7 +723,7 @@ else()
20 endif()
21
22 if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
23- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
24+ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD")
25 set(COMPILER_RT_HAS_TSAN TRUE)
26 else()
27 set(COMPILER_RT_HAS_TSAN FALSE)
28diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt
29index 7f1b0f257716..2caf78be2511 100644
30--- a/compiler-rt/test/sanitizer_common/CMakeLists.txt
31+++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt
32@@ -11,7 +11,7 @@ set(SANITIZER_COMMON_TESTSUITES)
33 # FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of
34 # the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other
35 # sanitizers work.
36-set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan)
37+set(SUPPORTED_TOOLS_INIT asan lsan msan ubsan)
38 set(SUPPORTED_TOOLS)
39 foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT})
40 string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER)
diff --git a/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
index fd58c68..4e1120a 100644
--- a/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ b/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
@@ -1,4 +1,4 @@
1From c3f0b7eb02d4b13400f0cf8d8e77f9e898f189e9 Mon Sep 17 00:00:00 2001 1From 4afcffd0c4b3317b5b5e08e3372b2923ab471e4b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 21 May 2016 00:33:20 +0000 3Date: Sat, 21 May 2016 00:33:20 +0000
4Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are 4Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 1 file changed, 21 insertions(+) 13 1 file changed, 21 insertions(+)
14 14
15diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def 15diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
16index afed404f04c..876888656f2 100644 16index defc95d0062a..41d2099d0c5b 100644
17--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def 17--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
18+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def 18+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
19@@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") 19@@ -809,6 +809,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
20 TLI_DEFINE_ENUM_INTERNAL(fopen) 20 TLI_DEFINE_ENUM_INTERNAL(fopen)
21 TLI_DEFINE_STRING_INTERNAL("fopen") 21 TLI_DEFINE_STRING_INTERNAL("fopen")
22 /// FILE *fopen64(const char *filename, const char *opentype) 22 /// FILE *fopen64(const char *filename, const char *opentype)
@@ -26,7 +26,7 @@ index afed404f04c..876888656f2 100644
26 TLI_DEFINE_ENUM_INTERNAL(fopen64) 26 TLI_DEFINE_ENUM_INTERNAL(fopen64)
27 TLI_DEFINE_STRING_INTERNAL("fopen64") 27 TLI_DEFINE_STRING_INTERNAL("fopen64")
28 /// int fork(); 28 /// int fork();
29@@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") 29@@ -856,6 +859,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
30 /// int fseeko(FILE *stream, off_t offset, int whence); 30 /// int fseeko(FILE *stream, off_t offset, int whence);
31 TLI_DEFINE_ENUM_INTERNAL(fseeko) 31 TLI_DEFINE_ENUM_INTERNAL(fseeko)
32 TLI_DEFINE_STRING_INTERNAL("fseeko") 32 TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -36,7 +36,7 @@ index afed404f04c..876888656f2 100644
36 /// int fseeko64(FILE *stream, off64_t offset, int whence) 36 /// int fseeko64(FILE *stream, off64_t offset, int whence)
37 TLI_DEFINE_ENUM_INTERNAL(fseeko64) 37 TLI_DEFINE_ENUM_INTERNAL(fseeko64)
38 TLI_DEFINE_STRING_INTERNAL("fseeko64") 38 TLI_DEFINE_STRING_INTERNAL("fseeko64")
39@@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") 39@@ -866,6 +872,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
40 TLI_DEFINE_ENUM_INTERNAL(fstat) 40 TLI_DEFINE_ENUM_INTERNAL(fstat)
41 TLI_DEFINE_STRING_INTERNAL("fstat") 41 TLI_DEFINE_STRING_INTERNAL("fstat")
42 /// int fstat64(int filedes, struct stat64 *buf) 42 /// int fstat64(int filedes, struct stat64 *buf)
@@ -46,7 +46,7 @@ index afed404f04c..876888656f2 100644
46 TLI_DEFINE_ENUM_INTERNAL(fstat64) 46 TLI_DEFINE_ENUM_INTERNAL(fstat64)
47 TLI_DEFINE_STRING_INTERNAL("fstat64") 47 TLI_DEFINE_STRING_INTERNAL("fstat64")
48 /// int fstatvfs(int fildes, struct statvfs *buf); 48 /// int fstatvfs(int fildes, struct statvfs *buf);
49@@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") 49@@ -881,6 +890,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
50 TLI_DEFINE_ENUM_INTERNAL(ftello) 50 TLI_DEFINE_ENUM_INTERNAL(ftello)
51 TLI_DEFINE_STRING_INTERNAL("ftello") 51 TLI_DEFINE_STRING_INTERNAL("ftello")
52 /// off64_t ftello64(FILE *stream) 52 /// off64_t ftello64(FILE *stream)
@@ -56,7 +56,7 @@ index afed404f04c..876888656f2 100644
56 TLI_DEFINE_ENUM_INTERNAL(ftello64) 56 TLI_DEFINE_ENUM_INTERNAL(ftello64)
57 TLI_DEFINE_STRING_INTERNAL("ftello64") 57 TLI_DEFINE_STRING_INTERNAL("ftello64")
58 /// int ftrylockfile(FILE *file); 58 /// int ftrylockfile(FILE *file);
59@@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") 59@@ -1007,6 +1019,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
60 TLI_DEFINE_ENUM_INTERNAL(lstat) 60 TLI_DEFINE_ENUM_INTERNAL(lstat)
61 TLI_DEFINE_STRING_INTERNAL("lstat") 61 TLI_DEFINE_STRING_INTERNAL("lstat")
62 /// int lstat64(const char *path, struct stat64 *buf); 62 /// int lstat64(const char *path, struct stat64 *buf);
@@ -66,7 +66,7 @@ index afed404f04c..876888656f2 100644
66 TLI_DEFINE_ENUM_INTERNAL(lstat64) 66 TLI_DEFINE_ENUM_INTERNAL(lstat64)
67 TLI_DEFINE_STRING_INTERNAL("lstat64") 67 TLI_DEFINE_STRING_INTERNAL("lstat64")
68 /// void *malloc(size_t size); 68 /// void *malloc(size_t size);
69@@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") 69@@ -1250,6 +1265,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
70 TLI_DEFINE_ENUM_INTERNAL(stat) 70 TLI_DEFINE_ENUM_INTERNAL(stat)
71 TLI_DEFINE_STRING_INTERNAL("stat") 71 TLI_DEFINE_STRING_INTERNAL("stat")
72 /// int stat64(const char *path, struct stat64 *buf); 72 /// int stat64(const char *path, struct stat64 *buf);
@@ -76,7 +76,7 @@ index afed404f04c..876888656f2 100644
76 TLI_DEFINE_ENUM_INTERNAL(stat64) 76 TLI_DEFINE_ENUM_INTERNAL(stat64)
77 TLI_DEFINE_STRING_INTERNAL("stat64") 77 TLI_DEFINE_STRING_INTERNAL("stat64")
78 /// int statvfs(const char *path, struct statvfs *buf); 78 /// int statvfs(const char *path, struct statvfs *buf);
79@@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times") 79@@ -1385,6 +1403,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
80 TLI_DEFINE_ENUM_INTERNAL(tmpfile) 80 TLI_DEFINE_ENUM_INTERNAL(tmpfile)
81 TLI_DEFINE_STRING_INTERNAL("tmpfile") 81 TLI_DEFINE_STRING_INTERNAL("tmpfile")
82 /// FILE *tmpfile64(void) 82 /// FILE *tmpfile64(void)
diff --git a/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch b/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
index 804cde9..4df2d62 100644
--- a/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
+++ b/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
@@ -1,4 +1,4 @@
1From f9e72bc861144d8f77505ce833fc0c8397520e9b Mon Sep 17 00:00:00 2001 1From 4ed6b8848edbe1c453ce0d23d33551ff023f4fb2 Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com> 2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700 3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH] llvm: allow env override of exe path 4Subject: [PATCH] llvm: allow env override of exe path
@@ -15,10 +15,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 1 file changed, 7 insertions(+) 15 1 file changed, 7 insertions(+)
16 16
17diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp 17diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
18index 6c31df3e173..f34f3a935ad 100644 18index 1a2f04552d13..019d8f2b5c5e 100644
19--- a/llvm/tools/llvm-config/llvm-config.cpp 19--- a/llvm/tools/llvm-config/llvm-config.cpp
20+++ b/llvm/tools/llvm-config/llvm-config.cpp 20+++ b/llvm/tools/llvm-config/llvm-config.cpp
21@@ -225,6 +225,13 @@ Typical components:\n\ 21@@ -247,6 +247,13 @@ Typical components:\n\
22 22
23 /// Compute the path to the main executable. 23 /// Compute the path to the main executable.
24 std::string GetExecutablePath(const char *Argv0) { 24 std::string GetExecutablePath(const char *Argv0) {
diff --git a/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch b/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
index 2d0cb1c..ea28de0 100644
--- a/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
+++ b/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
@@ -1,4 +1,4 @@
1From 2aa9b771b258b45e7de0bef6a99bcdd248ce3b17 Mon Sep 17 00:00:00 2001 1From 15008103e23b5e1cd65bcc32746aa41579583dc5 Mon Sep 17 00:00:00 2001
2From: Dan McGregor <dan.mcgregor@usask.ca> 2From: Dan McGregor <dan.mcgregor@usask.ca>
3Date: Wed, 26 Apr 2017 20:29:41 -0600 3Date: Wed, 26 Apr 2017 20:29:41 -0600
4Subject: [PATCH] clang: driver: Check sysroot for ldso path 4Subject: [PATCH] clang: driver: Check sysroot for ldso path
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 16 insertions(+) 14 1 file changed, 16 insertions(+)
15 15
16diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp 16diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
17index bff1ab1009b..02e3d676567 100644 17index 9663a7390ada..06b92cc0bf5b 100644
18--- a/clang/lib/Driver/ToolChains/Linux.cpp 18--- a/clang/lib/Driver/ToolChains/Linux.cpp
19+++ b/clang/lib/Driver/ToolChains/Linux.cpp 19+++ b/clang/lib/Driver/ToolChains/Linux.cpp
20@@ -596,11 +596,19 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 20@@ -507,11 +507,19 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
21 LibDir = "lib64"; 21 LibDir = "lib64";
22 Loader = 22 Loader =
23 (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; 23 (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
@@ -37,7 +37,7 @@ index bff1ab1009b..02e3d676567 100644
37 break; 37 break;
38 case llvm::Triple::riscv32: { 38 case llvm::Triple::riscv32: {
39 StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple); 39 StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
40@@ -622,6 +630,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 40@@ -533,6 +541,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
41 case llvm::Triple::sparcv9: 41 case llvm::Triple::sparcv9:
42 LibDir = "lib64"; 42 LibDir = "lib64";
43 Loader = "ld-linux.so.2"; 43 Loader = "ld-linux.so.2";
@@ -48,7 +48,7 @@ index bff1ab1009b..02e3d676567 100644
48 break; 48 break;
49 case llvm::Triple::systemz: 49 case llvm::Triple::systemz:
50 LibDir = "lib"; 50 LibDir = "lib";
51@@ -636,6 +648,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 51@@ -547,6 +559,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
52 52
53 LibDir = X32 ? "libx32" : "lib64"; 53 LibDir = X32 ? "libx32" : "lib64";
54 Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; 54 Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
@@ -58,4 +58,4 @@ index bff1ab1009b..02e3d676567 100644
58+ } 58+ }
59 break; 59 break;
60 } 60 }
61 } 61 case llvm::Triple::ve:
diff --git a/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
index 51ce720..a0d116b 100644
--- a/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
+++ b/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
@@ -1,4 +1,4 @@
1From 42800fd6bf0040ddd0abf280ea205407e9e004b5 Mon Sep 17 00:00:00 2001 1From 1b2f69bc1938d4d65dd88c2e43e1bd160312d074 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 May 2016 21:11:06 -0700 3Date: Thu, 19 May 2016 21:11:06 -0700
4Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl 4Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 1 file changed, 6 insertions(+) 13 1 file changed, 6 insertions(+)
14 14
15diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp 15diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
16index da197e47662..4821cfebc21 100644 16index 1d8a3cdce92a..195a302c8771 100644
17--- a/clang/lib/Driver/ToolChains/Gnu.cpp 17--- a/clang/lib/Driver/ToolChains/Gnu.cpp
18+++ b/clang/lib/Driver/ToolChains/Gnu.cpp 18+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
19@@ -583,6 +583,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, 19@@ -628,6 +628,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
20 if (IsIAMCU) 20 if (IsIAMCU)
21 CmdArgs.push_back("-lgloss"); 21 CmdArgs.push_back("-lgloss");
22 22
diff --git a/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
index 2de6618..8c2ddeb 100644
--- a/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
+++ b/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
@@ -1,4 +1,4 @@
1From d4719b78a4d59d572b9de7397d8179a5ed7460e9 Mon Sep 17 00:00:00 2001 1From 7ab52935bc6bd89529a2478af1ea2cdf192eb0d9 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 10 May 2016 02:00:11 -0700 3Date: Tue, 10 May 2016 02:00:11 -0700
4Subject: [PATCH] clang: musl/ppc does not support 128-bit long double 4Subject: [PATCH] clang: musl/ppc does not support 128-bit long double
@@ -9,10 +9,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
9 1 file changed, 4 insertions(+) 9 1 file changed, 4 insertions(+)
10 10
11diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h 11diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
12index 270aa7ff918..8b1bb167818 100644 12index 56c8f33ef221..b7e7edf270be 100644
13--- a/clang/lib/Basic/Targets/PPC.h 13--- a/clang/lib/Basic/Targets/PPC.h
14+++ b/clang/lib/Basic/Targets/PPC.h 14+++ b/clang/lib/Basic/Targets/PPC.h
15@@ -364,6 +364,10 @@ public: 15@@ -386,6 +386,10 @@ public:
16 LongDoubleFormat = &llvm::APFloat::IEEEdouble(); 16 LongDoubleFormat = &llvm::APFloat::IEEEdouble();
17 } 17 }
18 18
diff --git a/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
index 418afba..88d1868 100644
--- a/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
+++ b/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
@@ -1,4 +1,4 @@
1From 90ac3c6f6407ed40aa76e779ddbcfc0d24c58780 Mon Sep 17 00:00:00 2001 1From af7639bf4db497300060a22f2cc94b37145b8db5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 16 Mar 2017 09:02:13 -0700 3Date: Thu, 16 Mar 2017 09:02:13 -0700
4Subject: [PATCH] clang: Prepend trailing '/' to sysroot 4Subject: [PATCH] clang: Prepend trailing '/' to sysroot
@@ -24,15 +24,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
24 1 file changed, 1 insertion(+), 1 deletion(-) 24 1 file changed, 1 insertion(+), 1 deletion(-)
25 25
26diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp 26diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
27index 02e3d676567..d95da11e351 100644 27index 06b92cc0bf5b..726308413dc9 100644
28--- a/clang/lib/Driver/ToolChains/Linux.cpp 28--- a/clang/lib/Driver/ToolChains/Linux.cpp
29+++ b/clang/lib/Driver/ToolChains/Linux.cpp 29+++ b/clang/lib/Driver/ToolChains/Linux.cpp
30@@ -223,7 +223,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) 30@@ -218,7 +218,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
31 Multilibs = GCCInstallation.getMultilibs(); 31 Multilibs = GCCInstallation.getMultilibs();
32 SelectedMultilib = GCCInstallation.getMultilib(); 32 SelectedMultilib = GCCInstallation.getMultilib();
33 llvm::Triple::ArchType Arch = Triple.getArch(); 33 llvm::Triple::ArchType Arch = Triple.getArch();
34- std::string SysRoot = computeSysRoot(); 34- std::string SysRoot = computeSysRoot();
35+ std::string SysRoot = computeSysRoot() + "/"; 35+ std::string SysRoot = computeSysRoot() + "/";
36 ToolChain::path_list &PPaths = getProgramPaths();
36 37
37 // Cross-compiling binutils and GCC installations (vanilla and openSUSE at 38 Generic_GCC::PushPPaths(PPaths);
38 // least) put various tools in a triple-prefixed directory off of the parent
diff --git a/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
index 9316157..1e9d395 100644
--- a/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
+++ b/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
@@ -1,4 +1,4 @@
1From 805b4ce637faedee91bb92fdae273b01bd5aa363 Mon Sep 17 00:00:00 2001 1From f946307a70619c45919ac06fa37c267fd25c3ec8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 16 Mar 2017 19:06:26 -0700 3Date: Thu, 16 Mar 2017 19:06:26 -0700
4Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime 4Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime
@@ -15,7 +15,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 1 file changed, 5 insertions(+), 1 deletion(-) 15 1 file changed, 5 insertions(+), 1 deletion(-)
16 16
17diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp 17diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
18index cab97b1a601..059a5e62c40 100644 18index b2ddef141a75..784a946b453f 100644
19--- a/clang/lib/Driver/ToolChain.cpp 19--- a/clang/lib/Driver/ToolChain.cpp
20+++ b/clang/lib/Driver/ToolChain.cpp 20+++ b/clang/lib/Driver/ToolChain.cpp
21@@ -14,6 +14,7 @@ 21@@ -14,6 +14,7 @@
@@ -26,7 +26,7 @@ index cab97b1a601..059a5e62c40 100644
26 #include "clang/Config/config.h" 26 #include "clang/Config/config.h"
27 #include "clang/Driver/Action.h" 27 #include "clang/Driver/Action.h"
28 #include "clang/Driver/Driver.h" 28 #include "clang/Driver/Driver.h"
29@@ -379,7 +380,10 @@ StringRef ToolChain::getOSLibName() const { 29@@ -404,7 +405,10 @@ StringRef ToolChain::getOSLibName() const {
30 } 30 }
31 31
32 std::string ToolChain::getCompilerRTPath() const { 32 std::string ToolChain::getCompilerRTPath() const {
diff --git a/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
index b1b3f05..1b07e5a 100644
--- a/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
+++ b/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
@@ -1,4 +1,4 @@
1From 56a43865d296b6b3293cd35f3e4732dac8b00523 Mon Sep 17 00:00:00 2001 1From 9c61a33cec25c8f2e0a90d5109808131d2e51c2d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 21 May 2017 15:38:25 -0700 3Date: Sun, 21 May 2017 15:38:25 -0700
4Subject: [PATCH] clang: Define / releative gcc installation dir 4Subject: [PATCH] clang: Define / releative gcc installation dir
@@ -10,20 +10,36 @@ installation in OE
10 10
11Signed-off-by: Khem Raj <raj.khem@gmail.com> 11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12--- 12---
13 clang/lib/Driver/ToolChains/Gnu.cpp | 3 +++ 13 clang/lib/Driver/ToolChains/Gnu.cpp | 12 ++++++------
14 1 file changed, 3 insertions(+) 14 1 file changed, 6 insertions(+), 6 deletions(-)
15 15
16diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp 16diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
17index 4821cfebc21..0c8d9e2f475 100644 17index 195a302c8771..05d1d3003881 100644
18--- a/clang/lib/Driver/ToolChains/Gnu.cpp 18--- a/clang/lib/Driver/ToolChains/Gnu.cpp
19+++ b/clang/lib/Driver/ToolChains/Gnu.cpp 19+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
20@@ -2428,6 +2428,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( 20@@ -2514,12 +2514,6 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
21 {"gcc-cross/" + CandidateTriple.str(), "../..", 21 // Whether this library suffix is relevant for the triple.
22 TargetTriple.getOS() != llvm::Triple::Solaris}, 22 bool Active;
23 23 } Suffixes[] = {
24+ // OE cross-compilers path structures 24- // This is the normal place.
25+ {"/" + CandidateTriple.str(), "..", true}, 25- {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists},
26+ 26-
27- // Debian puts cross-compilers in gcc-cross.
28- {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists},
29-
27 // The Freescale PPC SDK has the gcc libraries in 30 // The Freescale PPC SDK has the gcc libraries in
28 // <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do 31 // <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do
29 // this on Freescale triples, though, since some systems put a *lot* of 32 // this on Freescale triples, though, since some systems put a *lot* of
33@@ -2528,6 +2522,12 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
34 TargetTriple.getVendor() == llvm::Triple::Freescale ||
35 TargetTriple.getVendor() == llvm::Triple::OpenEmbedded},
36
37+ // This is the normal place.
38+ {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists},
39+
40+ // Debian puts cross-compilers in gcc-cross.
41+ {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists},
42+
43 // Natively multiarch systems sometimes put the GCC triple-specific
44 // directory within their multiarch lib directory, resulting in the
45 // triple appearing twice.
diff --git a/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch b/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
index 71c1c52..67cc8de 100644
--- a/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
+++ b/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
@@ -1,4 +1,4 @@
1From b11d1668890778d6d55cadeaec4f6c2e291b583b Mon Sep 17 00:00:00 2001 1From 3166a3b59f406de57f04a0b6fd0f3f1eabfaaa37 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 16 Aug 2017 15:16:15 -0700 3Date: Wed, 16 Aug 2017 15:16:15 -0700
4Subject: [PATCH] clang: Fix ldso for musl on x86 and x32 architectures 4Subject: [PATCH] clang: Fix ldso for musl on x86 and x32 architectures
@@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 8 insertions(+) 14 1 file changed, 8 insertions(+)
15 15
16diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp 16diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
17index d95da11e351..0a4644dab9f 100644 17index 726308413dc9..b64396647882 100644
18--- a/clang/lib/Driver/ToolChains/Linux.cpp 18--- a/clang/lib/Driver/ToolChains/Linux.cpp
19+++ b/clang/lib/Driver/ToolChains/Linux.cpp 19+++ b/clang/lib/Driver/ToolChains/Linux.cpp
20@@ -519,6 +519,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 20@@ -426,6 +426,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
21 if (Triple.isMusl()) { 21 if (Triple.isMusl()) {
22 std::string ArchName; 22 std::string ArchName;
23 bool IsArm = false; 23 bool IsArm = false;
@@ -25,7 +25,7 @@ index d95da11e351..0a4644dab9f 100644
25 25
26 switch (Arch) { 26 switch (Arch) {
27 case llvm::Triple::arm: 27 case llvm::Triple::arm:
28@@ -531,6 +532,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 28@@ -438,6 +439,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
29 ArchName = "armeb"; 29 ArchName = "armeb";
30 IsArm = true; 30 IsArm = true;
31 break; 31 break;
diff --git a/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch b/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
index 7b762f1..46b6995 100644
--- a/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
+++ b/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
@@ -1,4 +1,4 @@
1From 0f969665b80310b90bcb304b2e60c4493687c5a6 Mon Sep 17 00:00:00 2001 1From bd42395fa181d5821f0d756d12c534f2cda525c0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 15 May 2018 10:28:43 -0700 3Date: Tue, 15 May 2018 10:28:43 -0700
4Subject: [PATCH] clang: scan-view needs python 2.x 4Subject: [PATCH] clang: scan-view needs python 2.x
@@ -13,7 +13,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
13 1 file changed, 1 insertion(+), 1 deletion(-) 13 1 file changed, 1 insertion(+), 1 deletion(-)
14 14
15diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view 15diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view
16index 6165432e7af..04ad518a60c 100755 16index 6165432e7af8..04ad518a60cd 100755
17--- a/clang/tools/scan-view/bin/scan-view 17--- a/clang/tools/scan-view/bin/scan-view
18+++ b/clang/tools/scan-view/bin/scan-view 18+++ b/clang/tools/scan-view/bin/scan-view
19@@ -1,4 +1,4 @@ 19@@ -1,4 +1,4 @@
diff --git a/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
index b77f433..a785bda 100644
--- a/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
+++ b/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
@@ -1,4 +1,4 @@
1From a1fa38408f7524c8452709574b3d83b72ebcfa38 Mon Sep 17 00:00:00 2001 1From c309e121d6aca050119084e3e98371cd8e44ecca Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 31 Jul 2019 22:51:39 -0700 3Date: Wed, 31 Jul 2019 22:51:39 -0700
4Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static 4Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static
@@ -20,15 +20,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
20 1 file changed, 6 insertions(+), 1 deletion(-) 20 1 file changed, 6 insertions(+), 1 deletion(-)
21 21
22diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp 22diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
23index 37ec7346857..c849b2242e9 100644 23index bcaea71dca94..95b806e29ef2 100644
24--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp 24--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
25+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp 25+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
26@@ -1211,8 +1211,13 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, 26@@ -1423,8 +1423,13 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
27 case ToolChain::UNW_CompilerRT: 27 // Let the linker choose between libunwind.dll.a and libunwind.a
28 if (LGT == LibGccType::StaticLibGcc) 28 // depending on what's available, and depending on the -static flag
29 CmdArgs.push_back("-l:libunwind.a"); 29 CmdArgs.push_back("-lunwind");
30- else 30- } else
31+ else { 31+ } else {
32 CmdArgs.push_back("-l:libunwind.so"); 32 CmdArgs.push_back("-l:libunwind.so");
33+ if (Args.hasArg(options::OPT_static)) { 33+ if (Args.hasArg(options::OPT_static)) {
34+ CmdArgs.push_back("-lpthread"); 34+ CmdArgs.push_back("-lpthread");
diff --git a/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
index de92b2f..3f2e16b 100644
--- a/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
+++ b/recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
@@ -1,4 +1,4 @@
1From a415287545ffe17f7dbc743a033877fd239856b5 Mon Sep 17 00:00:00 2001 1From 00449fb89e8ab3b34f03d3a09a4d859e5d0a8245 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com> 2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Thu, 26 Dec 2019 12:56:16 -0800 3Date: Thu, 26 Dec 2019 12:56:16 -0800
4Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build 4Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build
@@ -10,7 +10,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
10 1 file changed, 1 insertion(+) 10 1 file changed, 1 insertion(+)
11 11
12diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake 12diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake
13index 8a6e880c4e2..259211df18e 100644 13index 01cd37124841..f50be9d967df 100644
14--- a/llvm/cmake/modules/CrossCompile.cmake 14--- a/llvm/cmake/modules/CrossCompile.cmake
15+++ b/llvm/cmake/modules/CrossCompile.cmake 15+++ b/llvm/cmake/modules/CrossCompile.cmake
16@@ -79,6 +79,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) 16@@ -79,6 +79,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
diff --git a/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch b/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch
deleted file mode 100644
index f5bc773..0000000
--- a/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From cfe4473e8447cd2c73a2f42c9c235ce1dfd08bec Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 11 Dec 2019 10:23:15 -0800
4Subject: [PATCH] libclang: Use CMAKE_DL_LIBS for deducing libdl
5
6This helps in getting right settings for libdl irrespective of platform
7it also fixes build with -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
8
9Fixes
10
11tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o: In function clang::CIndexer::getClangResourcesPath[abi:cxx11]()': 2019-12-06T06:04:39.2987601Z | CIndexer.cpp:(.text._ZN5clang8CIndexer21getClangResourcesPathB5cxx11Ev+0x8b): undefined reference to dladdr'
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 clang/tools/libclang/CMakeLists.txt | 5 ++---
16 1 file changed, 2 insertions(+), 3 deletions(-)
17
18diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
19index bd0c945a5e1..723fa95f14b 100644
20--- a/clang/tools/libclang/CMakeLists.txt
21+++ b/clang/tools/libclang/CMakeLists.txt
22@@ -60,9 +60,8 @@ if (TARGET clangTidyPlugin)
23 endif()
24 endif ()
25
26-find_library(DL_LIBRARY_PATH dl)
27-if (DL_LIBRARY_PATH)
28- list(APPEND LIBS dl)
29+if (HAVE_LIBDL)
30+ list(APPEND LIBS ${CMAKE_DL_LIBS})
31 endif()
32
33 option(LIBCLANG_BUILD_STATIC
diff --git a/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch
index 0885648..800b58e 100644
--- a/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
+++ b/recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch
@@ -1,4 +1,4 @@
1From dd6a749dee10f537fc7cb558ace319041a63e5f3 Mon Sep 17 00:00:00 2001 1From 761be2d8d20d9ebe93fa33719bdd0d25396d812d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 18 Nov 2019 17:00:29 -0800 3Date: Mon, 18 Nov 2019 17:00:29 -0800
4Subject: [PATCH] Check for atomic<double> intrinsics 4Subject: [PATCH] Check for atomic<double> intrinsics
@@ -15,16 +15,17 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 1 file changed, 2 insertions(+), 1 deletion(-) 15 1 file changed, 2 insertions(+), 1 deletion(-)
16 16
17diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake 17diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
18index 29f3bdd57f0..6460842cf63 100644 18index 04eed1448482..e890cfecd139 100644
19--- a/llvm/cmake/modules/CheckAtomic.cmake 19--- a/llvm/cmake/modules/CheckAtomic.cmake
20+++ b/llvm/cmake/modules/CheckAtomic.cmake 20+++ b/llvm/cmake/modules/CheckAtomic.cmake
21@@ -26,9 +26,10 @@ function(check_working_cxx_atomics64 varname) 21@@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname)
22 #include <atomic> 22 #include <atomic>
23 #include <cstdint> 23 #include <cstdint>
24 std::atomic<uint64_t> x (0); 24 std::atomic<uint64_t> x (0);
25+std::atomic<double> y (0); 25+std::atomic<double> y (0);
26 int main() { 26 int main() {
27 uint64_t i = x.load(std::memory_order_relaxed); 27 uint64_t i = x.load(std::memory_order_relaxed);
28 (void)i;
28- return 0; 29- return 0;
29+ return int(y); 30+ return int(y);
30 } 31 }
diff --git a/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch
index 39d500c..164503f 100644
--- a/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch
+++ b/recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch
@@ -1,4 +1,4 @@
1From b826518219333760c4632062dc586bbe17a055e6 Mon Sep 17 00:00:00 2001 1From d0f788c1fb3d00350c51e88302ecbcf3506e4b53 Mon Sep 17 00:00:00 2001
2From: Evangelos Foutras <evangelos@foutrelis.com> 2From: Evangelos Foutras <evangelos@foutrelis.com>
3Date: Thu, 26 Dec 2019 15:46:19 -0800 3Date: Thu, 26 Dec 2019 15:46:19 -0800
4Subject: [PATCH] clang: Enable SSP and PIE by default 4Subject: [PATCH] clang: Enable SSP and PIE by default
@@ -21,8 +21,8 @@ Taken from ArchLinux - https://git.archlinux.org/svntogit/packages.git/plain/tru
21 21
22Signed-off-by: Khem Raj <raj.khem@gmail.com> 22Signed-off-by: Khem Raj <raj.khem@gmail.com>
23--- 23---
24 clang/lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++-- 24 clang/lib/Driver/ToolChains/Linux.cpp | 10 ++++++++--
25 clang/lib/Driver/ToolChains/Linux.h | 1 + 25 clang/lib/Driver/ToolChains/Linux.h | 4 ++++
26 clang/test/Driver/cross-linux.c | 16 ++++++++-------- 26 clang/test/Driver/cross-linux.c | 16 ++++++++--------
27 clang/test/Driver/env.c | 2 +- 27 clang/test/Driver/env.c | 2 +-
28 clang/test/Driver/fsanitize.c | 14 +++++++------- 28 clang/test/Driver/fsanitize.c | 14 +++++++-------
@@ -34,13 +34,13 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
34 clang/test/Driver/riscv32-toolchain.c | 4 ++-- 34 clang/test/Driver/riscv32-toolchain.c | 4 ++--
35 clang/test/Driver/riscv64-toolchain.c | 4 ++-- 35 clang/test/Driver/riscv64-toolchain.c | 4 ++--
36 clang/test/Driver/stack-protector.c | 4 ++-- 36 clang/test/Driver/stack-protector.c | 4 ++--
37 13 files changed, 43 insertions(+), 30 deletions(-) 37 13 files changed, 42 insertions(+), 30 deletions(-)
38 38
39diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp 39diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
40index 0a4644dab9f..fb579e7ad60 100644 40index b64396647882..604024bb3df4 100644
41--- a/clang/lib/Driver/ToolChains/Linux.cpp 41--- a/clang/lib/Driver/ToolChains/Linux.cpp
42+++ b/clang/lib/Driver/ToolChains/Linux.cpp 42+++ b/clang/lib/Driver/ToolChains/Linux.cpp
43@@ -941,8 +941,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs, 43@@ -856,8 +856,14 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
44 } 44 }
45 45
46 bool Linux::isPIEDefault() const { 46 bool Linux::isPIEDefault() const {
@@ -54,27 +54,26 @@ index 0a4644dab9f..fb579e7ad60 100644
54+ getTriple().isMusl() || getSanitizerArgs().requiresPIE(); 54+ getTriple().isMusl() || getSanitizerArgs().requiresPIE();
55+ 55+
56+ return true; 56+ return true;
57+}
58+
59+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
60+ return 2;
61 } 57 }
62 58
63 bool Linux::isNoExecStackDefault() const { 59 bool Linux::isNoExecStackDefault() const {
64diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h 60diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
65index f5518eac218..2d4973cf40c 100644 61index 6b16b0e64990..582d4bef81df 100644
66--- a/clang/lib/Driver/ToolChains/Linux.h 62--- a/clang/lib/Driver/ToolChains/Linux.h
67+++ b/clang/lib/Driver/ToolChains/Linux.h 63+++ b/clang/lib/Driver/ToolChains/Linux.h
68@@ -37,6 +37,7 @@ public: 64@@ -39,6 +39,10 @@ public:
69 bool isPIEDefault() const override; 65 bool isPIEDefault() const override;
70 bool isNoExecStackDefault() const override; 66 bool isNoExecStackDefault() const override;
71 bool IsMathErrnoDefault() const override; 67 bool IsMathErrnoDefault() const override;
72+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; 68+ virtual LangOptions::StackProtectorMode
69+ GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
70+ return LangOptions::SSPStrong;
71+ }
73 SanitizerMask getSupportedSanitizers() const override; 72 SanitizerMask getSupportedSanitizers() const override;
74 void addProfileRTLibs(const llvm::opt::ArgList &Args, 73 void addProfileRTLibs(const llvm::opt::ArgList &Args,
75 llvm::opt::ArgStringList &CmdArgs) const override; 74 llvm::opt::ArgStringList &CmdArgs) const override;
76diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c 75diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c
77index 6c2dab26069..c28c5653e34 100644 76index 6c2dab260695..c28c5653e348 100644
78--- a/clang/test/Driver/cross-linux.c 77--- a/clang/test/Driver/cross-linux.c
79+++ b/clang/test/Driver/cross-linux.c 78+++ b/clang/test/Driver/cross-linux.c
80@@ -42,8 +42,8 @@ 79@@ -42,8 +42,8 @@
@@ -122,7 +121,7 @@ index 6c2dab26069..c28c5653e34 100644
122 // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" 121 // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
123 // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib" 122 // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib"
124diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c 123diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c
125index 0371bc91c4a..ea89f525121 100644 124index 0371bc91c4a3..ea89f5251217 100644
126--- a/clang/test/Driver/env.c 125--- a/clang/test/Driver/env.c
127+++ b/clang/test/Driver/env.c 126+++ b/clang/test/Driver/env.c
128@@ -20,7 +20,7 @@ 127@@ -20,7 +20,7 @@
@@ -135,10 +134,10 @@ index 0371bc91c4a..ea89f525121 100644
135 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib" 134 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
136 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.." 135 // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
137diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c 136diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
138index f02f94d8c5a..358917588c7 100644 137index 8926d55a0cf4..40f628ccae45 100644
139--- a/clang/test/Driver/fsanitize.c 138--- a/clang/test/Driver/fsanitize.c
140+++ b/clang/test/Driver/fsanitize.c 139+++ b/clang/test/Driver/fsanitize.c
141@@ -328,15 +328,15 @@ 140@@ -330,15 +330,15 @@
142 // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 141 // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1
143 // OK 142 // OK
144 143
@@ -158,7 +157,7 @@ index f02f94d8c5a..358917588c7 100644
158 157
159 // CHECK-NO-PIE-NOT: "-pie" 158 // CHECK-NO-PIE-NOT: "-pie"
160 // CHECK-NO-PIE: "-mrelocation-model" "static" 159 // CHECK-NO-PIE: "-mrelocation-model" "static"
161@@ -661,12 +661,12 @@ 160@@ -667,12 +667,12 @@
162 // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP 161 // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
163 // NOSP-NOT: "-fsanitize=safe-stack" 162 // NOSP-NOT: "-fsanitize=safe-stack"
164 163
@@ -175,7 +174,7 @@ index f02f94d8c5a..358917588c7 100644
175 // NO-SP-NOT: stack-protector 174 // NO-SP-NOT: stack-protector
176 // NO-SP: "-fsanitize=safe-stack" 175 // NO-SP: "-fsanitize=safe-stack"
177diff --git a/clang/test/Driver/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp 176diff --git a/clang/test/Driver/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp
178index 6c872f4255c..f5006d1dd9a 100644 177index 6c872f4255c3..f5006d1dd9ab 100644
179--- a/clang/test/Driver/gcc-toolchain.cpp 178--- a/clang/test/Driver/gcc-toolchain.cpp
180+++ b/clang/test/Driver/gcc-toolchain.cpp 179+++ b/clang/test/Driver/gcc-toolchain.cpp
181@@ -26,6 +26,6 @@ 180@@ -26,6 +26,6 @@
@@ -187,10 +186,10 @@ index 6c872f4255c..f5006d1dd9a 100644
187 // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5" 186 // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
188 // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.." 187 // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
189diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c 188diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c
190index 44bff6f703a..6575d032f5d 100644 189index cc11f9fcba9e..1fe8b5db587b 100644
191--- a/clang/test/Driver/hexagon-toolchain-elf.c 190--- a/clang/test/Driver/hexagon-toolchain-elf.c
192+++ b/clang/test/Driver/hexagon-toolchain-elf.c 191+++ b/clang/test/Driver/hexagon-toolchain-elf.c
193@@ -470,7 +470,7 @@ 192@@ -487,7 +487,7 @@
194 // RUN: %s 2>&1 \ 193 // RUN: %s 2>&1 \
195 // RUN: | FileCheck -check-prefix=CHECK042 %s 194 // RUN: | FileCheck -check-prefix=CHECK042 %s
196 // CHECK042: "-cc1" 195 // CHECK042: "-cc1"
@@ -200,7 +199,7 @@ index 44bff6f703a..6575d032f5d 100644
200 // CHECK042-NEXT: llvm-mc 199 // CHECK042-NEXT: llvm-mc
201 // CHECK042: "-gpsize=8" 200 // CHECK042: "-gpsize=8"
202diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c 201diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
203index 77ac05f3094..cb474f32898 100644 202index 0959bd7ba0a1..4056a672b6f9 100644
204--- a/clang/test/Driver/linux-as.c 203--- a/clang/test/Driver/linux-as.c
205+++ b/clang/test/Driver/linux-as.c 204+++ b/clang/test/Driver/linux-as.c
206@@ -164,7 +164,7 @@ 205@@ -164,7 +164,7 @@
@@ -222,7 +221,7 @@ index 77ac05f3094..cb474f32898 100644
222 // CHECK-SPARCV9PIC: as 221 // CHECK-SPARCV9PIC: as
223 // CHECK-SPARCV9PIC: -64 222 // CHECK-SPARCV9PIC: -64
224diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c 223diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
225index 51227550b52..d01d6627131 100644 224index 24d3c78643f8..9ea22e6e0f64 100644
226--- a/clang/test/Driver/linux-ld.c 225--- a/clang/test/Driver/linux-ld.c
227+++ b/clang/test/Driver/linux-ld.c 226+++ b/clang/test/Driver/linux-ld.c
228@@ -1,3 +1,5 @@ 227@@ -1,3 +1,5 @@
@@ -232,28 +231,26 @@ index 51227550b52..d01d6627131 100644
232 // sysroot to make these tests independent of the host system. 231 // sysroot to make these tests independent of the host system.
233 // 232 //
234diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c 233diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
235index acc4981a2ee..0d465516762 100644 234index a74a19953ca2..0ba4a14ab74f 100644
236--- a/clang/test/Driver/ppc-abi.c 235--- a/clang/test/Driver/ppc-abi.c
237+++ b/clang/test/Driver/ppc-abi.c 236+++ b/clang/test/Driver/ppc-abi.c
238@@ -32,11 +32,11 @@ 237@@ -26,9 +26,9 @@
239 238
240 // CHECK-ELFv1: "-mrelocation-model" "static" 239 // CHECK-ELFv1: "-mrelocation-model" "static"
241 // CHECK-ELFv1: "-target-abi" "elfv1" 240 // CHECK-ELFv1: "-target-abi" "elfv1"
242-// CHECK-ELFv1-LE: "-mrelocation-model" "static" 241-// CHECK-ELFv1-LE: "-mrelocation-model" "static"
243+// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2" 242+// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
244 // CHECK-ELFv1-LE: "-target-abi" "elfv1" 243 // CHECK-ELFv1-LE: "-target-abi" "elfv1"
245 // CHECK-ELFv1-QPX: "-mrelocation-model" "static"
246 // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
247-// CHECK-ELFv2: "-mrelocation-model" "static" 244-// CHECK-ELFv2: "-mrelocation-model" "static"
248+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2" 245+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
249 // CHECK-ELFv2: "-target-abi" "elfv2" 246 // CHECK-ELFv2: "-target-abi" "elfv2"
250 // CHECK-ELFv2-BE: "-mrelocation-model" "static" 247 // CHECK-ELFv2-BE: "-mrelocation-model" "static"
251 // CHECK-ELFv2-BE: "-target-abi" "elfv2" 248 // CHECK-ELFv2-BE: "-target-abi" "elfv2"
252diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c 249diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c
253index 2ff3a585bda..f923b728c0f 100644 250index a5852f5f3997..233d9ef003cf 100644
254--- a/clang/test/Driver/riscv32-toolchain.c 251--- a/clang/test/Driver/riscv32-toolchain.c
255+++ b/clang/test/Driver/riscv32-toolchain.c 252+++ b/clang/test/Driver/riscv32-toolchain.c
256@@ -76,7 +76,7 @@ 253@@ -84,7 +84,7 @@
257 // C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" 254 // C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
258 // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv" 255 // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv"
259 // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1" 256 // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1"
@@ -262,7 +259,7 @@ index 2ff3a585bda..f923b728c0f 100644
262 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32" 259 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32"
263 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32" 260 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32"
264 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32" 261 // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
265@@ -91,7 +91,7 @@ 262@@ -99,7 +99,7 @@
266 // C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" 263 // C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
267 // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv" 264 // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv"
268 // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1" 265 // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1"
@@ -272,10 +269,10 @@ index 2ff3a585bda..f923b728c0f 100644
272 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d" 269 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
273 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d" 270 // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
274diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c 271diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c
275index 42cac51de59..42a05e02fcc 100644 272index e727f20bb601..a801e5eee462 100644
276--- a/clang/test/Driver/riscv64-toolchain.c 273--- a/clang/test/Driver/riscv64-toolchain.c
277+++ b/clang/test/Driver/riscv64-toolchain.c 274+++ b/clang/test/Driver/riscv64-toolchain.c
278@@ -76,7 +76,7 @@ 275@@ -84,7 +84,7 @@
279 // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" 276 // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
280 // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv" 277 // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv"
281 // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1" 278 // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1"
@@ -284,7 +281,7 @@ index 42cac51de59..42a05e02fcc 100644
284 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64" 281 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64"
285 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64" 282 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64"
286 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64" 283 // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
287@@ -91,7 +91,7 @@ 284@@ -99,7 +99,7 @@
288 // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" 285 // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
289 // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv" 286 // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv"
290 // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1" 287 // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1"
@@ -294,7 +291,7 @@ index 42cac51de59..42a05e02fcc 100644
294 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d" 291 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d"
295 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d" 292 // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d"
296diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c 293diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c
297index a3e40b50eed..dfffe0d6cf8 100644 294index a3e40b50eed8..dfffe0d6cf85 100644
298--- a/clang/test/Driver/stack-protector.c 295--- a/clang/test/Driver/stack-protector.c
299+++ b/clang/test/Driver/stack-protector.c 296+++ b/clang/test/Driver/stack-protector.c
300@@ -3,11 +3,11 @@ 297@@ -3,11 +3,11 @@
diff --git a/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
index ab406d0..1500fc9 100644
--- a/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
+++ b/recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
@@ -1,4 +1,4 @@
1From 6330360e13936fca5625e39ceed7441b45c3efd3 Mon Sep 17 00:00:00 2001 1From 5c0a4264ad87c880ade430022e0f128da86bbf6d Mon Sep 17 00:00:00 2001
2From: Jeremy Puhlman <jpuhlman@mvista.com> 2From: Jeremy Puhlman <jpuhlman@mvista.com>
3Date: Thu, 16 Jan 2020 21:16:10 +0000 3Date: Thu, 16 Jan 2020 21:16:10 +0000
4Subject: [PATCH] libcxx: Add compiler runtime library to link step for libcxx 4Subject: [PATCH] libcxx: Add compiler runtime library to link step for libcxx
@@ -14,24 +14,24 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 1 file changed, 2 insertions(+), 2 deletions(-) 14 1 file changed, 2 insertions(+), 2 deletions(-)
15 15
16diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt 16diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
17index 120505fe18d..b337fa2e403 100644 17index 9965104cb5b2..bee4d80bc67a 100644
18--- a/libcxx/src/CMakeLists.txt 18--- a/libcxx/src/CMakeLists.txt
19+++ b/libcxx/src/CMakeLists.txt 19+++ b/libcxx/src/CMakeLists.txt
20@@ -160,7 +160,7 @@ if (LIBCXX_ENABLE_SHARED) 20@@ -177,7 +177,7 @@ split_list(LIBCXX_LINK_FLAGS)
21 if(COMMAND llvm_setup_rpath) 21 if (LIBCXX_ENABLE_SHARED)
22 llvm_setup_rpath(cxx_shared) 22 add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
23 endif() 23 target_link_libraries(cxx_shared PUBLIC cxx-headers
24- target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES}) 24- PRIVATE ${LIBCXX_LIBRARIES})
25+ target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") 25+ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)")
26 set_target_properties(cxx_shared 26 set_target_properties(cxx_shared
27 PROPERTIES 27 PROPERTIES
28 COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" 28 COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
29@@ -238,7 +238,7 @@ endif() 29@@ -252,7 +252,7 @@ endif()
30 # Build the static library.
31 if (LIBCXX_ENABLE_STATIC) 30 if (LIBCXX_ENABLE_STATIC)
32 add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) 31 add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
33- target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES}) 32 target_link_libraries(cxx_static PUBLIC cxx-headers
34+ target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") 33- PRIVATE ${LIBCXX_LIBRARIES})
34+ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)")
35 set(CMAKE_STATIC_LIBRARY_PREFIX "lib") 35 set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
36 set_target_properties(cxx_static 36 set_target_properties(cxx_static
37 PROPERTIES 37 PROPERTIES
diff --git a/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
index 5413693..a9cd7a7 100644
--- a/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
+++ b/recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
@@ -1,4 +1,4 @@
1From 9f5949b795a92f85c98277fd8d72954fb52df164 Mon Sep 17 00:00:00 2001 1From 12fe6e45d18add7da95fe637f9e21425330666f9 Mon Sep 17 00:00:00 2001
2From: Ovidiu Panait <ovidiu.panait@windriver.com> 2From: Ovidiu Panait <ovidiu.panait@windriver.com>
3Date: Fri, 31 Jan 2020 10:56:11 +0200 3Date: Fri, 31 Jan 2020 10:56:11 +0200
4Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using 4Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using
@@ -32,10 +32,10 @@ Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
32 3 files changed, 33 deletions(-) 32 3 files changed, 33 deletions(-)
33 33
34diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake 34diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
35index 577cc11ab01..5c859d86069 100644 35index 704278a0e93b..6ea99c90772c 100644
36--- a/clang/cmake/modules/AddClang.cmake 36--- a/clang/cmake/modules/AddClang.cmake
37+++ b/clang/cmake/modules/AddClang.cmake 37+++ b/clang/cmake/modules/AddClang.cmake
38@@ -151,15 +151,8 @@ macro(add_clang_tool name) 38@@ -161,15 +161,8 @@ macro(add_clang_tool name)
39 add_dependencies(${name} clang-resource-headers) 39 add_dependencies(${name} clang-resource-headers)
40 40
41 if (CLANG_BUILD_TOOLS) 41 if (CLANG_BUILD_TOOLS)
@@ -51,7 +51,7 @@ index 577cc11ab01..5c859d86069 100644
51 RUNTIME DESTINATION bin 51 RUNTIME DESTINATION bin
52 COMPONENT ${name}) 52 COMPONENT ${name})
53 53
54@@ -168,7 +161,6 @@ macro(add_clang_tool name) 54@@ -178,7 +171,6 @@ macro(add_clang_tool name)
55 DEPENDS ${name} 55 DEPENDS ${name}
56 COMPONENT ${name}) 56 COMPONENT ${name})
57 endif() 57 endif()
@@ -60,10 +60,10 @@ index 577cc11ab01..5c859d86069 100644
60 endmacro() 60 endmacro()
61 61
62diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake 62diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
63index fd69786544a..70580ccb129 100644 63index 97c9980c7de3..2cb2ead31ba0 100644
64--- a/llvm/cmake/modules/AddLLVM.cmake 64--- a/llvm/cmake/modules/AddLLVM.cmake
65+++ b/llvm/cmake/modules/AddLLVM.cmake 65+++ b/llvm/cmake/modules/AddLLVM.cmake
66@@ -1045,15 +1045,8 @@ macro(add_llvm_tool name) 66@@ -1210,15 +1210,8 @@ macro(add_llvm_tool name)
67 67
68 if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 68 if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
69 if( LLVM_BUILD_TOOLS ) 69 if( LLVM_BUILD_TOOLS )
@@ -79,7 +79,7 @@ index fd69786544a..70580ccb129 100644
79 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} 79 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
80 COMPONENT ${name}) 80 COMPONENT ${name})
81 81
82@@ -1064,9 +1057,6 @@ macro(add_llvm_tool name) 82@@ -1229,9 +1222,6 @@ macro(add_llvm_tool name)
83 endif() 83 endif()
84 endif() 84 endif()
85 endif() 85 endif()
@@ -89,9 +89,9 @@ index fd69786544a..70580ccb129 100644
89 set_target_properties(${name} PROPERTIES FOLDER "Tools") 89 set_target_properties(${name} PROPERTIES FOLDER "Tools")
90 endmacro(add_llvm_tool name) 90 endmacro(add_llvm_tool name)
91 91
92@@ -1104,15 +1094,8 @@ macro(add_llvm_utility name) 92@@ -1269,15 +1259,8 @@ macro(add_llvm_utility name)
93 set_target_properties(${name} PROPERTIES FOLDER "Utils") 93 set_target_properties(${name} PROPERTIES FOLDER "Utils")
94 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 94 if ( ${name} IN_LIST LLVM_TOOLCHAIN_UTILITIES OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
95 if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) 95 if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
96- set(export_to_llvmexports) 96- set(export_to_llvmexports)
97- if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR 97- if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
@@ -105,7 +105,7 @@ index fd69786544a..70580ccb129 100644
105 RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR} 105 RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
106 COMPONENT ${name}) 106 COMPONENT ${name})
107 107
108@@ -1121,7 +1104,6 @@ macro(add_llvm_utility name) 108@@ -1286,7 +1269,6 @@ macro(add_llvm_utility name)
109 DEPENDS ${name} 109 DEPENDS ${name}
110 COMPONENT ${name}) 110 COMPONENT ${name})
111 endif() 111 endif()
@@ -114,10 +114,10 @@ index fd69786544a..70580ccb129 100644
114 set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name}) 114 set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
115 endif() 115 endif()
116diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake 116diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
117index 9d2fcd9a793..acdb898149d 100644 117index 5f07acc1f692..47fe887e083b 100644
118--- a/llvm/cmake/modules/TableGen.cmake 118--- a/llvm/cmake/modules/TableGen.cmake
119+++ b/llvm/cmake/modules/TableGen.cmake 119+++ b/llvm/cmake/modules/TableGen.cmake
120@@ -161,14 +161,8 @@ macro(add_tablegen target project) 120@@ -177,14 +177,8 @@ macro(add_tablegen target project)
121 endif() 121 endif()
122 122
123 if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) 123 if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
@@ -132,7 +132,7 @@ index 9d2fcd9a793..acdb898149d 100644
132 COMPONENT ${target} 132 COMPONENT ${target}
133 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}) 133 RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
134 if(NOT LLVM_ENABLE_IDE) 134 if(NOT LLVM_ENABLE_IDE)
135@@ -177,5 +171,4 @@ macro(add_tablegen target project) 135@@ -193,5 +187,4 @@ macro(add_tablegen target project)
136 COMPONENT ${target}) 136 COMPONENT ${target})
137 endif() 137 endif()
138 endif() 138 endif()
diff --git a/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch
index decab68..da4e3fe 100644
--- a/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
+++ b/recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch
@@ -1,4 +1,4 @@
1From ed3b5d8bb197f01556b42dfc2281693475fd830e Mon Sep 17 00:00:00 2001 1From 6ad331a0e464ee28eac7d0a1c658cd007e831297 Mon Sep 17 00:00:00 2001
2From: Jim Broadus <jbroadus@xevo.com> 2From: Jim Broadus <jbroadus@xevo.com>
3Date: Thu, 26 Mar 2020 16:05:53 -0700 3Date: Thu, 26 Mar 2020 16:05:53 -0700
4Subject: [PATCH] clang: Fix resource dir location for cross toolchains 4Subject: [PATCH] clang: Fix resource dir location for cross toolchains
@@ -13,29 +13,27 @@ As a fix for this, check the parent directory name. If that is "bin", then
13use that directory's parent. 13use that directory's parent.
14 14
15Signed-off-by: Jim Broadus <jbroadus@xevo.com> 15Signed-off-by: Jim Broadus <jbroadus@xevo.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
16--- 17---
17 clang/lib/Driver/Driver.cpp | 8 +++++++- 18 clang/lib/Driver/Driver.cpp | 8 +++++++-
18 1 file changed, 7 insertions(+), 1 deletion(-) 19 1 file changed, 7 insertions(+), 1 deletion(-)
19 20
20diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp 21diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
21index fb8335a3695..819887944b5 100644 22index 418e1d3e8ec9..44c9f6e59d3f 100644
22--- a/clang/lib/Driver/Driver.cpp 23--- a/clang/lib/Driver/Driver.cpp
23+++ b/clang/lib/Driver/Driver.cpp 24+++ b/clang/lib/Driver/Driver.cpp
24@@ -110,7 +110,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath, 25@@ -119,7 +119,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
25 // With a static-library build of libclang, LibClangPath will contain the 26 // With a static-library build of libclang, LibClangPath will contain the
26 // path of the embedding binary, which for LLVM binaries will be in bin/. 27 // path of the embedding binary, which for LLVM binaries will be in bin/.
27 // ../lib gets us to lib/ in both cases. 28 // ../lib gets us to lib/ in both cases.
28- P = llvm::sys::path::parent_path(Dir); 29- P = llvm::sys::path::parent_path(Dir);
29+ Dir = llvm::sys::path::parent_path(Dir); 30+ Dir = std::string(llvm::sys::path::parent_path(Dir));
30+ 31+
31+ // OE cross toolchains are installed, by default, in a subdir of bin. 32+ // OE cross toolchains are installed, by default, in a subdir of bin.
32+ if (llvm::sys::path::filename(Dir) == "bin") { 33+ if (llvm::sys::path::filename(Dir) == "bin") {
33+ Dir = llvm::sys::path::parent_path(Dir); 34+ Dir = std::string(llvm::sys::path::parent_path(Dir));
34+ } 35+ }
35+ P = Dir; 36+ P = Dir;
36 llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang", 37 llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
37 CLANG_VERSION_STRING); 38 CLANG_VERSION_STRING);
38 } 39 }
39--
402.24.1
41
diff --git a/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch b/recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch
index 2890228..e22c0bd 100644
--- a/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch
+++ b/recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch
@@ -1,4 +1,4 @@
1From 52b4e74809eba796663f0f65194ab4f3eafe2cb1 Mon Sep 17 00:00:00 2001 1From cbcfe7d13dfc5644c9b8a48e951b43bc15d9f4cf Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com> 2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Fri, 3 Apr 2020 15:10:37 +0800 3Date: Fri, 3 Apr 2020 15:10:37 +0800
4Subject: [PATCH] fix path to libffi 4Subject: [PATCH] fix path to libffi
@@ -8,21 +8,19 @@ libLLVMInterpreter, we were looking for libffi in clang's recipe-sysroot instead
8the recipe's sysroot. 8the recipe's sysroot.
9 9
10Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> 10Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
11--- 12---
12 llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +- 13 llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-) 14 1 file changed, 1 insertion(+), 1 deletion(-)
14 15
15diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt 16diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
16index b8adea5..7d8434c 100644 17index 976219830d5e..9930e01559e9 100644
17--- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt 18--- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
18+++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt 19+++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
19@@ -16,5 +16,5 @@ add_llvm_component_library(LLVMInterpreter 20@@ -22,5 +22,5 @@ add_llvm_component_library(LLVMInterpreter
20 ) 21 )
21 22
22 if( LLVM_ENABLE_FFI ) 23 if( LLVM_ENABLE_FFI )
23- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} ) 24- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} )
24+ target_link_libraries( LLVMInterpreter PRIVATE ffi ) 25+ target_link_libraries( LLVMInterpreter PRIVATE ffi )
25 endif() 26 endif()
26--
272.7.4
28
diff --git a/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
index 43161c7..521f06d 100644
--- a/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
+++ b/recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
@@ -1,4 +1,4 @@
1From fcafd24f9062eeecc9c87ac2fe9bce9accbe7534 Mon Sep 17 00:00:00 2001 1From 5f3d1b71c3e87017dfa471f1561f6c28f34a77f8 Mon Sep 17 00:00:00 2001
2From: Oleksandr Ocheretnyi <oocheret@cisco.com> 2From: Oleksandr Ocheretnyi <oocheret@cisco.com>
3Date: Wed, 15 Apr 2020 00:08:39 +0300 3Date: Wed, 15 Apr 2020 00:08:39 +0300
4Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso 4Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso
@@ -12,15 +12,16 @@ Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso
12 the usrmerge scenario. 12 the usrmerge scenario.
13 13
14Signed-off-by: Oleksandr Ocheretnyi <oocheret@cisco.com> 14Signed-off-by: Oleksandr Ocheretnyi <oocheret@cisco.com>
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
15--- 16---
16 clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++-------- 17 clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++--------
17 1 file changed, 8 insertions(+), 8 deletions(-) 18 1 file changed, 8 insertions(+), 8 deletions(-)
18 19
19diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp 20diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
20index fb579e7ad60..4ed5938cc59 100644 21index 604024bb3df4..812599cdaf84 100644
21--- a/clang/lib/Driver/ToolChains/Linux.cpp 22--- a/clang/lib/Driver/ToolChains/Linux.cpp
22+++ b/clang/lib/Driver/ToolChains/Linux.cpp 23+++ b/clang/lib/Driver/ToolChains/Linux.cpp
23@@ -604,8 +604,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 24@@ -515,8 +515,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
24 LibDir = "lib64"; 25 LibDir = "lib64";
25 Loader = 26 Loader =
26 (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; 27 (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
@@ -31,7 +32,7 @@ index fb579e7ad60..4ed5938cc59 100644
31 LibDir = "lib"; 32 LibDir = "lib";
32 } 33 }
33 break; 34 break;
34@@ -613,8 +613,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 35@@ -524,8 +524,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
35 LibDir = "lib64"; 36 LibDir = "lib64";
36 Loader = 37 Loader =
37 (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; 38 (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
@@ -42,7 +43,7 @@ index fb579e7ad60..4ed5938cc59 100644
42 LibDir = "lib"; 43 LibDir = "lib";
43 } 44 }
44 break; 45 break;
45@@ -638,8 +638,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 46@@ -549,8 +549,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
46 case llvm::Triple::sparcv9: 47 case llvm::Triple::sparcv9:
47 LibDir = "lib64"; 48 LibDir = "lib64";
48 Loader = "ld-linux.so.2"; 49 Loader = "ld-linux.so.2";
@@ -53,7 +54,7 @@ index fb579e7ad60..4ed5938cc59 100644
53 LibDir = "lib"; 54 LibDir = "lib";
54 } 55 }
55 break; 56 break;
56@@ -656,8 +656,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { 57@@ -567,8 +567,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
57 58
58 LibDir = X32 ? "libx32" : "lib64"; 59 LibDir = X32 ? "libx32" : "lib64";
59 Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; 60 Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
@@ -64,6 +65,3 @@ index fb579e7ad60..4ed5938cc59 100644
64 LibDir = "lib"; 65 LibDir = "lib";
65 } 66 }
66 break; 67 break;
67--
682.17.1
69
diff --git a/recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch b/recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch
new file mode 100644
index 0000000..defbc8d
--- /dev/null
+++ b/recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch
@@ -0,0 +1,112 @@
1From fd3696213eed77e8c217be0ded0e220c0b597f1e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 14 Oct 2020 22:19:57 -0700
4Subject: [PATCH] clang: Use python3 in python scripts
5
6Some scripts ask for python, but they work fine with python3
7and in OE python symlink is not exposed to build, only python3 is
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 .../find-all-symbols/tool/run-find-all-symbols.py | 2 +-
13 clang-tools-extra/clang-tidy/add_new_check.py | 2 +-
14 clang-tools-extra/clang-tidy/rename_check.py | 2 +-
15 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py | 2 +-
16 clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | 2 +-
17 clang/tools/clang-format/clang-format-diff.py | 2 +-
18 clang/tools/clang-format/git-clang-format | 2 +-
19 clang/tools/scan-view/bin/scan-view | 2 +-
20 clang/utils/hmaptool/hmaptool | 2 +-
21 9 files changed, 9 insertions(+), 9 deletions(-)
22
23diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
24index 8655af137bb2..e95ba59a421c 100755
25--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
26+++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
27@@ -1,4 +1,4 @@
28-#!/usr/bin/env python
29+#!/usr/bin/env python3
30 #
31 #=- run-find-all-symbols.py - Parallel find-all-symbols runner -*- python -*-=#
32 #
33diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py
34index 14fcfe8d49ff..ee7e682690b7 100755
35--- a/clang-tools-extra/clang-tidy/add_new_check.py
36+++ b/clang-tools-extra/clang-tidy/add_new_check.py
37@@ -1,4 +1,4 @@
38-#!/usr/bin/env python
39+#!/usr/bin/env python3
40 #
41 #===- add_new_check.py - clang-tidy check generator ---------*- python -*--===#
42 #
43diff --git a/clang-tools-extra/clang-tidy/rename_check.py b/clang-tools-extra/clang-tidy/rename_check.py
44index 2410041fd5d2..976a02100cd6 100755
45--- a/clang-tools-extra/clang-tidy/rename_check.py
46+++ b/clang-tools-extra/clang-tidy/rename_check.py
47@@ -1,4 +1,4 @@
48-#!/usr/bin/env python
49+#!/usr/bin/env python3
50 #
51 #===- rename_check.py - clang-tidy check renamer ------------*- python -*--===#
52 #
53diff --git a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
54index 17086d15053e..a20b1f1f46b2 100755
55--- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
56+++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
57@@ -1,4 +1,4 @@
58-#!/usr/bin/env python
59+#!/usr/bin/env python3
60 #
61 #===- clang-tidy-diff.py - ClangTidy Diff Checker -----------*- python -*--===#
62 #
63diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
64index 313ecd2f9571..a298e38b1a45 100755
65--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
66+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
67@@ -1,4 +1,4 @@
68-#!/usr/bin/env python
69+#!/usr/bin/env python3
70 #
71 #===- run-clang-tidy.py - Parallel clang-tidy runner --------*- python -*--===#
72 #
73diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
74index 6e653a134289..1c31192a4562 100755
75--- a/clang/tools/clang-format/clang-format-diff.py
76+++ b/clang/tools/clang-format/clang-format-diff.py
77@@ -1,4 +1,4 @@
78-#!/usr/bin/env python
79+#!/usr/bin/env python3
80 #
81 #===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
82 #
83diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
84index ccd2f50fa4ad..cfcfb9fcbaef 100755
85--- a/clang/tools/clang-format/git-clang-format
86+++ b/clang/tools/clang-format/git-clang-format
87@@ -1,4 +1,4 @@
88-#!/usr/bin/env python
89+#!/usr/bin/env python3
90 #
91 #===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===#
92 #
93diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view
94index 04ad518a60cd..07effbca5969 100755
95--- a/clang/tools/scan-view/bin/scan-view
96+++ b/clang/tools/scan-view/bin/scan-view
97@@ -1,4 +1,4 @@
98-#!/usr/bin/env python2
99+#!/usr/bin/env python3
100
101 from __future__ import print_function
102
103diff --git a/clang/utils/hmaptool/hmaptool b/clang/utils/hmaptool/hmaptool
104index e647cde6bc46..7ed2fdf674b1 100755
105--- a/clang/utils/hmaptool/hmaptool
106+++ b/clang/utils/hmaptool/hmaptool
107@@ -1,4 +1,4 @@
108-#!/usr/bin/env python
109+#!/usr/bin/env python3
110 from __future__ import absolute_import, division, print_function
111
112 import json
diff --git a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
new file mode 100644
index 0000000..801696e
--- /dev/null
+++ b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
@@ -0,0 +1,70 @@
1From 13dedb0bbf780f7d66ddad8b1b33b3a1e0de2d25 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Mon, 25 Jan 2021 16:14:35 +0800
4Subject: [PATCH] For x86_64, set Yocto based GCC install search path
5
6Under Yocto host, while using clang-native to build, it searches
7install host gcc failed which causing the include file not found
8[snip]
9|clang++ -target x86_64-linux -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \
10-isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \
11-std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o
12|../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found
13|#include <iterator>
14| ^~~~~~~~
15[snip]
16
17Set three Yocto based GCC triple: poky, oe-core and wind river
18
19Before aplly the patch
20[snip]
21$ ../recipe-sysroot-native/usr/bin/clang++ -v
22clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91)
23Target: x86_64-unknown-linux-gnu
24Thread model: posix
25InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
26[snip]
27
28After aplly the patch:
29[snip]
30$ ../recipe-sysroot-native/usr/bin/clang++ -v
31clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64)
32Target: x86_64-unknown-linux-gnu
33Thread model: posix
34InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
35Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
36Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0
37Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
38Candidate multilib: .;@m64
39Selected multilib: .;@m64
40[snip]
41
42BTW, it is hardly to insert a triple by the replacement of TARGET_SYS
43(=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR
44is different between clang and clang-native
45
46The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of
47additional triples based on CLANG_EXTRA_OE_VENDORS variable in
48recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors()
49
50Upstream-Status: Inappropriate [oe specific]
51
52Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
53Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
54Signed-off-by: Khem Raj <raj.khem@gmail.com>
55---
56 clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
57 1 file changed, 1 insertion(+)
58
59diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
60index 05d1d3003881..33b1d7fb7061 100644
61--- a/clang/lib/Driver/ToolChains/Gnu.cpp
62+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
63@@ -2109,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
64 "x86_64-redhat-linux", "x86_64-suse-linux",
65 "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
66 "x86_64-slackware-linux", "x86_64-unknown-linux",
67+ "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES
68 "x86_64-amazon-linux", "x86_64-linux-android"};
69 static const char *const X32LibDirs[] = {"/libx32"};
70 static const char *const X86LibDirs[] = {"/lib32", "/lib"};
diff --git a/recipes-devtools/clang/clang/0026-OpenCL-Fix-support-for-cl_khr_mipmap_image_writes.patch b/recipes-devtools/clang/clang/0026-OpenCL-Fix-support-for-cl_khr_mipmap_image_writes.patch
deleted file mode 100644
index a8798fb..0000000
--- a/recipes-devtools/clang/clang/0026-OpenCL-Fix-support-for-cl_khr_mipmap_image_writes.patch
+++ /dev/null
@@ -1,114 +0,0 @@
1From 4770490fa38a03624376b3c3973705a4bf8cc193 Mon Sep 17 00:00:00 2001
2From: Alexey Sotkin <alexey.sotkin@intel.com>
3Date: Mon, 27 Jan 2020 12:25:03 +0300
4Subject: [PATCH] [OpenCL] Fix support for cl_khr_mipmap_image_writes
5
6Text of the extension is available here:
7https://github.com/KhronosGroup/OpenCL-Docs/blob/master/ext/cl_khr_mipmap_image.asciidoc
8
9Patch by Ilya Mashkov
10
11Differential Revision: https://reviews.llvm.org/D71460
12
13Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/f780e15caf1bed0a9fbc87fde70bd5ab3d80a439]
14
15Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
16---
17 clang/include/clang/Basic/OpenCLExtensions.def | 1 +
18 clang/lib/Headers/opencl-c.h | 18 ++++++++++--------
19 clang/test/SemaOpenCL/extension-version.cl | 12 ++++++++++++
20 3 files changed, 23 insertions(+), 8 deletions(-)
21
22diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
23index 5536a6e8e4d..51748158431 100644
24--- a/clang/include/clang/Basic/OpenCLExtensions.def
25+++ b/clang/include/clang/Basic/OpenCLExtensions.def
26@@ -70,6 +70,7 @@ OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
27 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
28 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
29 OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U)
30+OPENCLEXT_INTERNAL(cl_khr_mipmap_image_writes, 200, ~0U)
31 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
32 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
33 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
34diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
35index 06c5ab6a72f..3210f93cc85 100644
36--- a/clang/lib/Headers/opencl-c.h
37+++ b/clang/lib/Headers/opencl-c.h
38@@ -14682,7 +14682,7 @@ void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, flo
39
40 // OpenCL Extension v2.0 s9.18 - Mipmaps
41 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
42-#ifdef cl_khr_mipmap_image
43+#if defined(cl_khr_mipmap_image_writes)
44 void __ovld write_imagef(write_only image1d_t image, int coord, int lod, float4 color);
45 void __ovld write_imagei(write_only image1d_t image, int coord, int lod, int4 color);
46 void __ovld write_imageui(write_only image1d_t image, int coord, int lod, uint4 color);
47@@ -14699,15 +14699,16 @@ void __ovld write_imagef(write_only image2d_array_t image_array, int4 coord, int
48 void __ovld write_imagei(write_only image2d_array_t image_array, int4 coord, int lod, int4 color);
49 void __ovld write_imageui(write_only image2d_array_t image_array, int4 coord, int lod, uint4 color);
50
51-void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float color);
52-void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float color);
53+void __ovld write_imagef(write_only image2d_depth_t image, int2 coord, int lod, float depth);
54+void __ovld write_imagef(write_only image2d_array_depth_t image, int4 coord, int lod, float depth);
55
56 #ifdef cl_khr_3d_image_writes
57 void __ovld write_imagef(write_only image3d_t image, int4 coord, int lod, float4 color);
58 void __ovld write_imagei(write_only image3d_t image, int4 coord, int lod, int4 color);
59 void __ovld write_imageui(write_only image3d_t image, int4 coord, int lod, uint4 color);
60-#endif
61-#endif //cl_khr_mipmap_image
62+#endif //cl_khr_3d_image_writes
63+
64+#endif //defined(cl_khr_mipmap_image_writes)
65 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
66
67 // Image write functions for half4 type
68@@ -14756,7 +14757,7 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, flo
69 #endif //cl_khr_depth_images
70
71 #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
72-#ifdef cl_khr_mipmap_image
73+#if defined(cl_khr_mipmap_image_writes)
74 void __ovld write_imagef(read_write image1d_t image, int coord, int lod, float4 color);
75 void __ovld write_imagei(read_write image1d_t image, int coord, int lod, int4 color);
76 void __ovld write_imageui(read_write image1d_t image, int coord, int lod, uint4 color);
77@@ -14780,8 +14781,9 @@ void __ovld write_imagef(read_write image2d_array_depth_t image, int4 coord, int
78 void __ovld write_imagef(read_write image3d_t image, int4 coord, int lod, float4 color);
79 void __ovld write_imagei(read_write image3d_t image, int4 coord, int lod, int4 color);
80 void __ovld write_imageui(read_write image3d_t image, int4 coord, int lod, uint4 color);
81-#endif
82-#endif //cl_khr_mipmap_image
83+#endif //cl_khr_3d_image_writes
84+
85+#endif //cl_khr_mipmap_image_writes
86 #endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
87
88 // Image write functions for half4 type
89diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl
90index 19d08849535..0e6bbb7d3bc 100644
91--- a/clang/test/SemaOpenCL/extension-version.cl
92+++ b/clang/test/SemaOpenCL/extension-version.cl
93@@ -242,6 +242,18 @@
94 #endif
95 #pragma OPENCL EXTENSION cl_khr_mipmap_image : enable
96
97+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
98+#ifndef cl_khr_mipmap_image_writes
99+#error "Missing cl_khr_mipmap_image_writes define"
100+#endif
101+#else
102+#ifdef cl_khr_mipmap_image_writes
103+#error "Incorrect cl_khr_mipmap_image_writes define"
104+#endif
105+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_mipmap_image_writes' - ignoring}}
106+#endif
107+#pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : enable
108+
109 #if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
110 #ifndef cl_khr_srgb_image_writes
111 #error "Missing cl_khr_srgb_image_writes define"
112--
1132.17.1
114
diff --git a/recipes-devtools/clang/clang/0027-InstCombine-visitBitCast-do-not-crash-on-weird-bitca.patch b/recipes-devtools/clang/clang/0027-InstCombine-visitBitCast-do-not-crash-on-weird-bitca.patch
deleted file mode 100644
index 77ca35b..0000000
--- a/recipes-devtools/clang/clang/0027-InstCombine-visitBitCast-do-not-crash-on-weird-bitca.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From 381054a989ebd0b585fee46f2a01a7c5de10acf7 Mon Sep 17 00:00:00 2001
2From: Roman Lebedev <lebedev.ri@gmail.com>
3Date: Wed, 24 Jun 2020 21:12:09 +0300
4Subject: [PATCH] [InstCombine] visitBitCast(): do not crash on weird `bitcast
5 <1 x i8*> to i8*`
6
7Even if we know that RHS of a bitcast is a pointer,
8we can't assume LHS is, because it might be
9a single-element vector of pointer.
10
11Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/381054a989ebd0b585fee46f2a01a7c5de10acf7]
12
13Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
14
15---
16 lib/Transforms/InstCombine/InstCombineCasts.cpp | 3 ++-
17 test/Transforms/InstCombine/bitcast.ll | 6 ++++++
18 2 files changed, 8 insertions(+), 1 deletion(-)
19
20diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
21index 3750f31e3cf..a8c87ea3558 100644
22--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
23+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
24@@ -2471,8 +2471,9 @@ Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
25 if (DestTy == Src->getType())
26 return replaceInstUsesWith(CI, Src);
27
28- if (PointerType *DstPTy = dyn_cast<PointerType>(DestTy)) {
29+ if (isa<PointerType>(SrcTy) && isa<PointerType>(DestTy)) {
30 PointerType *SrcPTy = cast<PointerType>(SrcTy);
31+ PointerType *DstPTy = cast<PointerType>(DestTy);
32 Type *DstElTy = DstPTy->getElementType();
33 Type *SrcElTy = SrcPTy->getElementType();
34
35diff --git a/test/Transforms/InstCombine/bitcast.ll b/test/Transforms/InstCombine/bitcast.ll
36index 0f0cbdb364a..c4ee52f27a8 100644
37--- a/test/Transforms/InstCombine/bitcast.ll
38+++ b/test/Transforms/InstCombine/bitcast.ll
39@@ -561,3 +561,9 @@ define void @constant_fold_vector_to_half() {
40 store volatile half bitcast (<4 x i4> <i4 0, i4 0, i4 0, i4 4> to half), half* undef
41 ret void
42 }
43+
44+; Ensure that we do not crash when looking at such a weird bitcast.
45+define i8* @bitcast_from_single_element_pointer_vector_to_pointer(<1 x i8*> %ptrvec) {
46+ %ptr = bitcast <1 x i8*> %ptrvec to i8*
47+ ret i8* %ptr
48+}
49--
502.17.1
51
diff --git a/recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch b/recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch
new file mode 100644
index 0000000..3bd41ea
--- /dev/null
+++ b/recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch
@@ -0,0 +1,27 @@
1From f5367ee64b6e74039c0957e1f7d81dc8d597804d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 6 Feb 2021 12:44:30 -0800
4Subject: [PATCH] compiler-rt: Include stddef.h
5
6size_t is use in the source needs relevant header to include the
7definition, fixes build on musl
8
9compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:82:61: error: unknown type name 'size_t'; did you mean 'std::size_t'?
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
17index b87798603fda..34e11727d77b 100644
18--- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
19+++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
20@@ -26,6 +26,7 @@
21
22 #include <cassert>
23 #include <cstdint>
24+#include <cstddef> // for size_t
25 #include <dlfcn.h> // for dlsym()
26
27 static void *getFuncAddr(const char *name, uintptr_t wrapper_addr) {
diff --git a/recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch b/recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch
new file mode 100644
index 0000000..ef9b2ed
--- /dev/null
+++ b/recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch
@@ -0,0 +1,44 @@
1From 6660c7d48601df4276fb3f51156c96fff103fb79 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 7 Feb 2021 23:58:41 -0800
4Subject: [PATCH] llvm: Do not use find_library for ncurses
5
6This ensures that it lets OE to decide which lib to link
7otherwise it adds absolute paths to linker cmdline and confuses it
8horribly with native and target libs when build clang for target
9
10TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/clang/12.0.0-r0/recipe-sysroot-native/usr/lib/libtinfo.so: error adding symbols: file in wrong format
11clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 compiler-rt/cmake/config-ix.cmake | 2 +-
16 llvm/cmake/config-ix.cmake | 2 +-
17 2 files changed, 2 insertions(+), 2 deletions(-)
18
19diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
20index 196aa62fd01c..49bbbd257d97 100644
21--- a/compiler-rt/cmake/config-ix.cmake
22+++ b/compiler-rt/cmake/config-ix.cmake
23@@ -140,7 +140,7 @@ else()
24 set(MAYBE_REQUIRED)
25 endif()
26 if(LLVM_ENABLE_TERMINFO)
27- find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED})
28+ set(TERMINFO_LIB tinfo curses ncurses ncursesw)
29 endif()
30 if(COMPILER_RT_TERMINFO_LIB)
31 set(LLVM_ENABLE_TERMINFO 1)
32diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
33index 818fafbce148..2f8ad6652334 100644
34--- a/llvm/cmake/config-ix.cmake
35+++ b/llvm/cmake/config-ix.cmake
36@@ -175,7 +175,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
37 set(MAYBE_REQUIRED)
38 endif()
39 if(LLVM_ENABLE_TERMINFO)
40- find_library(TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED})
41+ set(TERMINFO_LIB tinfo curses ncurses ncursesw)
42 endif()
43 if(TERMINFO_LIB)
44 set(LLVM_ENABLE_TERMINFO 1)
diff --git a/recipes-devtools/clang/clang/0028-nfc-Fix-missing-include.patch b/recipes-devtools/clang/clang/0028-nfc-Fix-missing-include.patch
deleted file mode 100644
index 250e0da..0000000
--- a/recipes-devtools/clang/clang/0028-nfc-Fix-missing-include.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From b498303066a63a203d24f739b2d2e0e56dca70d1 Mon Sep 17 00:00:00 2001
2From: serge-sans-paille <sguelton@redhat.com>
3Date: Tue, 10 Nov 2020 14:55:25 +0100
4Subject: [PATCH] [nfc] Fix missing include
5
6Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1]
7
8Signed-off-by: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
9
10---
11 llvm/utils/benchmark/src/benchmark_register.h | 1 +
12 1 file changed, 1 insertion(+)
13
14diff --git a/llvm/utils/benchmark/src/benchmark_register.h b/llvm/utils/benchmark/src/benchmark_register.h
15index 0705e219f2fa..4caa5ad4da07 100644
16--- a/llvm/utils/benchmark/src/benchmark_register.h
17+++ b/llvm/utils/benchmark/src/benchmark_register.h
18@@ -1,6 +1,7 @@
19 #ifndef BENCHMARK_REGISTER_H
20 #define BENCHMARK_REGISTER_H
21
22+#include <limits>
23 #include <vector>
24
25 #include "check.h"
26--
272.31.1
28
diff --git a/recipes-devtools/clang/clang/0029-OpenMP-link-fix.patch b/recipes-devtools/clang/clang/0029-OpenMP-link-fix.patch
deleted file mode 100644
index 3901268..0000000
--- a/recipes-devtools/clang/clang/0029-OpenMP-link-fix.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From 11bd98436bd7e99fb1fc2c07c150c71e2250a262 Mon Sep 17 00:00:00 2001
2From: Joel Winarske <joel.winarske@gmail.com>
3Date: Wed, 9 Feb 2022 11:11:55 -0800
4Subject: [PATCH] OpenMP link fix
5
6Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
7---
8 openmp/runtime/src/CMakeLists.txt | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
12index 9f46b4bd4..3106e497d 100644
13--- a/openmp/runtime/src/CMakeLists.txt
14+++ b/openmp/runtime/src/CMakeLists.txt
15@@ -168,7 +168,7 @@ endif()
16
17 # Linking command will include libraries in LIBOMP_CONFIGURED_LIBFLAGS
18 libomp_get_libflags(LIBOMP_CONFIGURED_LIBFLAGS)
19-target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${CMAKE_DL_LIBS})
20+target_link_libraries(omp ${LIBOMP_CONFIGURED_LIBFLAGS} ${CMAKE_DL_LIBS} "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports_so.txt")
21
22 # Create *.inc before compiling any sources
23 # objects depend on : .inc files
24--
252.31.1
26
diff --git a/recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch b/recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch
new file mode 100644
index 0000000..a9658b3
--- /dev/null
+++ b/recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch
@@ -0,0 +1,32 @@
1From 7bc8252aff944f2efeaad92c431b1f1c5cf606b1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 11 Feb 2021 16:42:49 -0800
4Subject: [PATCH] llvm: Insert anchor for adding OE distro vendor names
5
6This helps in making right detection for OE built gcc toolchains
7
8The //CLANG_EXTRA_OE_VENDORS_CASES string is replaced with list of
9additional Ceses based on CLANG_EXTRA_OE_VENDORS variable in
10recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors()
11
12Upstream-Status: Inappropriate [OE-specific]
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
16---
17 llvm/lib/Support/Triple.cpp | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
21index 4f483c965282..ffd20d223133 100644
22--- a/llvm/lib/Support/Triple.cpp
23+++ b/llvm/lib/Support/Triple.cpp
24@@ -489,7 +489,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
25 .Case("amd", Triple::AMD)
26 .Case("mesa", Triple::Mesa)
27 .Case("suse", Triple::SUSE)
28- .Case("oe", Triple::OpenEmbedded)
29+ .Case("oe", Triple::OpenEmbedded)//CLANG_EXTRA_OE_VENDORS_CASES
30 .Default(Triple::UnknownVendor);
31 }
32
diff --git a/recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch b/recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch
new file mode 100644
index 0000000..8093de0
--- /dev/null
+++ b/recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch
@@ -0,0 +1,32 @@
1From 4d51447a11ee6796594fd55718ea62575ecebc78 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: Pending
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++-
15 1 file changed, 4 insertions(+), 1 deletion(-)
16
17diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
18index 9d304910ba4e..d1b50b04fc71 100644
19--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
20+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
21@@ -359,7 +359,10 @@ public:
22 // name of a class shouldn't be significant. However, some of the backends
23 // accidentally rely on this behaviour, so it will have to stay like this
24 // until they are fixed.
25- return ValueName < RHS.ValueName;
26+ if (ValueName != RHS.ValueName)
27+ return ValueName < RHS.ValueName;
28+ // All else being equal, we should sort by name, for source and binary reproducibility
29+ return Name < RHS.Name;
30 }
31 };
32
diff --git a/recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch b/recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch
new file mode 100644
index 0000000..1f3af25
--- /dev/null
+++ b/recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch
@@ -0,0 +1,71 @@
1From 4f45514fb8841a08d8d3bb68d9cb84b607e652f2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 24 Mar 2021 00:32:09 -0700
4Subject: [PATCH] compiler-rt: Use mcr based barrier on armv6
5
6dsb is an armv7 instruction and wont work when we are building for armv6.
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 compiler-rt/lib/builtins/arm/sync-ops.h | 8 ++++----
12 compiler-rt/lib/builtins/assembly.h | 8 ++++++++
13 2 files changed, 12 insertions(+), 4 deletions(-)
14
15diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h
16index c9623249e5d2..7a26170741ad 100644
17--- a/compiler-rt/lib/builtins/arm/sync-ops.h
18+++ b/compiler-rt/lib/builtins/arm/sync-ops.h
19@@ -19,14 +19,14 @@
20 .thumb; \
21 .syntax unified; \
22 DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \
23- dmb; \
24+ DMB; \
25 mov r12, r0; \
26 LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \
27 op(r2, r0, r1); \
28 strex r3, r2, [r12]; \
29 cmp r3, #0; \
30 bne LOCAL_LABEL(tryatomic_##op); \
31- dmb; \
32+ DMB; \
33 bx lr
34
35 #define SYNC_OP_8(op) \
36@@ -35,14 +35,14 @@
37 .syntax unified; \
38 DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \
39 push {r4, r5, r6, lr}; \
40- dmb; \
41+ DMB; \
42 mov r12, r0; \
43 LOCAL_LABEL(tryatomic_##op) : ldrexd r0, r1, [r12]; \
44 op(r4, r5, r0, r1, r2, r3); \
45 strexd r6, r4, r5, [r12]; \
46 cmp r6, #0; \
47 bne LOCAL_LABEL(tryatomic_##op); \
48- dmb; \
49+ DMB; \
50 pop { r4, r5, r6, pc }
51
52 #define MINMAX_4(rD, rN, rM, cmp_kind) \
53diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h
54index f6ce6a9fccff..5c6cd9376ac4 100644
55--- a/compiler-rt/lib/builtins/assembly.h
56+++ b/compiler-rt/lib/builtins/assembly.h
57@@ -181,6 +181,14 @@
58 JMP(ip)
59 #endif
60
61+#if __ARM_ARCH >= 7
62+#define DMB dmb
63+#elif __ARM_ARCH >= 6
64+#define DMB mcr p15, #0, r0, c7, c10, #5
65+#else
66+#error Only use this with ARMv6+
67+#endif
68+
69 #if defined(USE_THUMB_2)
70 #define WIDE(op) op.w
71 #else
diff --git a/recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch b/recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch
new file mode 100644
index 0000000..a022a71
--- /dev/null
+++ b/recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch
@@ -0,0 +1,28 @@
1From 1d07b3e71bf073da0a25b30efb135adaa876e3df Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 15 Apr 2021 18:58:07 -0700
4Subject: [PATCH] clang: Switch defaults to dwarf-5 debug info on Linux
5
6GCC 11 has defaulted to DWARF-5 as well, this matches
7debug info formats, so mix and match of components with GCC 11
8works.
9
10Upstream-Status: Pending
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 clang/lib/Driver/ToolChains/Linux.h | 2 ++
14 1 file changed, 2 insertions(+)
15
16diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
17index 582d4bef81df..82c9494c744e 100644
18--- a/clang/lib/Driver/ToolChains/Linux.h
19+++ b/clang/lib/Driver/ToolChains/Linux.h
20@@ -58,6 +58,8 @@ public:
21 const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
22 const llvm::fltSemantics *FPType = nullptr) const override;
23
24+ unsigned GetDefaultDwarfVersion() const override { return 5; }
25+
26 protected:
27 Tool *buildAssembler() const override;
28 Tool *buildLinker() const override;
diff --git a/recipes-devtools/clang/llvm-common/llvm-config b/recipes-devtools/clang/clang/llvm-config
index a139514..a139514 100644
--- a/recipes-devtools/clang/llvm-common/llvm-config
+++ b/recipes-devtools/clang/clang/llvm-config
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
index 779c4ae..b0c81f1 100644
--- a/recipes-devtools/clang/clang_git.bb
+++ b/recipes-devtools/clang/clang_git.bb
@@ -15,7 +15,6 @@ BUILD_CXX_class-nativesdk = "clang++"
15BUILD_AR_class-nativesdk = "llvm-ar" 15BUILD_AR_class-nativesdk = "llvm-ar"
16BUILD_RANLIB_class-nativesdk = "llvm-ranlib" 16BUILD_RANLIB_class-nativesdk = "llvm-ranlib"
17BUILD_NM_class-nativesdk = "llvm-nm" 17BUILD_NM_class-nativesdk = "llvm-nm"
18LDFLAGS_append_class-nativesdk = " -fuse-ld=gold"
19 18
20inherit cmake cmake-native pkgconfig python3native 19inherit cmake cmake-native pkgconfig python3native
21 20
@@ -35,7 +34,8 @@ def get_clang_arch(bb, d, arch_var):
35 elif re.match('aarch64$', a): return 'AArch64' 34 elif re.match('aarch64$', a): return 'AArch64'
36 elif re.match('aarch64_be$', a): return 'AArch64' 35 elif re.match('aarch64_be$', a): return 'AArch64'
37 elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips' 36 elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
38 elif re.match('riscv(32|64)(eb|)$', a): return 'RISCV' 37 elif re.match('riscv32$', a): return 'riscv32'
38 elif re.match('riscv64$', a): return 'riscv64'
39 elif re.match('p(pc|owerpc)(|64)', a): return 'PowerPC' 39 elif re.match('p(pc|owerpc)(|64)', a): return 'PowerPC'
40 else: 40 else:
41 bb.note("'%s' is not a primary llvm architecture" % a) 41 bb.note("'%s' is not a primary llvm architecture" % a)
@@ -51,19 +51,19 @@ def get_clang_experimental_target_arch(bb, d):
51 return get_clang_experimental_arch(bb, d, 'TARGET_ARCH') 51 return get_clang_experimental_arch(bb, d, 'TARGET_ARCH')
52 52
53PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs lldb-wchar \ 53PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs lldb-wchar \
54 ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto full-lto', d)} \ 54 ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto lto', d)} \
55 rtti eh libedit \ 55 rtti eh libedit terminfo \
56 " 56 "
57PACKAGECONFIG_class-native = "rtti eh libedit" 57PACKAGECONFIG_class-native = "rtti eh libedit shared-libs"
58PACKAGECONFIG_class-nativesdk = "rtti eh libedit ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto full-lto', d)}" 58PACKAGECONFIG_class-nativesdk = "rtti eh libedit shared-libs ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto lto', d)}"
59 59
60PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,libcxx,compiler-rt" 60PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,libcxx,compiler-rt"
61PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx" 61PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx"
62PACKAGECONFIG[unwindlib] = "-DCLANG_DEFAULT_UNWINDLIB=libunwind,-DCLANG_DEFAULT_UNWINDLIB=libgcc,libcxx" 62PACKAGECONFIG[unwindlib] = "-DCLANG_DEFAULT_UNWINDLIB=libunwind,-DCLANG_DEFAULT_UNWINDLIB=libgcc,libcxx"
63PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," 63PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
64PACKAGECONFIG[full-lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils," 64PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
65PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,," 65PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,,"
66PACKAGECONFIG[terminfo] = "-DLLVM_ENABLE_TERMINFO=ON,-DLLVM_ENABLE_TERMINFO=OFF,ncurses," 66PACKAGECONFIG[terminfo] = "-DLLVM_ENABLE_TERMINFO=ON -DCOMPILER_RT_TERMINFO_LIB=ON,-DLLVM_ENABLE_TERMINFO=OFF -DCOMPILER_RT_TERMINFO_LIB=OFF,ncurses,"
67PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm," 67PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm,"
68PACKAGECONFIG[lldb-wchar] = "-DLLDB_EDITLINE_USE_WCHAR=1,-DLLDB_EDITLINE_USE_WCHAR=0," 68PACKAGECONFIG[lldb-wchar] = "-DLLDB_EDITLINE_USE_WCHAR=1,-DLLDB_EDITLINE_USE_WCHAR=0,"
69PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,," 69PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,,"
@@ -91,12 +91,10 @@ CMAKE_C_FLAGS_RELEASE;CMAKE_CXX_FLAGS_RELEASE;CMAKE_ASM_FLAGS_RELEASE;\
91" 91"
92# 92#
93# Default to build all OE-Core supported target arches (user overridable). 93# Default to build all OE-Core supported target arches (user overridable).
94# Gennerally setting LLVM_TARGETS_TO_BUILD = "" in local.conf is ok in most simple situations
95# where only one target architecture is needed along with just one build arch (usually X86)
94# 96#
95LLVM_TARGETS_TO_BUILD ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86" 97LLVM_TARGETS_TO_BUILD ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86"
96LLVM_TARGETS_TO_BUILD_append = ";${@get_clang_host_arch(bb, d)};${@get_clang_target_arch(bb, d)}"
97
98LLVM_TARGETS_TO_BUILD_TARGET ?= "${LLVM_TARGETS_TO_BUILD}"
99LLVM_TARGETS_TO_BUILD_TARGET_append ?= ";${@get_clang_target_arch(bb, d)}"
100 98
101LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= "" 99LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= ""
102LLVM_EXPERIMENTAL_TARGETS_TO_BUILD_append = ";${@get_clang_experimental_target_arch(bb, d)}" 100LLVM_EXPERIMENTAL_TARGETS_TO_BUILD_append = ";${@get_clang_experimental_target_arch(bb, d)}"
@@ -104,6 +102,13 @@ LLVM_EXPERIMENTAL_TARGETS_TO_BUILD_append = ";${@get_clang_experimental_target_a
104HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" 102HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
105HF[vardepvalue] = "${HF}" 103HF[vardepvalue] = "${HF}"
106 104
105LLVM_PROJECTS ?= "clang;clang-tools-extra;lld;lldb"
106# There is no LLDB support for RISCV
107LLVM_PROJECTS_riscv32 ?= "clang;clang-tools-extra;lld"
108LLVM_PROJECTS_riscv64 ?= "clang;clang-tools-extra;lld"
109
110#CMAKE_VERBOSE = "VERBOSE=1"
111
107EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ 112EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
108 -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \ 113 -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
109 -DLLVM_ENABLE_PIC=ON \ 114 -DLLVM_ENABLE_PIC=ON \
@@ -114,15 +119,17 @@ EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
114 -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \ 119 -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
115 -DCMAKE_SYSTEM_NAME=Linux \ 120 -DCMAKE_SYSTEM_NAME=Linux \
116 -DCMAKE_BUILD_TYPE=Release \ 121 -DCMAKE_BUILD_TYPE=Release \
122 -DCMAKE_CXX_FLAGS_RELEASE='${CXXFLAGS} -DNDEBUG -g0' \
123 -DCMAKE_C_FLAGS_RELEASE='${CFLAGS} -DNDEBUG -g0' \
117 -DBUILD_SHARED_LIBS=OFF \ 124 -DBUILD_SHARED_LIBS=OFF \
118 -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;lldb' \ 125 -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \
119 -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \ 126 -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \
120 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ 127 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
128 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \
129 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
121" 130"
122 131
123EXTRA_OECMAKE_append_class-native = "\ 132EXTRA_OECMAKE_append_class-native = "\
124 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \
125 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
126 -DPYTHON_EXECUTABLE='${PYTHON}' \ 133 -DPYTHON_EXECUTABLE='${PYTHON}' \
127" 134"
128EXTRA_OECMAKE_append_class-nativesdk = "\ 135EXTRA_OECMAKE_append_class-nativesdk = "\
@@ -131,8 +138,7 @@ EXTRA_OECMAKE_append_class-nativesdk = "\
131 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \ 138 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
132 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ 139 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
133 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ 140 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
134 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \ 141 -DCMAKE_STRIP=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-strip \
135 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
136 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ 142 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
137 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ 143 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
138 -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \ 144 -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \
@@ -145,12 +151,13 @@ EXTRA_OECMAKE_append_class-target = "\
145 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ 151 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
146 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ 152 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
147 -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \ 153 -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \
148 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD_TARGET}' \
149 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \ 154 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
150 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ 155 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
151 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ 156 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
157 -DCMAKE_STRIP=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-strip \
152 -DLLVM_TARGET_ARCH=${@get_clang_target_arch(bb, d)} \ 158 -DLLVM_TARGET_ARCH=${@get_clang_target_arch(bb, d)} \
153 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS}${HF} \ 159 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS}${HF} \
160 -DLLVM_HOST_TRIPLE=${TARGET_SYS}${HF} \
154 -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \ 161 -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
155 -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \ 162 -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
156 -DLLVM_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \ 163 -DLLVM_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
@@ -161,9 +168,6 @@ DEPENDS = "binutils zlib libffi libxml2 libxml2-native ninja-native swig-native"
161DEPENDS_append_class-nativesdk = " clang-crosssdk-${SDK_ARCH} virtual/${TARGET_PREFIX}binutils-crosssdk nativesdk-python3" 168DEPENDS_append_class-nativesdk = " clang-crosssdk-${SDK_ARCH} virtual/${TARGET_PREFIX}binutils-crosssdk nativesdk-python3"
162DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} python3" 169DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} python3"
163 170
164COMPATIBLE_HOST_riscv64 = "null"
165COMPATIBLE_HOST_riscv32 = "null"
166
167RRECOMMENDS_${PN} = "binutils" 171RRECOMMENDS_${PN} = "binutils"
168RRECOMMENDS_${PN}_append_class-target = " libcxx-dev" 172RRECOMMENDS_${PN}_append_class-target = " libcxx-dev"
169 173
@@ -189,13 +193,16 @@ endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
189 lnr ${D}${nonarch_libdir}/clang ${D}${libdir}/clang 193 lnr ${D}${nonarch_libdir}/clang ${D}${libdir}/clang
190 rmdir --ignore-fail-on-non-empty ${D}${libdir} 194 rmdir --ignore-fail-on-non-empty ${D}${libdir}
191 fi 195 fi
196 for t in clang clang++ llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip; do
197 ln -sf $t ${D}${bindir}/${TARGET_PREFIX}$t
198 done
192} 199}
193 200
194do_install_append_class-native () { 201do_install_append_class-native () {
195 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen 202 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
196 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen 203 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen
197 for f in `find ${D}${bindir} -executable -type f -not -type l`; do 204 for f in `find ${D}${bindir} -executable -type f -not -type l`; do
198 test -n "`file $f|grep -i ELF`" && ${STRIP} $f 205 test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f
199 echo "stripped $f" 206 echo "stripped $f"
200 done 207 done
201 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV} 208 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
@@ -207,7 +214,7 @@ do_install_append_class-nativesdk () {
207 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen 214 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
208 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen 215 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen
209 for f in `find ${D}${bindir} -executable -type f -not -type l`; do 216 for f in `find ${D}${bindir} -executable -type f -not -type l`; do
210 test -n "`file $f|grep -i ELF`" && ${STRIP} $f 217 test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f
211 done 218 done
212 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV} 219 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
213 ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV} 220 ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
@@ -288,3 +295,14 @@ TOOLCHAIN_class-native = "gcc"
288TOOLCHAIN_class-nativesdk = "clang" 295TOOLCHAIN_class-nativesdk = "clang"
289 296
290SYSROOT_DIRS_append_class-target = " ${nonarch_libdir}" 297SYSROOT_DIRS_append_class-target = " ${nonarch_libdir}"
298
299SYSROOT_PREPROCESS_FUNCS_append_class-target = " clang_sysroot_preprocess"
300
301clang_sysroot_preprocess() {
302 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
303 install -m 0755 ${S}/../llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
304 ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
305 # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to
306 install -d ${SYSROOT_DESTDIR}${bindir}
307 install -m 755 ${D}${bindir}/lld ${SYSROOT_DESTDIR}${bindir}/
308}
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc
index c7f4073..e211258 100644
--- a/recipes-devtools/clang/common.inc
+++ b/recipes-devtools/clang/common.inc
@@ -8,11 +8,12 @@ LICENSE = "Apache-2.0-with-LLVM-exception"
8BASEURI ??= "${LLVM_GIT}/llvm-project;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH}" 8BASEURI ??= "${LLVM_GIT}/llvm-project;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH}"
9SRC_URI = "\ 9SRC_URI = "\
10 ${BASEURI} \ 10 ${BASEURI} \
11 file://llvm-config \
11 file://0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch \ 12 file://0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch \
12 file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ 13 file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \
13 file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \ 14 file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \
14 file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ 15 file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \
15 file://0001-compiler-rt-Fix-realpath-already-defined-error.patch \ 16 file://0005-compiler-rt-Disable-tsan-on-OE-glibc.patch \
16 file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ 17 file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \
17 file://0007-llvm-allow-env-override-of-exe-path.patch \ 18 file://0007-llvm-allow-env-override-of-exe-path.patch \
18 file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \ 19 file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \
@@ -24,21 +25,23 @@ SRC_URI = "\
24 file://0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch \ 25 file://0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch \
25 file://0015-clang-scan-view-needs-python-2.x.patch \ 26 file://0015-clang-scan-view-needs-python-2.x.patch \
26 file://0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \ 27 file://0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \
27 file://0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch \ 28 file://0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \
28 file://0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ 29 file://0018-Check-for-atomic-double-intrinsics.patch \
29 file://0019-Check-for-atomic-double-intrinsics.patch \ 30 file://0019-clang-Enable-SSP-and-PIE-by-default.patch \
30 file://0020-clang-Enable-SSP-and-PIE-by-default.patch \ 31 file://0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \
31 file://0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \ 32 file://0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \
32 file://0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \ 33 file://0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch \
33 file://0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch \ 34 file://0023-fix-path-to-libffi.patch \
34 file://0024-fix-path-to-libffi.patch \ 35 file://0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \
35 file://0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \ 36 file://0025-clang-Use-python3-in-python-scripts.patch \
36 file://0026-OpenCL-Fix-support-for-cl_khr_mipmap_image_writes.patch \ 37 file://0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch \
37 file://0027-InstCombine-visitBitCast-do-not-crash-on-weird-bitca.patch;patchdir=llvm \ 38 file://0027-compiler-rt-Include-stddef.h.patch \
38 file://0028-nfc-Fix-missing-include.patch \ 39 file://0028-llvm-Do-not-use-find_library-for-ncurses.patch \
39 file://0029-OpenMP-link-fix.patch \ 40 file://0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch \
41 file://0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \
42 file://0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch \
43 file://0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch \
40" 44"
41
42# Fallback to no-PIE if not set 45# Fallback to no-PIE if not set
43GCCPIE ??= "" 46GCCPIE ??= ""
44 47
diff --git a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
new file mode 100644
index 0000000..aa3a9ac
--- /dev/null
+++ b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
@@ -0,0 +1,97 @@
1# Copyright (C) 2021 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler Runtime"
5HOMEPAGE = "http://compiler-rt.llvm.org/"
6SECTION = "base"
7
8require clang.inc
9require common-source.inc
10
11inherit cmake pkgconfig python3native
12
13
14LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
15
16TUNE_CCARGS_remove = "-no-integrated-as"
17
18RUNTIME = "llvm"
19
20DEPENDS += "ninja-native clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs"
21DEPENDS_append_libc-glibc = " libxcrypt"
22DEPENDS_append_class-nativesdk = " clang-native nativesdk-libxcrypt"
23
24PACKAGECONFIG ??= ""
25PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
26
27HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
28HF[vardepvalue] = "${HF}"
29
30OECMAKE_TARGET_COMPILE = "compiler-rt"
31OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
32OECMAKE_SOURCEPATH = "${S}/llvm"
33EXTRA_OECMAKE += "-DCOMPILER_RT_STANDALONE_BUILD=OFF \
34 -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${HOST_ARCH}${HF}${HOST_VENDOR}-${HOST_OS} \
35 -DCOMPILER_RT_BUILD_BUILTINS=OFF \
36 -DSANITIZER_CXX_ABI_LIBNAME=${@bb.utils.contains("RUNTIME", "llvm", "libc++", "libstdc++", d)} \
37 -DSANITIZER_USE_STATIC_CXX_ABI=ON \
38 -DSANITIZER_USE_STATIC_LLVM_UNWINDER=ON \
39 -DCOMPILER_RT_BUILD_XRAY=ON \
40 -DCOMPILER_RT_BUILD_SANITIZERS=ON \
41 -DCOMPILER_RT_BUILD_LIBFUZZER=ON \
42 -DCOMPILER_RT_BUILD_PROFILE=ON \
43 -DCOMPILER_RT_BUILD_MEMPROF=ON \
44 -DLLVM_ENABLE_PROJECTS='compiler-rt' \
45 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
46 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
47 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
48 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
49"
50
51EXTRA_OECMAKE_append_class-nativesdk = "\
52 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
53 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
54"
55
56EXTRA_OECMAKE_append_libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
57EXTRA_OECMAKE_append_powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
58
59do_install_append () {
60 if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
61 mkdir -p ${D}${nonarch_libdir}
62 mv ${D}${libdir}/clang ${D}${nonarch_libdir}/clang
63 rmdir --ignore-fail-on-non-empty ${D}${libdir}
64 fi
65}
66
67FILES_SOLIBSDEV = ""
68FILES_${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
69 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
70 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
71FILES_${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
72FILES_${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms \
73 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include \
74 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/clang_rt.crt*.o \
75 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.asan-preinit*.a \
76 "
77INSANE_SKIP_${PN} = "dev-so libdir"
78INSANE_SKIP_${PN}-dbg = "libdir"
79
80#PROVIDES_append_class-target = "\
81# virtual/${TARGET_PREFIX}compilerlibs \
82# libgcc \
83# libgcc-initial \
84# libgcc-dev \
85# libgcc-initial-dev \
86# "
87#
88
89RDEPENDS_${PN}-dev += "${PN}-staticdev"
90
91BBCLASSEXTEND = "native nativesdk"
92
93ALLOW_EMPTY_${PN} = "1"
94ALLOW_EMPTY_${PN}-dev = "1"
95
96TOOLCHAIN_forcevariable = "clang"
97SYSROOT_DIRS_append_class-target = " ${nonarch_libdir}"
diff --git a/recipes-devtools/clang/compiler-rt_git.bb b/recipes-devtools/clang/compiler-rt_git.bb
index 9178031..6dac9f6 100644
--- a/recipes-devtools/clang/compiler-rt_git.bb
+++ b/recipes-devtools/clang/compiler-rt_git.bb
@@ -19,7 +19,7 @@ TUNE_CCARGS_remove = "-no-integrated-as"
19 19
20INHIBIT_DEFAULT_DEPS = "1" 20INHIBIT_DEFAULT_DEPS = "1"
21 21
22DEPENDS += "ninja-native clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs virtual/crypt" 22DEPENDS += "ninja-native clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs"
23DEPENDS_append_class-nativesdk = " clang-native" 23DEPENDS_append_class-nativesdk = " clang-native"
24 24
25PACKAGECONFIG ??= "" 25PACKAGECONFIG ??= ""
@@ -34,6 +34,10 @@ OECMAKE_SOURCEPATH = "${S}/llvm"
34EXTRA_OECMAKE += "-DCOMPILER_RT_STANDALONE_BUILD=OFF \ 34EXTRA_OECMAKE += "-DCOMPILER_RT_STANDALONE_BUILD=OFF \
35 -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${HOST_ARCH}${HF}${HOST_VENDOR}-${HOST_OS} \ 35 -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${HOST_ARCH}${HF}${HOST_VENDOR}-${HOST_OS} \
36 -DCOMPILER_RT_BUILD_XRAY=OFF \ 36 -DCOMPILER_RT_BUILD_XRAY=OFF \
37 -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
38 -DCOMPILER_RT_BUILD_MEMPROF=OFF \
39 -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
40 -DCOMPILER_RT_BUILD_PROFILE=ON \
37 -DLLVM_ENABLE_PROJECTS='compiler-rt' \ 41 -DLLVM_ENABLE_PROJECTS='compiler-rt' \
38 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \ 42 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
39 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ 43 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
@@ -45,10 +49,6 @@ EXTRA_OECMAKE_append_class-nativesdk = "\
45 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ 49 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
46 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ 50 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
47" 51"
48
49EXTRA_OECMAKE_append_libc-musl = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF "
50CXXFLAGS_append_libc-musl = " -D_LIBCPP_HAS_MUSL_LIBC=ON "
51EXTRA_OECMAKE_append_mipsarch = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF "
52EXTRA_OECMAKE_append_powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc " 52EXTRA_OECMAKE_append_powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
53 53
54do_install_append () { 54do_install_append () {
diff --git a/recipes-devtools/clang/libclc_git.bb b/recipes-devtools/clang/libclc_git.bb
new file mode 100644
index 0000000..9525b25
--- /dev/null
+++ b/recipes-devtools/clang/libclc_git.bb
@@ -0,0 +1,37 @@
1DESCRIPTION = "LLVM based OpenCL runtime support library"
2HOMEPAGE = "http://libclc.llvm.org/"
3SECTION = "libs"
4
5require clang.inc
6require common-source.inc
7
8TOOLCHAIN = "clang"
9
10LIC_FILES_CHKSUM = "file://libclc/LICENSE.TXT;md5=7cc795f6cbb2d801d84336b83c8017db"
11
12inherit cmake pkgconfig python3native qemu
13
14DEPENDS += "qemu-native clang spirv-tools spirv-llvm-translator spirv-llvm-translator-native ncurses"
15
16OECMAKE_SOURCEPATH = "${S}/libclc"
17
18EXTRA_OECMAKE += " \
19 -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
20 -Dclc_comp_in:FILEPATH=${OECMAKE_SOURCEPATH}/cmake/CMakeCLCCompiler.cmake.in \
21 -Dll_comp_in:FILEPATH=${OECMAKE_SOURCEPATH}/cmake/CMakeLLAsmCompiler.cmake.in \
22 "
23
24do_configure_prepend () {
25 # Write out a qemu wrapper that will be used by cmake
26 # so that it can run target helper binaries through that.
27 qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
28 cat > ${WORKDIR}/qemuwrapper << EOF
29#!/bin/sh
30$qemu_binary "\$@"
31EOF
32 chmod +x ${WORKDIR}/qemuwrapper
33}
34
35FILES_${PN} += "${datadir}/clc"
36
37BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb
index 789da5b..80eaa78 100644
--- a/recipes-devtools/clang/libcxx_git.bb
+++ b/recipes-devtools/clang/libcxx_git.bb
@@ -11,8 +11,6 @@ require common-source.inc
11inherit cmake python3native 11inherit cmake python3native
12 12
13PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("RUNTIME", "llvm", "unwind", "", d)}" 13PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("RUNTIME", "llvm", "unwind", "", d)}"
14PACKAGECONFIG_riscv32 = "exceptions"
15PACKAGECONFIG_riscv64 = "exceptions"
16PACKAGECONFIG_append_armv5 = " no-atomics" 14PACKAGECONFIG_append_armv5 = " no-atomics"
17 15
18PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=ON,-DLIBCXXABI_USE_LLVM_UNWINDER=OFF,," 16PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=ON,-DLIBCXXABI_USE_LLVM_UNWINDER=OFF,,"
@@ -24,7 +22,7 @@ DEPENDS += "ninja-native"
24DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs" 22DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs"
25 23
26LIBCPLUSPLUS = "" 24LIBCPLUSPLUS = ""
27COMPILER_RT ?= "-rtlib=compiler-rt ${UNWINDLIB}" 25COMPILER_RT ?= "${@bb.utils.contains("PACKAGECONFIG", "compiler-rt", "-rtlib=compiler-rt", "", d)} ${UNWINDLIB}"
28UNWINDLIB ?= "${@bb.utils.contains("RUNTIME", "gnu", "--unwindlib=libgcc", "", d)}" 26UNWINDLIB ?= "${@bb.utils.contains("RUNTIME", "gnu", "--unwindlib=libgcc", "", d)}"
29 27
30INHIBIT_DEFAULT_DEPS = "1" 28INHIBIT_DEFAULT_DEPS = "1"
diff --git a/recipes-devtools/clang/llvm-common.bb b/recipes-devtools/clang/llvm-common.bb
deleted file mode 100644
index 893abd1..0000000
--- a/recipes-devtools/clang/llvm-common.bb
+++ /dev/null
@@ -1,22 +0,0 @@
1SUMMARY = "Helper script for OE's llvm support"
2LICENSE = "Apache-2.0-with-LLVM-exception"
3LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
4
5SRC_URI = "file://llvm-config"
6
7S = "${WORKDIR}"
8
9ALLOW_EMPTY_${PN} = "1"
10SYSROOT_PREPROCESS_FUNCS_append_class-target = " llvm_common_sysroot_preprocess"
11
12llvm_common_sysroot_preprocess() {
13 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
14 install -m 0755 ${WORKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
15}
16
17do_install_class-native() {
18 install -d ${D}${bindir}
19 install -m 0755 ${WORKDIR}/llvm-config ${D}${bindir}
20}
21
22BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/clang/llvm-project-source.bbappend b/recipes-devtools/clang/llvm-project-source.bbappend
new file mode 100644
index 0000000..5d47c23
--- /dev/null
+++ b/recipes-devtools/clang/llvm-project-source.bbappend
@@ -0,0 +1,9 @@
1# This needs to override meta-intel (which pulls in the
2# LLVM 10/11 version of SPIRV-LLVM-Translator)
3
4SPIRV_BRANCH = "llvm_release_120"
5SRC_URI_append_intel-x86-common = " \
6 git://github.com/KhronosGroup/SPIRV-LLVM-Translator.git;protocol=https;branch=${SPIRV_BRANCH};destsuffix=git/llvm/projects/llvm-spirv;name=spirv \
7 "
8SRCREV_spirv = "67d3e271a28287b2c92ecef2f5e98c49134e5946"
9
diff --git a/recipes-devtools/clang/llvm-project-source.inc b/recipes-devtools/clang/llvm-project-source.inc
index f6c552d..d7b91e0 100644
--- a/recipes-devtools/clang/llvm-project-source.inc
+++ b/recipes-devtools/clang/llvm-project-source.inc
@@ -18,3 +18,39 @@ STAMPCLEAN = "${STAMPS_DIR}/work-shared/llvm-project-source-${PV}-*"
18INHIBIT_DEFAULT_DEPS = "1" 18INHIBIT_DEFAULT_DEPS = "1"
19DEPENDS = "" 19DEPENDS = ""
20PACKAGES = "" 20PACKAGES = ""
21
22# space separated list of additional distro vendor values we want to support e.g.
23# "yoe webos" or "-yoe -webos" '-' is optional
24CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR} ${SDK_VENDOR}"
25
26python add_distro_vendor() {
27 import subprocess
28 case = ""
29 triple = ""
30 vendors = d.getVar('CLANG_EXTRA_OE_VENDORS')
31 multilib_variants = d.getVar('MULTILIB_VARIANTS').split()
32 vendors_to_add = []
33 for vendor in vendors.split():
34 # convert -yoe into yoe
35 vendor = vendor.lstrip('-')
36 # generate possible multilib vendor names for yoe
37 # such as yoemllib32
38 vendors_to_add.extend([vendor + 'ml' + variant for variant in multilib_variants])
39 # skip oe since already part of the cpp file
40 if vendor != "oe":
41 vendors_to_add.append(vendor)
42
43 for vendor_to_add in vendors_to_add:
44 case += '\\n .Case("' + vendor_to_add + '", Triple::OpenEmbedded)'
45 triple += ' "x86_64-' + vendor_to_add + '-linux",'
46
47 bb.note("Adding support following TARGET_VENDOR values")
48 bb.note(str(vendors_to_add))
49 bb.note("in llvm/lib/Support/Triple.cpp and ${S}/clang/lib/Driver/ToolChains/Gnu.cpp")
50 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" % (triple))
51 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
52 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/Support/Triple.cpp" % (case))
53 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
54}
55
56do_patch[postfuncs] += "add_distro_vendor"
diff --git a/recipes-devtools/clang/openmp_git.bb b/recipes-devtools/clang/openmp_git.bb
index 4c6be98..a1fa3b1 100644
--- a/recipes-devtools/clang/openmp_git.bb
+++ b/recipes-devtools/clang/openmp_git.bb
@@ -34,8 +34,7 @@ FILES_SOLIBSDEV = ""
34FILES_${PN} += "${libdir}/lib*${SOLIBSDEV}" 34FILES_${PN} += "${libdir}/lib*${SOLIBSDEV}"
35INSANE_SKIP_${PN} = "dev-so" 35INSANE_SKIP_${PN} = "dev-so"
36 36
37COMPATIBLE_HOST_riscv64 = "null"
38COMPATIBLE_HOST_riscv32 = "null"
39COMPATIBLE_HOST_mips64 = "null" 37COMPATIBLE_HOST_mips64 = "null"
38COMPATIBLE_HOST_riscv32 = "null"
40 39
41BBCLASSEXTEND = "native nativesdk" 40BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/distcc/distcc/distcc-3.3.3-clang-12.patch b/recipes-devtools/distcc/distcc/distcc-3.3.3-clang-12.patch
new file mode 100644
index 0000000..61a26a7
--- /dev/null
+++ b/recipes-devtools/distcc/distcc/distcc-3.3.3-clang-12.patch
@@ -0,0 +1,19 @@
1# SPDX-FileCopyrightText: Huawei Inc.
2# SPDX-License-Identifier: Apache-2.0
3
4Fix build with modern compilers, such as clang 12 and gcc 11
5
6Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
7
8diff -up git/src/stats.h.omv~ git/src/stats.h
9--- git/src/stats.h.omv~ 2021-03-11 18:38:55.022070855 +0100
10+++ git/src/stats.h 2021-03-11 18:38:59.498751697 +0100
11@@ -33,7 +33,7 @@ enum stats_e { STATS_TCP_ACCEPT, STATS_R
12 STATS_COMPILE_OK, STATS_COMPILE_ERROR, STATS_COMPILE_TIMEOUT,
13 STATS_CLI_DISCONN, STATS_OTHER, STATS_ENUM_MAX };
14
15-const char *stats_text[20];
16+extern const char *stats_text[20];
17
18 int dcc_stats_init(void);
19 void dcc_stats_init_kid(void);
diff --git a/recipes-devtools/distcc/distcc_3.3.3%.bbappend b/recipes-devtools/distcc/distcc_3.3.3%.bbappend
new file mode 100644
index 0000000..d2bf964
--- /dev/null
+++ b/recipes-devtools/distcc/distcc_3.3.3%.bbappend
@@ -0,0 +1,4 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append = "\
3 file://distcc-3.3.3-clang-12.patch \
4"
diff --git a/recipes-devtools/rpm/rpm_%.bbappend b/recipes-devtools/rpm/rpm_%.bbappend
index 14b3142..732af3f 100644
--- a/recipes-devtools/rpm/rpm_%.bbappend
+++ b/recipes-devtools/rpm/rpm_%.bbappend
@@ -1,3 +1,9 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2 2
3DEPENDS_append_toolchain-clang = " openmp" 3DEPENDS_append_toolchain-clang = " openmp"
4DEPENDS_remove_toolchain-clang_riscv32 = "openmp"
5DEPENDS_remove_toolchain-clang_mipsarch = "openmp"
6
7# rpm needs OMP
8TOOLCHAIN_riscv32 = "gcc"
9TOOLCHAIN_mipsarch = "gcc"
diff --git a/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-Use-12.0.0-for-base-llvm-version.patch b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-Use-12.0.0-for-base-llvm-version.patch
new file mode 100644
index 0000000..b52d97b
--- /dev/null
+++ b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-Use-12.0.0-for-base-llvm-version.patch
@@ -0,0 +1,26 @@
1From 1e38777c321605d13f9ad254880e73459877d7da Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 14 Feb 2021 18:43:21 -0800
4Subject: [PATCH] Use 12.0.0 for base llvm version
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 CMakeLists.txt | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/CMakeLists.txt b/CMakeLists.txt
13index 0ddb55ce..a9cd1978 100644
14--- a/CMakeLists.txt
15+++ b/CMakeLists.txt
16@@ -1,6 +1,6 @@
17 cmake_minimum_required(VERSION 3.3)
18
19-set (BASE_LLVM_VERSION 13.0.0)
20+set (BASE_LLVM_VERSION 12.0.0)
21 set(LLVM_SPIRV_VERSION ${BASE_LLVM_VERSION}.0)
22
23 option(LLVM_SPIRV_INCLUDE_TESTS
24--
252.30.1
26
diff --git a/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-cmake-allow-to-enable-disable-ccache.patch b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-cmake-allow-to-enable-disable-ccache.patch
new file mode 100644
index 0000000..68cdda4
--- /dev/null
+++ b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator/0001-cmake-allow-to-enable-disable-ccache.patch
@@ -0,0 +1,32 @@
1From 13b679eb76e6877b40fd41b91e71cb172bcf7b26 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Thu, 4 Mar 2021 11:23:20 +0800
4Subject: [PATCH] cmake: allow to enable/disable ccache
5
6By default ccache is enabled.
7
8Upstream-Status: Submitted [https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/930]
9
10Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
11---
12 CMakeLists.txt | 3 ++-
13 1 file changed, 2 insertions(+), 1 deletion(-)
14
15diff --git a/CMakeLists.txt b/CMakeLists.txt
16index 0ddb55c..c7d0498 100644
17--- a/CMakeLists.txt
18+++ b/CMakeLists.txt
19@@ -50,8 +50,9 @@ if(LLVM_SPIRV_BUILD_EXTERNAL)
20
21 message(STATUS "Found LLVM: ${LLVM_VERSION}")
22
23+ option(CCACHE_ALLOWED "allow use of ccache" TRUE)
24 find_program(CCACHE_EXE_FOUND ccache)
25- if(CCACHE_EXE_FOUND)
26+ if(CCACHE_EXE_FOUND AND CCACHE_ALLOWED)
27 message(STATUS "Found ccache: ${CCACHE_EXE_FOUND}")
28 set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
29 set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
30--
312.17.1
32
diff --git a/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb
new file mode 100644
index 0000000..171d54f
--- /dev/null
+++ b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb
@@ -0,0 +1,42 @@
1LICENSE = "NCSA"
2LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=47e311aa9caedd1b3abf098bd7814d1d"
3
4BRANCH = "llvm_release_120"
5SRC_URI = "git://github.com/KhronosGroup/SPIRV-LLVM-Translator/;protocol=https;branch=${BRANCH} \
6 file://0001-Use-12.0.0-for-base-llvm-version.patch \
7 file://0001-cmake-allow-to-enable-disable-ccache.patch \
8 "
9
10PV = "12.0.0"
11SRCREV = "c65388fcd4eac9ce070fc330d5fe263ba2c72d66"
12
13S = "${WORKDIR}/git"
14
15DEPENDS = "spirv-tools clang"
16
17inherit cmake pkgconfig python3native
18
19OECMAKE_GENERATOR = "Unix Makefiles"
20
21# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
22EXTRA_OECMAKE = "\
23 -DBUILD_SHARED_LIBS=ON \
24 -DLLVM_SPIRV_BUILD_EXTERNAL=YES \
25 -DCMAKE_BUILD_TYPE=Release \
26 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
27 -DCMAKE_SKIP_RPATH=ON \
28 -DLLVM_EXTERNAL_LIT=lit \
29 -DLLVM_INCLUDE_TESTS=ON \
30 -Wno-dev \
31 -DCCACHE_ALLOWED=FALSE \
32"
33
34do_compile_append() {
35 oe_runmake llvm-spirv
36}
37
38do_install_append() {
39 install -Dm755 ${B}/tools/llvm-spirv/llvm-spirv ${D}${bindir}/llvm-spirv
40}
41
42BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/valgrind/valgrind/aarch64-inline-asm-clang.patch b/recipes-devtools/valgrind/valgrind/aarch64-inline-asm-clang.patch
new file mode 100644
index 0000000..f65440a
--- /dev/null
+++ b/recipes-devtools/valgrind/valgrind/aarch64-inline-asm-clang.patch
@@ -0,0 +1,643 @@
1From: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
2
3Fix inline assembly to work with clang
4Clang's builtin assembler is much stricter than gas in syntax checks.
5
6Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
7Upstream-Status: Pending
8
9diff -up valgrind-3.15.0/none/tests/arm64/cvtf_imm.c.omv~ valgrind-3.15.0/none/tests/arm64/cvtf_imm.c
10--- valgrind-3.15.0/none/tests/arm64/cvtf_imm.c.omv~ 2021-05-31 15:38:57.493204990 +0200
11+++ valgrind-3.15.0/none/tests/arm64/cvtf_imm.c 2021-05-31 15:39:44.915571692 +0200
12@@ -17,7 +17,7 @@ __attribute__((noinline)) double do_scvt
13 U block[2]; block[0].i64 = x; block[1].i64 = 0;
14 __asm__ __volatile__(
15 "ldr x13,[%0,#0]; scvtf d18,x13,#1; str d18, [%0,#8]"
16- ::"r"(&block[0]) : "memory", "x13","q18");
17+ ::"r"(&block[0]) : "memory", "x13","v18");
18 return block[1].d64;
19 }
20 __attribute__((noinline)) double do_scvtf_d_x_imm32 ( Long x )
21@@ -25,7 +25,7 @@ __attribute__((noinline)) double do_scvt
22 U block[2]; block[0].i64 = x; block[1].i64 = 0;
23 __asm__ __volatile__(
24 "ldr x13,[%0,#0]; scvtf d18,x13,#32; str d18, [%0,#8]"
25- ::"r"(&block[0]) : "memory", "x13","q18");
26+ ::"r"(&block[0]) : "memory", "x13","v18");
27 return block[1].d64;
28 }
29 __attribute__((noinline)) double do_scvtf_d_x_imm64 ( Long x )
30@@ -33,7 +33,7 @@ __attribute__((noinline)) double do_scvt
31 U block[2]; block[0].i64 = x; block[1].i64 = 0;
32 __asm__ __volatile__(
33 "ldr x13,[%0,#0]; scvtf d18,x13,#64; str d18, [%0,#8]"
34- ::"r"(&block[0]) : "memory", "x13","q18");
35+ ::"r"(&block[0]) : "memory", "x13","v18");
36 return block[1].d64;
37 }
38
39@@ -42,7 +42,7 @@ __attribute__((noinline)) double do_ucvt
40 U block[2]; block[0].i64 = x; block[1].i64 = 0;
41 __asm__ __volatile__(
42 "ldr x13,[%0,#0]; ucvtf d18,x13,#1; str d18, [%0,#8]"
43- ::"r"(&block[0]) : "memory", "x13","q18");
44+ ::"r"(&block[0]) : "memory", "x13","v18");
45 return block[1].d64;
46 }
47 __attribute__((noinline)) double do_ucvtf_d_x_imm32 ( Long x )
48@@ -50,7 +50,7 @@ __attribute__((noinline)) double do_ucvt
49 U block[2]; block[0].i64 = x; block[1].i64 = 0;
50 __asm__ __volatile__(
51 "ldr x13,[%0,#0]; ucvtf d18,x13,#32; str d18, [%0,#8]"
52- ::"r"(&block[0]) : "memory", "x13","q18");
53+ ::"r"(&block[0]) : "memory", "x13","v18");
54 return block[1].d64;
55 }
56 __attribute__((noinline)) double do_ucvtf_d_x_imm64 ( Long x )
57@@ -58,7 +58,7 @@ __attribute__((noinline)) double do_ucvt
58 U block[2]; block[0].i64 = x; block[1].i64 = 0;
59 __asm__ __volatile__(
60 "ldr x13,[%0,#0]; ucvtf d18,x13,#64; str d18, [%0,#8]"
61- ::"r"(&block[0]) : "memory", "x13","q18");
62+ ::"r"(&block[0]) : "memory", "x13","v18");
63 return block[1].d64;
64 }
65
66@@ -70,7 +70,7 @@ __attribute__((noinline)) double do_scvt
67 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
68 __asm__ __volatile__(
69 "ldr x13,[%0,#0]; scvtf d18,w13,#1; str d18, [%0,#8]"
70- ::"r"(&block[0]) : "memory", "x13","q18");
71+ ::"r"(&block[0]) : "memory", "x13","v18");
72 return block[1].d64;
73 }
74 __attribute__((noinline)) double do_scvtf_d_w_imm16 ( Int x )
75@@ -78,7 +78,7 @@ __attribute__((noinline)) double do_scvt
76 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
77 __asm__ __volatile__(
78 "ldr x13,[%0,#0]; scvtf d18,w13,#16; str d18, [%0,#8]"
79- ::"r"(&block[0]) : "memory", "x13","q18");
80+ ::"r"(&block[0]) : "memory", "x13","v18");
81 return block[1].d64;
82 }
83 __attribute__((noinline)) double do_scvtf_d_w_imm32 ( Int x )
84@@ -86,7 +86,7 @@ __attribute__((noinline)) double do_scvt
85 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
86 __asm__ __volatile__(
87 "ldr x13,[%0,#0]; scvtf d18,w13,#32; str d18, [%0,#8]"
88- ::"r"(&block[0]) : "memory", "x13","q18");
89+ ::"r"(&block[0]) : "memory", "x13","v18");
90 return block[1].d64;
91 }
92
93@@ -95,7 +95,7 @@ __attribute__((noinline)) double do_ucvt
94 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
95 __asm__ __volatile__(
96 "ldr x13,[%0,#0]; ucvtf d18,w13,#1; str d18, [%0,#8]"
97- ::"r"(&block[0]) : "memory", "x13","q18");
98+ ::"r"(&block[0]) : "memory", "x13","v18");
99 return block[1].d64;
100 }
101 __attribute__((noinline)) double do_ucvtf_d_w_imm16 ( Int x )
102@@ -103,7 +103,7 @@ __attribute__((noinline)) double do_ucvt
103 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
104 __asm__ __volatile__(
105 "ldr x13,[%0,#0]; ucvtf d18,w13,#16; str d18, [%0,#8]"
106- ::"r"(&block[0]) : "memory", "x13","q18");
107+ ::"r"(&block[0]) : "memory", "x13","v18");
108 return block[1].d64;
109 }
110 __attribute__((noinline)) double do_ucvtf_d_w_imm32 ( Int x )
111@@ -111,7 +111,7 @@ __attribute__((noinline)) double do_ucvt
112 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
113 __asm__ __volatile__(
114 "ldr x13,[%0,#0]; ucvtf d18,w13,#32; str d18, [%0,#8]"
115- ::"r"(&block[0]) : "memory", "x13","q18");
116+ ::"r"(&block[0]) : "memory", "x13","v18");
117 return block[1].d64;
118 }
119
120@@ -123,7 +123,7 @@ __attribute__((noinline)) double do_scvt
121 U block[2]; block[0].i64 = x; block[1].i64 = 0;
122 __asm__ __volatile__(
123 "ldr x13,[%0,#0]; scvtf s18,x13,#1; str s18, [%0,#8]"
124- ::"r"(&block[0]) : "memory", "x13","q18");
125+ ::"r"(&block[0]) : "memory", "x13","v18");
126 return (double)block[1].f32[0];
127 }
128 __attribute__((noinline)) double do_scvtf_s_x_imm32 ( Long x )
129@@ -131,7 +131,7 @@ __attribute__((noinline)) double do_scvt
130 U block[2]; block[0].i64 = x; block[1].i64 = 0;
131 __asm__ __volatile__(
132 "ldr x13,[%0,#0]; scvtf s18,x13,#32; str s18, [%0,#8]"
133- ::"r"(&block[0]) : "memory", "x13","q18");
134+ ::"r"(&block[0]) : "memory", "x13","v18");
135 return (double)block[1].f32[0];
136 }
137 __attribute__((noinline)) double do_scvtf_s_x_imm64 ( Long x )
138@@ -139,7 +139,7 @@ __attribute__((noinline)) double do_scvt
139 U block[2]; block[0].i64 = x; block[1].i64 = 0;
140 __asm__ __volatile__(
141 "ldr x13,[%0,#0]; scvtf s18,x13,#64; str s18, [%0,#8]"
142- ::"r"(&block[0]) : "memory", "x13","q18");
143+ ::"r"(&block[0]) : "memory", "x13","v18");
144 return (double)block[1].f32[0];
145 }
146
147@@ -148,7 +148,7 @@ __attribute__((noinline)) double do_ucvt
148 U block[2]; block[0].i64 = x; block[1].i64 = 0;
149 __asm__ __volatile__(
150 "ldr x13,[%0,#0]; ucvtf s18,x13,#1; str s18, [%0,#8]"
151- ::"r"(&block[0]) : "memory", "x13","q18");
152+ ::"r"(&block[0]) : "memory", "x13","v18");
153 return (double)block[1].f32[0];
154 }
155 __attribute__((noinline)) double do_ucvtf_s_x_imm32 ( Long x )
156@@ -156,7 +156,7 @@ __attribute__((noinline)) double do_ucvt
157 U block[2]; block[0].i64 = x; block[1].i64 = 0;
158 __asm__ __volatile__(
159 "ldr x13,[%0,#0]; ucvtf s18,x13,#32; str s18, [%0,#8]"
160- ::"r"(&block[0]) : "memory", "x13","q18");
161+ ::"r"(&block[0]) : "memory", "x13","v18");
162 return (double)block[1].f32[0];
163 }
164 __attribute__((noinline)) double do_ucvtf_s_x_imm64 ( Long x )
165@@ -164,7 +164,7 @@ __attribute__((noinline)) double do_ucvt
166 U block[2]; block[0].i64 = x; block[1].i64 = 0;
167 __asm__ __volatile__(
168 "ldr x13,[%0,#0]; ucvtf s18,x13,#64; str s18, [%0,#8]"
169- ::"r"(&block[0]) : "memory", "x13","q18");
170+ ::"r"(&block[0]) : "memory", "x13","v18");
171 return (double)block[1].f32[0];
172 }
173
174@@ -176,7 +176,7 @@ __attribute__((noinline)) double do_scvt
175 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
176 __asm__ __volatile__(
177 "ldr x13,[%0,#0]; scvtf s18,w13,#1; str s18, [%0,#8]"
178- ::"r"(&block[0]) : "memory", "x13","q18");
179+ ::"r"(&block[0]) : "memory", "x13","v18");
180 return (double)block[1].f32[0];
181 }
182 __attribute__((noinline)) double do_scvtf_s_w_imm16 ( Int x )
183@@ -184,7 +184,7 @@ __attribute__((noinline)) double do_scvt
184 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
185 __asm__ __volatile__(
186 "ldr x13,[%0,#0]; scvtf s18,w13,#16; str s18, [%0,#8]"
187- ::"r"(&block[0]) : "memory", "x13","q18");
188+ ::"r"(&block[0]) : "memory", "x13","v18");
189 return (double)block[1].f32[0];
190 }
191 __attribute__((noinline)) double do_scvtf_s_w_imm32 ( Int x )
192@@ -192,7 +192,7 @@ __attribute__((noinline)) double do_scvt
193 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
194 __asm__ __volatile__(
195 "ldr x13,[%0,#0]; scvtf s18,w13,#32; str s18, [%0,#8]"
196- ::"r"(&block[0]) : "memory", "x13","q18");
197+ ::"r"(&block[0]) : "memory", "x13","v18");
198 return (double)block[1].f32[0];
199 }
200
201@@ -201,7 +201,7 @@ __attribute__((noinline)) double do_ucvt
202 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
203 __asm__ __volatile__(
204 "ldr x13,[%0,#0]; ucvtf s18,w13,#1; str s18, [%0,#8]"
205- ::"r"(&block[0]) : "memory", "x13","q18");
206+ ::"r"(&block[0]) : "memory", "x13","v18");
207 return (double)block[1].f32[0];
208 }
209 __attribute__((noinline)) double do_ucvtf_s_w_imm16 ( Int x )
210@@ -209,7 +209,7 @@ __attribute__((noinline)) double do_ucvt
211 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
212 __asm__ __volatile__(
213 "ldr x13,[%0,#0]; ucvtf s18,w13,#16; str s18, [%0,#8]"
214- ::"r"(&block[0]) : "memory", "x13","q18");
215+ ::"r"(&block[0]) : "memory", "x13","v18");
216 return (double)block[1].f32[0];
217 }
218 __attribute__((noinline)) double do_ucvtf_s_w_imm32 ( Int x )
219@@ -217,7 +217,7 @@ __attribute__((noinline)) double do_ucvt
220 U block[2]; block[0].i64 = (Long)x; block[1].i64 = 0;
221 __asm__ __volatile__(
222 "ldr x13,[%0,#0]; ucvtf s18,w13,#32; str s18, [%0,#8]"
223- ::"r"(&block[0]) : "memory", "x13","q18");
224+ ::"r"(&block[0]) : "memory", "x13","v18");
225 return (double)block[1].f32[0];
226 }
227
228diff -up valgrind-3.15.0/none/tests/arm64/fp_and_simd.c.omv~ valgrind-3.15.0/none/tests/arm64/fp_and_simd.c
229--- valgrind-3.15.0/none/tests/arm64/fp_and_simd.c.omv~ 2021-05-31 15:45:55.963884114 +0200
230+++ valgrind-3.15.0/none/tests/arm64/fp_and_simd.c 2021-05-31 16:07:36.437096320 +0200
231@@ -1909,7 +1909,7 @@ void test_SMAXV ( void )
232 __asm__ __volatile__( \
233 "ldr x9, [%0, 48]; msr nzcv, x9; " \
234 "ldr q29, [%0, #0]; ldr q11, [%0, #16]; ldr q9, [%0, #32]; " \
235- "fcmp d29, #0; " \
236+ "fcmp d29, #0.0; " \
237 "mrs x9, nzcv; str x9, [%0, 48]; " \
238 "str q29, [%0, #0]; str q11, [%0, #16]; str q9, [%0, #32]; " \
239 ::"r"(&block[0]) : "x9","cc","memory","v9","v11","v29" \
240@@ -1930,7 +1930,7 @@ void test_SMAXV ( void )
241 __asm__ __volatile__( \
242 "ldr x9, [%0, 48]; msr nzcv, x9; " \
243 "ldr q29, [%0, #0]; ldr q11, [%0, #16]; ldr q9, [%0, #32]; " \
244- "fcmp s29, #0; " \
245+ "fcmp s29, #0.0; " \
246 "mrs x9, nzcv; str x9, [%0, 48]; " \
247 "str q29, [%0, #0]; str q11, [%0, #16]; str q9, [%0, #32]; " \
248 ::"r"(&block[0]) : "x9","cc","memory","v9","v11","v29" \
249@@ -1951,7 +1951,7 @@ void test_SMAXV ( void )
250 __asm__ __volatile__( \
251 "ldr x9, [%0, 48]; msr nzcv, x9; " \
252 "ldr q29, [%0, #0]; ldr q11, [%0, #16]; ldr q9, [%0, #32]; " \
253- "fcmpe d29, #0; " \
254+ "fcmpe d29, #0.0; " \
255 "mrs x9, nzcv; str x9, [%0, 48]; " \
256 "str q29, [%0, #0]; str q11, [%0, #16]; str q9, [%0, #32]; " \
257 ::"r"(&block[0]) : "x9","cc","memory","v9","v11","v29" \
258@@ -1972,7 +1972,7 @@ void test_SMAXV ( void )
259 __asm__ __volatile__( \
260 "ldr x9, [%0, 48]; msr nzcv, x9; " \
261 "ldr q29, [%0, #0]; ldr q11, [%0, #16]; ldr q9, [%0, #32]; " \
262- "fcmpe s29, #0; " \
263+ "fcmpe s29, #0.0; " \
264 "mrs x9, nzcv; str x9, [%0, 48]; " \
265 "str q29, [%0, #0]; str q11, [%0, #16]; str q9, [%0, #32]; " \
266 ::"r"(&block[0]) : "x9","cc","memory","v9","v11","v29" \
267@@ -3054,8 +3054,8 @@ GEN_BINARY_TEST(mul, 16b, 16b, 16b)
268 GEN_BINARY_TEST(mul, 8b, 8b, 8b)
269
270 /* overkill -- don't need two vecs, only one */
271-GEN_TWOVEC_TEST(movi_16b_0x9C_lsl0, "movi v22.16b, #0x9C, LSL #0", 22, 23)
272-GEN_TWOVEC_TEST(movi_8b_0x8B_lsl0, "movi v22.8b, #0x8B, LSL #0", 22, 23)
273+GEN_TWOVEC_TEST(movi_16b_0x9C_lsl0, "movi v22.16b, #0x9C", 22, 23)
274+GEN_TWOVEC_TEST(movi_8b_0x8B_lsl0, "movi v22.8b, #0x8B", 22, 23)
275
276 GEN_TWOVEC_TEST(movi_8h_0x5A_lsl0, "movi v22.8h, #0x5A, LSL #0", 22, 23)
277 GEN_TWOVEC_TEST(movi_8h_0xA5_lsl8, "movi v22.8h, #0xA5, LSL #8", 22, 23)
278diff -up valgrind-3.15.0/none/tests/arm64/integer.c.omv~ valgrind-3.15.0/none/tests/arm64/integer.c
279--- valgrind-3.15.0/none/tests/arm64/integer.c.omv~ 2021-05-31 16:37:19.140073620 +0200
280+++ valgrind-3.15.0/none/tests/arm64/integer.c 2021-05-31 16:47:04.202303084 +0200
281@@ -9354,23 +9354,23 @@ printf("ADD/SUB(extended reg)(64)\n");
282 #define NN8 0x2e10f2a4055bec0e
283 #define NN9 0x77f3b8dcc730b96a
284
285-TESTINST3("add x21,x22,x23,uxtb #0", NN0, NN1, x21,x22,x23,0);
286-TESTINST3("add x21,x22,x23,uxtb #1", NN2, NN3, x21,x22,x23,0);
287-TESTINST3("add x21,x22,x23,uxtb #2", NN4, NN5, x21,x22,x23,0);
288-TESTINST3("add x21,x22,x23,uxtb #3", NN6, NN7, x21,x22,x23,0);
289-TESTINST3("add x21,x22,x23,uxtb #4", NN8, NN9, x21,x22,x23,0);
290-
291-TESTINST3("add x21,x22,x23,uxth #0", NN0, NN1, x21,x22,x23,0);
292-TESTINST3("add x21,x22,x23,uxth #1", NN2, NN3, x21,x22,x23,0);
293-TESTINST3("add x21,x22,x23,uxth #2", NN4, NN5, x21,x22,x23,0);
294-TESTINST3("add x21,x22,x23,uxth #3", NN6, NN7, x21,x22,x23,0);
295-TESTINST3("add x21,x22,x23,uxth #4", NN8, NN9, x21,x22,x23,0);
296-
297-TESTINST3("add x21,x22,x23,uxtw #0", NN0, NN1, x21,x22,x23,0);
298-TESTINST3("add x21,x22,x23,uxtw #1", NN2, NN3, x21,x22,x23,0);
299-TESTINST3("add x21,x22,x23,uxtw #2", NN4, NN5, x21,x22,x23,0);
300-TESTINST3("add x21,x22,x23,uxtw #3", NN6, NN7, x21,x22,x23,0);
301-TESTINST3("add x21,x22,x23,uxtw #4", NN8, NN9, x21,x22,x23,0);
302+TESTINST3("add x21,x22,w23,uxtb #0", NN0, NN1, x21,x22,x23,0);
303+TESTINST3("add x21,x22,w23,uxtb #1", NN2, NN3, x21,x22,x23,0);
304+TESTINST3("add x21,x22,w23,uxtb #2", NN4, NN5, x21,x22,x23,0);
305+TESTINST3("add x21,x22,w23,uxtb #3", NN6, NN7, x21,x22,x23,0);
306+TESTINST3("add x21,x22,w23,uxtb #4", NN8, NN9, x21,x22,x23,0);
307+
308+TESTINST3("add x21,x22,w23,uxth #0", NN0, NN1, x21,x22,x23,0);
309+TESTINST3("add x21,x22,w23,uxth #1", NN2, NN3, x21,x22,x23,0);
310+TESTINST3("add x21,x22,w23,uxth #2", NN4, NN5, x21,x22,x23,0);
311+TESTINST3("add x21,x22,w23,uxth #3", NN6, NN7, x21,x22,x23,0);
312+TESTINST3("add x21,x22,w23,uxth #4", NN8, NN9, x21,x22,x23,0);
313+
314+TESTINST3("add x21,x22,w23,uxtw #0", NN0, NN1, x21,x22,x23,0);
315+TESTINST3("add x21,x22,w23,uxtw #1", NN2, NN3, x21,x22,x23,0);
316+TESTINST3("add x21,x22,w23,uxtw #2", NN4, NN5, x21,x22,x23,0);
317+TESTINST3("add x21,x22,w23,uxtw #3", NN6, NN7, x21,x22,x23,0);
318+TESTINST3("add x21,x22,w23,uxtw #4", NN8, NN9, x21,x22,x23,0);
319
320 TESTINST3("add x21,x22,x23,uxtx #0", NN0, NN1, x21,x22,x23,0);
321 TESTINST3("add x21,x22,x23,uxtx #1", NN2, NN3, x21,x22,x23,0);
322@@ -9378,23 +9378,23 @@ TESTINST3("add x21,x22,x23,uxtx #2", NN4
323 TESTINST3("add x21,x22,x23,uxtx #3", NN6, NN7, x21,x22,x23,0);
324 TESTINST3("add x21,x22,x23,uxtx #4", NN8, NN9, x21,x22,x23,0);
325
326-TESTINST3("add x21,x22,x23,sxtb #0", NN0, NN1, x21,x22,x23,0);
327-TESTINST3("add x21,x22,x23,sxtb #1", NN2, NN3, x21,x22,x23,0);
328-TESTINST3("add x21,x22,x23,sxtb #2", NN4, NN5, x21,x22,x23,0);
329-TESTINST3("add x21,x22,x23,sxtb #3", NN6, NN7, x21,x22,x23,0);
330-TESTINST3("add x21,x22,x23,sxtb #4", NN8, NN9, x21,x22,x23,0);
331-
332-TESTINST3("add x21,x22,x23,sxth #0", NN0, NN1, x21,x22,x23,0);
333-TESTINST3("add x21,x22,x23,sxth #1", NN2, NN3, x21,x22,x23,0);
334-TESTINST3("add x21,x22,x23,sxth #2", NN4, NN5, x21,x22,x23,0);
335-TESTINST3("add x21,x22,x23,sxth #3", NN6, NN7, x21,x22,x23,0);
336-TESTINST3("add x21,x22,x23,sxth #4", NN8, NN9, x21,x22,x23,0);
337-
338-TESTINST3("add x21,x22,x23,sxtw #0", NN0, NN1, x21,x22,x23,0);
339-TESTINST3("add x21,x22,x23,sxtw #1", NN2, NN3, x21,x22,x23,0);
340-TESTINST3("add x21,x22,x23,sxtw #2", NN4, NN5, x21,x22,x23,0);
341-TESTINST3("add x21,x22,x23,sxtw #3", NN6, NN7, x21,x22,x23,0);
342-TESTINST3("add x21,x22,x23,sxtw #4", NN8, NN9, x21,x22,x23,0);
343+TESTINST3("add x21,x22,w23,sxtb #0", NN0, NN1, x21,x22,x23,0);
344+TESTINST3("add x21,x22,w23,sxtb #1", NN2, NN3, x21,x22,x23,0);
345+TESTINST3("add x21,x22,w23,sxtb #2", NN4, NN5, x21,x22,x23,0);
346+TESTINST3("add x21,x22,w23,sxtb #3", NN6, NN7, x21,x22,x23,0);
347+TESTINST3("add x21,x22,w23,sxtb #4", NN8, NN9, x21,x22,x23,0);
348+
349+TESTINST3("add x21,x22,w23,sxth #0", NN0, NN1, x21,x22,x23,0);
350+TESTINST3("add x21,x22,w23,sxth #1", NN2, NN3, x21,x22,x23,0);
351+TESTINST3("add x21,x22,w23,sxth #2", NN4, NN5, x21,x22,x23,0);
352+TESTINST3("add x21,x22,w23,sxth #3", NN6, NN7, x21,x22,x23,0);
353+TESTINST3("add x21,x22,w23,sxth #4", NN8, NN9, x21,x22,x23,0);
354+
355+TESTINST3("add x21,x22,w23,sxtw #0", NN0, NN1, x21,x22,x23,0);
356+TESTINST3("add x21,x22,w23,sxtw #1", NN2, NN3, x21,x22,x23,0);
357+TESTINST3("add x21,x22,w23,sxtw #2", NN4, NN5, x21,x22,x23,0);
358+TESTINST3("add x21,x22,w23,sxtw #3", NN6, NN7, x21,x22,x23,0);
359+TESTINST3("add x21,x22,w23,sxtw #4", NN8, NN9, x21,x22,x23,0);
360
361 TESTINST3("add x21,x22,x23,sxtx #0", NN0, NN1, x21,x22,x23,0);
362 TESTINST3("add x21,x22,x23,sxtx #1", NN2, NN3, x21,x22,x23,0);
363@@ -9403,72 +9403,72 @@ TESTINST3("add x21,x22,x23,sxtx #3", NN6
364 TESTINST3("add x21,x22,x23,sxtx #4", NN8, NN9, x21,x22,x23,0);
365
366
367-TESTINST3("adds x21,x22,x23,uxtb #0", NN0, NN1, x21,x22,x23,0);
368-TESTINST3("adds x21,x22,x23,uxtb #1", NN2, NN3, x21,x22,x23,0);
369-TESTINST3("adds x21,x22,x23,uxtb #2", NN4, NN5, x21,x22,x23,0);
370-TESTINST3("adds x21,x22,x23,uxtb #3", NN6, NN7, x21,x22,x23,0);
371-TESTINST3("adds x21,x22,x23,uxtb #4", NN8, NN9, x21,x22,x23,0);
372-
373-TESTINST3("adds x21,x22,x23,uxth #0", NN0, NN1, x21,x22,x23,0);
374-TESTINST3("adds x21,x22,x23,uxth #1", NN2, NN3, x21,x22,x23,0);
375-TESTINST3("adds x21,x22,x23,uxth #2", NN4, NN5, x21,x22,x23,0);
376-TESTINST3("adds x21,x22,x23,uxth #3", NN6, NN7, x21,x22,x23,0);
377-TESTINST3("adds x21,x22,x23,uxth #4", NN8, NN9, x21,x22,x23,0);
378-
379-TESTINST3("adds x21,x22,x23,uxtw #0", NN0, NN1, x21,x22,x23,0);
380-TESTINST3("adds x21,x22,x23,uxtw #1", NN2, NN3, x21,x22,x23,0);
381-TESTINST3("adds x21,x22,x23,uxtw #2", NN4, NN5, x21,x22,x23,0);
382-TESTINST3("adds x21,x22,x23,uxtw #3", NN6, NN7, x21,x22,x23,0);
383-TESTINST3("adds x21,x22,x23,uxtw #4", NN8, NN9, x21,x22,x23,0);
384-
385-TESTINST3("adds x21,x22,x23,uxtx #0", NN0, NN1, x21,x22,x23,0);
386-TESTINST3("adds x21,x22,x23,uxtx #1", NN2, NN3, x21,x22,x23,0);
387-TESTINST3("adds x21,x22,x23,uxtx #2", NN4, NN5, x21,x22,x23,0);
388-TESTINST3("adds x21,x22,x23,uxtx #3", NN6, NN7, x21,x22,x23,0);
389-TESTINST3("adds x21,x22,x23,uxtx #4", NN8, NN9, x21,x22,x23,0);
390-
391-TESTINST3("adds x21,x22,x23,sxtb #0", NN0, NN1, x21,x22,x23,0);
392-TESTINST3("adds x21,x22,x23,sxtb #1", NN2, NN3, x21,x22,x23,0);
393-TESTINST3("adds x21,x22,x23,sxtb #2", NN4, NN5, x21,x22,x23,0);
394-TESTINST3("adds x21,x22,x23,sxtb #3", NN6, NN7, x21,x22,x23,0);
395-TESTINST3("adds x21,x22,x23,sxtb #4", NN8, NN9, x21,x22,x23,0);
396-
397-TESTINST3("adds x21,x22,x23,sxth #0", NN0, NN1, x21,x22,x23,0);
398-TESTINST3("adds x21,x22,x23,sxth #1", NN2, NN3, x21,x22,x23,0);
399-TESTINST3("adds x21,x22,x23,sxth #2", NN4, NN5, x21,x22,x23,0);
400-TESTINST3("adds x21,x22,x23,sxth #3", NN6, NN7, x21,x22,x23,0);
401-TESTINST3("adds x21,x22,x23,sxth #4", NN8, NN9, x21,x22,x23,0);
402-
403-TESTINST3("adds x21,x22,x23,sxtw #0", NN0, NN1, x21,x22,x23,0);
404-TESTINST3("adds x21,x22,x23,sxtw #1", NN2, NN3, x21,x22,x23,0);
405-TESTINST3("adds x21,x22,x23,sxtw #2", NN4, NN5, x21,x22,x23,0);
406-TESTINST3("adds x21,x22,x23,sxtw #3", NN6, NN7, x21,x22,x23,0);
407-TESTINST3("adds x21,x22,x23,sxtw #4", NN8, NN9, x21,x22,x23,0);
408-
409-TESTINST3("adds x21,x22,x23,sxtx #0", NN0, NN1, x21,x22,x23,0);
410-TESTINST3("adds x21,x22,x23,sxtx #1", NN2, NN3, x21,x22,x23,0);
411-TESTINST3("adds x21,x22,x23,sxtx #2", NN4, NN5, x21,x22,x23,0);
412-TESTINST3("adds x21,x22,x23,sxtx #3", NN6, NN7, x21,x22,x23,0);
413-TESTINST3("adds x21,x22,x23,sxtx #4", NN8, NN9, x21,x22,x23,0);
414-
415-
416-TESTINST3("sub x21,x22,x23,uxtb #0", NN0, NN1, x21,x22,x23,0);
417-TESTINST3("sub x21,x22,x23,uxtb #1", NN2, NN3, x21,x22,x23,0);
418-TESTINST3("sub x21,x22,x23,uxtb #2", NN4, NN5, x21,x22,x23,0);
419-TESTINST3("sub x21,x22,x23,uxtb #3", NN6, NN7, x21,x22,x23,0);
420-TESTINST3("sub x21,x22,x23,uxtb #4", NN8, NN9, x21,x22,x23,0);
421-
422-TESTINST3("sub x21,x22,x23,uxth #0", NN0, NN1, x21,x22,x23,0);
423-TESTINST3("sub x21,x22,x23,uxth #1", NN2, NN3, x21,x22,x23,0);
424-TESTINST3("sub x21,x22,x23,uxth #2", NN4, NN5, x21,x22,x23,0);
425-TESTINST3("sub x21,x22,x23,uxth #3", NN6, NN7, x21,x22,x23,0);
426-TESTINST3("sub x21,x22,x23,uxth #4", NN8, NN9, x21,x22,x23,0);
427-
428-TESTINST3("sub x21,x22,x23,uxtw #0", NN0, NN1, x21,x22,x23,0);
429-TESTINST3("sub x21,x22,x23,uxtw #1", NN2, NN3, x21,x22,x23,0);
430-TESTINST3("sub x21,x22,x23,uxtw #2", NN4, NN5, x21,x22,x23,0);
431-TESTINST3("sub x21,x22,x23,uxtw #3", NN6, NN7, x21,x22,x23,0);
432-TESTINST3("sub x21,x22,x23,uxtw #4", NN8, NN9, x21,x22,x23,0);
433+TESTINST3("adds x21,x22,w23,uxtb #0", NN0, NN1, x21,x22,x23,0);
434+TESTINST3("adds x21,x22,w23,uxtb #1", NN2, NN3, x21,x22,x23,0);
435+TESTINST3("adds x21,x22,w23,uxtb #2", NN4, NN5, x21,x22,x23,0);
436+TESTINST3("adds x21,x22,w23,uxtb #3", NN6, NN7, x21,x22,x23,0);
437+TESTINST3("adds x21,x22,w23,uxtb #4", NN8, NN9, x21,x22,x23,0);
438+
439+TESTINST3("adds x21,x22,w23,uxth #0", NN0, NN1, x21,x22,x23,0);
440+TESTINST3("adds x21,x22,w23,uxth #1", NN2, NN3, x21,x22,x23,0);
441+TESTINST3("adds x21,x22,w23,uxth #2", NN4, NN5, x21,x22,x23,0);
442+TESTINST3("adds x21,x22,w23,uxth #3", NN6, NN7, x21,x22,x23,0);
443+TESTINST3("adds x21,x22,w23,uxth #4", NN8, NN9, x21,x22,x23,0);
444+
445+TESTINST3("adds x21,x22,w23,uxtw #0", NN0, NN1, x21,x22,x23,0);
446+TESTINST3("adds x21,x22,w23,uxtw #1", NN2, NN3, x21,x22,x23,0);
447+TESTINST3("adds x21,x22,w23,uxtw #2", NN4, NN5, x21,x22,x23,0);
448+TESTINST3("adds x21,x22,w23,uxtw #3", NN6, NN7, x21,x22,x23,0);
449+TESTINST3("adds x21,x22,w23,uxtw #4", NN8, NN9, x21,x22,x23,0);
450+
451+TESTINST3("adds x21,x22,w23,uxtx #0", NN0, NN1, x21,x22,x23,0);
452+TESTINST3("adds x21,x22,w23,uxtx #1", NN2, NN3, x21,x22,x23,0);
453+TESTINST3("adds x21,x22,w23,uxtx #2", NN4, NN5, x21,x22,x23,0);
454+TESTINST3("adds x21,x22,w23,uxtx #3", NN6, NN7, x21,x22,x23,0);
455+TESTINST3("adds x21,x22,w23,uxtx #4", NN8, NN9, x21,x22,x23,0);
456+
457+TESTINST3("adds x21,x22,w23,sxtb #0", NN0, NN1, x21,x22,x23,0);
458+TESTINST3("adds x21,x22,w23,sxtb #1", NN2, NN3, x21,x22,x23,0);
459+TESTINST3("adds x21,x22,w23,sxtb #2", NN4, NN5, x21,x22,x23,0);
460+TESTINST3("adds x21,x22,w23,sxtb #3", NN6, NN7, x21,x22,x23,0);
461+TESTINST3("adds x21,x22,w23,sxtb #4", NN8, NN9, x21,x22,x23,0);
462+
463+TESTINST3("adds x21,x22,w23,sxth #0", NN0, NN1, x21,x22,x23,0);
464+TESTINST3("adds x21,x22,w23,sxth #1", NN2, NN3, x21,x22,x23,0);
465+TESTINST3("adds x21,x22,w23,sxth #2", NN4, NN5, x21,x22,x23,0);
466+TESTINST3("adds x21,x22,w23,sxth #3", NN6, NN7, x21,x22,x23,0);
467+TESTINST3("adds x21,x22,w23,sxth #4", NN8, NN9, x21,x22,x23,0);
468+
469+TESTINST3("adds x21,x22,w23,sxtw #0", NN0, NN1, x21,x22,x23,0);
470+TESTINST3("adds x21,x22,w23,sxtw #1", NN2, NN3, x21,x22,x23,0);
471+TESTINST3("adds x21,x22,w23,sxtw #2", NN4, NN5, x21,x22,x23,0);
472+TESTINST3("adds x21,x22,w23,sxtw #3", NN6, NN7, x21,x22,x23,0);
473+TESTINST3("adds x21,x22,w23,sxtw #4", NN8, NN9, x21,x22,x23,0);
474+
475+TESTINST3("adds x21,x22,w23,sxtx #0", NN0, NN1, x21,x22,x23,0);
476+TESTINST3("adds x21,x22,w23,sxtx #1", NN2, NN3, x21,x22,x23,0);
477+TESTINST3("adds x21,x22,w23,sxtx #2", NN4, NN5, x21,x22,x23,0);
478+TESTINST3("adds x21,x22,w23,sxtx #3", NN6, NN7, x21,x22,x23,0);
479+TESTINST3("adds x21,x22,w23,sxtx #4", NN8, NN9, x21,x22,x23,0);
480+
481+
482+TESTINST3("sub x21,x22,w23,uxtb #0", NN0, NN1, x21,x22,x23,0);
483+TESTINST3("sub x21,x22,w23,uxtb #1", NN2, NN3, x21,x22,x23,0);
484+TESTINST3("sub x21,x22,w23,uxtb #2", NN4, NN5, x21,x22,x23,0);
485+TESTINST3("sub x21,x22,w23,uxtb #3", NN6, NN7, x21,x22,x23,0);
486+TESTINST3("sub x21,x22,w23,uxtb #4", NN8, NN9, x21,x22,x23,0);
487+
488+TESTINST3("sub x21,x22,w23,uxth #0", NN0, NN1, x21,x22,x23,0);
489+TESTINST3("sub x21,x22,w23,uxth #1", NN2, NN3, x21,x22,x23,0);
490+TESTINST3("sub x21,x22,w23,uxth #2", NN4, NN5, x21,x22,x23,0);
491+TESTINST3("sub x21,x22,w23,uxth #3", NN6, NN7, x21,x22,x23,0);
492+TESTINST3("sub x21,x22,w23,uxth #4", NN8, NN9, x21,x22,x23,0);
493+
494+TESTINST3("sub x21,x22,w23,uxtw #0", NN0, NN1, x21,x22,x23,0);
495+TESTINST3("sub x21,x22,w23,uxtw #1", NN2, NN3, x21,x22,x23,0);
496+TESTINST3("sub x21,x22,w23,uxtw #2", NN4, NN5, x21,x22,x23,0);
497+TESTINST3("sub x21,x22,w23,uxtw #3", NN6, NN7, x21,x22,x23,0);
498+TESTINST3("sub x21,x22,w23,uxtw #4", NN8, NN9, x21,x22,x23,0);
499
500 TESTINST3("sub x21,x22,x23,uxtx #0", NN0, NN1, x21,x22,x23,0);
501 TESTINST3("sub x21,x22,x23,uxtx #1", NN2, NN3, x21,x22,x23,0);
502@@ -9476,23 +9476,23 @@ TESTINST3("sub x21,x22,x23,uxtx #2", NN4
503 TESTINST3("sub x21,x22,x23,uxtx #3", NN6, NN7, x21,x22,x23,0);
504 TESTINST3("sub x21,x22,x23,uxtx #4", NN8, NN9, x21,x22,x23,0);
505
506-TESTINST3("sub x21,x22,x23,sxtb #0", NN0, NN1, x21,x22,x23,0);
507-TESTINST3("sub x21,x22,x23,sxtb #1", NN2, NN3, x21,x22,x23,0);
508-TESTINST3("sub x21,x22,x23,sxtb #2", NN4, NN5, x21,x22,x23,0);
509-TESTINST3("sub x21,x22,x23,sxtb #3", NN6, NN7, x21,x22,x23,0);
510-TESTINST3("sub x21,x22,x23,sxtb #4", NN8, NN9, x21,x22,x23,0);
511-
512-TESTINST3("sub x21,x22,x23,sxth #0", NN0, NN1, x21,x22,x23,0);
513-TESTINST3("sub x21,x22,x23,sxth #1", NN2, NN3, x21,x22,x23,0);
514-TESTINST3("sub x21,x22,x23,sxth #2", NN4, NN5, x21,x22,x23,0);
515-TESTINST3("sub x21,x22,x23,sxth #3", NN6, NN7, x21,x22,x23,0);
516-TESTINST3("sub x21,x22,x23,sxth #4", NN8, NN9, x21,x22,x23,0);
517-
518-TESTINST3("sub x21,x22,x23,sxtw #0", NN0, NN1, x21,x22,x23,0);
519-TESTINST3("sub x21,x22,x23,sxtw #1", NN2, NN3, x21,x22,x23,0);
520-TESTINST3("sub x21,x22,x23,sxtw #2", NN4, NN5, x21,x22,x23,0);
521-TESTINST3("sub x21,x22,x23,sxtw #3", NN6, NN7, x21,x22,x23,0);
522-TESTINST3("sub x21,x22,x23,sxtw #4", NN8, NN9, x21,x22,x23,0);
523+TESTINST3("sub x21,x22,w23,sxtb #0", NN0, NN1, x21,x22,x23,0);
524+TESTINST3("sub x21,x22,w23,sxtb #1", NN2, NN3, x21,x22,x23,0);
525+TESTINST3("sub x21,x22,w23,sxtb #2", NN4, NN5, x21,x22,x23,0);
526+TESTINST3("sub x21,x22,w23,sxtb #3", NN6, NN7, x21,x22,x23,0);
527+TESTINST3("sub x21,x22,w23,sxtb #4", NN8, NN9, x21,x22,x23,0);
528+
529+TESTINST3("sub x21,x22,w23,sxth #0", NN0, NN1, x21,x22,x23,0);
530+TESTINST3("sub x21,x22,w23,sxth #1", NN2, NN3, x21,x22,x23,0);
531+TESTINST3("sub x21,x22,w23,sxth #2", NN4, NN5, x21,x22,x23,0);
532+TESTINST3("sub x21,x22,w23,sxth #3", NN6, NN7, x21,x22,x23,0);
533+TESTINST3("sub x21,x22,w23,sxth #4", NN8, NN9, x21,x22,x23,0);
534+
535+TESTINST3("sub x21,x22,w23,sxtw #0", NN0, NN1, x21,x22,x23,0);
536+TESTINST3("sub x21,x22,w23,sxtw #1", NN2, NN3, x21,x22,x23,0);
537+TESTINST3("sub x21,x22,w23,sxtw #2", NN4, NN5, x21,x22,x23,0);
538+TESTINST3("sub x21,x22,w23,sxtw #3", NN6, NN7, x21,x22,x23,0);
539+TESTINST3("sub x21,x22,w23,sxtw #4", NN8, NN9, x21,x22,x23,0);
540
541 TESTINST3("sub x21,x22,x23,sxtx #0", NN0, NN1, x21,x22,x23,0);
542 TESTINST3("sub x21,x22,x23,sxtx #1", NN2, NN3, x21,x22,x23,0);
543@@ -9501,53 +9501,53 @@ TESTINST3("sub x21,x22,x23,sxtx #3", NN6
544 TESTINST3("sub x21,x22,x23,sxtx #4", NN8, NN9, x21,x22,x23,0);
545
546
547-TESTINST3("subs x21,x22,x23,uxtb #0", NN0, NN1, x21,x22,x23,0);
548-TESTINST3("subs x21,x22,x23,uxtb #1", NN2, NN3, x21,x22,x23,0);
549-TESTINST3("subs x21,x22,x23,uxtb #2", NN4, NN5, x21,x22,x23,0);
550-TESTINST3("subs x21,x22,x23,uxtb #3", NN6, NN7, x21,x22,x23,0);
551-TESTINST3("subs x21,x22,x23,uxtb #4", NN8, NN9, x21,x22,x23,0);
552-
553-TESTINST3("subs x21,x22,x23,uxth #0", NN0, NN1, x21,x22,x23,0);
554-TESTINST3("subs x21,x22,x23,uxth #1", NN2, NN3, x21,x22,x23,0);
555-TESTINST3("subs x21,x22,x23,uxth #2", NN4, NN5, x21,x22,x23,0);
556-TESTINST3("subs x21,x22,x23,uxth #3", NN6, NN7, x21,x22,x23,0);
557-TESTINST3("subs x21,x22,x23,uxth #4", NN8, NN9, x21,x22,x23,0);
558-
559-TESTINST3("subs x21,x22,x23,uxtw #0", NN0, NN1, x21,x22,x23,0);
560-TESTINST3("subs x21,x22,x23,uxtw #1", NN2, NN3, x21,x22,x23,0);
561-TESTINST3("subs x21,x22,x23,uxtw #2", NN4, NN5, x21,x22,x23,0);
562-TESTINST3("subs x21,x22,x23,uxtw #3", NN6, NN7, x21,x22,x23,0);
563-TESTINST3("subs x21,x22,x23,uxtw #4", NN8, NN9, x21,x22,x23,0);
564-
565-TESTINST3("subs x21,x22,x23,uxtx #0", NN0, NN1, x21,x22,x23,0);
566-TESTINST3("subs x21,x22,x23,uxtx #1", NN2, NN3, x21,x22,x23,0);
567-TESTINST3("subs x21,x22,x23,uxtx #2", NN4, NN5, x21,x22,x23,0);
568-TESTINST3("subs x21,x22,x23,uxtx #3", NN6, NN7, x21,x22,x23,0);
569-TESTINST3("subs x21,x22,x23,uxtx #4", NN8, NN9, x21,x22,x23,0);
570-
571-TESTINST3("subs x21,x22,x23,sxtb #0", NN0, NN1, x21,x22,x23,0);
572-TESTINST3("subs x21,x22,x23,sxtb #1", NN2, NN3, x21,x22,x23,0);
573-TESTINST3("subs x21,x22,x23,sxtb #2", NN4, NN5, x21,x22,x23,0);
574-TESTINST3("subs x21,x22,x23,sxtb #3", NN6, NN7, x21,x22,x23,0);
575-TESTINST3("subs x21,x22,x23,sxtb #4", NN8, NN9, x21,x22,x23,0);
576-
577-TESTINST3("subs x21,x22,x23,sxth #0", NN0, NN1, x21,x22,x23,0);
578-TESTINST3("subs x21,x22,x23,sxth #1", NN2, NN3, x21,x22,x23,0);
579-TESTINST3("subs x21,x22,x23,sxth #2", NN4, NN5, x21,x22,x23,0);
580-TESTINST3("subs x21,x22,x23,sxth #3", NN6, NN7, x21,x22,x23,0);
581-TESTINST3("subs x21,x22,x23,sxth #4", NN8, NN9, x21,x22,x23,0);
582-
583-TESTINST3("subs x21,x22,x23,sxtw #0", NN0, NN1, x21,x22,x23,0);
584-TESTINST3("subs x21,x22,x23,sxtw #1", NN2, NN3, x21,x22,x23,0);
585-TESTINST3("subs x21,x22,x23,sxtw #2", NN4, NN5, x21,x22,x23,0);
586-TESTINST3("subs x21,x22,x23,sxtw #3", NN6, NN7, x21,x22,x23,0);
587-TESTINST3("subs x21,x22,x23,sxtw #4", NN8, NN9, x21,x22,x23,0);
588-
589-TESTINST3("subs x21,x22,x23,sxtx #0", NN0, NN1, x21,x22,x23,0);
590-TESTINST3("subs x21,x22,x23,sxtx #1", NN2, NN3, x21,x22,x23,0);
591-TESTINST3("subs x21,x22,x23,sxtx #2", NN4, NN5, x21,x22,x23,0);
592-TESTINST3("subs x21,x22,x23,sxtx #3", NN6, NN7, x21,x22,x23,0);
593-TESTINST3("subs x21,x22,x23,sxtx #4", NN8, NN9, x21,x22,x23,0);
594+TESTINST3("subs x21,x22,w23,uxtb #0", NN0, NN1, x21,x22,x23,0);
595+TESTINST3("subs x21,x22,w23,uxtb #1", NN2, NN3, x21,x22,x23,0);
596+TESTINST3("subs x21,x22,w23,uxtb #2", NN4, NN5, x21,x22,x23,0);
597+TESTINST3("subs x21,x22,w23,uxtb #3", NN6, NN7, x21,x22,x23,0);
598+TESTINST3("subs x21,x22,w23,uxtb #4", NN8, NN9, x21,x22,x23,0);
599+
600+TESTINST3("subs x21,x22,w23,uxth #0", NN0, NN1, x21,x22,x23,0);
601+TESTINST3("subs x21,x22,w23,uxth #1", NN2, NN3, x21,x22,x23,0);
602+TESTINST3("subs x21,x22,w23,uxth #2", NN4, NN5, x21,x22,x23,0);
603+TESTINST3("subs x21,x22,w23,uxth #3", NN6, NN7, x21,x22,x23,0);
604+TESTINST3("subs x21,x22,w23,uxth #4", NN8, NN9, x21,x22,x23,0);
605+
606+TESTINST3("subs x21,x22,w23,uxtw #0", NN0, NN1, x21,x22,x23,0);
607+TESTINST3("subs x21,x22,w23,uxtw #1", NN2, NN3, x21,x22,x23,0);
608+TESTINST3("subs x21,x22,w23,uxtw #2", NN4, NN5, x21,x22,x23,0);
609+TESTINST3("subs x21,x22,w23,uxtw #3", NN6, NN7, x21,x22,x23,0);
610+TESTINST3("subs x21,x22,w23,uxtw #4", NN8, NN9, x21,x22,x23,0);
611+
612+TESTINST3("subs x21,x22,w23,uxtx #0", NN0, NN1, x21,x22,x23,0);
613+TESTINST3("subs x21,x22,w23,uxtx #1", NN2, NN3, x21,x22,x23,0);
614+TESTINST3("subs x21,x22,w23,uxtx #2", NN4, NN5, x21,x22,x23,0);
615+TESTINST3("subs x21,x22,w23,uxtx #3", NN6, NN7, x21,x22,x23,0);
616+TESTINST3("subs x21,x22,w23,uxtx #4", NN8, NN9, x21,x22,x23,0);
617+
618+TESTINST3("subs x21,x22,w23,sxtb #0", NN0, NN1, x21,x22,x23,0);
619+TESTINST3("subs x21,x22,w23,sxtb #1", NN2, NN3, x21,x22,x23,0);
620+TESTINST3("subs x21,x22,w23,sxtb #2", NN4, NN5, x21,x22,x23,0);
621+TESTINST3("subs x21,x22,w23,sxtb #3", NN6, NN7, x21,x22,x23,0);
622+TESTINST3("subs x21,x22,w23,sxtb #4", NN8, NN9, x21,x22,x23,0);
623+
624+TESTINST3("subs x21,x22,w23,sxth #0", NN0, NN1, x21,x22,x23,0);
625+TESTINST3("subs x21,x22,w23,sxth #1", NN2, NN3, x21,x22,x23,0);
626+TESTINST3("subs x21,x22,w23,sxth #2", NN4, NN5, x21,x22,x23,0);
627+TESTINST3("subs x21,x22,w23,sxth #3", NN6, NN7, x21,x22,x23,0);
628+TESTINST3("subs x21,x22,w23,sxth #4", NN8, NN9, x21,x22,x23,0);
629+
630+TESTINST3("subs x21,x22,w23,sxtw #0", NN0, NN1, x21,x22,x23,0);
631+TESTINST3("subs x21,x22,w23,sxtw #1", NN2, NN3, x21,x22,x23,0);
632+TESTINST3("subs x21,x22,w23,sxtw #2", NN4, NN5, x21,x22,x23,0);
633+TESTINST3("subs x21,x22,w23,sxtw #3", NN6, NN7, x21,x22,x23,0);
634+TESTINST3("subs x21,x22,w23,sxtw #4", NN8, NN9, x21,x22,x23,0);
635+
636+TESTINST3("subs x21,x22,w23,sxtx #0", NN0, NN1, x21,x22,x23,0);
637+TESTINST3("subs x21,x22,w23,sxtx #1", NN2, NN3, x21,x22,x23,0);
638+TESTINST3("subs x21,x22,w23,sxtx #2", NN4, NN5, x21,x22,x23,0);
639+TESTINST3("subs x21,x22,w23,sxtx #3", NN6, NN7, x21,x22,x23,0);
640+TESTINST3("subs x21,x22,w23,sxtx #4", NN8, NN9, x21,x22,x23,0);
641
642
643 ////////////////////////////////////////////////////////////////
diff --git a/recipes-devtools/valgrind/valgrind/builtin_setjmp.patch b/recipes-devtools/valgrind/valgrind/builtin_setjmp.patch
new file mode 100644
index 0000000..daa22da
--- /dev/null
+++ b/recipes-devtools/valgrind/valgrind/builtin_setjmp.patch
@@ -0,0 +1,116 @@
1Author: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
2
3Implement VG_MINIMAL_SETJMP in inline assembly for OHOS/arm64
4
5Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
6Upstream-Status: Pending
7
8Based on patch from Android NDK:
9
10commit cebc9a058d2048e8233ee3eeb510e19b8772909f
11Author: Benoit Jacob <benoitjacob@google.com>
12Date: Wed May 29 21:15:53 2019 -0400
13
14 Implement VG_MINIMAL_SETJMP in inline assembly on Android/arm64
15 because __builtin_setjmp is not implemented in current clang
16 toolchains in current Android NDK.
17
18diff --git a/include/pub_tool_libcsetjmp.h b/include/pub_tool_libcsetjmp.h
19index 681450cef..ccdf295df 100644
20--- a/include/pub_tool_libcsetjmp.h
21+++ b/include/pub_tool_libcsetjmp.h
22@@ -126,6 +126,93 @@ UWord VG_MINIMAL_SETJMP(VG_MINIMAL_JMP_BUF(_env));
23 __attribute__((noreturn))
24 void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env));
25
26+#elif defined __aarch64__
27+
28+// __builtin_setjmp is not implemented by the standard C library
29+// used on Android in current llvm-based toolchains as of NDK r19.
30+//
31+// Here is a custom implementation of Valgrind's "minimal" setjmp
32+// interface. Per the comment at the top of this file, we only need
33+// to save integer registers.
34+//
35+// Per the Procedure Call Standard for the ARM 64-bit Architecture
36+// document,
37+// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf
38+// Section 5.1.1. General-purpose registers:
39+// >
40+// > A subroutine invocation must preserve the contents of the
41+// > registers r19-r29 and SP."
42+//
43+// We also need to save and restore r30, the link register, i.e.
44+// the default destination that a 'ret' instruction branches to.
45+//
46+// Note that this document is phrased in terms of 'r' registers
47+// (e.g. "r30") because it aims to be agnostic as to A64 vs A32
48+// instruction sets, but here we are targeting the A64 instruction
49+// set, so we are dealing with 'x' registers.
50+
51+
52+#define VG_MINIMAL_JMP_BUF(_name) UWord _name [13]
53+
54+__attribute__((returns_twice))
55+inline UWord VG_MINIMAL_SETJMP(VG_MINIMAL_JMP_BUF(_env))
56+{
57+ asm volatile(
58+ // x9 is the first of the regular temporary registers
59+ // per the above-mentioned Procedule Call Standard document.
60+ // Use it as temporary to hold the value of SP, since str does
61+ // not accept SP as operand.
62+ " mov x9, sp \n"
63+ // Store the general-purpose registers that we need to save
64+ // per the above discussion.
65+ // Note that x30 is the link register.
66+ " stp x19, x20, [%[_env], 0] \n"
67+ " stp x21, x22, [%[_env], 0x10] \n"
68+ " stp x23, x24, [%[_env], 0x20] \n"
69+ " stp x25, x26, [%[_env], 0x30] \n"
70+ " stp x27, x28, [%[_env], 0x40] \n"
71+ " stp x29, x30, [%[_env], 0x50] \n"
72+ // Store the value of SP.
73+ " str x9, [%[_env], 0x60] \n"
74+ :
75+ // No outputs
76+ :
77+ // Inputs
78+ [_env]"r"(_env)
79+ :
80+ // Clobbers.
81+ // We have used x9 as a temporary
82+ "x9",
83+ // We have written to memory locations
84+ "memory");
85+
86+ // Direct invokation of setjmp always returns 0.
87+ // The pseudo returning of the value 1 as a return from longjmp
88+ // is implemented in longjmp.
89+ return 0;
90+}
91+
92+#define VG_MINIMAL_LONGJMP(x) \
93+{ \
94+ asm volatile( \
95+ " ldp x19, x20, [%[_env], 0] \n" \
96+ " ldp x21, x22, [%[_env], 0x10] \n" \
97+ " ldp x23, x24, [%[_env], 0x20] \n" \
98+ " ldp x25, x26, [%[_env], 0x30] \n" \
99+ " ldp x27, x28, [%[_env], 0x40] \n" \
100+ " ldp x29, x30, [%[_env], 0x50] \n" \
101+ " ldr x9, [%[_env], 0x60] \n" \
102+ " mov sp, x9 \n" \
103+ " mov x0, 1 \n" \
104+ " ret \n" \
105+ : \
106+ : \
107+ [_env]"r"(x) \
108+ : \
109+ "x9"); \
110+ __builtin_unreachable(); \
111+}
112+
113 #else
114
115 /* The default implementation. */
116
diff --git a/recipes-devtools/valgrind/valgrind_%.bbappend b/recipes-devtools/valgrind/valgrind_%.bbappend
new file mode 100644
index 0000000..2138014
--- /dev/null
+++ b/recipes-devtools/valgrind/valgrind_%.bbappend
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append = " file://builtin_setjmp.patch \
3 file://aarch64-inline-asm-clang.patch"
diff --git a/recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch b/recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch
new file mode 100644
index 0000000..a5bb8de
--- /dev/null
+++ b/recipes-extended/logrotate/logrotate/logrotate-3.15.1-fno-common.patch
@@ -0,0 +1,30 @@
1This patch fixes building logrotate 3.15.1 with modern compilers
2that default to -fno-common (such as clang >= 10, gcc >= 10)
3
4Signed-off-by: Bernhard Rosenkraenzer <bernhard.rosenkraenzer.ext@huawei.com>
5
6diff -up logrotate-3.15.1/logrotate.h.omv~ logrotate-3.15.1/logrotate.h
7--- logrotate-3.15.1/logrotate.h.omv~ 2021-03-18 13:48:57.662529086 +0100
8+++ logrotate-3.15.1/logrotate.h 2021-03-18 13:49:28.983736070 +0100
9@@ -89,7 +89,8 @@ struct logInfo {
10 TAILQ_ENTRY(logInfo) list;
11 };
12
13-TAILQ_HEAD(logInfoHead, logInfo) logs;
14+TAILQ_HEAD(logInfoHead, logInfo);
15+extern struct logInfoHead logs;
16
17 extern int numLogs;
18 extern int debug;
19diff -up logrotate-3.15.1/config.c.omv~ logrotate-3.15.1/config.c
20--- logrotate-3.15.1/config.c.omv~ 2021-03-18 18:22:09.897571389 +0100
21+++ logrotate-3.15.1/config.c 2021-03-18 18:22:24.023660076 +0100
22@@ -32,6 +32,8 @@
23 #include "log.h"
24 #include "logrotate.h"
25
26+struct logInfoHead logs;
27+
28 #if !defined(GLOB_ABORTED) && defined(GLOB_ABEND)
29 #define GLOB_ABORTED GLOB_ABEND
30 #endif
diff --git a/recipes-extended/logrotate/logrotate_%.bbappend b/recipes-extended/logrotate/logrotate_%.bbappend
new file mode 100644
index 0000000..884c4df
--- /dev/null
+++ b/recipes-extended/logrotate/logrotate_%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append = " file://logrotate-3.15.1-fno-common.patch"
diff --git a/recipes-extended/ltp/ltp_%.bbappend b/recipes-extended/ltp/ltp_%.bbappend
new file mode 100644
index 0000000..e9ff911
--- /dev/null
+++ b/recipes-extended/ltp/ltp_%.bbappend
@@ -0,0 +1,4 @@
1# Old versions of ltp assume the compiler defaults to -fcommon
2# This can be removed when moving to a newer version of ltp.
3# The fix is also needed when building with gcc >= 10.
4CFLAGS_append = " -fcommon"
diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend
index ce9c2fa..ddf5305 100644
--- a/recipes-graphics/mesa/mesa_%.bbappend
+++ b/recipes-graphics/mesa/mesa_%.bbappend
@@ -6,5 +6,4 @@ EXTRA_OEMASON_append_toolchain-clang_x86-64 = " -Dasm=false"
6 6
7export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config" 7export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config"
8 8
9PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, clang clang-native \ 9PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, clang clang-native elfutils"
10${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
diff --git a/recipes-kernel/lttng/babeltrace2/babeltrace2-2.0.2-fix-reserved-keywords.patch b/recipes-kernel/lttng/babeltrace2/babeltrace2-2.0.2-fix-reserved-keywords.patch
new file mode 100644
index 0000000..43461fe
--- /dev/null
+++ b/recipes-kernel/lttng/babeltrace2/babeltrace2-2.0.2-fix-reserved-keywords.patch
@@ -0,0 +1,31 @@
1From 790d3e55982df7b21caea7eff97dbd0ebce4f8cd Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bero@lindev.ch>
3Date: Wed, 26 May 2021 05:06:55 +0200
4Subject: [PATCH] ctf-writer: Fix list of reserved keywords
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The missing comma between "void" and "_Bool" causes the compiler to
10treat it as one string ("void_Bool"), missing both "void" and "_Bool"
11as real reserved keywords.
12
13Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
14Upstream-Status: Submitted [https://github.com/efficios/babeltrace/pull/117]
15---
16 src/ctf-writer/utils.c | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/src/ctf-writer/utils.c b/src/ctf-writer/utils.c
20index 0cfb5742b..6c4b0ed8f 100644
21--- a/src/ctf-writer/utils.c
22+++ b/src/ctf-writer/utils.c
23@@ -25,7 +25,7 @@ const char * const reserved_keywords_str[] = {"align", "callsite",
24 "const", "char", "clock", "double", "enum", "env", "event",
25 "floating_point", "float", "integer", "int", "long", "short", "signed",
26 "stream", "string", "struct", "trace", "typealias", "typedef",
27- "unsigned", "variant", "void" "_Bool", "_Complex", "_Imaginary"};
28+ "unsigned", "variant", "void", "_Bool", "_Complex", "_Imaginary"};
29
30 static GHashTable *reserved_keywords_set;
31 static int init_done;
diff --git a/recipes-kernel/lttng/babeltrace2_%.bbappend b/recipes-kernel/lttng/babeltrace2_%.bbappend
new file mode 100644
index 0000000..3f2f08b
--- /dev/null
+++ b/recipes-kernel/lttng/babeltrace2_%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2SRC_URI_append = " file://babeltrace2-2.0.2-fix-reserved-keywords.patch"