summaryrefslogtreecommitdiffstats
path: root/external/meta-clang
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-clang')
-rw-r--r--external/meta-clang/.drone.yml83
-rw-r--r--external/meta-clang/.github/CODEOWNERS1
-rw-r--r--external/meta-clang/.github/ISSUE_TEMPLATE/bug_report.md38
-rw-r--r--external/meta-clang/.github/ISSUE_TEMPLATE/custom.md10
-rw-r--r--external/meta-clang/.github/ISSUE_TEMPLATE/feature_request.md20
-rw-r--r--external/meta-clang/.github/PULL_REQUEST_TEMPLATE.md12
-rw-r--r--external/meta-clang/.gitignore6
-rw-r--r--external/meta-clang/CODE_OF_CONDUCT.md76
-rw-r--r--external/meta-clang/CONTRIBUTING.md7
-rw-r--r--external/meta-clang/README.md88
-rw-r--r--external/meta-clang/classes/clang.bbclass88
-rw-r--r--external/meta-clang/classes/cmake-native.bbclass15
-rw-r--r--external/meta-clang/classes/lto.bbclass7
-rw-r--r--external/meta-clang/classes/scan-build.bbclass51
-rw-r--r--external/meta-clang/conf/layer.conf22
-rw-r--r--external/meta-clang/conf/nonclangable.conf169
-rw-r--r--external/meta-clang/conf/nonscanable.conf22
-rw-r--r--external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-ozone-wayland_%.bbappend5
-rw-r--r--external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-x11_%.bbappend5
-rw-r--r--external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/files/fix_duplicate_pdb_search_init.patch10
-rw-r--r--external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/samba_4.%.bbappend3
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch27
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch176
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch40
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch51
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb47
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb29
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend3
-rw-r--r--external/meta-clang/recipes-connectivity/openssl/openssl_%.bbappend8
-rw-r--r--external/meta-clang/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch183
-rw-r--r--external/meta-clang/recipes-core/busybox/busybox_%.bbappend1
-rw-r--r--external/meta-clang/recipes-core/busybox/busybox_1.31.%.bbappend9
-rw-r--r--external/meta-clang/recipes-core/meta/meta-environment.bbappend9
-rw-r--r--external/meta-clang/recipes-core/musl/musl_%.bbappend11
-rw-r--r--external/meta-clang/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend4
-rw-r--r--external/meta-clang/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend7
-rw-r--r--external/meta-clang/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend7
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang-cross-canadian_git.bb7
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang-cross_git.bb9
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang-crosssdk_git.bb8
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang.inc18
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch56
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch)17
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch28
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch)26
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch27
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch42
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch)42
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch65
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch)19
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch44
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch40
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch)35
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch)19
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch61
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch27
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch)21
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch25
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch)21
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch)26
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch)19
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch)21
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch24
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch40
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch33
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch23
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch32
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch)213
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch24
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch37
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch140
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch41
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch28
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch69
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang_git.bb216
-rw-r--r--external/meta-clang/recipes-devtools/clang/common.inc76
-rw-r--r--external/meta-clang/recipes-devtools/clang/compiler-rt_git.bb88
-rw-r--r--external/meta-clang/recipes-devtools/clang/libcxx_git.bb92
-rw-r--r--external/meta-clang/recipes-devtools/clang/lldb_git.bb57
-rw-r--r--external/meta-clang/recipes-devtools/clang/llvm-common.bb4
-rw-r--r--external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config5
-rw-r--r--external/meta-clang/recipes-devtools/clang/nativesdk-clang-glue.bb16
-rw-r--r--external/meta-clang/recipes-devtools/clang/openmp_git.bb39
-rw-r--r--external/meta-clang/recipes-devtools/gdb/gdb/0001-gdb-Link-with-latomic-for-riscv-clang-alone.patch26
-rw-r--r--external/meta-clang/recipes-devtools/gdb/gdb_%.bbappend3
-rw-r--r--external/meta-clang/recipes-devtools/rpm/rpm_%.bbappend3
-rw-r--r--external/meta-clang/recipes-gnome/gcr/gcr_%.bbappend4
-rw-r--r--external/meta-clang/recipes-graphics/mesa/mesa_%.bbappend9
-rw-r--r--external/meta-clang/recipes-kernel/perf/perf.bbappend1
-rw-r--r--external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg/clang_mips64.patch28
-rw-r--r--external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg_%.bbappend3
-rw-r--r--external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-Disable-fpu-using-code-when-using-clang-mips64-combo.patch40
-rw-r--r--external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav_%.bbappend4
93 files changed, 2520 insertions, 971 deletions
diff --git a/external/meta-clang/.drone.yml b/external/meta-clang/.drone.yml
new file mode 100644
index 00000000..753dacba
--- /dev/null
+++ b/external/meta-clang/.drone.yml
@@ -0,0 +1,83 @@
+kind: pipeline
+type: exec
+name: arm64
+
+platform:
+ os: linux
+ arch: arm64
+
+clone:
+ disable: false
+
+trigger:
+ branch:
+ - dunfell
+ event:
+ - push
+ - pull_request
+
+steps:
+ - name: build
+ commands:
+ - git clone --recurse-submodules -j8 git://github.com/YoeDistro/yoe-distro.git yoe
+ - cd yoe
+ - git checkout -b test origin/dunfell
+ - git pull
+ - git submodule update --recursive --init
+ - rm -rf sources/meta-clang
+ - ln -sf `pwd`/../ sources/meta-clang
+ - export DOCKER_REPO=none
+ - export LANG=en_US.UTF-8
+ - export SSTATE_CACHE_DIR=/scratch/sstate-cache
+ - echo "Started build# $DRONE_BUILD_NUMBER"
+ - echo "sstate cache dir = $SSTATE_CACHE_DIR"
+ - echo "building $DRONE_GIT_HTTP_URL, branch $DRONE_SOURCE_BRANCH"
+ - echo export DOCKER_REPO=none > local.sh
+ - echo export LANG=en_US.UTF-8 >> local.sh
+ - echo export SSTATE_CACHE_DIR=/scratch/sstate-cache >> local.sh
+ - cp conf/local.conf.sample conf/local.conf
+ - echo SSTATE_DIR = \"$SSTATE_CACHE_DIR\" >> conf/local.conf
+ - echo IMAGE_CLASSES += \"testimage testsdk\" >> conf/local.conf
+ - echo INHERIT += \"report-error rm_work blacklist\" >> conf/local.conf
+ - echo ERR_REPORT_SERVER = \"errors.yoctoproject.org\" >> conf/local.conf
+ - echo ERR_REPORT_PORT = \"80\" >> conf/local.conf
+ - echo ERR_REPORT_USERNAME = \"Drone Autobuilder\" >> conf/local.conf
+ - echo ERR_REPORT_EMAIL = \"info@yoedistro.org\" >> conf/local.conf
+ - echo TOOLCHAIN = \"clang\" >> conf/local.conf
+ - echo CLANGSDK = \"1\" >> conf/local.conf
+ - echo IMAGE_INSTALL_append = \" clang \" >> conf/local.conf
+ - echo XZ_DEFAULTS = \"--threads=8\" >> conf/local.conf
+ - echo LICENSE_FLAGS_WHITELIST_append = \" commercial non-commercial\" >> conf/local.conf
+ #- echo TESTIMAGE_AUTO_qemuall = \"1\" >> conf/local.conf
+ - /bin/bash -c ". ./qemux86-64-envsetup.sh && bitbake yoe-debug-image -cpopulate_sdk"
+ - /bin/bash -c ". ./qemux86-64-envsetup.sh && ./sources/openembedded-core/scripts/sstate-cache-management.sh -d -y"
+---
+kind: pipeline
+type: exec
+name: cleanup
+
+platform:
+ os: linux
+ arch: arm64
+
+clone:
+ disable: true
+
+trigger:
+ branch:
+ - dunfell
+ event:
+ - push
+ - pull_request
+ status:
+ - success
+ - failure
+
+steps:
+- name: clean
+ commands:
+ - echo "Deleting tmpdir for build# $DRONE_BUILD_NUMBER"
+ - rm -rf /scratch/tmp-clang-$DRONE_BUILD_NUMBER
+
+depends_on:
+- arm64
diff --git a/external/meta-clang/.github/CODEOWNERS b/external/meta-clang/.github/CODEOWNERS
new file mode 100644
index 00000000..815e8321
--- /dev/null
+++ b/external/meta-clang/.github/CODEOWNERS
@@ -0,0 +1 @@
+* @kraj
diff --git a/external/meta-clang/.github/ISSUE_TEMPLATE/bug_report.md b/external/meta-clang/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..dd84ea78
--- /dev/null
+++ b/external/meta-clang/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/external/meta-clang/.github/ISSUE_TEMPLATE/custom.md b/external/meta-clang/.github/ISSUE_TEMPLATE/custom.md
new file mode 100644
index 00000000..48d5f81f
--- /dev/null
+++ b/external/meta-clang/.github/ISSUE_TEMPLATE/custom.md
@@ -0,0 +1,10 @@
+---
+name: Custom issue template
+about: Describe this issue template's purpose here.
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+
diff --git a/external/meta-clang/.github/ISSUE_TEMPLATE/feature_request.md b/external/meta-clang/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..bbcbbe7d
--- /dev/null
+++ b/external/meta-clang/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/external/meta-clang/.github/PULL_REQUEST_TEMPLATE.md b/external/meta-clang/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..0e5943a1
--- /dev/null
+++ b/external/meta-clang/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,12 @@
+---
+### Contributor checklist
+<!-- For completed items, change [ ] to [x]. -->
+- [ ] Changes have been tested
+- [ ] `Signed-off-by` is present
+- [ ] The PR complies with the [Open Embedded Commit Patch Message Guidelines](http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines)
+
+### Reviewer Guidelines
+- When submitting a review, please pick:
+ - '*Approve*' if this change would be acceptable in the codebase (even if there are minor or cosmetic tweaks that could be improved).
+ - '*Request Changes*' if this change would not be acceptable in our codebase (e.g. bugs, changes that will make development harder in future, security/performance issues, etc).
+ - '*Comment*' if you don't feel you have enough information to decide either way (e.g. if you have major questions, or you don't understand the context of the change sufficiently to fully review yourself, but want to make a comment)
diff --git a/external/meta-clang/.gitignore b/external/meta-clang/.gitignore
new file mode 100644
index 00000000..9f1d873c
--- /dev/null
+++ b/external/meta-clang/.gitignore
@@ -0,0 +1,6 @@
+/*.patch
+*.swp
+*.orig
+*.rej
+*~
+
diff --git a/external/meta-clang/CODE_OF_CONDUCT.md b/external/meta-clang/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..bcec6e11
--- /dev/null
+++ b/external/meta-clang/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at raj.khem@gmail.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/external/meta-clang/CONTRIBUTING.md b/external/meta-clang/CONTRIBUTING.md
new file mode 100644
index 00000000..11d84dea
--- /dev/null
+++ b/external/meta-clang/CONTRIBUTING.md
@@ -0,0 +1,7 @@
+
+# Contributing
+
+You are encouraged to follow Github Pull request workflow
+to share changes and following commit message guidelines are recommended [OE patch guidelines](https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines)
+
+Layer Maintainer: [Khem Raj](<mailto:raj.khem@gmail.com>)
diff --git a/external/meta-clang/README.md b/external/meta-clang/README.md
index 986f77c3..55413965 100644
--- a/external/meta-clang/README.md
+++ b/external/meta-clang/README.md
@@ -1,3 +1,5 @@
+[![Build Status](https://drone.yoedistro.org/api/badges/kraj/meta-clang/status.svg)](https://drone.yoedistro.org/kraj/meta-clang)
+
# meta-clang (a C language family frontend and LLVM compiler backend)
This layer provides [clang/llvm](http://clang.llvm.org/) as alternative to your system
@@ -7,52 +9,74 @@ C/C++ compiler for OpenEmbedded based distributions along with gcc
```shell
git clone git://github.com/openembedded/openembedded-core.git
-cd openembeeded-core
+cd openembedded-core
git clone git://github.com/openembedded/bitbake.git
git clone git://github.com/kraj/meta-clang.git
$ . ./oe-init-build-env
```
-Edit conf/bblayers.conf to add meta-clang to layer mix e.g.
-
-```python
-BBLAYERS ?= " \
- /home/kraj/openembedded-core/meta-clang \
- /home/kraj/openembedded-core/meta \
- "
+Add meta-clang overlay
+```
+bitbake-layers add-layer ../meta-clang
```
+Check `conf/bblayers.conf` to see that meta-clang is added to layer mix e.g.
+
# Default Compiler Switch
Note that by default gcc will remain the system compiler, however if you wish
clang to be the default compiler then set
-```python
+```shell
TOOLCHAIN ?= "clang"
```
-in local.conf, this would now switch to using clang as default compiler systemwide
-you can select clang per package too by writing bbappends for them containing
+in `local.conf`, this would now switch default cross-compiler to be clang
+you can select clang per recipe too by writing bbappends for them containing
-```python
+```shell
TOOLCHAIN = "clang"
```
# Default C++ Standard Library Switch
-Note that by default libstdc++ will remain the default C++ standard library, however if you wish
-libc++ to be the default one then set
+Note that by default clang libc++ is default C++ standard library, however if you wish
+to keep GNU libstdc++ to be the default then set
+
+```shell
+LIBCPLUSPLUS = ""
+```
+
+in `local.conf`.
+You can select libstdc++ per package too by writing bbappends for them containing
+
+```shell
+LIBCPLUSPLUS_toolchain-clang_pn-<recipe> = ""
+```
+
+# Default Compiler Runtime ( Compiler-rt + libc++ )
+
+By default, clang build from meta-clang uses clang runtime ( compiler-rt + libc++ + libunwind ) out of box
+However, it is possible to switch to using gcc runtime as default, In order to do that
+following settings are needed in site configurations e.g. in `local.conf`
+
+```shell
+TOOLCHAIN ?= "clang"
+LIBCPLUSPLUS = ""
+COMPILER_RT = ""
+UNWINDLIB = ""
-```python
-TARGET_CXXFLAGS_append_toolchain-clang ?= " -stdlib=libc++ "
```
-in local.conf.
-You can select libc++ per package too by writing bbappends for them containing
+# Removing clang from generated SDK toolchain
-```python
-TARGET_CXXFLAGS_append_toolchain-clang = " -stdlib=libc++ "
+clang based cross compiler is automatically included into the generated SDK using `bitbake meta-toolchain` or
+`bitbake -cpopulate_sdk <image>` in circumstanced where clang is not expected to be part of SDK, then reset `CLANGSDK`
+variable in `local.conf`
+
+```shell
+CLANGSDK = ""
```
# Building
@@ -60,12 +84,12 @@ TARGET_CXXFLAGS_append_toolchain-clang = " -stdlib=libc++ "
Below we build for qemuarm machine as an example
```shell
-$ MACHINE=qemux86 bitbake core-image-minimal
+$ MACHINE=qemuarm bitbake core-image-full-cmdline
```
# Running
```shell
-$ runqemu qemux86
+$ runqemu nographic
```
# Limitations
@@ -79,15 +103,15 @@ TOOLCHAIN_pn-<recipe> = "gcc"
and OE will start using gcc to cross compile that recipe.
-And if a component does not build with libc++, you can add it to conf/nonclangable.inc e.g.
+And if a component does not build with libc++, you can add it to `conf/nonclangable.inc` e.g.
```shell
-TARGET_CXXFLAGS_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ "
+CXX_remove_pn-<recipe>_toolchain-clang = " -stdlib=libc++ "
```
# Dependencies
-```
+```shell
URI: git://github.com/openembedded/openembedded-core.git
branch: master
revision: HEAD
@@ -97,17 +121,9 @@ branch: master
revision: HEAD
```
-Send pull requests to openembedded-devel@lists.openembedded.org with '[meta-clang]' in the subject'
-
-When sending single patches, please use something like:
-
-'git send-email -M -1 --to openembedded-devel@lists.openembedded.org --subject-prefix=meta-clang][PATCH'
+# Contributing
-You are encouraged to fork the mirror on [github](https://github.com/kraj/meta-clang/)
-to share your patches, this is preferred for patch sets consisting of more than
-one patch. Other services like gitorious, repo.or.cz or self hosted setups are
-of course accepted as well, 'git fetch <remote>' works the same on all of them.
-We recommend github because it is free, easy to use, has been proven to be reliable
-and has a really good web GUI.
+You are encouraged to follow Github Pull request workflow
+to share changes and following commit message guidelines are recommended [OE patch guidelines](https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines)
Layer Maintainer: [Khem Raj](<mailto:raj.khem@gmail.com>)
diff --git a/external/meta-clang/classes/clang.bbclass b/external/meta-clang/classes/clang.bbclass
index 4d20ff07..a00eef69 100644
--- a/external/meta-clang/classes/clang.bbclass
+++ b/external/meta-clang/classes/clang.bbclass
@@ -1,27 +1,68 @@
# Add the necessary override
+CCACHE_COMPILERCHECK_toolchain-clang = "%compiler% -v"
+HOST_CC_ARCH_prepend_toolchain-clang = "-target ${HOST_SYS} "
CC_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
CXX_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
CPP_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E"
CCLD_toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
-RANLIB_toolchain-clang = "${HOST_PREFIX}ranlib"
-AR_toolchain-clang = "${HOST_PREFIX}ar"
-NM_toolchain-clang = "${HOST_PREFIX}nm"
+RANLIB_toolchain-clang = "${HOST_PREFIX}llvm-ranlib"
+AR_toolchain-clang = "${HOST_PREFIX}llvm-ar"
+NM_toolchain-clang = "${HOST_PREFIX}llvm-nm"
+
+export CLANG_TIDY_toolchain-clang = "${HOST_PREFIX}clang-tidy"
+
+COMPILER_RT ??= "${@bb.utils.contains("RUNTIME", "llvm", "-rtlib=compiler-rt ${UNWINDLIB}", "", d)}"
+COMPILER_RT_powerpc = "--rtlib=libgcc ${UNWINDLIB}"
+COMPILER_RT_armeb = "--rtlib=libgcc ${UNWINDLIB}"
+
+UNWINDLIB ??= "${@bb.utils.contains("RUNTIME", "llvm", "--unwindlib=libgcc", "", d)}"
+UNWINDLIB_riscv64 = "--unwindlib=libgcc"
+UNWINDLIB_riscv32 = "--unwindlib=libgcc"
+UNWINDLIB_powerpc = "--unwindlib=libgcc"
+UNWINDLIB_armeb = "--unwindlib=libgcc"
+
+LIBCPLUSPLUS ??= "${@bb.utils.contains("RUNTIME", "llvm", "--stdlib=libc++", "", d)}"
+
+TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}"
+TUNE_CCARGS_append_toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}"
-THUMB_TUNE_CCARGS_remove_toolchain-clang = "-mthumb-interwork"
TUNE_CCARGS_remove_toolchain-clang = "-meb"
TUNE_CCARGS_remove_toolchain-clang = "-mel"
TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", " -mbig-endian", " -mlittle-endian", d)}"
+# Clang does not yet support big.LITTLE performance tunes, so use the LITTLE for tunes
+TUNE_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"
+TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mtune=cortex-a53", "", d)}"
+TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mtune=cortex-a7", "", d)}"
+TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35", " -mtune=cortex-a35", "", d)}"
+TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortex-a55 cortexa76-cortex-a55", " -mtune=cortex-a55", "", d)}"
+
TUNE_CCARGS_remove_toolchain-clang_powerpc = "-mhard-float"
TUNE_CCARGS_remove_toolchain-clang_powerpc = "-mno-spe"
-TUNE_CCARGS_append_toolchain-clang = " --rtlib=compiler-rt -Wno-error=unused-command-line-argument -Qunused-arguments"
+TUNE_CCARGS_append_toolchain-clang = " -Qunused-arguments"
+TUNE_CCARGS_append_toolchain-clang_libc-musl_powerpc64 = " -mlong-double-64"
+TUNE_CCARGS_append_toolchain-clang_libc-musl_powerpc64le = " -mlong-double-64"
+# usrmerge workaround
+TUNE_CCARGS_append_toolchain-clang = "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-prefix=/usr", "", d)}"
+
+LDFLAGS_append_toolchain-clang_class-nativesdk_x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
+LDFLAGS_append_toolchain-clang_class-nativesdk_x86 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux.so.2"
+LDFLAGS_append_toolchain-clang_class-nativesdk_aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1"
+
+LDFLAGS_toolchain-clang_class-nativesdk = "${BUILDSDK_LDFLAGS} \
+ -Wl,-rpath-link,${STAGING_LIBDIR}/.. \
+ -Wl,-rpath,${libdir}/.. "
-TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
-TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux.so.2"
+# Enable lld globally"
+LDFLAGS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=lld', '', d)}"
# choose between 'gcc' 'clang' an empty '' can be used as well
TOOLCHAIN ??= "gcc"
+# choose between 'gnu' 'llvm'
+RUNTIME ??= "gnu"
+RUNTIME_toolchain-gcc = "gnu"
+RUNTIME_armeb = "gnu"
TOOLCHAIN_class-native = "gcc"
TOOLCHAIN_class-nativesdk = "gcc"
@@ -29,24 +70,35 @@ TOOLCHAIN_class-cross-canadian = "gcc"
TOOLCHAIN_class-crosssdk = "gcc"
TOOLCHAIN_class-cross = "gcc"
-# -fmacro-prefix-map does not exist in clang 7.x
-DEBUG_PREFIX_MAP_toolchain-clang = " "
-
OVERRIDES =. "${@['', 'toolchain-${TOOLCHAIN}:']['${TOOLCHAIN}' != '']}"
-OVERRIDES[vardepsexclude] += "TOOLCHAIN"
+OVERRIDES =. "${@['', 'runtime-${RUNTIME}:']['${RUNTIME}' != '']}"
+OVERRIDES[vardepsexclude] += "TOOLCHAIN RUNTIME"
#DEPENDS_append_toolchain-clang_class-target = " clang-cross-${TARGET_ARCH} "
#DEPENDS_remove_toolchain-clang_allarch = "clang-cross-${TARGET_ARCH}"
-def clang_dep_prepend(d):
+def clang_base_deps(d):
if not d.getVar('INHIBIT_DEFAULT_DEPS', False):
if not oe.utils.inherits(d, 'allarch') :
- return " clang-cross-${TARGET_ARCH} compiler-rt libcxx"
+ ret = " clang-cross-${TARGET_ARCH} virtual/libc "
+ if (d.getVar('COMPILER_RT').find('--rtlib=compiler-rt') != -1):
+ ret += " compiler-rt "
+ else:
+ ret += " libgcc "
+ if (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1):
+ ret += " libcxx "
+ if (d.getVar('LIBCPLUSPLUS').find('--stdlib=libc++') != -1):
+ ret += " libcxx "
+ else:
+ ret += " virtual/${TARGET_PREFIX}compilerlibs "
+ return ret
return ""
-BASEDEPENDS_remove_toolchain-clang_class-target = "virtual/${TARGET_PREFIX}gcc"
-BASEDEPENDS_append_toolchain-clang_class-target = "${@clang_dep_prepend(d)}"
+BASE_DEFAULT_DEPS_toolchain-clang_class-target = "${@clang_base_deps(d)}"
+
+cmake_do_generate_toolchain_file_append_toolchain-clang () {
+ cat >> ${WORKDIR}/toolchain.cmake <<EOF
+set( CMAKE_CLANG_TIDY ${CLANG_TIDY} )
+EOF
+}
-PREFERRED_PROVIDER_libunwind = "libunwind"
-PREFERRED_PROVIDER_libunwind_mipsarch = "libunwind"
-PREFERRED_PROVIDER_libunwind_toolchain-clang = "libcxx"
diff --git a/external/meta-clang/classes/cmake-native.bbclass b/external/meta-clang/classes/cmake-native.bbclass
index 911476e1..116cdd1a 100644
--- a/external/meta-clang/classes/cmake-native.bbclass
+++ b/external/meta-clang/classes/cmake-native.bbclass
@@ -1,10 +1,9 @@
-# We need to unset CCACHE otherwise cmake gets too confused
-CCACHE = ""
-
# Native C/C++ compiler (without cpu arch/tune arguments)
OECMAKE_NATIVE_C_COMPILER ?= "`echo ${BUILD_CC} | sed 's/^\([^ ]*\).*/\1/'`"
OECMAKE_NATIVE_CXX_COMPILER ?= "`echo ${BUILD_CXX} | sed 's/^\([^ ]*\).*/\1/'`"
OECMAKE_NATIVE_AR ?= "${BUILD_AR}"
+OECMAKE_NATIVE_RANLIB ?= "${BUILD_RANLIB}"
+OECMAKE_NATIVE_NM ?= "${BUILD_NM}"
# Native compiler flags
OECMAKE_NATIVE_C_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CFLAGS}"
@@ -24,6 +23,8 @@ set( CMAKE_C_COMPILER ${OECMAKE_NATIVE_C_COMPILER} )
set( CMAKE_CXX_COMPILER ${OECMAKE_NATIVE_CXX_COMPILER} )
set( CMAKE_ASM_COMPILER ${OECMAKE_NATIVE_C_COMPILER} )
set( CMAKE_AR ${OECMAKE_NATIVE_AR} CACHE FILEPATH "Archiver" )
+set( CMAKE_RANLIB ${OECMAKE_NATIVE_RANLIB} CACHE FILEPATH "Archive Indexer" )
+set( CMAKE_NM ${OECMAKE_NATIVE_NM} CACHE FILEPATH "Symbol Lister" )
set( CMAKE_C_FLAGS "${OECMAKE_NATIVE_C_FLAGS}" CACHE STRING "CFLAGS" )
set( CMAKE_CXX_FLAGS "${OECMAKE_NATIVE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
set( CMAKE_ASM_FLAGS "${OECMAKE_NATIVE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
@@ -41,6 +42,14 @@ set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
# Use native cmake modules
list(APPEND CMAKE_MODULE_PATH "${STAGING_DATADIR_NATIVE}/cmake/Modules/")
+
+# add for non /usr/lib libdir, e.g. /usr/lib64
+set( CMAKE_LIBRARY_PATH ${STAGING_BASE_LIBDIR_NATIVE} ${STAGING_LIBDIR_NATIVE})
+
+# add include dir to implicit includes in case it differs from /usr/include
+list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${STAGING_INCDIR_NATIVE})
+list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${STAGING_INCDIR_NATIVE})
+
EOF
}
diff --git a/external/meta-clang/classes/lto.bbclass b/external/meta-clang/classes/lto.bbclass
new file mode 100644
index 00000000..80a3d4da
--- /dev/null
+++ b/external/meta-clang/classes/lto.bbclass
@@ -0,0 +1,7 @@
+# Enable LTO based on global distro settings
+TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', ' -flto=thin -fuse-ld=gold', '', d)}"
+TOOLCHAIN_OPTIONS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'full-lto', ' -flto=full -fuse-ld=gold', '', d)}"
+RANLIB_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib"
+AR_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar"
+NM_toolchain-clang = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm"
+
diff --git a/external/meta-clang/classes/scan-build.bbclass b/external/meta-clang/classes/scan-build.bbclass
index e0de56bb..6d3fe652 100644
--- a/external/meta-clang/classes/scan-build.bbclass
+++ b/external/meta-clang/classes/scan-build.bbclass
@@ -1,33 +1,27 @@
# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
-CFLAGS =+ "${TARGET_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
-CXXFLAGS =+ "${TARGET_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
+EXTRA_ANALYZER_OPTIONS += "-analyze-headers"
+EXTRA_ANALYZER_OPTIONS += "--force-analyze-debug-code"
+SCAN_BUILD ??= "1"
+SCAN_BUILD_class-native = ""
+SCAN_BUILD_class-nativesdk = ""
+SCAN_BUILD_class-cross = ""
+SCAN_BUILD_class-crosssdk = ""
+SCAN_BUILD_class-cross-canadian = ""
-#EXTRA_ANALYZER_OPTIONS ?= "-analyze-headers"
-CLANG_SCAN_ENABLED ??= "1"
#CLANG_SCAN_SERVER_IP ??= "127.0.0.1"
CLANG_SCAN_SERVER_IP ??= "10.0.0.10"
CLANG_SCAN_PORT ??= "8181"
SCAN_RESULTS_DIR ?= "${TMPDIR}/static-scan/${PN}"
-scanbuild_munge_cc_cxx() {
- cc="`echo ${CC} | cut -f1 -d " "`"
- cxx="`echo ${CXX} | cut -f1 -d " "`"
- export CC="${cc}"
- export CXX="${cxx}"
-}
-
-do_configure[prefuncs] += "scanbuild_munge_cc_cxx"
+CCSCAN ?= "${HOST_PREFIX}${TOOLCHAIN}"
+CXXSCAN_toolchain-clang ?= "${HOST_PREFIX}clang++"
+CXXSCAN_toolchain-gcc ?= "${HOST_PREFIX}g++"
do_scanbuild() {
- cc="`echo ${CC} | cut -f1 -d " "`"
- cxx="`echo ${CXX} | cut -f1 -d " "`"
- #mk="scan-build --use-cc=${cc} --use-c++=${cxx} --analyzer-target=${HOST_SYS} --html-title="${BP}" -o ${SCAN_RESULTS_DIR} ${EXTRA_ANALYZER_OPTIONS} make"
- #export MAKE="${mk}"
- export CC="${cc}"
- export CXX="${cxx}"
- scan-build --use-cc=${cc} --use-c++=${cxx} --analyzer-target=${HOST_SYS} --html-title="${BP}" -o ${SCAN_RESULTS_DIR} ${EXTRA_ANALYZER_OPTIONS} ${MAKE} ${EXTRA_OEMAKE}
+ rm -rf ${SCAN_RESULTS_DIR}
+ scan-build --use-cc ${CCSCAN} --use-c++ ${CXXSCAN} --analyzer-target ${HOST_SYS} --html-title ${BP} -o ${SCAN_RESULTS_DIR} ${EXTRA_ANALYZER_OPTIONS} ${MAKE} ${PARALLEL_MAKE} ${EXTRA_OEMAKE}
}
do_scanview() {
@@ -39,7 +33,8 @@ do_scanview() {
}
do_scanview[depends] += "${PN}:do_scanbuild"
-do_scanbuild[cleandirs] += "${SCAN_RESULTS_DIR}"
+do_scanbuild[depends] += "clang-native:do_populate_sysroot"
+#do_scanbuild[cleandirs] += "${SCAN_RESULTS_DIR}"
do_scanbuild[dirs] += "${B}"
do_scanview[dirs] += "${SCAN_RESULTS_DIR}"
#do_build[recrdeptask] += "do_scanbuild"
@@ -48,11 +43,19 @@ do_scanbuild[doc] = "Build and scan static analysis data using clang"
do_scanview[doc] = "Start a webserver to visualize static analysis data"
addtask scanbuild after do_configure before do_compile
-addtask scanview
-
+addtask scanview after do_scanbuild
python () {
- # Remove scanbuild task when scanning is not enabled
- if not(d.getVar('CLANG_SCAN_ENABLED') == "1"):
+ # Remove scanbuild task when scanning is not enabled or recipe does not have do_configure
+ if not(d.getVar('SCAN_BUILD') == "1") or not(d.getVar('TOOLCHAIN') == "clang") or oe.utils.inherits(d, 'allarch'):
for i in ['do_scanbuild', 'do_scanview']:
bb.build.deltask(i, d)
+ else:
+ cflags = d.getVar('CFLAGS', False) + d.getVar('TARGET_CC_ARCH', False) + d.getVar('TOOLCHAIN_OPTIONS', False)
+ cxxflags = d.getVar('CXXFLAGS', False) + d.getVar('TARGET_CC_ARCH', False) + d.getVar('TOOLCHAIN_OPTIONS', False)
+ d.setVar('CFLAGS', cflags)
+ d.setVar('CXXFLAGS', cxxflags)
+ if oe.utils.inherits(d, 'autotools'):
+ cachedvar = d.getVar('CACHED_CONFIGUREVARS', False)
+ cachedvar = cachedvar + " scan-build " + " --analyzer-target " + d.getVar('HOST_SYS', False) + " --use-cc " + d.getVar('CCSCAN', False) + " --use-c++ " + d.getVar('CXXSCAN', False)
+ d.setVar('CACHED_CONFIGUREVARS', cachedvar)
}
diff --git a/external/meta-clang/conf/layer.conf b/external/meta-clang/conf/layer.conf
index a5c666fc..c0a422f4 100644
--- a/external/meta-clang/conf/layer.conf
+++ b/external/meta-clang/conf/layer.conf
@@ -7,17 +7,31 @@ BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
BBFILE_COLLECTIONS += "clang-layer"
BBFILE_PATTERN_clang-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_clang-layer = "7"
-LAYERSERIES_COMPAT_clang-layer = "sumo thud"
+LAYERSERIES_COMPAT_clang-layer = "zeus dunfell"
+LAYERDEPENDS_clang-layer = "core"
BBFILES_DYNAMIC += " \
+ browser-layer:${LAYERDIR}/dynamic-layers/browser-layer/*/*.bb \
+ browser-layer:${LAYERDIR}/dynamic-layers/browser-layer/*/*.bbappend \
openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/*/*/*.bb \
openembedded-layer:${LAYERDIR}/dynamic-layers/openembedded-layer/*/*/*.bbappend \
+ networking-layer:${LAYERDIR}/dynamic-layers/networking-layer/*/*/*.bb \
+ networking-layer:${LAYERDIR}/dynamic-layers/networking-layer/*/*/*.bbappend \
"
-#PREFERRED_PROVIDER_gcc-cross-initial-${TARGET_ARCH}_forcevariable = "clang-cross"
-#PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial_forcevariable = "clang-cross"
PREFERRED_PROVIDER_libgcc-initial = "libgcc-initial"
-
+#PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs_forcevariable = "libcxx"
+PREFERRED_PROVIDER_llvm = "clang"
+PREFERRED_PROVIDER_llvm-native = "clang-native"
+PREFERRED_PROVIDER_nativesdk-llvm = "nativesdk-clang"
INHERIT += "clang"
+# Do not include clang in SDK unless user wants to
+CLANGSDK ??= "0"
+
+LLVMVERSION = "10.0.1"
+
require conf/nonclangable.conf
+require conf/nonscanable.conf
+
+NON_MULTILIB_RECIPES_append = " bcc bpftrace"
diff --git a/external/meta-clang/conf/nonclangable.conf b/external/meta-clang/conf/nonclangable.conf
index 54aa4114..6ef16fec 100644
--- a/external/meta-clang/conf/nonclangable.conf
+++ b/external/meta-clang/conf/nonclangable.conf
@@ -1,4 +1,6 @@
-TOOLCHAIN_pn-aspell = "gcc"
+#babeltrace2: ELF binary /usr/lib/babeltrace2/plugins/babeltrace-plugin-text.so has relocations in .text [textrel]
+TOOLCHAIN_pn-babeltrace2 = "gcc"
+TOOLCHAIN_pn-u-boot = "gcc"
TOOLCHAIN_pn-cpufrequtils = "gcc"
# crash embeds version of gdb which is not buildable with clang
TOOLCHAIN_pn-crash = "gcc"
@@ -14,14 +16,24 @@ TOOLCHAIN_pn-glibc-initial = "gcc"
TOOLCHAIN_pn-glibc-locale = "gcc"
TOOLCHAIN_pn-glibc-mtrace = "gcc"
TOOLCHAIN_pn-glibc-scripts = "gcc"
+TOOLCHAIN_pn-glibc-testsuite = "gcc"
TOOLCHAIN_pn-grub = "gcc"
TOOLCHAIN_pn-grub-efi = "gcc"
+
+#| prelink-rtld: error while loading shared libraries: ld.so.1
+#| /lib64/ld.so.1: No such file or directory
+TOOLCHAIN_pn-gobject-intospection_mips64 = "gcc"
+TOOLCHAIN_pn-avahi_mips64 = "gcc"
+
# VLAs
#| control.c:286:19: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
#| __u32 buffer[cam->max_response_quads];
#| ^
#| 1 error generated.
TOOLCHAIN_pn-libdc1394 = "gcc"
+
+# error: return address can be determined only for current frame
+TOOLCHAIN_pn-libexecinfo_mipsarch = "gcc"
TOOLCHAIN_pn-libgcc = "gcc"
TOOLCHAIN_pn-libgcc-initial = "gcc"
TOOLCHAIN_pn-libgfortran = "gcc"
@@ -31,14 +43,27 @@ TOOLCHAIN_pn-libssp-nonshared = "gcc"
#| cargo:warning=# error "Assumed value of MB_LEN_MAX wrong"
#| cargo:warning= ^
TOOLCHAIN_pn-libstd-rs = "gcc"
+TOOLCHAIN_pn-m4_powerpc = "gcc"
# clang does not have 64bit atomics on mips32
-TOOLCHAIN_pn-mesa_mips = "gcc"
-TOOLCHAIN_pn-mesa_mipsel = "gcc"
+#TOOLCHAIN_pn-mesa_mips = "gcc"
+#TOOLCHAIN_pn-mesa_mipsel = "gcc"
+TOOLCHAIN_pn-mesa_riscv64 = "gcc"
+TOOLCHAIN_pn-mesa_powerpc = "gcc"
+# multiple definition of 'mongo::error_details::isNamedCode<0>'
+TOOLCHAIN_pn-mongodb = "gcc"
+# variant-impl.hpp:309:36: error: 'is_variant' does not name a template but is followed by template arguments
+TOOLCHAIN_pn-omxplayer = "gcc"
+# error: return address can be determined only for current frame
+TOOLCHAIN_pn-openflow_mipsarch = "gcc"
+TOOLCHAIN_pn-opensbi = "gcc"
TOOLCHAIN_pn-openjdk-8 = "gcc"
TOOLCHAIN_pn-openjre-8 = "gcc"
TOOLCHAIN_pn-piglit = "gcc"
TOOLCHAIN_pn-prelink = "gcc"
-TOOLCHAIN_pn-polkit = "gcc"
+# Qemu cant run profile tests run during build
+# | *** stack smashing detected ***: terminated
+# | ./pgo-wrapper: line 3: 3372346 Aborted
+TOOLCHAIN_pn-python3 = "gcc"
# has dpkg source which does not compile
TOOLCHAIN_pn-start-stop-daemon = "gcc"
TOOLCHAIN_pn-syslinux = "gcc"
@@ -71,6 +96,11 @@ TOOLCHAIN_pn-libgcrypt_mips64 = "gcc"
# also see http://lists.llvm.org/pipermail/llvm-dev/2016-October/105997.html
TOOLCHAIN_pn-pixman = "gcc"
+#recipe-sysroot/usr/include/mozjs-60/mozilla/Span.h:634:5: error: statement not allowed in constexpr function
+#| MOZ_RELEASE_ASSERT(aStart <= len && (aLength == dynamic_extent ||
+#| ^
+TOOLCHAIN_pn-polkit = "gcc"
+
#| ./ports/linux/pseudo_wrappers.c:80:14: error: use of unknown builtin '__builtin_apply' [-Wimplicit-function-declaration]
#| void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7);
#| ^
@@ -87,12 +117,8 @@ TOOLCHAIN_pn-pulseaudio_aarch64 = "gcc"
TOOLCHAIN_pn-pulseaudio_armv7ve = "gcc"
TOOLCHAIN_pn-pulseaudio_armv7a = "gcc"
-# clang++ 6.0 crashes during link phase of a shared library
-TOOLCHAIN_pn-wpewebkit = "gcc"
-
-# x264 causes a infinite loop when compiling 1 source file
-#
-TOOLCHAIN_pn-x264_x86 = "gcc"
+# clang++ hangs see https://bugs.llvm.org/show_bug.cgi?id=45134
+DEBUG_FLAGS_remove_pn-sqlite-orm_toolchain-clang = "-g"
#| /usr/src/debug/qemu/2.6.0-r1/qemu-2.6.0/util/bitmap.c:191: undefined reference to `__atomic_fetch_or_4'
#| /usr/src/debug/qemu/2.6.0-r1/qemu-2.6.0/util/bitmap.c:210: undefined reference to `__atomic_fetch_or_4'
@@ -104,15 +130,18 @@ TOOLCHAIN_pn-x264_x86 = "gcc"
# to compile qemu for target
TOOLCHAIN_pn-qemu_arm = "gcc"
-# llvm-profdata fails see
-# | error: Could not read profile code.profd: No such file or directory
-TOOLCHAIN_pn-python3 = "gcc"
-
#| ./dsp/v4f_IIR2.h:554:12: error: no matching function for call to 'v4f_map'
#| a[5] = v4f_map<__builtin_cosf> (f);
#| ^~~~~~~~~~~~~~~~~~~~~~~
TOOLCHAIN_pn-caps = "gcc"
+TOOLCHAIN_pn-lttng-ust_riscv64 = "gcc"
+
+#| ../libffi-3.3-rc0/src/arm/sysv.S: Assembler messages:
+#| ../libffi-3.3-rc0/src/arm/sysv.S:131: Error: selected processor does not support `vldrle d0,[sp]' in ARM mode
+#| ../libffi-3.3-rc0/src/arm/sysv.S:132: Error: selected processor does not support `vldmgt sp,{d0-d7}' in ARM mode
+TOOLCHAIN_pn-libffi_armeb = "gcc"
+
CFLAGS_append_pn-liboil_toolchain-clang_x86-64 = " -fheinous-gnu-extensions "
#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
@@ -124,25 +153,75 @@ CFLAGS_append_pn-mdadm_toolchain-clang = " -Wno-error=unknown-warning-option"
#../libffi-3.2.1/src/arm/sysv.S:363:2: error: invalid instruction, did you mean: fldmiax?
# fldmiadgt ip, {d0-d7}
-CFLAGS_append_pn-libffi_toolchain-clang = " -no-integrated-as"
+CFLAGS_append_pn-libffi_arm_toolchain-clang = " -no-integrated-as"
+
# ../db-5.3.28/src/mutex/mut_tas.c:150:34: error: unknown directive
#<inline asm>:9:2: note: instantiated into assembly here
# .force_thumb
# ^
-CFLAGS_append_pn-db_toolchain-clang = " -no-integrated-as"
+#CFLAGS_append_pn-db_toolchain-clang = " -no-integrated-as"
+#
+#| ../../../DirectFB-1.7.7/lib/direct/armasm_memcpy.S:63:2: error: invalid instruction
+#| ldmgeia r1!, {r3, r4, r12, lr}
+#| ^
+CFLAGS_append_pn-directfb_toolchain-clang_arm = " -no-integrated-as"
# Disable internal assembler for armv7 since it uses gnu assmebly syntax
# which should be preprocessed via gcc/compiler
#
CFLAGS_append_pn-openssl_toolchain-clang_armv7ve = " -no-integrated-as"
CFLAGS_append_pn-openssl_toolchain-clang_armv7a = " -no-integrated-as"
+
+#| crypto/bn/bn-mips.S:671:2: error: unknown instruction, did you mean: bgeu, sgtu, tgeu?
+#| sgeu $1,$4,$6
+#| ^
+CC_append_pn-openssl_toolchain-clang_mipsarch = " -no-integrated-as"
+
CFLAGS_append_pn-userland_toolchain-clang = " -no-integrated-as"
+# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
+# <instantiation>:13:5: error: invalid token in expression
+# .if $17 != 0
+# ^
+CFLAGS_append_pn-libjpeg-turbo_toolchain-clang_mipsarch = " -no-integrated-as"
+
+# arm-yoe-linux-gnueabi-ld: /usr/src/debug/libvorbis/1.3.6-r0/build/lib/../../libvorbis-1.3.6/lib/sharedbook.c:165: undefined reference to `__pow_finite'
+CFLAGS_append_pn-libvorbis_toolchain-clang_armv7ve = " -fno-fast-math"
+CFLAGS_append_pn-mpg123_toolchain-clang_armv7ve = " -fno-fast-math"
+
+#../kexec-tools-2.0.18/purgatory/arch/i386/entry32-16.S:23:2: error: unknown directive
+# .arch i386
+# ^
+CC_append_pn-kexec-tools_toolchain-clang_x86-64 = " -no-integrated-as"
+CC_append_pn-kexec-tools_toolchain-clang_x86 = " -no-integrated-as"
+CC_append_pn-kexec-tools-klibc_toolchain-clang_x86-64 = " -no-integrated-as"
+CC_append_pn-kexec-tools-klibc_toolchain-clang_x86 = " -no-integrated-as"
+
+#| /tmp/x86-sse2-cdb148.s:207:9: error: ambiguous operand size for instruction 'sub'
+#| sub SIZE, 64
+#| ^~~~
+CFLAGS_append_pn-tinymembench_toolchain-clang_x86-64 = " -no-integrated-as"
+CFLAGS_append_pn-tinymembench_toolchain-clang_x86 = " -no-integrated-as"
+CFLAGS_append_pn-tinymembench_toolchain-clang_mipsarch = " -no-integrated-as"
+
+CFLAGS_append_pn-ne10_toolchain-clang_arm = " -no-integrated-as"
+CFLAGS_append_pn-libde265_toolchain-clang_arm = " -no-integrated-as"
+
+# :5 : error: unknown directive
+#^
+# .endfunc
+# ^
+CFLAGS_append_pn-libsdl2_toolchain-clang_arm = " -no-integrated-as"
+
# regtest.cc:374:39: error: invalid suffix on literal; C++11 requires a
# space between literal and identifier [-Wreserved-user-defined-literal]
#| snprintf_func (buf, sizeof(buf), "%"Q"u", x);
#| ^
+
CXXFLAGS_append_pn-xdelta3_toolchain-clang = " -Wno-error=reserved-user-defined-literal"
+# -fno-tree-vrp is gcc specific
+CXXFLAGS_remove_pn-mozjs_toolchain-clang = "-fno-tree-vrp"
+CFLAGS_remove_pn-mozjs_toolchain-clang = "-fno-tree-vrp"
#memcached.c:6280:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
CPPFLAGS_append_pn-memcached_toolchain-clang = " -Wno-error=embedded-directive"
@@ -153,8 +232,62 @@ CPPFLAGS_append_pn-memcached_toolchain-clang = " -Wno-error=embedded-directive"
#| clang-7: error: assembler command failed with exit code 1 (use -v to see invocation)
TUNE_CCARGS_remove_pn-upm_toolchain-clang = "-no-integrated-as"
TUNE_CCARGS_remove_pn-omxplayer_toolchain-clang = "-no-integrated-as"
+TUNE_CCARGS_remove_pn-nfs-utils_toolchain-clang = "-Qunused-arguments"
+
+# We want to error out when -msse option is used otherwise it enables sse on non-x86 arches
+TUNE_CCARGS_remove_pn-pipewire_toolchain-clang = "-Qunused-arguments"
#| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4'
#| clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
-LDFLAGS_append_pn-ruby_toolchain-clang = " -rtlib=compiler-rt"
-LDFLAGS_append_pn-m4_toolchain-clang = " -rtlib=compiler-rt"
+COMPILER_RT_pn-ruby_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}"
+COMPILER_RT_pn-python3_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}"
+COMPILER_RT_pn-m4_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}"
+COMPILER_RT_pn-cpio_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}"
+COMPILER_RT_pn-webkitgtk_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}"
+COMPILER_RT_pn-wpewebkit_toolchain-clang = "--rtlib=compiler-rt ${UNWINDLIB}"
+COMPILER_RT_remove_pn-m4_powerpc = "--rtlib=compiler-rt"
+COMPILER_RT_remove_pn-ruby_powerpc = "--rtlib=compiler-rt"
+COMPILER_RT_remove_pn-webkitgtk_powerpc = "--rtlib=compiler-rt"
+COMPILER_RT_remove_pn-m4_armeb = "--rtlib=compiler-rt"
+COMPILER_RT_remove_pn-ruby_armeb = "--rtlib=compiler-rt"
+COMPILER_RT_remove_pn-webkitgtk_armeb = "--rtlib=compiler-rt"
+
+LDFLAGS_append_pn-gnutls_toolchain-clang_riscv64 = " -latomic"
+LDFLAGS_append_pn-harfbuzz_toolchain-clang_riscv64 = " -latomic"
+LDFLAGS_append_pn-qtwebengine_toolchain-clang_runtime-gnu_x86 = " -latomic"
+
+# glibc is built with gcc and hence encodes some libgcc specific builtins which are not found
+# when doing static linking with clang using compiler-rt, so use libgcc
+# undefined reference to `__unordtf2'
+COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc"
+COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc"
+COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc"
+COMPILER_RT_pn-tsocks_libc-glibc_toolchain-clang_x86 = "--rtlib=libgcc"
+COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc"
+COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc"
+COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc"
+COMPILER_RT_pn-tsocks_libc-glibc_toolchain-clang_x86-64 = "--rtlib=libgcc"
+
+#(unwind.o): in function `__pthread_unwind':
+#/usr/src/debug/glibc/2.29-r0/git/nptl/unwind.c:121: undefined reference to `_Unwind_ForcedUnwind'
+#clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
+COMPILER_RT_pn-libc-bench_libc-glibc_toolchain-clang_arm = "--rtlib=libgcc"
+COMPILER_RT_pn-aufs-util_libc-glibc_toolchain-clang_arm = "--rtlib=libgcc"
+COMPILER_RT_pn-libhugetlbfs_libc-glibc_toolchain-clang_arm = "--rtlib=libgcc"
+
+RUNTIME_pn-gerbera_toolchain-clang = "llvm"
+
+# Uses gcc for native tools, e.g. nsinstall and passes clang options which fails so
+# let same compiler ( gcc or clang) be native/cross compiler
+# | gcc: error: unrecognized command line option ‘-Qunused-arguments’
+BUILD_CC_pn-nss_toolchain-clang = "clang"
+
+# libnoprofile.c:19:5: error: expected parameter declarator
+# int printf(const char *format, ...) {
+# ^
+# error: non-constant-expression cannot be narrowed from type 'std::chrono::duration<
+#long long, std::ratio<1, 1> >::rep' (aka 'long long') to '__time_t' (aka 'long') in initializer list
+# [-Wc++11-narrowing]
+CXXFLAGS_append_pn-apt_toolchain-clang = " -Wno-c++11-narrowing"
+lcl_maybe_fortify_pn-apt_toolchain-clang = ""
+
diff --git a/external/meta-clang/conf/nonscanable.conf b/external/meta-clang/conf/nonscanable.conf
new file mode 100644
index 00000000..e2b8f5dd
--- /dev/null
+++ b/external/meta-clang/conf/nonscanable.conf
@@ -0,0 +1,22 @@
+SCAN_BUILD_pn-linux-libc-headers = ""
+SCAN_BUILD_pn-update-rc.d = ""
+SCAN_BUILD_pn-initscripts = ""
+SCAN_BUILD_pn-base-files = ""
+SCAN_BUILD_pn-os-release = ""
+SCAN_BUILD_pn-wireless-regdb = ""
+SCAN_BUILD_pn-tzdata = ""
+SCAN_BUILD_pn-qemuwrapper-cross = ""
+SCAN_BUILD_pn-depmodwrapper-cross = ""
+SCAN_BUILD_pn-bluez-firmware-rpidistro = ""
+SCAN_BUILD_pn-udev-rules-rpi = ""
+SCAN_BUILD_pn-shadow-securetty = ""
+SCAN_BUILD_pn-96boards-tools = ""
+SCAN_BUILD_pn-run-postinsts = ""
+SCAN_BUILD_pn-keymaps = ""
+SCAN_BUILD_pn-sysvinit-inittab = ""
+SCAN_BUILD_pn-pi-bluetooth = ""
+SCAN_BUILD_pn-rpi-config = ""
+SCAN_BUILD_pn-bcm2835-bootfiles = ""
+SCAN_BUILD_pn-autoconf-archive = ""
+SCAN_BUILD_pn-compiler-rt = ""
+SCAN_BUILD_pn-libcxx = ""
diff --git a/external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-ozone-wayland_%.bbappend b/external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-ozone-wayland_%.bbappend
new file mode 100644
index 00000000..18055547
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-ozone-wayland_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+GN_ARGS += "use_lld=true use_gold=false"
+
+UNWINDLIB_toolchain-clang = "--unwindlib=libgcc"
diff --git a/external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-x11_%.bbappend b/external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-x11_%.bbappend
new file mode 100644
index 00000000..18055547
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/browser-layer/recipes-browser/chromium-x11_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+GN_ARGS += "use_lld=true use_gold=false"
+
+UNWINDLIB_toolchain-clang = "--unwindlib=libgcc"
diff --git a/external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/files/fix_duplicate_pdb_search_init.patch b/external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/files/fix_duplicate_pdb_search_init.patch
new file mode 100644
index 00000000..e9d88d20
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/files/fix_duplicate_pdb_search_init.patch
@@ -0,0 +1,10 @@
+--- a/source3/wscript_build 2019-03-14 09:03:29.498617250 +0100
++++ b/source3/wscript_build 2019-03-14 09:06:19.824949694 +0100
+@@ -124,7 +124,6 @@
+ '!get_attr_list']
+ private_pdb_match.append('!pdb_nds_*')
+ private_pdb_match.append('!pdb_ldapsam_init*')
+-private_pdb_match.append('!pdb_*_init')
+ private_pdb_match = private_pdb_match + ldapsam_pdb_match
+
+ bld.SAMBA3_LIBRARY('samba-passdb',
diff --git a/external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/samba_4.%.bbappend b/external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/samba_4.%.bbappend
new file mode 100644
index 00000000..dd3c5f9d
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/networking-layer/recipes-connectivity/samba/samba_4.%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " file://fix_duplicate_pdb_search_init.patch "
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch
new file mode 100644
index 00000000..1ca73bae
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch
@@ -0,0 +1,27 @@
+From 9e2415679e41adacc59dd7a426d505232f0b7129 Mon Sep 17 00:00:00 2001
+From: William Findlay <william@williamfindlay.com>
+Date: Wed, 17 Jun 2020 12:07:48 -0400
+Subject: [PATCH 1/2] Add KBUILD_MODNAME flag to default cflags
+
+Upstream-Status: Backported [https://github.com/iovisor/bcc/pull/2974/commits/badd85c58549d0e7f0d536490c41213141e180c5]
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ src/cc/frontends/clang/kbuild_helper.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
+index db5ca7f6..e3aade89 100644
+--- a/src/cc/frontends/clang/kbuild_helper.cc
++++ b/src/cc/frontends/clang/kbuild_helper.cc
+@@ -101,6 +101,7 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
+ cflags->push_back("-D__HAVE_BUILTIN_BSWAP16__");
+ cflags->push_back("-D__HAVE_BUILTIN_BSWAP32__");
+ cflags->push_back("-D__HAVE_BUILTIN_BSWAP64__");
++ cflags->push_back("-DKBUILD_MODNAME=\"bcc\"");
+
+ // If ARCH env variable is set, pass this along.
+ if (archenv)
+--
+2.26.2
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch
new file mode 100644
index 00000000..dd879973
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch
@@ -0,0 +1,176 @@
+From eb8b0487a05d650499b20fdd5edeb6e47c2c17a5 Mon Sep 17 00:00:00 2001
+From: William Findlay <william@williamfindlay.com>
+Date: Wed, 17 Jun 2020 18:59:43 -0400
+Subject: [PATCH 2/2] Delete existing kbuild_modname definitions
+
+Upstream-Status: Backported [https://github.com/iovisor/bcc/pull/2974/commits/a5bdc9c65746389d7072e1e8e583025dde78e91b]
+
+Adjust context
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ examples/networking/xdp/xdp_drop_count.py | 1 -
+ examples/networking/xdp/xdp_macswap_count.py | 1 -
+ examples/networking/xdp/xdp_redirect_cpu.py | 1 -
+ examples/networking/xdp/xdp_redirect_map.py | 1 -
+ tests/python/test_clang.py | 8 --------
+ tools/tcplife.lua | 1 -
+ tools/tcplife.py | 1 -
+ tools/tcpstates.py | 1 -
+ 8 files changed, 15 deletions(-)
+
+diff --git a/examples/networking/xdp/xdp_drop_count.py b/examples/networking/xdp/xdp_drop_count.py
+index f03273e9..512e0a20 100755
+--- a/examples/networking/xdp/xdp_drop_count.py
++++ b/examples/networking/xdp/xdp_drop_count.py
+@@ -52,7 +52,6 @@ else:
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/examples/networking/xdp/xdp_macswap_count.py b/examples/networking/xdp/xdp_macswap_count.py
+index 0e2b21ca..770ce8ca 100755
+--- a/examples/networking/xdp/xdp_macswap_count.py
++++ b/examples/networking/xdp/xdp_macswap_count.py
+@@ -50,7 +50,6 @@ else:
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/examples/networking/xdp/xdp_redirect_cpu.py b/examples/networking/xdp/xdp_redirect_cpu.py
+index 15b0d09b..470079f4 100755
+--- a/examples/networking/xdp/xdp_redirect_cpu.py
++++ b/examples/networking/xdp/xdp_redirect_cpu.py
+@@ -30,7 +30,6 @@ if (cpu_id > max_cpu):
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/examples/networking/xdp/xdp_redirect_map.py b/examples/networking/xdp/xdp_redirect_map.py
+index 4a622723..4936ac1e 100755
+--- a/examples/networking/xdp/xdp_redirect_map.py
++++ b/examples/networking/xdp/xdp_redirect_map.py
+@@ -29,7 +29,6 @@ out_idx = ip.link_lookup(ifname=out_if)[0]
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py
+index 886eebed..648494cf 100755
+--- a/tests/python/test_clang.py
++++ b/tests/python/test_clang.py
+@@ -78,7 +78,6 @@ int count_foo(struct pt_regs *ctx, unsigned long a, unsigned long b) {
+
+ def test_probe_read3(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
+ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+@@ -90,7 +89,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+
+ def test_probe_read4(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
+ int test(struct pt_regs *ctx, struct sk_buff *skb) {
+@@ -102,7 +100,6 @@ int test(struct pt_regs *ctx, struct sk_buff *skb) {
+
+ def test_probe_read_whitelist1(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+ // The below define is in net/tcp.h:
+@@ -120,7 +117,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+
+ def test_probe_read_whitelist2(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+ // The below define is in net/tcp.h:
+@@ -1072,7 +1068,6 @@ int test(struct __sk_buff *ctx) {
+
+ def test_probe_read_return(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) {
+@@ -1088,7 +1083,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
+
+ def test_probe_read_multiple_return(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline u64 error_function() {
+@@ -1109,7 +1103,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
+
+ def test_probe_read_return_expr(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) {
+@@ -1125,7 +1118,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
+
+ def test_probe_read_return_call(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline struct tcphdr *my_skb_transport_header(struct sk_buff *skb) {
+diff --git a/tools/tcplife.lua b/tools/tcplife.lua
+index 3f4f6afd..5e311631 100755
+--- a/tools/tcplife.lua
++++ b/tools/tcplife.lua
+@@ -25,7 +25,6 @@ uint16_t ntohs(uint16_t netshort);
+
+ local program = [[
+ #include <uapi/linux/ptrace.h>
+-#define KBUILD_MODNAME "foo"
+ #include <linux/tcp.h>
+ #include <net/sock.h>
+ #include <bcc/proto.h>
+diff --git a/tools/tcplife.py b/tools/tcplife.py
+index d4e679dd..c2bd8236 100755
+--- a/tools/tcplife.py
++++ b/tools/tcplife.py
+@@ -66,7 +66,6 @@ debug = 0
+ # define BPF program
+ bpf_text = """
+ #include <uapi/linux/ptrace.h>
+-#define KBUILD_MODNAME "foo"
+ #include <linux/tcp.h>
+ #include <net/sock.h>
+ #include <bcc/proto.h>
+diff --git a/tools/tcpstates.py b/tools/tcpstates.py
+index b9a64387..09bbe0ce 100755
+--- a/tools/tcpstates.py
++++ b/tools/tcpstates.py
+@@ -61,7 +61,6 @@ debug = 0
+ # define BPF program
+ bpf_text = """
+ #include <uapi/linux/ptrace.h>
+-#define KBUILD_MODNAME "foo"
+ #include <linux/tcp.h>
+ #include <net/sock.h>
+ #include <bcc/proto.h>
+--
+2.26.2
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch
new file mode 100644
index 00000000..4d71b15e
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch
@@ -0,0 +1,40 @@
+From cb3f032b55b32c50201862b26c76ea18ad37cb39 Mon Sep 17 00:00:00 2001
+From: Ovidiu Panait <ovidiu.panait@windriver.com>
+Date: Thu, 30 Jan 2020 14:19:33 +0200
+Subject: [PATCH] python/CMakeLists.txt: Remove check for host
+ /etc/debian_version
+
+Fix the following error that occurs during do_install when using the native
+version of python3:
+usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
+ or: setup.py --help [cmd1 cmd2 ...]
+ or: setup.py --help-commands
+ or: setup.py cmd --help
+
+error: option --install-layout not recognized
+
+Upstream-status: Innapropriate [oe-specific]
+
+Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
+---
+ src/python/CMakeLists.txt | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
+index fa602397..797e0d14 100644
+--- a/src/python/CMakeLists.txt
++++ b/src/python/CMakeLists.txt
+@@ -5,10 +5,6 @@ if(NOT PYTHON_CMD)
+ set(PYTHON_CMD "python")
+ endif()
+
+-if(EXISTS "/etc/debian_version")
+- set(PYTHON_FLAGS "${PYTHON_FLAGS} --install-layout deb")
+-endif()
+-
+ file(GLOB_RECURSE PYTHON_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.py)
+ file(GLOB_RECURSE PYTHON_INCLUDES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+--
+2.17.1
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
new file mode 100644
index 00000000..f2b1495d
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
@@ -0,0 +1,51 @@
+From 935f7e47f54df1af30f4a1cdfd2f385863ab9dec Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe.he@windriver.com>
+Date: Mon, 15 Jun 2020 07:05:24 +0000
+Subject: [PATCH] tools: opensnoop: snoop do_sys_openat2 for kernel v5.6 and
+ later
+
+Since kernel v5.6, fddb5d430ad9 ("open: introduce openat2(2) syscall"),
+do_sys_openat2 instead of do_sys_open has been used as entry function for open.
+
+Upstream-Status: Inappropriate, upstream context has changed and needs more
+ tweak.
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ tools/opensnoop.py | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/tools/opensnoop.py b/tools/opensnoop.py
+index 6d1388b3..3f7e48a3 100755
+--- a/tools/opensnoop.py
++++ b/tools/opensnoop.py
+@@ -21,6 +21,8 @@ from bcc.utils import printb
+ import argparse
+ from datetime import datetime, timedelta
+ import os
++import platform
++from pkg_resources import parse_version
+
+ # arguments
+ examples = """examples:
+@@ -195,8 +197,15 @@ if debug or args.ebpf:
+
+ # initialize BPF
+ b = BPF(text=bpf_text)
+-b.attach_kprobe(event="do_sys_open", fn_name="trace_entry")
+-b.attach_kretprobe(event="do_sys_open", fn_name="trace_return")
++
++# Since kernel v5.6, do_sys_openat2 instead of do_sys_open has been used as entry function for open
++if parse_version(platform.uname().release.split('-')[0]) > parse_version('5.6.0'):
++ entry = "do_sys_openat2"
++else:
++ entry = "do_sys_open"
++
++b.attach_kprobe(event=entry, fn_name="trace_entry")
++b.attach_kretprobe(event=entry, fn_name="trace_return")
+
+ initial_ts = 0
+
+--
+2.24.1
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb
new file mode 100644
index 00000000..5a628db4
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb
@@ -0,0 +1,47 @@
+SUMMARY = "BPF Compiler Collection (BCC)"
+HOMEPAGE = "https://github.com/iovisor/bcc"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+inherit cmake python3native manpages
+
+DEPENDS += "bison-native \
+ flex-native \
+ elfutils \
+ luajit \
+ clang \
+ "
+
+RDEPENDS_${PN} += "bash python3 python3-core python3-setuptools xz"
+
+SRC_URI = "gitsm://github.com/iovisor/bcc \
+ file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \
+ file://0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch \
+ file://0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch \
+ file://0001-Delete-existing-kbuild_modname-definitions.patch \
+ "
+
+SRCREV = "942227484d3207f6a42103674001ef01fb5335a0"
+
+S = "${WORKDIR}/git"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF,"
+
+EXTRA_OECMAKE = " \
+ -DENABLE_LLVM_SHARED=ON \
+ -DENABLE_CLANG_JIT=ON \
+ -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
+ -DPYTHON_CMD=${PYTHON} \
+ -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \
+"
+
+do_install_append() {
+ sed -e 's@#!/usr/bin/python@#!/usr/bin/env python3@g' \
+ -i $(find ${D}${datadir}/${PN} -type f)
+}
+
+FILES_${PN} += "${PYTHON_SITEPACKAGES_DIR}"
+FILES_${PN}-doc += "${datadir}/${PN}/man"
+
+COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*)-linux"
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
new file mode 100644
index 00000000..ad044fd7
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
@@ -0,0 +1,29 @@
+SUMMARY = "bpftrace"
+HOMEPAGE = "https://github.com/iovisor/bpftrace"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+DEPENDS += "bison-native \
+ flex-native \
+ gzip-native \
+ elfutils \
+ bcc \
+ "
+
+RDEPENDS_${PN} += "bash python3 xz"
+
+SRC_URI = "git://github.com/iovisor/bpftrace \
+ "
+SRCREV = "b1200771b61fd77ed7c5b326e7960d24514dd961"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE = " \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DBUILD_TESTING=OFF \
+"
+
+COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*)-linux"
+COMPATIBLE_HOST_libc-musl = "null"
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend
index 53409624..a1d4585f 100644
--- a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend
@@ -1 +1,4 @@
DEPENDS_append = " clang-native"
+DEPENDS_remove = "llvm-native"
+
+EXCLUDE_FROM_WORLD_forcevariable = ""
diff --git a/external/meta-clang/recipes-connectivity/openssl/openssl_%.bbappend b/external/meta-clang/recipes-connectivity/openssl/openssl_%.bbappend
new file mode 100644
index 00000000..408ac387
--- /dev/null
+++ b/external/meta-clang/recipes-connectivity/openssl/openssl_%.bbappend
@@ -0,0 +1,8 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+LDLIBS_append_toolchain-clang_riscv64 = " -latomic"
+LDLIBS_append_toolchain-clang_riscv32 = " -latomic"
+
+do_configure_prepend_toolchain-clang () {
+ export LDLIBS="${LDLIBS}"
+}
diff --git a/external/meta-clang/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch b/external/meta-clang/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch
new file mode 100644
index 00000000..c14950a5
--- /dev/null
+++ b/external/meta-clang/recipes-core/busybox/busybox/0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch
@@ -0,0 +1,183 @@
+From d941b59087d34cb93053b638c066bf080122e7bb Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 16 Jan 2019 22:39:24 -0800
+Subject: [PATCH] Turn ptr_to_globals and bb_errno to be non const
+
+writing to a const variable is undefined behavior
+
+This is undefined as per (C99 6.7.3 paragraph 5) see [1]
+
+errno and ptr_to_globals is written to in code, this fails with
+segfaults when compiled with clang
+
+unsigned FAST_FUNC bb_strtou(const char *arg, char **endp, int base)
+{
+ unsigned long v;
+ char *endptr;
+
+ if (!endp) endp = &endptr;
+ *endp = (char*) arg;
+
+ if (!isalnum(arg[0])) return ret_ERANGE();
+ errno = 0;
+ v = strtoul(arg, endp, base);
+ if (v > UINT_MAX) return ret_ERANGE();
+ return handle_errors(v, endp);
+ }
+
+without 'const' ( working code )
+
+Dump of assembler code for function bb_strtou:
+ 0x0000555555568298 <+0>: push %rbx
+ 0x0000555555568299 <+1>: sub $0x10,%rsp
+ 0x000055555556829d <+5>: test %rsi,%rsi
+ 0x00005555555682a0 <+8>: lea 0x8(%rsp),%rbx
+ 0x00005555555682a5 <+13>: cmovne %rsi,%rbx
+ 0x00005555555682a9 <+17>: mov %rdi,(%rbx)
+ 0x00005555555682ac <+20>: mov (%rdi),%al
+ 0x00005555555682ae <+22>: lea -0x30(%rax),%ecx
+ 0x00005555555682b1 <+25>: cmp $0xa,%cl
+ 0x00005555555682b4 <+28>: jb 0x5555555682be <bb_strtou+38>
+ 0x00005555555682b6 <+30>: or $0x20,%al
+ 0x00005555555682b8 <+32>: add $0x9f,%al
+ 0x00005555555682ba <+34>: cmp $0x1a,%al
+ 0x00005555555682bc <+36>: jae 0x5555555682dc <bb_strtou+68>
+ 0x00005555555682be <+38>: mov 0x107da3(%rip),%rax # 0x555555670068 <bb_errno>
+=> 0x00005555555682c5 <+45>: movl $0x0,(%rax)
+ 0x00005555555682cb <+51>: mov %rbx,%rsi
+ 0x00005555555682ce <+54>: callq 0x555555564310 <strtoul@plt>
+ 0x00005555555682d3 <+59>: mov %rax,%rcx
+ 0x00005555555682d6 <+62>: shr $0x20,%rcx
+ 0x00005555555682da <+66>: je 0x5555555682f0 <bb_strtou+88>
+ 0x00005555555682dc <+68>: mov 0x107d85(%rip),%rax # 0x555555670068 <bb_errno>
+ 0x00005555555682e3 <+75>: movl $0x22,(%rax)
+ 0x00005555555682e9 <+81>: mov $0xffffffff,%eax
+ 0x00005555555682ee <+86>: jmp 0x5555555682fb <bb_strtou+99>
+ 0x00005555555682f0 <+88>: mov %rax,%rdi
+ 0x00005555555682f3 <+91>: mov %rbx,%rsi
+ 0x00005555555682f6 <+94>: callq 0x5555555681e8 <handle_errors>
+ 0x00005555555682fb <+99>: add $0x10,%rsp
+ 0x00005555555682ff <+103>: pop %rbx
+ 0x0000555555568300 <+104>: retq
+
+here address of bb_errno is valid rax = 0x7ffff7cac6c0
+
+with 'const' ( non-working code )
+
+Dump of assembler code for function bb_strtou:
+ 0x00005555555682a4 <+0>: push %r14
+ 0x00005555555682a6 <+2>: push %rbx
+ 0x00005555555682a7 <+3>: push %rax
+ 0x00005555555682a8 <+4>: test %rsi,%rsi
+ 0x00005555555682ab <+7>: mov %rsp,%rbx
+ 0x00005555555682ae <+10>: cmovne %rsi,%rbx
+ 0x00005555555682b2 <+14>: mov %rdi,(%rbx)
+ 0x00005555555682b5 <+17>: mov (%rdi),%al
+ 0x00005555555682b7 <+19>: lea -0x30(%rax),%ecx
+ 0x00005555555682ba <+22>: cmp $0xa,%cl
+ 0x00005555555682bd <+25>: jb 0x5555555682d6 <bb_strtou+50>
+ 0x00005555555682bf <+27>: or $0x20,%al
+ 0x00005555555682c1 <+29>: add $0x9f,%al
+ 0x00005555555682c3 <+31>: cmp $0x1a,%al
+ 0x00005555555682c5 <+33>: jb 0x5555555682d6 <bb_strtou+50>
+ 0x00005555555682c7 <+35>: mov 0x107d9a(%rip),%rax # 0x555555670068 <bb_errno>
+ 0x00005555555682ce <+42>: movl $0x22,(%rax)
+ 0x00005555555682d4 <+48>: jmp 0x5555555682fc <bb_strtou+88>
+ 0x00005555555682d6 <+50>: mov 0x107d8b(%rip),%r14 # 0x555555670068 <bb_errno>
+=> 0x00005555555682dd <+57>: movl $0x0,(%r14)
+ 0x00005555555682e4 <+64>: mov %rbx,%rsi
+ 0x00005555555682e7 <+67>: callq 0x555555564300 <strtoul@plt>
+ 0x00005555555682ec <+72>: mov %rax,%rcx
+ 0x00005555555682ef <+75>: shr $0x20,%rcx
+ 0x00005555555682f3 <+79>: je 0x555555568303 <bb_strtou+95>
+ 0x00005555555682f5 <+81>: movl $0x22,(%r14)
+ 0x00005555555682fc <+88>: mov $0xffffffff,%eax
+ 0x0000555555568301 <+93>: jmp 0x55555556830e <bb_strtou+106>
+ 0x0000555555568303 <+95>: mov %rax,%rdi
+ 0x0000555555568306 <+98>: mov %rbx,%rsi
+ 0x0000555555568309 <+101>: callq 0x5555555681f4 <handle_errors>
+ 0x000055555556830e <+106>: add $0x8,%rsp
+ 0x0000555555568312 <+110>: pop %rbx
+ 0x0000555555568313 <+111>: pop %r14
+ 0x0000555555568315 <+113>: retq
+
+r14 is 0x0 and writing to this ofcourse ends up in segfault
+
+[1] https://bugs.llvm.org/show_bug.cgi?id=39919
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ coreutils/test.c | 2 +-
+ include/libbb.h | 4 ++--
+ libbb/lineedit.c | 2 +-
+ shell/ash.c | 5 ++---
+ 4 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/coreutils/test.c b/coreutils/test.c
+index 868ffbecb..d11fccf5b 100644
+--- a/coreutils/test.c
++++ b/coreutils/test.c
+@@ -401,7 +401,7 @@ struct test_statics {
+ };
+
+ /* See test_ptr_hack.c */
+-extern struct test_statics *const test_ptr_to_statics;
++extern struct test_statics *test_ptr_to_statics;
+
+ #define S (*test_ptr_to_statics)
+ #define args (S.args )
+diff --git a/include/libbb.h b/include/libbb.h
+index 111d1b790..a52265e77 100644
+--- a/include/libbb.h
++++ b/include/libbb.h
+@@ -341,7 +341,7 @@ struct BUG_off_t_size_is_misdetected {
+ #if defined(__GLIBC__)
+ /* glibc uses __errno_location() to get a ptr to errno */
+ /* We can just memorize it once - no multithreading in busybox :) */
+-extern int *const bb_errno;
++extern int *bb_errno;
+ #undef errno
+ #define errno (*bb_errno)
+ #endif
+@@ -2152,7 +2152,7 @@ struct globals;
+ /* '*const' ptr makes gcc optimize code much better.
+ * Magic prevents ptr_to_globals from going into rodata.
+ * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */
+-extern struct globals *const ptr_to_globals;
++extern struct globals *ptr_to_globals;
+ /* At least gcc 3.4.6 on mipsel system needs optimization barrier */
+ #define barrier() __asm__ __volatile__("":::"memory")
+ #define SET_PTR_TO_GLOBALS(x) do { \
+diff --git a/libbb/lineedit.c b/libbb/lineedit.c
+index fbabc6c12..026c42c4c 100644
+--- a/libbb/lineedit.c
++++ b/libbb/lineedit.c
+@@ -181,7 +181,7 @@ struct lineedit_statics {
+ };
+
+ /* See lineedit_ptr_hack.c */
+-extern struct lineedit_statics *const lineedit_ptr_to_statics;
++extern struct lineedit_statics * lineedit_ptr_to_statics;
+
+ #define S (*lineedit_ptr_to_statics)
+ #define state (S.state )
+diff --git a/shell/ash.c b/shell/ash.c
+index c5588ea66..6f07f7d6d 100644
+--- a/shell/ash.c
++++ b/shell/ash.c
+@@ -297,10 +297,9 @@ typedef long arith_t;
+ * set "-DBB_GLOBAL_CONST=''" in CONFIG_EXTRA_CFLAGS to disable
+ * this optimization.
+ */
+-#ifndef BB_GLOBAL_CONST
+-# define BB_GLOBAL_CONST const
+-#endif
+
++#undef BB_GLOBAL_CONST
++#define BB_GLOBAL_CONST
+
+ /* ============ Hash table sizes. Configurable. */
+
+--
+2.23.0
+
diff --git a/external/meta-clang/recipes-core/busybox/busybox_%.bbappend b/external/meta-clang/recipes-core/busybox/busybox_%.bbappend
deleted file mode 100644
index d7b9ca1d..00000000
--- a/external/meta-clang/recipes-core/busybox/busybox_%.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-ARM_INSTRUCTION_SET_toolchain-clang = "arm"
diff --git a/external/meta-clang/recipes-core/busybox/busybox_1.31.%.bbappend b/external/meta-clang/recipes-core/busybox/busybox_1.31.%.bbappend
new file mode 100644
index 00000000..f26df7e1
--- /dev/null
+++ b/external/meta-clang/recipes-core/busybox/busybox_1.31.%.bbappend
@@ -0,0 +1,9 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI_append_toolchain-clang = "\
+ file://0001-Turn-ptr_to_globals-and-bb_errno-to-be-non-const.patch \
+"
+
+# networking/tls_pstm_sqr_comba.c:514:4: error: inline assembly requires more registers than available
+# SQRADD2(*tmpx++, *tmpy--);
+# ^
+TOOLCHAIN_x86 = "gcc"
diff --git a/external/meta-clang/recipes-core/meta/meta-environment.bbappend b/external/meta-clang/recipes-core/meta/meta-environment.bbappend
index 734a9e65..725a431e 100644
--- a/external/meta-clang/recipes-core/meta/meta-environment.bbappend
+++ b/external/meta-clang/recipes-core/meta/meta-environment.bbappend
@@ -10,7 +10,10 @@ TARGET_CLANGCC_ARCH_remove_powerpc = "-mno-spe"
create_sdk_files_append() {
script=${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
- echo 'export CLANGCC="${TARGET_PREFIX}clang ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export CLANGCXX="${TARGET_PREFIX}clang++ ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
- echo 'export CLANGCPP="${TARGET_PREFIX}clang -E ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
+ if ${@bb.utils.contains('CLANGSDK', '1', 'true', 'false', d)}; then
+ echo 'export CLANGCC="${TARGET_PREFIX}clang ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
+ echo 'export CLANGCXX="${TARGET_PREFIX}clang++ ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
+ echo 'export CLANGCPP="${TARGET_PREFIX}clang -E ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
+ echo 'export CLANG_TIDY_EXE="${TARGET_PREFIX}clang-tidy ${TARGET_CLANGCC_ARCH} --sysroot=$SDKTARGETSYSROOT"' >> $script
+ fi
}
diff --git a/external/meta-clang/recipes-core/musl/musl_%.bbappend b/external/meta-clang/recipes-core/musl/musl_%.bbappend
index c8b9878e..a6a1bf54 100644
--- a/external/meta-clang/recipes-core/musl/musl_%.bbappend
+++ b/external/meta-clang/recipes-core/musl/musl_%.bbappend
@@ -1 +1,12 @@
DEPENDS_append_toolchain-clang = " clang-cross-${TARGET_ARCH}"
+TOOLCHAIN_x86-x32 = "gcc"
+TOOLCHAIN_riscv64 = "gcc"
+TOOLCHAIN_powerpc64 = "gcc"
+
+inherit lto
+
+# workaround until https://bugs.llvm.org/show_bug.cgi?id=44384
+# is fixed
+do_configure_prepend_toolchain-clang () {
+ sed -i -e '/frounding-math/d' ${S}/configure
+}
diff --git a/external/meta-clang/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend b/external/meta-clang/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
index a8e81aa5..0c8ae6c3 100644
--- a/external/meta-clang/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
+++ b/external/meta-clang/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend
@@ -1,3 +1 @@
-NATIVESDKCLANG ?= "nativesdk-clang"
-
-RDEPENDS_${PN} += "${NATIVESDKCLANG}"
+RDEPENDS_${PN} += "${@bb.utils.contains('CLANGSDK', '1', 'nativesdk-clang', '', d)}"
diff --git a/external/meta-clang/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend b/external/meta-clang/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
index dd0f83c6..59f0959b 100644
--- a/external/meta-clang/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
+++ b/external/meta-clang/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bbappend
@@ -1,6 +1 @@
-RRECOMMENDS_${PN} += "\
- libcxx-dev \
- libcxx-staticdev \
- compiler-rt-dev \
- compiler-rt-staticdev \
-"
+RRECOMMENDS_${PN} += "${@bb.utils.contains('CLANGSDK', '1', 'libcxx-dev libcxx-staticdev compiler-rt-dev compiler-rt-staticdev', '', d)}"
diff --git a/external/meta-clang/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend b/external/meta-clang/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend
index 2618d20d..4bbd4ab8 100644
--- a/external/meta-clang/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend
+++ b/external/meta-clang/recipes-core/packagegroups/packagegroup-cross-canadian.bbappend
@@ -1,5 +1,2 @@
-CLANGCROSSCANADIAN ?= "clang-cross-canadian-${TRANSLATED_TARGET_ARCH}"
-CLANGCROSSCANADIAN_riscv64 = ""
-RDEPENDS_${PN} += "\
- ${@all_multilib_tune_values(d, 'CLANGCROSSCANADIAN')} \
-"
+CLANGCROSSCANADIAN = "${@bb.utils.contains('CLANGSDK', '1', 'clang-cross-canadian-${TRANSLATED_TARGET_ARCH}', '', d)}"
+RDEPENDS_${PN} += "${@all_multilib_tune_values(d, 'CLANGCROSSCANADIAN')}"
diff --git a/external/meta-clang/recipes-devtools/clang/clang-cross-canadian_git.bb b/external/meta-clang/recipes-devtools/clang/clang-cross-canadian_git.bb
index 69a7e1fa..b16dbe11 100644
--- a/external/meta-clang/recipes-devtools/clang/clang-cross-canadian_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/clang-cross-canadian_git.bb
@@ -3,8 +3,7 @@
DESCRIPTION = "Clang/LLVM based C/C++ compiler (cross-canadian for ${TARGET_ARCH} target)"
HOMEPAGE = "http://clang.llvm.org/"
-LICENSE = "NCSA"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/NCSA;md5=1b5fdec70ee13ad8a91667f16c1959d7"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
SECTION = "devel"
PN = "clang-cross-canadian-${TRANSLATED_TARGET_ARCH}"
@@ -21,13 +20,13 @@ TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
do_install() {
install -d ${D}${bindir}
- for tool in clang clang++ llvm-profdata llvm-ar llvm-ranlib llvm-nm
+ for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata llvm-ar llvm-ranlib llvm-nm
do
ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
done
}
SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-llvm-ar \
- *-llvm-ranlib *-llvm-nm"
+ *-llvm-ranlib *-llvm-nm *-lld *-ld.lld"
do_install_append() {
cross_canadian_bindirlinks
}
diff --git a/external/meta-clang/recipes-devtools/clang/clang-cross_git.bb b/external/meta-clang/recipes-devtools/clang/clang-cross_git.bb
index 22f177f3..fd8ece58 100644
--- a/external/meta-clang/recipes-devtools/clang/clang-cross_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/clang-cross_git.bb
@@ -3,8 +3,7 @@
DESCRIPTION = "Cross compiler wrappers for LLVM based C/C++ compiler"
HOMEPAGE = "http://clang.llvm.org/"
-LICENSE = "NCSA"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/NCSA;md5=1b5fdec70ee13ad8a91667f16c1959d7"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
SECTION = "devel"
PN = "clang-cross-${TARGET_ARCH}"
@@ -16,17 +15,17 @@ DEPENDS += "clang-native binutils-cross-${TARGET_ARCH}"
do_install() {
install -d ${D}${bindir}
- for tool in clang clang++ llvm-profdata llvm-ar llvm-ranlib llvm-nm
+ for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata llvm-ar llvm-ranlib llvm-nm
do
ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
done
}
+SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-llvm-ar \
+ *-llvm-ranlib *-llvm-nm *-lld *-ld.lld"
SYSROOT_PREPROCESS_FUNCS += "clangcross_sysroot_preprocess"
clangcross_sysroot_preprocess () {
sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
}
-SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-llvm-ar \
- *-llvm-ranlib *-llvm-nm"
PACKAGES = ""
diff --git a/external/meta-clang/recipes-devtools/clang/clang-crosssdk_git.bb b/external/meta-clang/recipes-devtools/clang/clang-crosssdk_git.bb
index ac1dd63a..eaea7659 100644
--- a/external/meta-clang/recipes-devtools/clang/clang-crosssdk_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/clang-crosssdk_git.bb
@@ -3,8 +3,7 @@
DESCRIPTION = "SDK Cross compiler wrappers for LLVM based C/C++ compiler"
HOMEPAGE = "http://clang.llvm.org/"
-LICENSE = "NCSA"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/NCSA;md5=1b5fdec70ee13ad8a91667f16c1959d7"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
SECTION = "devel"
PN = "clang-crosssdk-${TARGET_ARCH}"
@@ -16,15 +15,16 @@ DEPENDS += "clang-native nativesdk-clang-glue virtual/${TARGET_PREFIX}binutils-c
do_install() {
install -d ${D}${bindir}
- for tool in clang clang++ llvm-profdata llvm-ar llvm-ranlib llvm-nm
+ for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata llvm-ar llvm-ranlib llvm-nm
do
ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
done
}
SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-llvm-ar \
- *-llvm-ranlib *-llvm-nm"
+ *-llvm-ranlib *-llvm-nm *-lld *-ld.lld"
sysroot_stage_all () {
sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
}
PACKAGES = ""
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang.inc b/external/meta-clang/recipes-devtools/clang/clang.inc
index e8cf3f26..a99049dc 100644
--- a/external/meta-clang/recipes-devtools/clang/clang.inc
+++ b/external/meta-clang/recipes-devtools/clang/clang.inc
@@ -4,18 +4,20 @@ LLVM_DIR = "llvm${LLVM_RELEASE}"
LLVM_GIT ?= "git://github.com/llvm"
LLVM_GIT_PROTOCOL ?= "https"
-MAJOR_VER = "7"
-MINOR_VER = "1"
-PATCH_VER = "0"
+MAJOR_VER = "10"
+MINOR_VER = "0"
+PATCH_VER = "1"
-SRCREV ?= "4856a9330ee01d30e9e11b6c2f991662b4c04b07"
+SRCREV ?= "ef32c611aa214dea855364efd7ba451ec5ec3f74"
PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}"
BRANCH = "release/${MAJOR_VER}.x"
-LLVMMD5SUM = "c520ed40e11887bb1d24d86f7f5b1f05"
-CLANGMD5SUM = "444af0e124949f07f791f12c928e5994"
-LLDMD5SUM = "f4941ace8ddb3d6cf177fff94966319a"
-LLDBMD5SUM = "b6320ed0b0d00ae661dd94f277bbf024"
+LLVMMD5SUM = "8a15a0759ef07f2682d2ba4b893c9afe"
+CLANGMD5SUM = "ff42885ed2ab98f1ecb8c1fc41205343"
+LLDMD5SUM = "ae7dc7c027b1fa89b5b013d391d3ee2b"
+LLDBMD5SUM = "2e0d44968471fcde980034dbb826bea9"
+
+LLVM_LIBDIR_SUFFIX="${@d.getVar('baselib').replace('lib', '')}"
require common.inc
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch b/external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
deleted file mode 100644
index 2b06da25..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 06033c7fa2d575a9a68b377f5ce9324433c23806 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 21 May 2016 21:52:36 -0700
-Subject: [PATCH 1/8] clang: driver: Use /lib for ldso on OE
-
-OE does not follow the default base_libdir
-that clang has, therefore adjust it for OE
-it wont be able to support multilib since
-in multilib case OE switches the base libdir
-for 64bit to /lib64 instead of /lib
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/Driver/ToolChains/Linux.cpp | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index f8f3623918..e662b6b262 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -566,12 +566,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
- Loader = "ld.so.1";
- break;
- case llvm::Triple::ppc64:
-- LibDir = "lib64";
-+ LibDir = "lib";
- Loader =
- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
- break;
- case llvm::Triple::ppc64le:
-- LibDir = "lib64";
-+ LibDir = "lib";
- Loader =
- (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
- break;
-@@ -593,7 +593,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
- Loader = "ld-linux.so.2";
- break;
- case llvm::Triple::sparcv9:
-- LibDir = "lib64";
-+ LibDir = "lib";
- Loader = "ld-linux.so.2";
- break;
- case llvm::Triple::systemz:
-@@ -607,7 +607,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
- case llvm::Triple::x86_64: {
- bool X32 = Triple.getEnvironment() == llvm::Triple::GNUX32;
-
-- LibDir = X32 ? "libx32" : "lib64";
-+ LibDir = "lib";
- Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
- break;
- }
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch b/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
index c331e7a7..1a606f43 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
@@ -1,7 +1,7 @@
-From fa140ec90e72da40d49301e674c84854fdac804b Mon Sep 17 00:00:00 2001
+From 9f0c90da3de0706e3dd699ed0eb92744d4d9ea80 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 22 May 2017 17:36:16 -0700
-Subject: [PATCH 2/2] lldb: Add -lxml2 to linker cmdline of xml is found
+Subject: [PATCH] lldb: Add -lxml2 to linker cmdline of xml is found
When cross compiling for systems where static libs
for libxml are not available cmake's detection mechanism
@@ -19,13 +19,13 @@ Fixes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- source/Host/CMakeLists.txt | 2 +-
+ lldb/source/Host/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
-index 5a92447ed..22ce6eee4 100644
---- a/source/Host/CMakeLists.txt
-+++ b/source/Host/CMakeLists.txt
+diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
+index 2e9bb402227..bfad6703c65 100644
+--- a/lldb/source/Host/CMakeLists.txt
++++ b/lldb/source/Host/CMakeLists.txt
@@ -149,7 +149,7 @@ if (APPLE)
list(APPEND EXTRA_LIBS xml2)
else ()
@@ -35,6 +35,3 @@ index 5a92447ed..22ce6eee4 100644
endif()
endif ()
if (HAVE_LIBDL)
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch b/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch
deleted file mode 100644
index 1c42931f..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From ff8d7137ed4d62e9db6d31581822a2ce06d5cbc6 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 18 May 2017 23:12:34 -0700
-Subject: [PATCH 1/2] lldb: Include limits.h for PATH_MAX definition
-
-Helps compiling on musl targets
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- source/Utility/FileSpec.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/source/Utility/FileSpec.cpp b/source/Utility/FileSpec.cpp
-index b6952f7e3..2cedf5d90 100644
---- a/source/Utility/FileSpec.cpp
-+++ b/source/Utility/FileSpec.cpp
-@@ -29,7 +29,7 @@
- #include <assert.h> // for assert
- #include <stdio.h> // for size_t, NULL, snpr...
- #include <string.h> // for strcmp
--
-+#include <limits.h> // for PATH_MAX
- using namespace lldb;
- using namespace lldb_private;
-
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch b/external/meta-clang/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
index 297b56d1..65fb23d6 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
@@ -1,4 +1,4 @@
-From a122717a9bc31e0ab44197e743aa466711c4bf79 Mon Sep 17 00:00:00 2001
+From a268e2fb21b30cce26f76536bf133b7a706e460f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 27 Aug 2017 10:37:49 -0700
Subject: [PATCH] libcxxabi: Find libunwind headers when
@@ -13,14 +13,14 @@ LIBCXXABI_LIBUNWIND_INCLUDES if its there in environment
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- CMakeLists.txt | 21 +++++++++++----------
+ libcxxabi/CMakeLists.txt | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index d6648ed..12c02f2 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -434,15 +434,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
+diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
+index 59d99971a76..b0f51ebee3e 100644
+--- a/libcxxabi/CMakeLists.txt
++++ b/libcxxabi/CMakeLists.txt
+@@ -497,14 +497,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
# Setup Source Code
#===============================================================================
@@ -31,13 +31,12 @@ index d6648ed..12c02f2 100644
-
include_directories(include)
if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
- find_path(
-- LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL
-+ LIBCXXABI_LIBUNWIND_INCLUDES
- libunwind.h
+- find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
++ find_path(LIBCXXABI_LIBUNWIND_INCLUDES libunwind.h
PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
${LIBCXXABI_LIBUNWIND_PATH}/include
-@@ -454,15 +449,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
+ ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
+@@ -515,15 +510,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
NO_CMAKE_FIND_ROOT_PATH
)
@@ -63,6 +62,3 @@ index d6648ed..12c02f2 100644
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
add_subdirectory(src)
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
deleted file mode 100644
index 868fc3b6..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 48fa180df65f7ee63a85dd69fd2c1382609c5e95 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 10 May 2016 02:00:11 -0700
-Subject: [PATCH 3/8] clang: musl/ppc does not support 128-bit long double
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/Basic/Targets/PPC.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h
-index 439c73a0e3..8da698ee21 100644
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -328,7 +328,8 @@ public:
- break;
- }
-
-- if (getTriple().getOS() == llvm::Triple::FreeBSD) {
-+ if (getTriple().getOS() == llvm::Triple::FreeBSD
-+ || getTriple().isMusl()) {
- LongDoubleWidth = LongDoubleAlign = 64;
- LongDoubleFormat = &llvm::APFloat::IEEEdouble();
- }
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch
deleted file mode 100644
index 8f45c2b8..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From c7d41a6e4dd61733530d2f44c377b91e13004b71 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 18 Jul 2016 08:05:02 +0000
-Subject: [PATCH 3/4] compiler-rt: Disable tsan on OE/glibc
-
-It does not build see
-http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- cmake/config-ix.cmake | 2 +-
- test/sanitizer_common/CMakeLists.txt | 1 -
- 2 files changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
-index f3935ffd6..2c651b756 100644
---- a/cmake/config-ix.cmake
-+++ b/cmake/config-ix.cmake
-@@ -564,7 +564,7 @@ else()
- endif()
-
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
-- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
-+ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD")
- set(COMPILER_RT_HAS_TSAN TRUE)
- else()
- set(COMPILER_RT_HAS_TSAN FALSE)
-diff --git a/test/sanitizer_common/CMakeLists.txt b/test/sanitizer_common/CMakeLists.txt
-index 4e2c80390..990315f11 100644
---- a/test/sanitizer_common/CMakeLists.txt
-+++ b/test/sanitizer_common/CMakeLists.txt
-@@ -8,7 +8,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|SunOS")
- list(APPEND SUPPORTED_TOOLS asan)
- endif()
- if(CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID))
-- list(APPEND SUPPORTED_TOOLS tsan)
- list(APPEND SUPPORTED_TOOLS msan)
- list(APPEND SUPPORTED_TOOLS ubsan)
- endif()
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
index 8b0c9feb..4c8bc631 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
@@ -1,36 +1,35 @@
-From 8b0d5d19e8ebec9b6508b51701cb0c64069091cb Mon Sep 17 00:00:00 2001
+From 57ba81bfe82f18899b1c846bee6276b1b43ce4cf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 19 Apr 2015 15:16:23 -0700
-Subject: [PATCH 1/4] compiler-rt: support a new embedded linux target
+Subject: [PATCH] compiler-rt: support a new embedded linux target
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/builtins/int_util.c | 3 +-
- make/platform/clang_linux_embedded.mk | 286 ++++++++++++++++++
+ compiler-rt/lib/builtins/int_util.c | 2 +-
+ .../make/platform/clang_linux_embedded.mk | 286 ++++++++++++++++++
.../clang_linux_embedded_test_input.c | 0
- 3 files changed, 287 insertions(+), 2 deletions(-)
- create mode 100644 make/platform/clang_linux_embedded.mk
- create mode 100644 make/platform/clang_linux_embedded_test_input.c
+ 3 files changed, 287 insertions(+), 1 deletion(-)
+ create mode 100644 compiler-rt/make/platform/clang_linux_embedded.mk
+ create mode 100644 compiler-rt/make/platform/clang_linux_embedded_test_input.c
-diff --git a/lib/builtins/int_util.c b/lib/builtins/int_util.c
-index de87410db..0d5b56fe1 100644
---- a/lib/builtins/int_util.c
-+++ b/lib/builtins/int_util.c
-@@ -58,8 +58,7 @@ void compilerrt_abort_impl(const char *file, int line, const char *function) {
+diff --git a/compiler-rt/lib/builtins/int_util.c b/compiler-rt/lib/builtins/int_util.c
+index 226a6e93440..efc977acbb3 100644
+--- a/compiler-rt/lib/builtins/int_util.c
++++ b/compiler-rt/lib/builtins/int_util.c
+@@ -54,7 +54,7 @@ void __compilerrt_abort_impl(const char *file, int line, const char *function) {
#else
- /* Get the system definition of abort() */
+ // Get the system definition of abort()
-#include <stdlib.h>
--
+extern void abort (void) __attribute__ ((__noreturn__));
+
#ifndef _WIN32
__attribute__((weak))
- __attribute__((visibility("hidden")))
-diff --git a/make/platform/clang_linux_embedded.mk b/make/platform/clang_linux_embedded.mk
+diff --git a/compiler-rt/make/platform/clang_linux_embedded.mk b/compiler-rt/make/platform/clang_linux_embedded.mk
new file mode 100644
-index 000000000..d0a890075
+index 00000000000..d0a890075a1
--- /dev/null
-+++ b/make/platform/clang_linux_embedded.mk
++++ b/compiler-rt/make/platform/clang_linux_embedded.mk
@@ -0,0 +1,286 @@
+# These are the functions which clang needs when it is targeting a previous
+# version of the OS. The issue is that the backend may use functions which were
@@ -318,9 +317,6 @@ index 000000000..d0a890075
+
+FUNCTIONS.hard_static.x86_64 := $(FUNCTIONS_X86_64)
+FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64)
-diff --git a/make/platform/clang_linux_embedded_test_input.c b/make/platform/clang_linux_embedded_test_input.c
+diff --git a/compiler-rt/make/platform/clang_linux_embedded_test_input.c b/compiler-rt/make/platform/clang_linux_embedded_test_input.c
new file mode 100644
-index 000000000..e69de29bb
---
-2.20.1
-
+index 00000000000..e69de29bb2d
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch
deleted file mode 100644
index 9f665e36..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From cb1b6f021d2ce82d7d0084758b7efaa3917640f5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 26 Aug 2018 22:43:19 -0700
-Subject: [PATCH 3/3] llvm: Disable calls to *_finite and other glibc-only
- functions on Musl.
-
-glibc's finite lib calls are generated when possible.
-However, they are not supported on Musl/linux. This change also
-disables other functions not available on Musl.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/Analysis/TargetLibraryInfo.cpp | 29 +++++++++++++++--------------
- 1 file changed, 15 insertions(+), 14 deletions(-)
-
-diff --git a/lib/Analysis/TargetLibraryInfo.cpp b/lib/Analysis/TargetLibraryInfo.cpp
-index 102135fbf31..5bc4d2b47f5 100644
---- a/lib/Analysis/TargetLibraryInfo.cpp
-+++ b/lib/Analysis/TargetLibraryInfo.cpp
-@@ -415,27 +415,28 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
-
- // The following functions are available on Linux,
- // but Android uses bionic instead of glibc.
-- if (!T.isOSLinux() || T.isAndroid()) {
-+ if (!T.isOSLinux() || T.isAndroid() || T.isMusl()) {
- TLI.setUnavailable(LibFunc_dunder_strdup);
- TLI.setUnavailable(LibFunc_dunder_strtok_r);
- TLI.setUnavailable(LibFunc_dunder_isoc99_scanf);
- TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf);
- TLI.setUnavailable(LibFunc_under_IO_getc);
- TLI.setUnavailable(LibFunc_under_IO_putc);
-- // But, Android has memalign.
-- if (!T.isAndroid())
-+ // But, Android/Musl has memalign.
-+ if (!T.isAndroid() || !T.isMusl() )
- TLI.setUnavailable(LibFunc_memalign);
-- TLI.setUnavailable(LibFunc_fopen64);
-- TLI.setUnavailable(LibFunc_fseeko64);
-- TLI.setUnavailable(LibFunc_fstat64);
-- TLI.setUnavailable(LibFunc_fstatvfs64);
-- TLI.setUnavailable(LibFunc_ftello64);
-- TLI.setUnavailable(LibFunc_lstat64);
-- TLI.setUnavailable(LibFunc_open64);
-- TLI.setUnavailable(LibFunc_stat64);
-- TLI.setUnavailable(LibFunc_statvfs64);
-- TLI.setUnavailable(LibFunc_tmpfile64);
--
-+ if (!T.isMusl()) {
-+ TLI.setUnavailable(LibFunc_fopen64);
-+ TLI.setUnavailable(LibFunc_fseeko64);
-+ TLI.setUnavailable(LibFunc_fstat64);
-+ TLI.setUnavailable(LibFunc_fstatvfs64);
-+ TLI.setUnavailable(LibFunc_ftello64);
-+ TLI.setUnavailable(LibFunc_lstat64);
-+ TLI.setUnavailable(LibFunc_open64);
-+ TLI.setUnavailable(LibFunc_stat64);
-+ TLI.setUnavailable(LibFunc_statvfs64);
-+ TLI.setUnavailable(LibFunc_tmpfile64);
-+ }
- // Relaxed math functions are included in math-finite.h on Linux (GLIBC).
- TLI.setUnavailable(LibFunc_acos_finite);
- TLI.setUnavailable(LibFunc_acosf_finite);
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch b/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
index 2ff903b1..dfbfb53d 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
@@ -1,7 +1,7 @@
-From 5ee148af76169aa327bfa0bfc1c2618a68e873fb Mon Sep 17 00:00:00 2001
+From 1ecabb645e30330b82754b133f685d96c3e1ee42 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 May 2016 23:11:45 -0700
-Subject: [PATCH 2/4] compiler-rt: Simplify cross-compilation. Don't use
+Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use
native-compiled llvm-config.
Note: AddLLVM.cmake does not expose the LLVM source directory.
@@ -16,14 +16,14 @@ https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.
Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- CMakeLists.txt | 11 ++++++++++-
+ compiler-rt/CMakeLists.txt | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 86ca2b3ef..07d894c8a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -63,7 +63,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOLEAN
+diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
+index 8d768a404f2..1b1a29dc25a 100644
+--- a/compiler-rt/CMakeLists.txt
++++ b/compiler-rt/CMakeLists.txt
+@@ -74,7 +74,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL
"Build for a bare-metal target.")
if (COMPILER_RT_STANDALONE_BUILD)
@@ -41,6 +41,3 @@ index 86ca2b3ef..07d894c8a 100644
if (TARGET intrinsics_gen)
# Loading the llvm config causes this target to be imported so place it
# under the appropriate folder in an IDE.
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch b/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch
deleted file mode 100644
index 0356e2a6..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From b29deaeb42a8f56bb5dd72b5a8c3e2c755a6bb9e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 11 Feb 2017 17:54:33 +0000
-Subject: [PATCH 4/4] compiler-rt: cmake/mips: Do not specify --target with OE
-
-OE already specifies cross compiler correctly, adding this additional
---target confuses the clang driver and it resorts to invoke host assembler
-when using -no-integrated-as
-
-Fixes errors e.g.
-| Assembler messages:
-|
-| Fatal error: invalid -march= option: `mips32r2'
-|
-| clang-4.0: error: assembler command failed with exit code 1
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- cmake/base-config-ix.cmake | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
-index 91fe2494b..789b80628 100644
---- a/cmake/base-config-ix.cmake
-+++ b/cmake/base-config-ix.cmake
-@@ -191,11 +191,11 @@ macro(test_targets)
- # clang's default CPU's. In the 64-bit case, we must also specify the ABI
- # since the default ABI differs between gcc and clang.
- # FIXME: Ideally, we would build the N32 library too.
-- test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
-- test_target_arch(mips64el "" "-mips64r2" "--target=mips64el-linux-gnu" "-mabi=64")
-+ test_target_arch(mipsel "" "-mips32r2")
-+ test_target_arch(mips64el "" "-mips64r2" "-mabi=64")
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
-- test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
-- test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64")
-+ test_target_arch(mips "" "-mips32r2")
-+ test_target_arch(mips64 "" "-mips64r2" "-mabi=64")
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
- if(WIN32)
- test_target_arch(arm "" "" "")
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch b/external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch
new file mode 100644
index 00000000..59d774c0
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch
@@ -0,0 +1,40 @@
+From 7730422bbca50431386391ed341c5d5ed649d14e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 18 Jul 2016 08:05:02 +0000
+Subject: [PATCH] compiler-rt: Disable tsan on OE/glibc
+
+It does not build see
+http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ compiler-rt/cmake/config-ix.cmake | 2 +-
+ compiler-rt/test/sanitizer_common/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
+index 3aad08e8896..a979d38c7a6 100644
+--- a/compiler-rt/cmake/config-ix.cmake
++++ b/compiler-rt/cmake/config-ix.cmake
+@@ -653,7 +653,7 @@ else()
+ endif()
+
+ if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
+- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
++ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD")
+ set(COMPILER_RT_HAS_TSAN TRUE)
+ else()
+ set(COMPILER_RT_HAS_TSAN FALSE)
+diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt
+index fcd651ebe42..821de915be8 100644
+--- a/compiler-rt/test/sanitizer_common/CMakeLists.txt
++++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt
+@@ -11,7 +11,7 @@ set(SANITIZER_COMMON_TESTSUITES)
+ # FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of
+ # the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other
+ # sanitizers work.
+-set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan)
++set(SUPPORTED_TOOLS_INIT asan lsan msan ubsan)
+ set(SUPPORTED_TOOLS)
+ foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT})
+ string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER)
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/external/meta-clang/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
index de8da745..fd58c681 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
@@ -1,22 +1,22 @@
-From fc9904be5d4ee1d1e92a1ff86b01218fbf91b12f Mon Sep 17 00:00:00 2001
+From c3f0b7eb02d4b13400f0cf8d8e77f9e898f189e9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 21 May 2016 00:33:20 +0000
-Subject: [PATCH 1/3] llvm: TargetLibraryInfo: Undefine libc functions if they
- are macros
+Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are
+ macros
musl defines some functions as macros and not inline functions
if this is the case then make sure to undefine them
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- include/llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++++
+ .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
-diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def
-index f94debba9c5..e92dbc98c55 100644
---- a/include/llvm/Analysis/TargetLibraryInfo.def
-+++ b/include/llvm/Analysis/TargetLibraryInfo.def
-@@ -707,6 +707,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
+diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+index afed404f04c..876888656f2 100644
+--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+@@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
TLI_DEFINE_ENUM_INTERNAL(fopen)
TLI_DEFINE_STRING_INTERNAL("fopen")
/// FILE *fopen64(const char *filename, const char *opentype)
@@ -25,8 +25,8 @@ index f94debba9c5..e92dbc98c55 100644
+#endif
TLI_DEFINE_ENUM_INTERNAL(fopen64)
TLI_DEFINE_STRING_INTERNAL("fopen64")
- /// int fprintf(FILE *stream, const char *format, ...);
-@@ -751,6 +754,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
+ /// int fork();
+@@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
/// int fseeko(FILE *stream, off_t offset, int whence);
TLI_DEFINE_ENUM_INTERNAL(fseeko)
TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -36,7 +36,7 @@ index f94debba9c5..e92dbc98c55 100644
/// int fseeko64(FILE *stream, off64_t offset, int whence)
TLI_DEFINE_ENUM_INTERNAL(fseeko64)
TLI_DEFINE_STRING_INTERNAL("fseeko64")
-@@ -761,6 +767,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
+@@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
TLI_DEFINE_ENUM_INTERNAL(fstat)
TLI_DEFINE_STRING_INTERNAL("fstat")
/// int fstat64(int filedes, struct stat64 *buf)
@@ -46,7 +46,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(fstat64)
TLI_DEFINE_STRING_INTERNAL("fstat64")
/// int fstatvfs(int fildes, struct statvfs *buf);
-@@ -776,6 +785,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
+@@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
TLI_DEFINE_ENUM_INTERNAL(ftello)
TLI_DEFINE_STRING_INTERNAL("ftello")
/// off64_t ftello64(FILE *stream)
@@ -56,7 +56,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(ftello64)
TLI_DEFINE_STRING_INTERNAL("ftello64")
/// int ftrylockfile(FILE *file);
-@@ -902,6 +914,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
+@@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
TLI_DEFINE_ENUM_INTERNAL(lstat)
TLI_DEFINE_STRING_INTERNAL("lstat")
/// int lstat64(const char *path, struct stat64 *buf);
@@ -66,7 +66,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(lstat64)
TLI_DEFINE_STRING_INTERNAL("lstat64")
/// void *malloc(size_t size);
-@@ -1127,6 +1142,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
+@@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
TLI_DEFINE_ENUM_INTERNAL(stat)
TLI_DEFINE_STRING_INTERNAL("stat")
/// int stat64(const char *path, struct stat64 *buf);
@@ -76,7 +76,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(stat64)
TLI_DEFINE_STRING_INTERNAL("stat64")
/// int statvfs(const char *path, struct statvfs *buf);
-@@ -1256,6 +1274,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
+@@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
TLI_DEFINE_ENUM_INTERNAL(tmpfile)
TLI_DEFINE_STRING_INTERNAL("tmpfile")
/// FILE *tmpfile64(void)
@@ -86,6 +86,3 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
TLI_DEFINE_STRING_INTERNAL("tmpfile64")
/// int toascii(int c);
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch b/external/meta-clang/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
index fa49e677..804cde9e 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
@@ -1,7 +1,7 @@
-From c65c0af4a5721e3c0dfcc56c15ef3310a54e0008 Mon Sep 17 00:00:00 2001
+From f9e72bc861144d8f77505ce833fc0c8397520e9b Mon Sep 17 00:00:00 2001
From: Martin Kelly <mkelly@xevo.com>
Date: Fri, 19 May 2017 00:22:57 -0700
-Subject: [PATCH 2/3] llvm: allow env override of exe path
+Subject: [PATCH] llvm: allow env override of exe path
When using a native llvm-config from inside a sysroot, we need llvm-config to
return the libraries, include directories, etc. from inside the sysroot rather
@@ -11,14 +11,14 @@ llvm-config from a target sysroot.
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- tools/llvm-config/llvm-config.cpp | 7 +++++++
+ llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++
1 file changed, 7 insertions(+)
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 892adc3b9dd..38f190ecbd1 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -226,6 +226,13 @@ Typical components:\n\
+diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
+index 6c31df3e173..f34f3a935ad 100644
+--- a/llvm/tools/llvm-config/llvm-config.cpp
++++ b/llvm/tools/llvm-config/llvm-config.cpp
+@@ -225,6 +225,13 @@ Typical components:\n\
/// Compute the path to the main executable.
std::string GetExecutablePath(const char *Argv0) {
@@ -32,6 +32,3 @@ index 892adc3b9dd..38f190ecbd1 100644
// This just needs to be some symbol in the binary; C++ doesn't
// allow taking the address of ::main however.
void *P = (void *)(intptr_t)GetExecutablePath;
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch b/external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
new file mode 100644
index 00000000..2d0cb1cb
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
@@ -0,0 +1,61 @@
+From 2aa9b771b258b45e7de0bef6a99bcdd248ce3b17 Mon Sep 17 00:00:00 2001
+From: Dan McGregor <dan.mcgregor@usask.ca>
+Date: Wed, 26 Apr 2017 20:29:41 -0600
+Subject: [PATCH] clang: driver: Check sysroot for ldso path
+
+OE does not necessarily follow the default path for the dynamic linker,
+therefore adjust it for OE. Check for the default path, and if it isn't
+there, check /lib.
+
+Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index bff1ab1009b..02e3d676567 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -596,11 +596,19 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ LibDir = "lib64";
+ Loader =
+ (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ LibDir = "lib";
++ }
+ break;
+ case llvm::Triple::ppc64le:
+ LibDir = "lib64";
+ Loader =
+ (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ LibDir = "lib";
++ }
+ break;
+ case llvm::Triple::riscv32: {
+ StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
+@@ -622,6 +630,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ case llvm::Triple::sparcv9:
+ LibDir = "lib64";
+ Loader = "ld-linux.so.2";
++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ LibDir = "lib";
++ }
+ break;
+ case llvm::Triple::systemz:
+ LibDir = "lib";
+@@ -636,6 +648,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+
+ LibDir = X32 ? "libx32" : "lib64";
+ Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ LibDir = "lib";
++ }
+ break;
+ }
+ }
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch b/external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
deleted file mode 100644
index c55b309e..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 846e59787ec12b6cd817640151d1f23d3b78d6b5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 15 May 2018 10:28:43 -0700
-Subject: [PATCH 8/8] clang: scan-view needs python 2.x
-
-Some distributions e.g. archlinux have switched to pointing
-python to python3, therefore its better to be specific about
-python version needed.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- tools/scan-view/bin/scan-view | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/scan-view/bin/scan-view b/tools/scan-view/bin/scan-view
-index 1b6e8ba90d..7c5867d1be 100755
---- a/tools/scan-view/bin/scan-view
-+++ b/tools/scan-view/bin/scan-view
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
-
- """The clang static analyzer results viewer.
- """
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
index f73b1c0f..51ce7208 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
@@ -1,7 +1,7 @@
-From fc628b03a5ac41a446fd2dfea0ecbe03331e54d8 Mon Sep 17 00:00:00 2001
+From 42800fd6bf0040ddd0abf280ea205407e9e004b5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 May 2016 21:11:06 -0700
-Subject: [PATCH 2/8] clang: Driver/tools.cpp: Add -lssp_nonshared on musl
+Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl
musl driver will need to add ssp_nonshared for stack_check_local
on the linker cmdline when using stack protector commands on
@@ -9,14 +9,14 @@ compiler cmdline
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
+ clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
1 file changed, 6 insertions(+)
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index 3755673250..766c650b3c 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -503,6 +503,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
+index da197e47662..4821cfebc21 100644
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -583,6 +583,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (IsIAMCU)
CmdArgs.push_back("-lgloss");
@@ -26,9 +26,6 @@ index 3755673250..766c650b3c 100644
+ Args.hasArg(options::OPT_fstack_protector_all))) {
+ CmdArgs.push_back("-lssp_nonshared");
+ }
- if (Args.hasArg(options::OPT_static))
+ if (IsStatic || IsStaticPIE)
CmdArgs.push_back("--end-group");
else
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
new file mode 100644
index 00000000..2de66187
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
@@ -0,0 +1,25 @@
+From d4719b78a4d59d572b9de7397d8179a5ed7460e9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 10 May 2016 02:00:11 -0700
+Subject: [PATCH] clang: musl/ppc does not support 128-bit long double
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ clang/lib/Basic/Targets/PPC.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
+index 270aa7ff918..8b1bb167818 100644
+--- a/clang/lib/Basic/Targets/PPC.h
++++ b/clang/lib/Basic/Targets/PPC.h
+@@ -364,6 +364,10 @@ public:
+ LongDoubleFormat = &llvm::APFloat::IEEEdouble();
+ }
+
++ if (getTriple().isMusl()) {
++ LongDoubleWidth = LongDoubleAlign = 64;
++ LongDoubleFormat = &llvm::APFloat::IEEEdouble();
++ }
+ // PPC32 supports atomics up to 4 bytes.
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+ }
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch b/external/meta-clang/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
index 03c6babf..418afba3 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
@@ -1,7 +1,7 @@
-From 4764d8f8b613631de2e3c9a3614427d07c599017 Mon Sep 17 00:00:00 2001
+From 90ac3c6f6407ed40aa76e779ddbcfc0d24c58780 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 16 Mar 2017 09:02:13 -0700
-Subject: [PATCH 4/8] clang: Prepend trailing '/' to sysroot
+Subject: [PATCH] clang: Prepend trailing '/' to sysroot
This is needed to handle a case where clang
isntall and target sysroot are perilously same
@@ -20,22 +20,19 @@ installation and not sysroot
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Linux.cpp | 2 +-
+ clang/lib/Driver/ToolChains/Linux.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index e662b6b262..5bca972cc2 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -211,7 +211,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
- GCCInstallation.init(Triple, Args);
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 02e3d676567..d95da11e351 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -223,7 +223,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Multilibs = GCCInstallation.getMultilibs();
+ SelectedMultilib = GCCInstallation.getMultilib();
llvm::Triple::ArchType Arch = Triple.getArch();
- std::string SysRoot = computeSysRoot();
+ std::string SysRoot = computeSysRoot() + "/";
// Cross-compiling binutils and GCC installations (vanilla and openSUSE at
// least) put various tools in a triple-prefixed directory off of the parent
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/external/meta-clang/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
index 8425f8d8..9316157d 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
@@ -1,8 +1,7 @@
-From e02d9f3e1c724a4161709952a3ef59f81432fc06 Mon Sep 17 00:00:00 2001
+From 805b4ce637faedee91bb92fdae273b01bd5aa363 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 16 Mar 2017 19:06:26 -0700
-Subject: [PATCH 5/8] clang: Look inside the target sysroot for compiler
- runtime
+Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime
In OE compiler-rt and libc++ are built and staged into target
sysroot and not into resourcedir which is relative to clang
@@ -12,22 +11,22 @@ Specific to cross compiling the way yocto/OE works
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChain.cpp | 6 +++++-
+ clang/lib/Driver/ToolChain.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
-diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
-index cf3db34688..dae3178380 100644
---- a/lib/Driver/ToolChain.cpp
-+++ b/lib/Driver/ToolChain.cpp
-@@ -13,6 +13,7 @@
- #include "ToolChains/Clang.h"
+diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
+index cab97b1a601..059a5e62c40 100644
+--- a/clang/lib/Driver/ToolChain.cpp
++++ b/clang/lib/Driver/ToolChain.cpp
+@@ -14,6 +14,7 @@
+ #include "ToolChains/Flang.h"
#include "clang/Basic/ObjCRuntime.h"
#include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/Version.h"
- #include "clang/Basic/VirtualFileSystem.h"
#include "clang/Config/config.h"
#include "clang/Driver/Action.h"
-@@ -343,7 +344,10 @@ StringRef ToolChain::getOSLibName() const {
+ #include "clang/Driver/Driver.h"
+@@ -379,7 +380,10 @@ StringRef ToolChain::getOSLibName() const {
}
std::string ToolChain::getCompilerRTPath() const {
@@ -39,6 +38,3 @@ index cf3db34688..dae3178380 100644
if (Triple.isOSUnknown()) {
llvm::sys::path::append(Path, "lib");
} else {
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch b/external/meta-clang/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
index b611dd50..b1b3f05a 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
@@ -1,7 +1,7 @@
-From e6232d22df73b80ced3784fd85166ebe24e6c31b Mon Sep 17 00:00:00 2001
+From 56a43865d296b6b3293cd35f3e4732dac8b00523 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 21 May 2017 15:38:25 -0700
-Subject: [PATCH 6/8] clang: Define / releative gcc installation dir
+Subject: [PATCH] clang: Define / releative gcc installation dir
This is required for OE gcc installation to work.
Without this its not able to find the paths for libgcc
@@ -10,14 +10,14 @@ installation in OE
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Gnu.cpp | 3 +++
+ clang/lib/Driver/ToolChains/Gnu.cpp | 3 +++
1 file changed, 3 insertions(+)
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index 766c650b3c..777526e063 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -2190,6 +2190,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
+diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
+index 4821cfebc21..0c8d9e2f475 100644
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -2428,6 +2428,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
{"gcc-cross/" + CandidateTriple.str(), "../..",
TargetTriple.getOS() != llvm::Triple::Solaris},
@@ -27,6 +27,3 @@ index 766c650b3c..777526e063 100644
// The Freescale PPC SDK has the gcc libraries in
// <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do
// this on Freescale triples, though, since some systems put a *lot* of
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch b/external/meta-clang/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
index b456a59d..71c1c528 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
@@ -1,7 +1,7 @@
-From 5840f5a6756f8f67dbba1b47015e75c8c3264b2b Mon Sep 17 00:00:00 2001
+From b11d1668890778d6d55cadeaec4f6c2e291b583b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 16 Aug 2017 15:16:15 -0700
-Subject: [PATCH 7/8] clang: Fix ldso for musl on x86 and x32 architectures
+Subject: [PATCH] clang: Fix ldso for musl on x86 and x32 architectures
x32 linker is called ld-musl-x32.so.1 and x86 linker
is called ld-musl-i386.so.1, Currently, linker for
@@ -10,14 +10,14 @@ arch is i586, which is not the right thing
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Linux.cpp | 8 ++++++++
+ clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index 5bca972cc2..2ca285679c 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -492,6 +492,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index d95da11e351..0a4644dab9f 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -519,6 +519,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
if (Triple.isMusl()) {
std::string ArchName;
bool IsArm = false;
@@ -25,7 +25,7 @@ index 5bca972cc2..2ca285679c 100644
switch (Arch) {
case llvm::Triple::arm:
-@@ -504,6 +505,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+@@ -531,6 +532,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
ArchName = "armeb";
IsArm = true;
break;
@@ -39,6 +39,3 @@ index 5bca972cc2..2ca285679c 100644
default:
ArchName = Triple.getArchName().str();
}
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch b/external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
new file mode 100644
index 00000000..7b762f17
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
@@ -0,0 +1,24 @@
+From 0f969665b80310b90bcb304b2e60c4493687c5a6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 15 May 2018 10:28:43 -0700
+Subject: [PATCH] clang: scan-view needs python 2.x
+
+Some distributions e.g. archlinux have switched to pointing
+python to python3, therefore its better to be specific about
+python version needed.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ clang/tools/scan-view/bin/scan-view | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view
+index 6165432e7af..04ad518a60c 100755
+--- a/clang/tools/scan-view/bin/scan-view
++++ b/clang/tools/scan-view/bin/scan-view
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+
+ from __future__ import print_function
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
new file mode 100644
index 00000000..b77f4335
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
@@ -0,0 +1,40 @@
+From a1fa38408f7524c8452709574b3d83b72ebcfa38 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 31 Jul 2019 22:51:39 -0700
+Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static
+ linking
+
+When doing static liking with --unwindlib=libunwind -static we encounter
+undefined symbols
+libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock'
+
+and
+
+libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr'
+
+therefore we need to link in libpthread and libdl to fill these symbols
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ clang/lib/Driver/ToolChains/CommonArgs.cpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
+index 37ec7346857..c849b2242e9 100644
+--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
++++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
+@@ -1211,8 +1211,13 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
+ case ToolChain::UNW_CompilerRT:
+ if (LGT == LibGccType::StaticLibGcc)
+ CmdArgs.push_back("-l:libunwind.a");
+- else
++ else {
+ CmdArgs.push_back("-l:libunwind.so");
++ if (Args.hasArg(options::OPT_static)) {
++ CmdArgs.push_back("-lpthread");
++ CmdArgs.push_back("-ldl");
++ }
++ }
+ break;
+ }
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch b/external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch
new file mode 100644
index 00000000..f5bc7730
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch
@@ -0,0 +1,33 @@
+From cfe4473e8447cd2c73a2f42c9c235ce1dfd08bec Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 11 Dec 2019 10:23:15 -0800
+Subject: [PATCH] libclang: Use CMAKE_DL_LIBS for deducing libdl
+
+This helps in getting right settings for libdl irrespective of platform
+it also fixes build with -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON
+
+Fixes
+
+tools/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'
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ clang/tools/libclang/CMakeLists.txt | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
+index bd0c945a5e1..723fa95f14b 100644
+--- a/clang/tools/libclang/CMakeLists.txt
++++ b/clang/tools/libclang/CMakeLists.txt
+@@ -60,9 +60,8 @@ if (TARGET clangTidyPlugin)
+ endif()
+ endif ()
+
+-find_library(DL_LIBRARY_PATH dl)
+-if (DL_LIBRARY_PATH)
+- list(APPEND LIBS dl)
++if (HAVE_LIBDL)
++ list(APPEND LIBS ${CMAKE_DL_LIBS})
+ endif()
+
+ option(LIBCLANG_BUILD_STATIC
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
new file mode 100644
index 00000000..de92b2fd
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
@@ -0,0 +1,23 @@
+From a415287545ffe17f7dbc743a033877fd239856b5 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Thu, 26 Dec 2019 12:56:16 -0800
+Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ llvm/cmake/modules/CrossCompile.cmake | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake
+index 8a6e880c4e2..259211df18e 100644
+--- a/llvm/cmake/modules/CrossCompile.cmake
++++ b/llvm/cmake/modules/CrossCompile.cmake
+@@ -79,6 +79,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
+ -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}"
+ ${external_project_source_dirs}
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}"
++ -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}"
+ ${build_type_flags} ${linker_flag} ${external_clang_dir}
+ ${ARGN}
+ WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD}
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch b/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
new file mode 100644
index 00000000..08856482
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
@@ -0,0 +1,32 @@
+From dd6a749dee10f537fc7cb558ace319041a63e5f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 18 Nov 2019 17:00:29 -0800
+Subject: [PATCH] Check for atomic<double> intrinsics
+
+On some architectures e.g. x86/32bit gcc decides to inline calls to
+double atomic variables but clang does not and defers it to libatomic
+therefore detect if clang can use built-ins for atomic<double> if not
+then link libatomic, this helps building clangd for x86 on linux systems
+with gcc runtime
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
+index 29f3bdd57f0..6460842cf63 100644
+--- a/llvm/cmake/modules/CheckAtomic.cmake
++++ b/llvm/cmake/modules/CheckAtomic.cmake
+@@ -26,9 +26,10 @@ function(check_working_cxx_atomics64 varname)
+ #include <atomic>
+ #include <cstdint>
+ std::atomic<uint64_t> x (0);
++std::atomic<double> y (0);
+ int main() {
+ uint64_t i = x.load(std::memory_order_relaxed);
+- return 0;
++ return int(y);
+ }
+ " ${varname})
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch b/external/meta-clang/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch
index d7b61bb1..39d500cf 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch
@@ -1,7 +1,7 @@
-From 594abc54ce652e0490860c96038513cfb576bb92 Mon Sep 17 00:00:00 2001
+From b826518219333760c4632062dc586bbe17a055e6 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
-Date: Thu, 20 Sep 2018 06:20:28 +0300
-Subject: [PATCH 9/9] clang: Enable SSP and PIE by default
+Date: Thu, 26 Dec 2019 15:46:19 -0800
+Subject: [PATCH] clang: Enable SSP and PIE by default
This is a minimal set of changes needed to make clang use SSP and PIE by
default on Arch Linux. Tests that were easy to adjust have been changed
@@ -16,26 +16,31 @@ solution, but a simple temporary fix.
Hopefully these changes will be obsoleted by the introduction upstream
of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
+
+Taken from ArchLinux - https://git.archlinux.org/svntogit/packages.git/plain/trunk/enable-SSP-and-PIE-by-default.patch?h=packages/clang
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++--
- lib/Driver/ToolChains/Linux.h | 1 +
- test/Driver/clang-offload-bundler.c | 2 +-
- test/Driver/cross-linux.c | 16 ++++++++--------
- test/Driver/env.c | 2 +-
- test/Driver/fsanitize.c | 14 +++++++-------
- test/Driver/gcc-toolchain.cpp | 2 +-
- test/Driver/hexagon-toolchain-elf.c | 2 +-
- test/Driver/linux-as.c | 4 ++--
- test/Driver/linux-ld.c | 2 ++
- test/Driver/riscv32-toolchain.c | 4 ++--
- test/Driver/stack-protector.c | 4 ++--
- 12 files changed, 40 insertions(+), 27 deletions(-)
+ clang/lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++--
+ clang/lib/Driver/ToolChains/Linux.h | 1 +
+ clang/test/Driver/cross-linux.c | 16 ++++++++--------
+ clang/test/Driver/env.c | 2 +-
+ clang/test/Driver/fsanitize.c | 14 +++++++-------
+ clang/test/Driver/gcc-toolchain.cpp | 2 +-
+ clang/test/Driver/hexagon-toolchain-elf.c | 2 +-
+ clang/test/Driver/linux-as.c | 4 ++--
+ clang/test/Driver/linux-ld.c | 2 ++
+ clang/test/Driver/ppc-abi.c | 4 ++--
+ clang/test/Driver/riscv32-toolchain.c | 4 ++--
+ clang/test/Driver/riscv64-toolchain.c | 4 ++--
+ clang/test/Driver/stack-protector.c | 4 ++--
+ 13 files changed, 43 insertions(+), 30 deletions(-)
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index 2ca285679c..22f1a1da6d 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -911,8 +911,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 0a4644dab9f..fb579e7ad60 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -941,8 +941,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
}
bool Linux::isPIEDefault() const {
@@ -55,36 +60,23 @@ index 2ca285679c..22f1a1da6d 100644
+ return 2;
}
- SanitizerMask Linux::getSupportedSanitizers() const {
-diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
-index 22dbbecf6b..ba0d5587e0 100644
---- a/lib/Driver/ToolChains/Linux.h
-+++ b/lib/Driver/ToolChains/Linux.h
-@@ -38,6 +38,7 @@ public:
- void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
- llvm::opt::ArgStringList &CC1Args) const override;
+ bool Linux::isNoExecStackDefault() const {
+diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
+index f5518eac218..2d4973cf40c 100644
+--- a/clang/lib/Driver/ToolChains/Linux.h
++++ b/clang/lib/Driver/ToolChains/Linux.h
+@@ -37,6 +37,7 @@ public:
bool isPIEDefault() const override;
+ bool isNoExecStackDefault() const override;
+ bool IsMathErrnoDefault() const override;
+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
SanitizerMask getSupportedSanitizers() const override;
void addProfileRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
-diff --git a/test/Driver/clang-offload-bundler.c b/test/Driver/clang-offload-bundler.c
-index adf13f59d4..fd2f6e5d8c 100644
---- a/test/Driver/clang-offload-bundler.c
-+++ b/test/Driver/clang-offload-bundler.c
-@@ -115,7 +115,7 @@
- // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____END__ openmp-x86_64-pc-linux-gnu
-
- // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ host-powerpc64le-ibm-linux-gnu
--// CK-TEXTLL: @A = global i32 0
-+// CK-TEXTLL: @A = {{(dso_local )?}}global i32 0
- // CK-TEXTLL: define {{.*}}@test_func()
- // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____END__ host-powerpc64le-ibm-linux-gnu
- // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ openmp-powerpc64le-ibm-linux-gnu
-diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c
-index a5ea832e77..1949c05a60 100644
---- a/test/Driver/cross-linux.c
-+++ b/test/Driver/cross-linux.c
+diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c
+index 6c2dab26069..c28c5653e34 100644
+--- a/clang/test/Driver/cross-linux.c
++++ b/clang/test/Driver/cross-linux.c
@@ -42,8 +42,8 @@
// CHECK-MULTI32-I386: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
@@ -96,7 +88,7 @@ index a5ea832e77..1949c05a60 100644
// CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32"
// CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
// CHECK-MULTI32-I386: "-L[[sysroot]]/lib"
-@@ -59,8 +59,8 @@
+@@ -60,8 +60,8 @@
// CHECK-MULTI32-X86-64: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI32-X86-64: "-m" "elf_x86_64"
@@ -107,7 +99,7 @@ index a5ea832e77..1949c05a60 100644
// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64"
// CHECK-MULTI32-X86-64: "-L[[gcc_install]]"
// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
-@@ -77,8 +77,8 @@
+@@ -79,8 +79,8 @@
// CHECK-MULTI64-I386: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI64-I386: "-m" "elf_i386"
@@ -118,7 +110,7 @@ index a5ea832e77..1949c05a60 100644
// CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32"
// CHECK-MULTI64-I386: "-L[[gcc_install]]"
// CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
-@@ -95,8 +95,8 @@
+@@ -98,8 +98,8 @@
// CHECK-MULTI64-X86-64: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI64-X86-64: "-m" "elf_x86_64"
@@ -129,10 +121,10 @@ index a5ea832e77..1949c05a60 100644
// CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64"
// CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
// CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib"
-diff --git a/test/Driver/env.c b/test/Driver/env.c
-index 0371bc91c4..ea89f52512 100644
---- a/test/Driver/env.c
-+++ b/test/Driver/env.c
+diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c
+index 0371bc91c4a..ea89f525121 100644
+--- a/clang/test/Driver/env.c
++++ b/clang/test/Driver/env.c
@@ -20,7 +20,7 @@
//
// CHECK-LD-32-NOT: warning:
@@ -142,11 +134,11 @@ index 0371bc91c4..ea89f52512 100644
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
-diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
-index 304e759302..c157f9fc48 100644
---- a/test/Driver/fsanitize.c
-+++ b/test/Driver/fsanitize.c
-@@ -238,15 +238,15 @@
+diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
+index f02f94d8c5a..358917588c7 100644
+--- a/clang/test/Driver/fsanitize.c
++++ b/clang/test/Driver/fsanitize.c
+@@ -328,15 +328,15 @@
// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1
// OK
@@ -166,7 +158,7 @@ index 304e759302..c157f9fc48 100644
// CHECK-NO-PIE-NOT: "-pie"
// CHECK-NO-PIE: "-mrelocation-model" "static"
-@@ -585,12 +585,12 @@
+@@ -661,12 +661,12 @@
// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
// NOSP-NOT: "-fsanitize=safe-stack"
@@ -182,11 +174,11 @@ index 304e759302..c157f9fc48 100644
// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
// NO-SP-NOT: stack-protector
// NO-SP: "-fsanitize=safe-stack"
-diff --git a/test/Driver/gcc-toolchain.cpp b/test/Driver/gcc-toolchain.cpp
-index ca96757a2b..ae1c25e989 100644
---- a/test/Driver/gcc-toolchain.cpp
-+++ b/test/Driver/gcc-toolchain.cpp
-@@ -24,6 +24,6 @@
+diff --git a/clang/test/Driver/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp
+index 6c872f4255c..f5006d1dd9a 100644
+--- a/clang/test/Driver/gcc-toolchain.cpp
++++ b/clang/test/Driver/gcc-toolchain.cpp
+@@ -26,6 +26,6 @@
// the same precise formatting of the path as the '-internal-system' flags
// above, so we just blanket wildcard match the 'crtbegin.o'.
// CHECK: "{{[^"]*}}ld{{(.exe)?}}"
@@ -194,11 +186,11 @@ index ca96757a2b..ae1c25e989 100644
+// CHECK: "crtbeginS.o"
// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
-diff --git a/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c
-index 8f4c320ce4..a4d9ae502b 100644
---- a/test/Driver/hexagon-toolchain-elf.c
-+++ b/test/Driver/hexagon-toolchain-elf.c
-@@ -457,7 +457,7 @@
+diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c
+index 44bff6f703a..6575d032f5d 100644
+--- a/clang/test/Driver/hexagon-toolchain-elf.c
++++ b/clang/test/Driver/hexagon-toolchain-elf.c
+@@ -470,7 +470,7 @@
// RUN: %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK042 %s
// CHECK042: "-cc1"
@@ -207,11 +199,11 @@ index 8f4c320ce4..a4d9ae502b 100644
// CHECK042: "-mllvm" "-hexagon-small-data-threshold=8"
// CHECK042-NEXT: llvm-mc
// CHECK042: "-gpsize=8"
-diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c
-index 68cf403d97..92b556db73 100644
---- a/test/Driver/linux-as.c
-+++ b/test/Driver/linux-as.c
-@@ -133,7 +133,7 @@
+diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c
+index 77ac05f3094..cb474f32898 100644
+--- a/clang/test/Driver/linux-as.c
++++ b/clang/test/Driver/linux-as.c
+@@ -164,7 +164,7 @@
// CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
//
// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
@@ -220,7 +212,7 @@ index 68cf403d97..92b556db73 100644
// RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s
// CHECK-SPARCV9: as
// CHECK-SPARCV9: -64
-@@ -142,7 +142,7 @@
+@@ -173,7 +173,7 @@
// CHECK-SPARCV9: -o
//
// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
@@ -229,21 +221,39 @@ index 68cf403d97..92b556db73 100644
// RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
// CHECK-SPARCV9PIC: as
// CHECK-SPARCV9PIC: -64
-diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
-index 787013931a..cba173b354 100644
---- a/test/Driver/linux-ld.c
-+++ b/test/Driver/linux-ld.c
+diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
+index 51227550b52..d01d6627131 100644
+--- a/clang/test/Driver/linux-ld.c
++++ b/clang/test/Driver/linux-ld.c
@@ -1,3 +1,5 @@
+// XFAIL: linux
+
// General tests that ld invocations on Linux targets sane. Note that we use
// sysroot to make these tests independent of the host system.
//
-diff --git a/test/Driver/riscv32-toolchain.c b/test/Driver/riscv32-toolchain.c
-index 1e0c750a3f..563493a33b 100644
---- a/test/Driver/riscv32-toolchain.c
-+++ b/test/Driver/riscv32-toolchain.c
-@@ -44,7 +44,7 @@
+diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
+index acc4981a2ee..0d465516762 100644
+--- a/clang/test/Driver/ppc-abi.c
++++ b/clang/test/Driver/ppc-abi.c
+@@ -32,11 +32,11 @@
+
+ // CHECK-ELFv1: "-mrelocation-model" "static"
+ // CHECK-ELFv1: "-target-abi" "elfv1"
+-// CHECK-ELFv1-LE: "-mrelocation-model" "static"
++// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv1-LE: "-target-abi" "elfv1"
+ // CHECK-ELFv1-QPX: "-mrelocation-model" "static"
+ // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+-// CHECK-ELFv2: "-mrelocation-model" "static"
++// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
+ // CHECK-ELFv2: "-target-abi" "elfv2"
+ // CHECK-ELFv2-BE: "-mrelocation-model" "static"
+ // CHECK-ELFv2-BE: "-target-abi" "elfv2"
+diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c
+index 2ff3a585bda..f923b728c0f 100644
+--- a/clang/test/Driver/riscv32-toolchain.c
++++ b/clang/test/Driver/riscv32-toolchain.c
+@@ -76,7 +76,7 @@
// C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
// C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv"
// C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1"
@@ -252,7 +262,7 @@ index 1e0c750a3f..563493a33b 100644
// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32"
// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32"
// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32"
-@@ -59,7 +59,7 @@
+@@ -91,7 +91,7 @@
// C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
// C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv"
// C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1"
@@ -261,10 +271,32 @@ index 1e0c750a3f..563493a33b 100644
// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d"
// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d"
// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d"
-diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
-index a3e40b50ee..dfffe0d6cf 100644
---- a/test/Driver/stack-protector.c
-+++ b/test/Driver/stack-protector.c
+diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c
+index 42cac51de59..42a05e02fcc 100644
+--- a/clang/test/Driver/riscv64-toolchain.c
++++ b/clang/test/Driver/riscv64-toolchain.c
+@@ -76,7 +76,7 @@
+ // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1"
+-// C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64"
+ // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64"
+@@ -91,7 +91,7 @@
+ // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot"
+ // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv"
+ // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1"
+-// C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o"
++// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d"
+ // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d"
+diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c
+index a3e40b50eed..dfffe0d6cf8 100644
+--- a/clang/test/Driver/stack-protector.c
++++ b/clang/test/Driver/stack-protector.c
@@ -3,11 +3,11 @@
// NOSSP-NOT: "-stack-protector-buffer-size"
@@ -279,6 +311,3 @@ index a3e40b50ee..dfffe0d6cf 100644
// SSP-BUF: "-stack-protector-buffer-size" "16"
// RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
---
-2.19.2
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch b/external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch
deleted file mode 100644
index d9eac9a6..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 98e1067695596c4c4a91f4c58e2a6f6aaeb56a0c Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 21 Sep 2019 08:57:36 -0700
-Subject: [PATCH] clang: link libgcc_eh when using compiler-rt
-
-we still need libgcc unwinder
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- clang/lib/Driver/ToolChains/CommonArgs.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
-index 1e093b25b90..4b81ae2b50a 100644
---- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
-+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
-@@ -1162,6 +1162,7 @@ void tools::AddRunTimeLibs(const ToolChain &TC, const Driver &D,
- switch (RLT) {
- case ToolChain::RLT_CompilerRT:
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, "builtins"));
-+ CmdArgs.push_back("-lgcc_eh");
- break;
- case ToolChain::RLT_Libgcc:
- // Make sure libgcc is not used under MSVC environment by default
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
new file mode 100644
index 00000000..ab406d08
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
@@ -0,0 +1,37 @@
+From 6330360e13936fca5625e39ceed7441b45c3efd3 Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman <jpuhlman@mvista.com>
+Date: Thu, 16 Jan 2020 21:16:10 +0000
+Subject: [PATCH] libcxx: Add compiler runtime library to link step for libcxx
+
+This corrects "undefined reference to __divti3"
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libcxx/src/CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
+index 120505fe18d..b337fa2e403 100644
+--- a/libcxx/src/CMakeLists.txt
++++ b/libcxx/src/CMakeLists.txt
+@@ -160,7 +160,7 @@ if (LIBCXX_ENABLE_SHARED)
+ if(COMMAND llvm_setup_rpath)
+ llvm_setup_rpath(cxx_shared)
+ endif()
+- target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES})
++ target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)")
+ set_target_properties(cxx_shared
+ PROPERTIES
+ COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
+@@ -238,7 +238,7 @@ endif()
+ # Build the static library.
+ if (LIBCXX_ENABLE_STATIC)
+ add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+- target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES})
++ target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)")
+ set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+ set_target_properties(cxx_static
+ PROPERTIES
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
new file mode 100644
index 00000000..5413693a
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
@@ -0,0 +1,140 @@
+From 9f5949b795a92f85c98277fd8d72954fb52df164 Mon Sep 17 00:00:00 2001
+From: Ovidiu Panait <ovidiu.panait@windriver.com>
+Date: Fri, 31 Jan 2020 10:56:11 +0200
+Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using
+ find_package()
+
+Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
+that depends on LLVM/Clang tries to run cmake find_package() during
+do_configure, it will fail with a similar error:
+
+| The imported target "llvm-tblgen" references the file
+| ".../recipe-sysroot/usr/bin/llvm-tblgen"
+|
+| but this file does not exist. Possible reasons include:
+| * The file was deleted, renamed, or moved to another location.
+| * An install or uninstall procedure did not complete successfully.
+| * The installation package was faulty and contained
+| ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
+| but not all the files it references.
+
+This is due to the fact that currently the cmake scripts look for target
+binaries in sysroot. Work around this by not exporting the target binaries in
+Exports-* cmake files.
+
+Upstream-Status: Innapropriate [oe-specific]
+
+Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
+---
+ clang/cmake/modules/AddClang.cmake | 8 --------
+ llvm/cmake/modules/AddLLVM.cmake | 18 ------------------
+ llvm/cmake/modules/TableGen.cmake | 7 -------
+ 3 files changed, 33 deletions(-)
+
+diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
+index 577cc11ab01..5c859d86069 100644
+--- a/clang/cmake/modules/AddClang.cmake
++++ b/clang/cmake/modules/AddClang.cmake
+@@ -151,15 +151,8 @@ macro(add_clang_tool name)
+ add_dependencies(${name} clang-resource-headers)
+
+ if (CLANG_BUILD_TOOLS)
+- set(export_to_clangtargets)
+- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+- NOT LLVM_DISTRIBUTION_COMPONENTS)
+- set(export_to_clangtargets EXPORT ClangTargets)
+- set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
+- endif()
+
+ install(TARGETS ${name}
+- ${export_to_clangtargets}
+ RUNTIME DESTINATION bin
+ COMPONENT ${name})
+
+@@ -168,7 +161,6 @@ macro(add_clang_tool name)
+ DEPENDS ${name}
+ COMPONENT ${name})
+ endif()
+- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
+ endif()
+ endmacro()
+
+diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
+index fd69786544a..70580ccb129 100644
+--- a/llvm/cmake/modules/AddLLVM.cmake
++++ b/llvm/cmake/modules/AddLLVM.cmake
+@@ -1045,15 +1045,8 @@ macro(add_llvm_tool name)
+
+ if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if( LLVM_BUILD_TOOLS )
+- set(export_to_llvmexports)
+- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+- NOT LLVM_DISTRIBUTION_COMPONENTS)
+- set(export_to_llvmexports EXPORT LLVMExports)
+- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
+- endif()
+
+ install(TARGETS ${name}
+- ${export_to_llvmexports}
+ RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
+ COMPONENT ${name})
+
+@@ -1064,9 +1057,6 @@ macro(add_llvm_tool name)
+ endif()
+ endif()
+ endif()
+- if( LLVM_BUILD_TOOLS )
+- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+- endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Tools")
+ endmacro(add_llvm_tool name)
+
+@@ -1104,15 +1094,8 @@ macro(add_llvm_utility name)
+ set_target_properties(${name} PROPERTIES FOLDER "Utils")
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
+- set(export_to_llvmexports)
+- if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+- NOT LLVM_DISTRIBUTION_COMPONENTS)
+- set(export_to_llvmexports EXPORT LLVMExports)
+- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
+- endif()
+
+ install(TARGETS ${name}
+- ${export_to_llvmexports}
+ RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
+ COMPONENT ${name})
+
+@@ -1121,7 +1104,6 @@ macro(add_llvm_utility name)
+ DEPENDS ${name}
+ COMPONENT ${name})
+ endif()
+- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ elseif(LLVM_BUILD_UTILS)
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
+ endif()
+diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
+index 9d2fcd9a793..acdb898149d 100644
+--- a/llvm/cmake/modules/TableGen.cmake
++++ b/llvm/cmake/modules/TableGen.cmake
+@@ -161,14 +161,8 @@ macro(add_tablegen target project)
+ endif()
+
+ if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
+- set(export_to_llvmexports)
+- if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+- NOT LLVM_DISTRIBUTION_COMPONENTS)
+- set(export_to_llvmexports EXPORT LLVMExports)
+- endif()
+
+ install(TARGETS ${target}
+- ${export_to_llvmexports}
+ COMPONENT ${target}
+ RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
+ if(NOT LLVM_ENABLE_IDE)
+@@ -177,5 +171,4 @@ macro(add_tablegen target project)
+ COMPONENT ${target})
+ endif()
+ endif()
+- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
+ endmacro()
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
new file mode 100644
index 00000000..decab684
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
@@ -0,0 +1,41 @@
+From ed3b5d8bb197f01556b42dfc2281693475fd830e Mon Sep 17 00:00:00 2001
+From: Jim Broadus <jbroadus@xevo.com>
+Date: Thu, 26 Mar 2020 16:05:53 -0700
+Subject: [PATCH] clang: Fix resource dir location for cross toolchains
+
+When clang looks for the resources directory, it does so based on the binary
+location and assumes that the containing directory is a sibling to lib. The
+Yocto cross.bbclass defines the default bindir as
+${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/.
+This causes clang to form a path that looks like /usr/bin/lib/clang/...
+
+As a fix for this, check the parent directory name. If that is "bin", then
+use that directory's parent.
+
+Signed-off-by: Jim Broadus <jbroadus@xevo.com>
+---
+ clang/lib/Driver/Driver.cpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
+index fb8335a3695..819887944b5 100644
+--- a/clang/lib/Driver/Driver.cpp
++++ b/clang/lib/Driver/Driver.cpp
+@@ -110,7 +110,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
+ // With a static-library build of libclang, LibClangPath will contain the
+ // path of the embedding binary, which for LLVM binaries will be in bin/.
+ // ../lib gets us to lib/ in both cases.
+- P = llvm::sys::path::parent_path(Dir);
++ Dir = llvm::sys::path::parent_path(Dir);
++
++ // OE cross toolchains are installed, by default, in a subdir of bin.
++ if (llvm::sys::path::filename(Dir) == "bin") {
++ Dir = llvm::sys::path::parent_path(Dir);
++ }
++ P = Dir;
+ llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
+ CLANG_VERSION_STRING);
+ }
+--
+2.24.1
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch b/external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch
new file mode 100644
index 00000000..28902289
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch
@@ -0,0 +1,28 @@
+From 52b4e74809eba796663f0f65194ab4f3eafe2cb1 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Fri, 3 Apr 2020 15:10:37 +0800
+Subject: [PATCH] fix path to libffi
+
+FFI_LIBRARY_PATH is the full path to libffi so when building something that links to
+libLLVMInterpreter, we were looking for libffi in clang's recipe-sysroot instead of
+the recipe's sysroot.
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+index b8adea5..7d8434c 100644
+--- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
++++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+@@ -16,5 +16,5 @@ add_llvm_component_library(LLVMInterpreter
+ )
+
+ if( LLVM_ENABLE_FFI )
+- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} )
++ target_link_libraries( LLVMInterpreter PRIVATE ffi )
+ endif()
+--
+2.7.4
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
new file mode 100644
index 00000000..43161c73
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
@@ -0,0 +1,69 @@
+From fcafd24f9062eeecc9c87ac2fe9bce9accbe7534 Mon Sep 17 00:00:00 2001
+From: Oleksandr Ocheretnyi <oocheret@cisco.com>
+Date: Wed, 15 Apr 2020 00:08:39 +0300
+Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso
+ path
+
+ * the dyld-prefix shall be taken into account when the default
+ path for the dynamic linker has to be checked.
+
+ * this patch shall be used as annex to the next patch:
+ 'clang: driver: Check sysroot for ldso path' which includes
+ the usrmerge scenario.
+
+Signed-off-by: Oleksandr Ocheretnyi <oocheret@cisco.com>
+---
+ clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index fb579e7ad60..4ed5938cc59 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -604,8 +604,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ LibDir = "lib64";
+ Loader =
+ (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+@@ -613,8 +613,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ LibDir = "lib64";
+ Loader =
+ (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+@@ -638,8 +638,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ case llvm::Triple::sparcv9:
+ LibDir = "lib64";
+ Loader = "ld-linux.so.2";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+@@ -656,8 +656,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+
+ LibDir = X32 ? "libx32" : "lib64";
+ Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+--
+2.17.1
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang_git.bb b/external/meta-clang/recipes-devtools/clang/clang_git.bb
index b3b82724..779c4aeb 100644
--- a/external/meta-clang/recipes-devtools/clang/clang_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/clang_git.bb
@@ -10,10 +10,22 @@ require common-source.inc
INHIBIT_DEFAULT_DEPS = "1"
-inherit cmake cmake-native
+BUILD_CC_class-nativesdk = "clang"
+BUILD_CXX_class-nativesdk = "clang++"
+BUILD_AR_class-nativesdk = "llvm-ar"
+BUILD_RANLIB_class-nativesdk = "llvm-ranlib"
+BUILD_NM_class-nativesdk = "llvm-nm"
+LDFLAGS_append_class-nativesdk = " -fuse-ld=gold"
+
+inherit cmake cmake-native pkgconfig python3native
OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
+def get_clang_experimental_arch(bb, d, arch_var):
+ import re
+ a = d.getVar(arch_var, True)
+ return ""
+
def get_clang_arch(bb, d, arch_var):
import re
a = d.getVar(arch_var, True)
@@ -23,10 +35,10 @@ def get_clang_arch(bb, d, arch_var):
elif re.match('aarch64$', a): return 'AArch64'
elif re.match('aarch64_be$', a): return 'AArch64'
elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
+ elif re.match('riscv(32|64)(eb|)$', a): return 'RISCV'
elif re.match('p(pc|owerpc)(|64)', a): return 'PowerPC'
- elif re.match('riscv(32|64)$', a): return 'RISCV'
else:
- bb.error("cannot map '%s' to a supported llvm architecture" % a)
+ bb.note("'%s' is not a primary llvm architecture" % a)
return ""
def get_clang_host_arch(bb, d):
@@ -35,22 +47,63 @@ def get_clang_host_arch(bb, d):
def get_clang_target_arch(bb, d):
return get_clang_arch(bb, d, 'TARGET_ARCH')
-PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs"
-PACKAGECONFIG_class-native = ""
-PACKAGECONFIG_class-nativesdk = "compiler-rt libcplusplus"
+def get_clang_experimental_target_arch(bb, d):
+ return get_clang_experimental_arch(bb, d, 'TARGET_ARCH')
+
+PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs lldb-wchar \
+ ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto full-lto', d)} \
+ rtti eh libedit \
+ "
+PACKAGECONFIG_class-native = "rtti eh libedit"
+PACKAGECONFIG_class-nativesdk = "rtti eh libedit ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto full-lto', d)}"
-PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,compiler-rt"
+PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,libcxx,compiler-rt"
PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,libcxx"
+PACKAGECONFIG[unwindlib] = "-DCLANG_DEFAULT_UNWINDLIB=libunwind,-DCLANG_DEFAULT_UNWINDLIB=libgcc,libcxx"
+PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
+PACKAGECONFIG[full-lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,,"
+PACKAGECONFIG[terminfo] = "-DLLVM_ENABLE_TERMINFO=ON,-DLLVM_ENABLE_TERMINFO=OFF,ncurses,"
+PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm,"
+PACKAGECONFIG[lldb-wchar] = "-DLLDB_EDITLINE_USE_WCHAR=1,-DLLDB_EDITLINE_USE_WCHAR=0,"
+PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,,"
+PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,,"
+PACKAGECONFIG[rtti] = "-DLLVM_ENABLE_RTTI=ON,-DLLVM_ENABLE_RTTI=OFF,,"
+PACKAGECONFIG[split-dwarf] = "-DLLVM_USE_SPLIT_DWARF=ON,-DLLVM_USE_SPLIT_DWARF=OFF,,"
+PACKAGECONFIG[libedit] = "-DLLVM_ENABLE_LIBEDIT=ON -DLLDB_ENABLE_LIBEDIT=ON,-DLLVM_ENABLE_LIBEDIT=OFF -DLLDB_ENABLE_LIBEDIT=OFF,libedit libedit-native"
+
+OECMAKE_SOURCEPATH = "${S}/llvm"
+
+OECMAKE_TARGET_COMPILE = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', 'stage2', 'all', d)}"
+OECMAKE_TARGET_INSTALL = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', 'stage2-install', 'install', d)}"
+BINPATHPREFIX = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', '/tools/clang/stage2-bins/NATIVE', '', d)}"
+PASSTHROUGH = "\
+CLANG_DEFAULT_RTLIB;CLANG_DEFAULT_CXX_STDLIB;LLVM_BUILD_LLVM_DYLIB;LLVM_LINK_LLVM_DYLIB;\
+LLVM_ENABLE_ASSERTIONS;LLVM_ENABLE_EXPENSIVE_CHECKS;LLVM_ENABLE_PIC;\
+LLVM_BINDINGS_LIST;LLVM_ENABLE_FFI;FFI_INCLUDE_DIR;LLVM_OPTIMIZED_TABLEGEN;\
+LLVM_ENABLE_RTTI;LLVM_ENABLE_EH;LLVM_BUILD_EXTERNAL_COMPILER_RT;CMAKE_SYSTEM_NAME;\
+CMAKE_BUILD_TYPE;BUILD_SHARED_LIBS;LLVM_ENABLE_PROJECTS;LLVM_BINUTILS_INCDIR;\
+LLVM_TARGETS_TO_BUILD;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;PYTHON_EXECUTABLE;\
+PYTHON_LIBRARY;PYTHON_INCLUDE_DIR;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;LLDB_EDITLINE_USE_WCHAR;\
+LLVM_ENABLE_LIBEDIT;LLDB_ENABLE_LIBEDIT; \
+CMAKE_C_FLAGS_RELEASE;CMAKE_CXX_FLAGS_RELEASE;CMAKE_ASM_FLAGS_RELEASE;\
+"
#
# Default to build all OE-Core supported target arches (user overridable).
#
-LLVM_TARGETS_TO_BUILD ?= "AArch64;ARM;BPF;Mips;PowerPC;X86"
+LLVM_TARGETS_TO_BUILD ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86"
LLVM_TARGETS_TO_BUILD_append = ";${@get_clang_host_arch(bb, d)};${@get_clang_target_arch(bb, d)}"
-LLVM_TARGETS_TO_BUILD_TARGET ?= ""
+LLVM_TARGETS_TO_BUILD_TARGET ?= "${LLVM_TARGETS_TO_BUILD}"
LLVM_TARGETS_TO_BUILD_TARGET_append ?= ";${@get_clang_target_arch(bb, d)}"
+
+LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= ""
+LLVM_EXPERIMENTAL_TARGETS_TO_BUILD_append = ";${@get_clang_experimental_target_arch(bb, d)}"
+
+HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
+HF[vardepvalue] = "${HF}"
+
EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
-DLLVM_ENABLE_PIC=ON \
@@ -58,93 +111,180 @@ EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_FFI=ON \
-DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
-DLLVM_OPTIMIZED_TABLEGEN=ON \
- -DLLVM_ENABLE_RTTI=ON \
- -DLLVM_ENABLE_EH=ON \
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
- -DLLVM_ENABLE_PROJECTS='clang;lld' \
- -G Ninja ${S}/llvm \
+ -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;lldb' \
+ -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
"
EXTRA_OECMAKE_append_class-native = "\
-DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \
+ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
+ -DPYTHON_EXECUTABLE='${PYTHON}' \
"
EXTRA_OECMAKE_append_class-nativesdk = "\
-DCMAKE_CROSSCOMPILING:BOOL=ON \
-DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-native.cmake' \
+ -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
+ -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
+ -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
-DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \
+ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
-DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
-DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
+ -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \
+ -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
+ -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
+ -DPYTHON_EXECUTABLE='${PYTHON}' \
"
EXTRA_OECMAKE_append_class-target = "\
-DCMAKE_CROSSCOMPILING:BOOL=ON \
-DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
-DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
+ -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \
-DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD_TARGET}' \
+ -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
+ -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
+ -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
-DLLVM_TARGET_ARCH=${@get_clang_target_arch(bb, d)} \
- -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS} \
+ -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS}${HF} \
+ -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
+ -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
+ -DLLVM_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
+ -DPYTHON_EXECUTABLE='${PYTHON}' \
"
-DEPENDS = "zlib libffi libxml2 ninja-native"
-DEPENDS_append_class-nativesdk = " clang-native virtual/${TARGET_PREFIX}binutils-crosssdk virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk"
-DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} ${@bb.utils.contains('TOOLCHAIN', 'gcc', 'virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++', '', d)}"
+DEPENDS = "binutils zlib libffi libxml2 libxml2-native ninja-native swig-native"
+DEPENDS_append_class-nativesdk = " clang-crosssdk-${SDK_ARCH} virtual/${TARGET_PREFIX}binutils-crosssdk nativesdk-python3"
+DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} python3"
+
+COMPATIBLE_HOST_riscv64 = "null"
+COMPATIBLE_HOST_riscv32 = "null"
RRECOMMENDS_${PN} = "binutils"
+RRECOMMENDS_${PN}_append_class-target = " libcxx-dev"
-do_compile() {
- ninja ${PARALLEL_MAKE}
+do_install_append() {
+ rm -rf ${D}${libdir}/python*/site-packages/six.py
}
-do_install() {
- DESTDIR=${D} ninja ${PARALLEL_MAKE} install
+do_install_append_class-target () {
+ # Allow bin path to change based on YOCTO_ALTERNATE_EXE_PATH
+ sed -i 's;${_IMPORT_PREFIX}/bin;${_IMPORT_PREFIX_BIN};g' ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
+
+ # Insert function to populate Import Variables
+ sed -i "4i\
+if(DEFINED ENV{YOCTO_ALTERNATE_EXE_PATH})\n\
+ execute_process(COMMAND \"llvm-config\" \"--bindir\" OUTPUT_VARIABLE _IMPORT_PREFIX_BIN OUTPUT_STRIP_TRAILING_WHITESPACE)\n\
+else()\n\
+ set(_IMPORT_PREFIX_BIN \"\${_IMPORT_PREFIX}/bin\")\n\
+endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
+
+ if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
+ mkdir -p ${D}${nonarch_libdir}
+ mv ${D}${libdir}/clang ${D}${nonarch_libdir}/clang
+ lnr ${D}${nonarch_libdir}/clang ${D}${libdir}/clang
+ rmdir --ignore-fail-on-non-empty ${D}${libdir}
+ fi
}
do_install_append_class-native () {
- install -Dm 0755 ${B}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
- for f in `find ${D}${bindir} -executable -type f -not -type l`; do
- test -n "`file $f|grep -i ELF`" && ${STRIP} $f
- echo "stripped $f"
- done
+ install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
+ install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen
+ for f in `find ${D}${bindir} -executable -type f -not -type l`; do
+ test -n "`file $f|grep -i ELF`" && ${STRIP} $f
+ echo "stripped $f"
+ done
+ ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
+ ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
+ ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
}
do_install_append_class-nativesdk () {
- install -Dm 0755 ${B}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
- for f in `find ${D}${bindir} -executable -type f -not -type l`; do
- test -n "`file $f|grep -i ELF`" && ${STRIP} $f
- done
- rm -rf ${D}${datadir}/llvm/cmake
- rm -rf ${D}${datadir}/llvm
+ install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
+ install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen
+ for f in `find ${D}${bindir} -executable -type f -not -type l`; do
+ test -n "`file $f|grep -i ELF`" && ${STRIP} $f
+ done
+ ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
+ ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
+ ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
+ rm -rf ${D}${datadir}/llvm/cmake
+ rm -rf ${D}${datadir}/llvm
}
-PACKAGE_DEBUG_SPLIT_STYLE_class-nativesdk = "debug-without-src"
+PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python libclang lldb lldb-server liblldb"
-PACKAGES =+ "${PN}-libllvm"
+PROVIDES += "llvm llvm${PV}"
+PROVIDES_append_class-native = " llvm-native"
BBCLASSEXTEND = "native nativesdk"
+RDEPENDS_lldb += "${PN}-lldb-python"
+
+FILES_${PN}-lldb-python = "${libdir}/python*/site-packages/lldb/*"
+
FILES_${PN} += "\
${libdir}/BugpointPasses.so \
${libdir}/LLVMHello.so \
- ${libdir}/TestPlugin.so \
+ ${libdir}/LLVMgold.so \
+ ${libdir}/*Plugin.so \
+ ${libdir}/${BPN} \
+ ${nonarch_libdir}/${BPN}/*/include/ \
${datadir}/scan-* \
${datadir}/opt-viewer/ \
"
-FILES_${PN}-libllvm += "\
+FILES_lldb = "\
+ ${bindir}/lldb \
+"
+
+FILES_lldb-server = "\
+ ${bindir}/lldb-server \
+"
+
+FILES_liblldb = "\
+ ${libdir}/liblldbIntelFeatures.so* \
+ ${libdir}/liblldb.so* \
+"
+
+FILES_${PN}-libllvm =+ "\
${libdir}/libLLVM-${MAJOR_VER}.${MINOR_VER}.so \
${libdir}/libLLVM-${MAJOR_VER}.so \
- ${libdir}/libLLVM-${MAJOR_VER}.${MINOR_VER}svn.so \
+ ${libdir}/libLLVM-${MAJOR_VER}git.so \
+ ${libdir}/libLLVM-${MAJOR_VER}.${MINOR_VER}git.so \
+"
+
+FILES_libclang = "\
+ ${libdir}/libclang.so.${MAJOR_VER} \
"
FILES_${PN}-dev += "\
${datadir}/llvm/cmake \
${libdir}/cmake \
+ ${nonarch_libdir}/${BPN}/*.la \
"
+FILES_${PN}-staticdev += "${nonarch_libdir}/${BPN}/*.a"
+
+FILES_${PN}-staticdev_remove = "${libdir}/${BPN}/*.a"
+FILES_${PN}-dev_remove = "${libdir}/${BPN}/*.la"
+FILES_${PN}_remove = "${libdir}/${BPN}/*"
+
+
INSANE_SKIP_${PN} += "already-stripped"
-INSANE_SKIP_${PN}-dev += "dev-elf"
+#INSANE_SKIP_${PN}-dev += "dev-elf"
+INSANE_SKIP_${PN}-lldb-python += "dev-so dev-deps"
+INSANE_SKIP_liblldb = "dev-so"
#Avoid SSTATE_SCAN_COMMAND running sed over llvm-config.
SSTATE_SCAN_FILES_remove = "*-config"
+
+TOOLCHAIN = "clang"
+TOOLCHAIN_class-native = "gcc"
+TOOLCHAIN_class-nativesdk = "clang"
+
+SYSROOT_DIRS_append_class-target = " ${nonarch_libdir}"
diff --git a/external/meta-clang/recipes-devtools/clang/common.inc b/external/meta-clang/recipes-devtools/clang/common.inc
index 52f30c6d..6b805a61 100644
--- a/external/meta-clang/recipes-devtools/clang/common.inc
+++ b/external/meta-clang/recipes-devtools/clang/common.inc
@@ -3,65 +3,41 @@ FILESEXTRAPATHS =. "${FILE_DIRNAME}/clang:"
LIC_FILES_CHKSUM = "file://llvm/LICENSE.TXT;md5=${LLVMMD5SUM} \
file://clang/LICENSE.TXT;md5=${CLANGMD5SUM} \
"
-LICENSE = "NCSA"
+LICENSE = "Apache-2.0-with-LLVM-exception"
BASEURI ??= "${LLVM_GIT}/llvm-project;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH}"
SRC_URI = "\
${BASEURI} \
- ${LLVMPATCHES} \
- ${CLANGPATCHES} \
- ${COMPILERRTPATCHES} \
- ${LIBCXXABIPATCHES} \
- ${LIBCXXPATCHES} \
- ${LLDBPATCHES} \
+ file://0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch \
+ file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \
+ file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \
+ file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \
+ file://0005-compiler-rt-Disable-tsan-on-OE-glibc.patch \
+ file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \
+ file://0007-llvm-allow-env-override-of-exe-path.patch \
+ file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \
+ file://0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \
+ file://0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch \
+ file://0011-clang-Prepend-trailing-to-sysroot.patch \
+ file://0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \
+ file://0013-clang-Define-releative-gcc-installation-dir.patch \
+ file://0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch \
+ file://0015-clang-scan-view-needs-python-2.x.patch \
+ file://0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \
+ file://0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch \
+ file://0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \
+ file://0019-Check-for-atomic-double-intrinsics.patch \
+ file://0020-clang-Enable-SSP-and-PIE-by-default.patch \
+ file://0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \
+ file://0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \
+ file://0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch \
+ file://0024-fix-path-to-libffi.patch \
+ file://0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \
"
-# llvm patches
-#
-LLVMPATCHES = "\
- file://0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch;patchdir=llvm \
- file://0002-llvm-allow-env-override-of-exe-path.patch;patchdir=llvm \
- file://0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch;patchdir=llvm \
-"
# Fallback to no-PIE if not set
GCCPIE ??= ""
-# Clang patches
-CLANGPATCHES = "\
- file://0001-clang-driver-Use-lib-for-ldso-on-OE.patch;patchdir=clang \
- file://0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch;patchdir=clang \
- file://0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch;patchdir=clang \
- file://0004-clang-Prepend-trailing-to-sysroot.patch;patchdir=clang \
- file://0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch;patchdir=clang \
- file://0006-clang-Define-releative-gcc-installation-dir.patch;patchdir=clang \
- file://0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch;patchdir=clang \
- file://0008-clang-scan-view-needs-python-2.x.patch;patchdir=clang \
- file://0020-clang-link-libgcc_eh-when-using-compiler-rt.patch \
-"
-CLANGPATCHES += "${@'file://0009-clang-Enable-SSP-and-PIE-by-default.patch;patchdir=clang' if '${GCCPIE}' else ''}"
-
-# compiler-rt patches
-COMPILERRTPATCHES = "\
- file://0001-compiler-rt-support-a-new-embedded-linux-target.patch;patchdir=compiler-rt \
- file://0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch;patchdir=compiler-rt \
- file://0003-compiler-rt-Disable-tsan-on-OE-glibc.patch;patchdir=compiler-rt \
- file://0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch;patchdir=compiler-rt \
-"
-# libcxxabi patches
-LIBCXXABIPATCHES ="\
- file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch;patchdir=libcxxabi \
-"
-
-# libc++ patches
-LIBCXXPATCHES = "\
-"
-
-# lldb patches
-LLDBPATCHES = "\
- file://0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch;patchdir=lldb \
- file://0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch;patchdir=lldb \
-"
-
S = "${TMPDIR}/work-shared/llvm-project-source-${PV}-${PR}/git"
B = "${WORKDIR}/llvm-project-source-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
diff --git a/external/meta-clang/recipes-devtools/clang/compiler-rt_git.bb b/external/meta-clang/recipes-devtools/clang/compiler-rt_git.bb
index 05de71f4..91780319 100644
--- a/external/meta-clang/recipes-devtools/clang/compiler-rt_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/compiler-rt_git.bb
@@ -3,79 +3,74 @@
DESCRIPTION = "LLVM based C/C++ compiler Runtime"
HOMEPAGE = "http://compiler-rt.llvm.org/"
-LICENSE = "MIT | NCSA"
SECTION = "base"
require clang.inc
require common-source.inc
-inherit cmake pkgconfig pythonnative
+inherit cmake pkgconfig python3native
-LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=92bfbe70fc44c6e5efc6403a31180ed7; \
-"
+LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
+
+LIBCPLUSPLUS = ""
+COMPILER_RT = ""
+TUNE_CCARGS_remove = "-no-integrated-as"
-BASEDEPENDS_remove_toolchain-clang_class-target = "compiler-rt"
-BASEDEPENDS_remove_toolchain-clang_class-target = "libcxx"
-TARGET_CXXFLAGS_remove_toolchain-clang = " -stdlib=libc++ "
-TUNE_CCARGS_remove = "-no-integrated-as --rtlib=compiler-rt"
-DEPENDS += "ninja-native"
+INHIBIT_DEFAULT_DEPS = "1"
+
+DEPENDS += "ninja-native clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs virtual/crypt"
DEPENDS_append_class-nativesdk = " clang-native"
-THUMB_TUNE_CCARGS = ""
-#TUNE_CCARGS += "-nostdlib"
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
HF[vardepvalue] = "${HF}"
-EXTRA_OECMAKE += "-DCOMPILER_RT_STANDALONE_BUILD=ON \
+
+OECMAKE_TARGET_COMPILE = "compiler-rt"
+OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
+OECMAKE_SOURCEPATH = "${S}/llvm"
+EXTRA_OECMAKE += "-DCOMPILER_RT_STANDALONE_BUILD=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${HOST_ARCH}${HF}${HOST_VENDOR}-${HOST_OS} \
-DCOMPILER_RT_BUILD_XRAY=OFF \
- -G Ninja ${S}/compiler-rt \
-"
-EXTRA_OECMAKE_append_class-target = "\
+ -DLLVM_ENABLE_PROJECTS='compiler-rt' \
+ -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
-DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
-DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
- -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
+ -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
"
+
EXTRA_OECMAKE_append_class-nativesdk = "\
-DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
-DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
"
-EXTRA_OECMAKE_append_libc-musl = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF "
-EXTRA_OECMAKE_append_mipsarch = "-DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF "
-
-do_compile() {
- ninja ${PARALLEL_MAKE}
-}
-
-do_install() {
- DESTDIR=${D} ninja ${PARALLEL_MAKE} install
-}
-
+EXTRA_OECMAKE_append_libc-musl = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF "
+CXXFLAGS_append_libc-musl = " -D_LIBCPP_HAS_MUSL_LIBC=ON "
+EXTRA_OECMAKE_append_mipsarch = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF "
+EXTRA_OECMAKE_append_powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
do_install_append () {
- if [ -d ${D}${libdir}/linux ]; then
- for f in `find ${D}${libdir}/linux -maxdepth 1 -type f`
- do
- install -D -m 0644 $f ${D}${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/`basename $f`
- rm $f
- done
- rmdir ${D}${libdir}/linux
- fi
- for f in `find ${D}${exec_prefix} -maxdepth 1 -name '*.txt' -type f`
- do
- install -D -m 0644 $f ${D}${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/`basename $f`
- rm $f
- done
+ if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
+ mkdir -p ${D}${nonarch_libdir}
+ mv ${D}${libdir}/clang ${D}${nonarch_libdir}/clang
+ rmdir --ignore-fail-on-non-empty ${D}${libdir}
+ fi
}
FILES_SOLIBSDEV = ""
-FILES_${PN} += "${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
- ${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt"
-FILES_${PN}-staticdev += "${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
-FILES_${PN}-dev += "${datadir} ${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms"
-INSANE_SKIP_${PN} = "dev-so"
+FILES_${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
+ ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
+ ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
+FILES_${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
+FILES_${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms \
+ ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include \
+ ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/clang_rt.crt*.o \
+ ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.asan-preinit*.a \
+ "
+INSANE_SKIP_${PN} = "dev-so libdir"
+INSANE_SKIP_${PN}-dbg = "libdir"
#PROVIDES_append_class-target = "\
# virtual/${TARGET_PREFIX}compilerlibs \
@@ -93,4 +88,5 @@ BBCLASSEXTEND = "native nativesdk"
ALLOW_EMPTY_${PN} = "1"
ALLOW_EMPTY_${PN}-dev = "1"
-TOOLCHAIN = "clang"
+TOOLCHAIN_forcevariable = "clang"
+SYSROOT_DIRS_append_class-target = " ${nonarch_libdir}"
diff --git a/external/meta-clang/recipes-devtools/clang/libcxx_git.bb b/external/meta-clang/recipes-devtools/clang/libcxx_git.bb
index b879df13..789da5bd 100644
--- a/external/meta-clang/recipes-devtools/clang/libcxx_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/libcxx_git.bb
@@ -3,79 +3,73 @@
DESCRIPTION = "libc++ is a new implementation of the C++ standard library, targeting C++11"
HOMEPAGE = "http://libcxx.llvm.org/"
-LICENSE = "MIT | NCSA"
SECTION = "base"
require clang.inc
require common-source.inc
-inherit cmake pythonnative
+inherit cmake python3native
+
+PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("RUNTIME", "llvm", "unwind", "", d)}"
+PACKAGECONFIG_riscv32 = "exceptions"
+PACKAGECONFIG_riscv64 = "exceptions"
+PACKAGECONFIG_append_armv5 = " no-atomics"
+
+PACKAGECONFIG[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,,"
+PACKAGECONFIG[exceptions] = "-DLIBCXXABI_ENABLE_EXCEPTIONS=ON -DDLIBCXX_ENABLE_EXCEPTIONS=ON,-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF -DLIBCXX_ENABLE_EXCEPTIONS=OFF -DCMAKE_REQUIRED_FLAGS='-fno-exceptions',"
+PACKAGECONFIG[no-atomics] = "-D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF -DCMAKE_SHARED_LINKER_FLAGS='-latomic',,"
+PACKAGECONFIG[compiler-rt] = ",,compiler-rt"
DEPENDS += "ninja-native"
-BASEDEPENDS_remove_toolchain-clang = "libcxx"
-TARGET_CXXFLAGS_remove_toolchain-clang = " -stdlib=libc++ "
+DEPENDS_append_class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs"
-PACKAGECONFIG ??= "unwind"
-PACKAGECONFIG_powerpc = ""
-PACKAGECONFIG_mipsarch = ""
-PACKAGECONFIG_riscv64 = ""
-PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_LIBUNWIND_INCLUDES=${S}/projects/libunwind/include, -DLIBCXXABI_USE_LLVM_UNWINDER=OFF,"
+LIBCPLUSPLUS = ""
+COMPILER_RT ?= "-rtlib=compiler-rt ${UNWINDLIB}"
+UNWINDLIB ?= "${@bb.utils.contains("RUNTIME", "gnu", "--unwindlib=libgcc", "", d)}"
-PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'libunwind', '', d)}"
+INHIBIT_DEFAULT_DEPS = "1"
-LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=7b3a0e1b99822669d630011defe9bfd9; \
- file://libcxxabi/LICENSE.TXT;md5=3600117b7c18121ab04c53e4615dc36e \
- file://libunwind/LICENSE.TXT;md5=7ea986af7f70eaea5a297dd2744c79a5 \
+LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da3953 \
+ file://libcxxabi/LICENSE.TXT;md5=7b9334635b542c56868400a46b272b1e \
+ file://libunwind/LICENSE.TXT;md5=f66970035d12f196030658b11725e1a1 \
"
-THUMB_TUNE_CCARGS = ""
-#TUNE_CCARGS += "-nostdlib"
+LLVM_LIBDIR_SUFFIX_powerpc64 = "64"
+
+OECMAKE_TARGET_COMPILE = "cxxabi cxx"
+OECMAKE_TARGET_INSTALL = "install-cxx install-cxxabi"
+OECMAKE_SOURCEPATH = "${S}/llvm"
EXTRA_OECMAKE += "\
- -DLIBCXX_CXX_ABI=libcxxabi \
- -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
- -DCXX_SUPPORTS_CXX11=ON \
+ -DCMAKE_CROSSCOMPILING=ON \
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
+ -DLLVM_ENABLE_RTTI=ON \
+ -DLIBUNWIND_ENABLE_SHARED=OFF \
+ -DLIBUNWIND_ENABLE_THREADS=OFF \
+ -DLIBUNWIND_WEAK_PTHREAD_LIB=ON \
+ -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON \
+ -DLIBCXXABI_INCLUDE_TESTS=OFF \
+ -DLIBCXXABI_ENABLE_SHARED=ON \
-DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \
+ -DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \
- -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib \
+ -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib${LLVM_LIBDIR_SUFFIX} \
+ -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${AR} \
+ -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${NM} \
+ -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${RANLIB} \
-DLLVM_ENABLE_PROJECTS='libcxx;libcxxabi;libunwind' \
- -G Ninja \
- ${S}/llvm \
-"
-
-EXTRA_OECMAKE_append_class-target = "\
- -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
- -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
- -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
+ -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
"
EXTRA_OECMAKE_append_class-native = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF"
-EXTRA_OECMAKE_append_class-nativesdk = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF"
-EXTRA_OECMAKE_append_libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
-
-do_compile() {
- ninja -v ${PARALLEL_MAKE} cxxabi
- ninja -v ${PARALLEL_MAKE} cxx
- if ${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'true', 'false', d)}; then
- ninja -v ${PARALLEL_MAKE} unwind
- fi
-
-}
+EXTRA_OECMAKE_append_class-nativesdk = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF"
-do_install() {
- DESTDIR=${D} ninja ${PARALLEL_MAKE} install-cxxabi
- DESTDIR=${D} ninja ${PARALLEL_MAKE} install-cxx
- if ${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'true', 'false', d)}; then
- DESTDIR=${D} ninja ${PARALLEL_MAKE} install-unwind
- fi
-}
+EXTRA_OECMAKE_append_libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
-PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'libunwind', '', d)}"
-FILES_libunwind += "${libdir}/libunwind.so.*"
+CXXFLAGS_append_armv5 = " -mfpu=vfp2"
ALLOW_EMPTY_${PN} = "1"
-RDEPENDS_${PN}-dev += "${PN}-staticdev"
-
BBCLASSEXTEND = "native nativesdk"
TOOLCHAIN = "clang"
+
diff --git a/external/meta-clang/recipes-devtools/clang/lldb_git.bb b/external/meta-clang/recipes-devtools/clang/lldb_git.bb
deleted file mode 100644
index 7c4be42f..00000000
--- a/external/meta-clang/recipes-devtools/clang/lldb_git.bb
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (C) 2017 Kai Ruhnau <kai.ruhnau@target-sg.com>
-# Released under the MIT license (see COPYING.MIT for the terms)
-
-DESCRIPTION = "Next generation, high-performance debugger"
-HOMEPAGE = "http://lldb.llvm.org/"
-LICENSE = "MIT | NCSA"
-SECTION = "devel"
-
-DEPENDS += "clang-native zlib libxml2 ninja-native"
-
-require clang.inc
-require common-source.inc
-
-inherit cmake pkgconfig
-
-LIC_FILES_CHKSUM = "file://llvm/LICENSE.TXT;md5=${LLVMMD5SUM}; \
- file://clang/LICENSE.TXT;md5=${CLANGMD5SUM}; \
- file://lldb/LICENSE.TXT;md5=${LLDBMD5SUM}; \
-"
-
-OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
-
-EXTRA_OECMAKE="\
- -DCMAKE_CROSSCOMPILING=1 \
- -DLLVM_ENABLE_CXX11=ON \
- -DLLVM_BUILD_LLVM_DYLIB=ON \
- -DBUILD_SHARED_LIBS=OFF \
- -DLLVM_BUILD_LLVM_DYLIB=ON \
- -DLLVM_ENABLE_PIC=ON \
- -DLLDB_DISABLE_LIBEDIT=1 \
- -DLLDB_DISABLE_CURSES=1 \
- -DLLDB_DISABLE_PYTHON=1 \
- -DLLVM_ENABLE_TERMINFO=0 \
- -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
- -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
- -DLLVM_HOST_TRIPLE=${TARGET_SYS} \
- -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON \
- -DLLDB_TEST_USE_CUSTOM_CXX_COMPILER=ON \
- -DLLDB_TEST_C_COMPILER='${CC}' \
- -DLLDB_TEST_CXX_COMPILER='${CXX}' \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLVM_ENABLE_PROJECTS='clang;lldb' \
- -G Ninja ${S}/llvm \
-"
-
-EXTRA_OEMAKE = "VERBOSE=1"
-
-do_compile() {
- ninja ${PARALLEL_MAKE} lldb
-}
-
-do_install() {
- DESTDIR=${D} ninja ${PARALLEL_MAKE} tools/lldb/install
-}
-
-INSANE_SKIP_${PN}-dbg = "libdir"
-INSANE_SKIP_${PN} = "libdir"
diff --git a/external/meta-clang/recipes-devtools/clang/llvm-common.bb b/external/meta-clang/recipes-devtools/clang/llvm-common.bb
index f17f01c2..893abd12 100644
--- a/external/meta-clang/recipes-devtools/clang/llvm-common.bb
+++ b/external/meta-clang/recipes-devtools/clang/llvm-common.bb
@@ -1,6 +1,6 @@
SUMMARY = "Helper script for OE's llvm support"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+LICENSE = "Apache-2.0-with-LLVM-exception"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
SRC_URI = "file://llvm-config"
diff --git a/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config b/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config
index 4462896a..a139514d 100644
--- a/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config
+++ b/external/meta-clang/recipes-devtools/clang/llvm-common/llvm-config
@@ -18,6 +18,11 @@ if [[ $1 == "--libs" ]]; then
exec "$NEXT_LLVM_CONFIG" $@
fi
+if [[ $1 == "--bindir" ]]; then
+ unset YOCTO_ALTERNATE_EXE_PATH
+ exec "$NEXT_LLVM_CONFIG" $@
+fi
+
for arg in "$@"; do
case "$arg" in
--cppflags)
diff --git a/external/meta-clang/recipes-devtools/clang/nativesdk-clang-glue.bb b/external/meta-clang/recipes-devtools/clang/nativesdk-clang-glue.bb
index 6824bcb5..169366a7 100644
--- a/external/meta-clang/recipes-devtools/clang/nativesdk-clang-glue.bb
+++ b/external/meta-clang/recipes-devtools/clang/nativesdk-clang-glue.bb
@@ -3,12 +3,10 @@
DESCRIPTION = "SDK Cross compiler wrappers for LLVM based C/C++ compiler"
HOMEPAGE = "http://clang.llvm.org/"
-LICENSE = "NCSA"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/NCSA;md5=1b5fdec70ee13ad8a91667f16c1959d7"
+LICENSE = "Apache-2.0-with-LLVM-exception"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
SECTION = "devel"
-require clang.inc
-require common-source.inc
inherit nativesdk
DEPENDS += "nativesdk-clang"
@@ -17,11 +15,19 @@ do_install() {
cd ${D}${prefix_nativesdk}
ln -s ..${libdir} .
ln -s ..${includedir} .
+ cd ..
+ ln -s .${base_libdir} .
}
sysroot_stage_all () {
sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
}
-FILES_${PN} += "${prefix_nativesdk}"
+FILES_${PN} += "${prefix_nativesdk} ${base_libdir_nativesdk}"
FILES_${PN}-dbg = ""
+
+deltask do_configure
+deltask do_compile
+deltask do_patch
+deltask do_fetch
+deltask do_unpack
diff --git a/external/meta-clang/recipes-devtools/clang/openmp_git.bb b/external/meta-clang/recipes-devtools/clang/openmp_git.bb
index 30bc3071..4c6be98b 100644
--- a/external/meta-clang/recipes-devtools/clang/openmp_git.bb
+++ b/external/meta-clang/recipes-devtools/clang/openmp_git.bb
@@ -3,38 +3,39 @@
DESCRIPTION = "LLVM based C/C++ compiler Runtime"
HOMEPAGE = "http://openmp.llvm.org/"
-LICENSE = "MIT | NCSA"
-SECTION = "base"
+SECTION = "libs"
require clang.inc
require common-source.inc
-DEPENDS += "ninja-native"
-
-RPROVIDES_${PN} += "libgomp"
-RPROVIDES_${PN}-dev += "libgomp-dev"
-
TOOLCHAIN = "clang"
-LIC_FILES_CHKSUM = "file://openmp/LICENSE.txt;md5=5dcbca021bcb2fbc22186bc7a8a159e6"
-
-BASEDEPENDS_remove_toolchain-clang_class-target = "compiler-rt"
-BASEDEPENDS_remove_toolchain-clang_class-target = "libcxx"
+LIC_FILES_CHKSUM = "file://openmp/LICENSE.txt;md5=d75288d1ce0450b28b8d58a284c09c79"
inherit cmake pkgconfig perlnative
-EXTRA_OECMAKE = "-G Ninja ${S}/openmp"
+DEPENDS += "elfutils libffi"
+
+EXTRA_OECMAKE += "-DOPENMP_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')}"
-THUMB_TUNE_CCARGS = ""
+OECMAKE_SOURCEPATH = "${S}/openmp"
-do_compile() {
- ninja ${PARALLEL_MAKE}
-}
+PACKAGECONFIG ?= "ompt-tools offloading-plugin"
-do_install() {
- DESTDIR=${D} ninja ${PARALLEL_MAKE} install
-}
+PACKAGECONFIG_remove_arm = "ompt-tools offloading-plugin"
+PACKAGECONFIG_remove_mipsarch = "ompt-tools offloading-plugin"
+PACKAGECONFIG_remove_powerpc = "ompt-tools offloading-plugin"
+
+PACKAGECONFIG[ompt-tools] = "-DOPENMP_ENABLE_OMPT_TOOLS=ON,-DOPENMP_ENABLE_OMPT_TOOLS=OFF,"
+PACKAGECONFIG[aliases] = "-DLIBOMP_INSTALL_ALIASES=ON,-DLIBOMP_INSTALL_ALIASES=OFF,"
+PACKAGECONFIG[offloading-plugin] = ",,elfutils libffi,libelf libffi"
FILES_SOLIBSDEV = ""
FILES_${PN} += "${libdir}/lib*${SOLIBSDEV}"
INSANE_SKIP_${PN} = "dev-so"
+
+COMPATIBLE_HOST_riscv64 = "null"
+COMPATIBLE_HOST_riscv32 = "null"
+COMPATIBLE_HOST_mips64 = "null"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/external/meta-clang/recipes-devtools/gdb/gdb/0001-gdb-Link-with-latomic-for-riscv-clang-alone.patch b/external/meta-clang/recipes-devtools/gdb/gdb/0001-gdb-Link-with-latomic-for-riscv-clang-alone.patch
new file mode 100644
index 00000000..8ec0e0e9
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/gdb/gdb/0001-gdb-Link-with-latomic-for-riscv-clang-alone.patch
@@ -0,0 +1,26 @@
+From 23ad5c62e3586a0ea734c191cbcbe71261747758 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 19 Aug 2019 21:47:49 -0700
+Subject: [PATCH] gdb: Link with -latomic for riscv/clang alone
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ gdb/Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gdb/Makefile.in b/gdb/Makefile.in
+index 762b32b..6e2a271 100644
+--- a/gdb/Makefile.in
++++ b/gdb/Makefile.in
+@@ -1889,7 +1889,7 @@ gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
+ $(SILENCE) rm -f gdb$(EXEEXT)
+ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
+ -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \
+- $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
++ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) -latomic $(LOADLIBES)
+ ifneq ($(CODESIGN_CERT),)
+ $(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)
+ endif
+--
+2.23.0
+
diff --git a/external/meta-clang/recipes-devtools/gdb/gdb_%.bbappend b/external/meta-clang/recipes-devtools/gdb/gdb_%.bbappend
new file mode 100644
index 00000000..63fbf481
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/gdb/gdb_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_toolchain-clang_riscv64 = " file://0001-gdb-Link-with-latomic-for-riscv-clang-alone.patch "
diff --git a/external/meta-clang/recipes-devtools/rpm/rpm_%.bbappend b/external/meta-clang/recipes-devtools/rpm/rpm_%.bbappend
new file mode 100644
index 00000000..14b31422
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/rpm/rpm_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+DEPENDS_append_toolchain-clang = " openmp"
diff --git a/external/meta-clang/recipes-gnome/gcr/gcr_%.bbappend b/external/meta-clang/recipes-gnome/gcr/gcr_%.bbappend
deleted file mode 100644
index 4432748d..00000000
--- a/external/meta-clang/recipes-gnome/gcr/gcr_%.bbappend
+++ /dev/null
@@ -1,4 +0,0 @@
-# qemu crashes when built with hardening flags
-#
-GI_DATA_ENABLED_toolchain-clang = "False"
-
diff --git a/external/meta-clang/recipes-graphics/mesa/mesa_%.bbappend b/external/meta-clang/recipes-graphics/mesa/mesa_%.bbappend
index fadc95ce..ce9c2fa6 100644
--- a/external/meta-clang/recipes-graphics/mesa/mesa_%.bbappend
+++ b/external/meta-clang/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,5 +1,10 @@
LDFLAGS_append_toolchain-clang = " -latomic -lm"
DEPENDS_append_toolchain-clang = " libatomic-ops"
-EXTRA_OECONF_append_toolchain-clang_x86 = " --disable-asm"
-EXTRA_OECONF_append_toolchain-clang_x86-64 = " --disable-asm"
+EXTRA_OEMASON_append_toolchain-clang_x86 = " -Dasm=false"
+EXTRA_OEMASON_append_toolchain-clang_x86-64 = " -Dasm=false"
+
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config"
+
+PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, clang clang-native \
+${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
diff --git a/external/meta-clang/recipes-kernel/perf/perf.bbappend b/external/meta-clang/recipes-kernel/perf/perf.bbappend
deleted file mode 100644
index df46b9cd..00000000
--- a/external/meta-clang/recipes-kernel/perf/perf.bbappend
+++ /dev/null
@@ -1 +0,0 @@
-DEPENDS_append_toolchain-clang_class-target = " clang-cross-${TARGET_ARCH}"
diff --git a/external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg/clang_mips64.patch b/external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg/clang_mips64.patch
new file mode 100644
index 00000000..9206af1f
--- /dev/null
+++ b/external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg/clang_mips64.patch
@@ -0,0 +1,28 @@
+Disable fpu using code when using clang/mips64 combo
+it works around clang's inline asm error
+
+error: couldn't allocate output register for constraint 'r'
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- a/libavcodec/mips/aacdec_mips.c
++++ b/libavcodec/mips/aacdec_mips.c
+@@ -282,7 +282,7 @@ static void apply_ltp_mips(AACContext *a
+ }
+ }
+
+-#if HAVE_MIPSFPU
++#if HAVE_MIPSFPU && !defined(__clang__)
+ static av_always_inline void fmul_and_reverse(float *dst, const float *src0, const float *src1, int count)
+ {
+ /* Multiply 'count' floats in src0 by src1 and store the results in dst in reverse */
+@@ -435,7 +435,7 @@ void ff_aacdec_init_mips(AACContext *c)
+ #if HAVE_INLINE_ASM
+ c->imdct_and_windowing = imdct_and_windowing_mips;
+ c->apply_ltp = apply_ltp_mips;
+-#if HAVE_MIPSFPU
++#if HAVE_MIPSFPU && !defined(__clang__)
+ c->update_ltp = update_ltp_mips;
+ #endif /* HAVE_MIPSFPU */
+ #endif /* HAVE_INLINE_ASM */
diff --git a/external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg_%.bbappend b/external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg_%.bbappend
new file mode 100644
index 00000000..2077fdad
--- /dev/null
+++ b/external/meta-clang/recipes-multimedia/ffmpeg/ffmpeg_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_toolchain-clang_mips64 = " file://clang_mips64.patch"
diff --git a/external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-Disable-fpu-using-code-when-using-clang-mips64-combo.patch b/external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-Disable-fpu-using-code-when-using-clang-mips64-combo.patch
new file mode 100644
index 00000000..93ab73fb
--- /dev/null
+++ b/external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav/0001-Disable-fpu-using-code-when-using-clang-mips64-combo.patch
@@ -0,0 +1,40 @@
+From 91c980d4cf88b0c12fe5971fe16c7b97b5a942af Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 17 Dec 2019 14:57:55 -0800
+Subject: [PATCH] Disable fpu using code when using clang/mips64 combo
+
+it works around clang's inline asm error
+
+error: couldn't allocate output register for constraint 'r'
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ gst-libs/ext/libav/libavcodec/mips/aacdec_mips.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gst-libs/ext/libav/libavcodec/mips/aacdec_mips.c b/gst-libs/ext/libav/libavcodec/mips/aacdec_mips.c
+index 253cdeb..df4f25d 100644
+--- a/gst-libs/ext/libav/libavcodec/mips/aacdec_mips.c
++++ b/gst-libs/ext/libav/libavcodec/mips/aacdec_mips.c
+@@ -282,7 +282,7 @@ static void apply_ltp_mips(AACContext *ac, SingleChannelElement *sce)
+ }
+ }
+
+-#if HAVE_MIPSFPU
++#if HAVE_MIPSFPU && !defined(__clang__)
+ static av_always_inline void fmul_and_reverse(float *dst, const float *src0, const float *src1, int count)
+ {
+ /* Multiply 'count' floats in src0 by src1 and store the results in dst in reverse */
+@@ -435,7 +435,7 @@ void ff_aacdec_init_mips(AACContext *c)
+ #if HAVE_INLINE_ASM
+ c->imdct_and_windowing = imdct_and_windowing_mips;
+ c->apply_ltp = apply_ltp_mips;
+-#if HAVE_MIPSFPU
++#if HAVE_MIPSFPU && !defined(__clang__)
+ c->update_ltp = update_ltp_mips;
+ #endif /* HAVE_MIPSFPU */
+ #endif /* HAVE_INLINE_ASM */
+--
+2.24.1
+
diff --git a/external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav_%.bbappend b/external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav_%.bbappend
new file mode 100644
index 00000000..dee9619a
--- /dev/null
+++ b/external/meta-clang/recipes-multimedia/gstreamer/gstreamer1.0-libav_%.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_toolchain-clang_mips64 = " file://0001-Disable-fpu-using-code-when-using-clang-mips64-combo.patch"
+