Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dunfell-clang14: Update from clang 12 to clang 14 #853

Merged
merged 166 commits into from
Sep 8, 2023

Conversation

rakuco
Copy link

@rakuco rakuco commented Sep 8, 2023

This gigantic pull request contains a lot of cherry-picks from the kirkstone branch that move clang from version 12 to version 14. This is necessary to update Chromium beyond M114 in meta-chromium, as clang 12 is too old for the language features used by Chromium.

This has been compiled and runtime-tested as described in OSSystems/meta-browser#734 (comment) and subsequent comments.

Parts of the changes had already landed separately in the dunfell-clang12 branch, so I did have to manually fix some conflicts in some LLVM update cherry-picks.

I've specifically skipped some commits touching recipes that are not used by Chromium, such as the bpf, bcc and android-tools commits, and OTOH it's also possible that I've cherry-picked too many changes, some of which can be dropped.

Fixes #835.


Contributor checklist

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)

kraj added 30 commits July 26, 2023 17:16
RUNTIME=llvm means we use libc++ instead of libstdc++ among other things

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 9337952)
This has been removed see
https://reviews.llvm.org/D103048

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit c379426)
We want to use llvm libunwind implementation when RUNTIME = "llvm"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit a360486)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 76e37fa)

Conflicts:
- recipes-devtools/clang/common.inc: caused by
  3880a39, the patches have been kept.
  The patch introduced in fdb936e is part
  of LLVM 13 so it has been removed.
License name should be LICENSE.TXT not LICENSE.txt

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 07357fd)
This is in sync with clang trunk (upcoming 13.0.0) release

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 79dc9a0)
libclc uses clang CLC preprocessor on .ll files, llvm/clang-13 started
including clc declarations by default (clang
cf3ef15a6ec5e5b45c6c54e8fbe3769255e815ce),
thus corrupting any .ll assembly files that are used by libclc.
Inclusion of the default declarations can be turned off using a
cmdline switch but that remains to be implemented in the libclc build
system. manually adding '-cl-no-stdinc' should work as a workaround.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit d692c03)
backtrace APIs are glibc specific so do not use them

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 0f3c6b5)
This ensures that search path for c++ headers is using right directory
structure as per Openembedded gcc and sysroot install

e.g.

ignoring nonexistent directory "/mnt/b/yoe/master/build/tmp/work/core2-32-yoe-linux-musl/compiler-rt/13.0.0-r0/recipe-sysroot/usr/lib/i686-yoe-linux-musl/11.1.0/../../../include/
c++/11.1.0/i386-linux-gnu"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 6ecc098)
This fixes build on ARM

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 241e7e5)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 6a442a8)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 85c1247)
lldb-server is not fully ported for mips yet see
https://reviews.llvm.org/D102872

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 1a90a80)
Its already shipped with compile-rt recipe

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit c5c59a9)
Use compile-rt consistently across when building libc++ and libc++abi
and libunwind

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 78acb4a)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit da92b36)
This ensures that compiler defaults are defaulting to llvm provided
c/c++ runtimes which includes c-runtime, c++runtime, unwinder and omp
runtime, current approach is to inject commandline options but it does
not get passed in all cases and a lot of smaller/big patches are used to
make such package recipes behave

If RUNTIME = "gnu" then defaults stay to use gcc runtime as it is

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit e4edc91)
while compiler-rt may not use any of these libraries, but the cmake
environment pokes for working compiler, linker and other tools, this
ensures that it can build when  RUNTIME = "llvm" and also RUNTIME =
"gnu"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 7f43187)

Conflicts:
- recipes-devtools/clang/compiler-rt_git.bb: Commit
  93552c7 had already backported parts of
  this commit.
sanitizers can link libc++/libc++abi statically or dynamically, we
default to use dynamic version but leave the option to enable static
linking if so needed

Use virtual/crypt to represent crypt implementation which becomes libc
independent

Fix dependencies for native recipes

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit f4bb299)
ensure that libcxx can be built when RUNTIME = "llvm" as it might need
to pass some cmake compiler tests

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit a0a3181)
Now that clang can pass right options automatically when RUNTIME =
"llvm", adjust the variables e.g. COMPILER_RT/UNWINDLIB/LIBCPLUSPLUS are
no more required to be defaulted

Disable enforcing gcc runtime for packages using gcc as its no longer
needed here but is taken care by RUNTIME variable as an aside it also
helps in building native and nativesdk llvm runtimes

Compute right dependencies based on selected RUNTIME along with
COMPILER_RT/UNWINDLIB/LIBCPLUSPLUS variables

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit dc5e04e)
Avoids conflicts with libunwind recipe from OE-Core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 5be1042)
Since clang maybe configured to use llvm runtime, we need to ensure to
use gnu runtime in native builds

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 563e115)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 9c83473)
since toolchain-clang maybe available for native as well now, it means
we have to ensure we do not use it for native recipes _yet_

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 95b2e77)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 5597807)
This ensures it can replace nongnu libunwind
Use it only when selecting RUNTIME = "llvm"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit c48de92)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit d45403b)
This helps in ensuring it pose as RPROVIDES when llvm runtime is used

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit cee6adc)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit e9a764e)
kraj and others added 24 commits July 27, 2023 14:47
…LIBDIR

base_libdir may vary e.g. when using usrmerge feature

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit e8b870b)
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
(cherry picked from commit f3c3e49)
Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
(cherry picked from commit 12a5f8b)
Brings these changes

* 1f9140064dfb Bump version to 14.0.3
* 2e7e14177186 workflows: Add a test to ensure that the LLVM version is correct
* 0e27d08cdeb3 [RISCV] Fix crash for section alignment with .option norvc
* a36801750327 [asan] Always skip first object from dl_iterate_phdr
* 1f4c7b2a9120 [RISCV] Don't emit fractional VIDs with negative steps
* e19be4195b87 [RISCV] Add another test showing incorrect BUILD_VECTOR lowering
* 9efcce92b55b [RISCV] Fix lowering of BUILD_VECTORs as VID sequences
* 21ce6cfd1d93 [RISCV] Add tests showing incorrect BUILD_VECTOR lowering
* 58d5fbe2c20b [llvm-mt] Add support /notify_update
* 50c6ba751fa2 [RISCV] Only try LUI+SH*ADD+ADDI for int materialization if LUI+ADDI+SH*ADD failed.
* dc30b0d3320d [ELF] --emit-relocs: fix missing STT_SECTION when the first input section is synthetic
* 324127d8da95 [libcxx] Add some missing xlocale wrapper functions for OpenBSD
* ebf29ba9f0a3 [LV] Remove stray debug dump added in 0d2efbb8b82c.
* 0d2efbb8b82c [LV] Always use add to add scalar iv and (startidx + step) for ints.
* e7a9fd4f57d6 [LV] Add test case for PR54427.
* 9a3e81e1f91f [InstCombine] canonicalize select with signbit test
* b83c4a2dc0fb [x86] Fix infinite loop inside DAG combiner with lzcnt feature.
* 0fbe860711be [Clang][Fortify] drop inline decls when redeclared
* 571c7d8f6dae Reland "[llvm][AArch64] Insert "bti j" after call to setjmp"
* 0f56ce0fb207 [DebugInfo][InstrRef] Avoid a crash from mixed variable location modes
* e8f03f2057ee Force GHashCell to be 8-byte-aligned.
* 09fba23d41f7 [compiler-rt] Implement __clear_cache on FreeBSD/powerpc
* 33504b3bbe10 [PowerPC] Allow absolute expressions in relocations
* 3400d0293a14 [CMake] Update cache file for Win to ARM Linux cross toolchain builders. NFC.
* 6c41c8edb0cc [CMake] Replace `TARGET_TRIPLE` with `TOOLCHAIN_TARGET_TRIPLE` for Win-to-Arm cross toolchain cache file. NFC.
* b6dbee34387d [CMake] Update cache file for Win to ARM cross tooolchain. NFC.
* 46d19f3a8699 [CMake] Use CMAKE_SYSROOT to build libs for Win to ARM cross tooolchain. NFC.
* e11b929a3c97 [LLD][COFF] Fix TypeServerSource matcher with more than one collision
* d800180f6bee [lld][COFF] Fix TypeServerSource lookup on GUID collisions
* 8c3445ac1c8b [AArch64][LOH] Don't ignore regmasks in bundles by iterating over instrs.
* 43ee392dd462 [InstCombine] try to fold low-mask of ashr to lshr
* 5ea5e3c01b7b [InstCombine] add tests for low-mask of ashr; NFC
* fe8a27acd716 [LV] Handle zero cost loops in selectInterleaveCount.
* 2c4d288eae8b [RISCV][NFC] Add missing lit.local.cfg in test/CodeGen/MIR/RISCV/
* d0f27fb44952 [RISCV] Fixing stack offset for RVV object with vararg in stack.
* b6e91d4a331e [RISCV] Pre-commit for fixing stack offset for RVV object
* 87599bdabbd1 [RISCV] Store/restore RISCVMachineFunctionInfo into MIR YAML file
* 5c9eed741dbd [libc++] Make __dir_stream visibility declaration consistent
* c62053979489 [AArch64] Fix the upper limit for folded address offsets for COFF
* 6697c5bc3a1e [compiler-rt] [scudo] Use -mcrc32 on x86 when available
* 8475349bd639 [AARCH64] ssbs should be enabled by default for cortex-x1, cortex-x1c, cortex-a77
* d4e3c50b2bda [libc++] Define `namespace views` in its own detail header.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 85d956d)
To enable clang_rt.profile library do something like the following in
local.conf or your distro configuration.

    PACKAGECONFIG:pn-compiler-rt = "profile"

The clang_rt.profile library is used to collect coverage information. It is a
static library, so does not introduce any additional footprint in
target images.

Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
(cherry picked from commit 659d431)
(cherry picked from commit cd7b2f8)
Compiler-rt cross-compile for ARMv5 fails because D99282 made it an error if DMB
is used for any pre-ARMv6 targets. More specifically, the "#error only supported
on ARMv6+" added in D99282 will cause compilation to fail when any source file
which includes assembly.h are compiled for pre-ARMv6 targets. Since the only
place where DMB is used is syn-ops.h (which is only included by
arm/sync_fetch_and_* and these files are excluded from being built for older
targets), this patch moves the definition there to avoid the issues described
above.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
(cherry picked from commit 36c4dc6)
Setting the ${HF} variable based on ${TUNE_CCARGS_MFLOAT} does only make sense
for target builds, as it defines arguments for target.  Without this fix,
building with hf machine configuration will cause problems, as native and
nativesdk triplets will be include "hf", something like "x86_64hf-linux", which
is wrong and not recognized by LLVM build/configuration system.

Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
(cherry picked from commit 9cea736)
(cherry picked from commit d669d87)
Upstream doesn't have a branch 'master' anymore so switch to using LLVM
14 specific branch.

meta-clang master uses main branch so that doesn't have this problem.

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
(cherry picked from commit 7952eba)
Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
(cherry picked from commit 8e53d8f)
remove libclang_rt.orc and c_orc.h header since it is being installed by both
compiler-rt and compiler-rt-sanitizer when built for arm.

Signed-off-by: Mamta Shukla <mamta.shukla@leica-geosystems.com>
(cherry picked from commit ed5ac4f)
These are not staged into sysroot otherwise and cmake fails to configure

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 5d6c7c1)
Add "erlang" for all architectures (found on riscv64 and x86-64)
Add "grub" for x86-64 architecture
Use proper OBJCOPY for "linux-yocto" for all architectures

Signed-off-by: Aleksey Smirnov <aleksey.smirnov@yadro.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit f7fa299)
We are not _yet_ using clang as kernel compiler

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 299a5fd)
When built with thin LTO enabled, LLVM produces object files containing
LLVM IR, which ld can't understand. Since we're forcing the toolchain
to clang anyway, let's also force using lld.

Fixes GitHub kraj#708

Signed-off-by: Jan Dorniak <jaskij@gmail.com>
(cherry picked from commit bc8388c)
as the recipe populates the shared source tree as part of
do_patch, but create-spdx does only wait for do_unpack.
Add an explicit dependency to wait to avoid race conditions

Signed-off-by: Konrad Weihmann <kweihmann@witekio.com>
(cherry picked from commit dc95c5e)
- do_create_spdx does have to wait till the shared source
  tree is properly populated
- override the spdx class code detection to determine
  if sources are under work-shared.
  the core code does only look at WORKDIR, which isn’t
  overridden in every case, more likely only S and B are
  touched, which make the spdx class code assume that
  these are per-workdir sources and starts to remove the
  shared sources via bitbake’s cleandirs settings.
  Avoid that by let the code always handle recipes including
  common-source as shared sources.

Relates to kraj#721

Signed-off-by: Konrad Weihmann <kweihmann@witekio.com>
(cherry picked from commit b7c0dcc)
…n't change

if machines are switched, do_deploy_source_date_epoch
would re-run as the stamps are tune specific

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 16c67b4)
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
(cherry picked from commit e33eec3)
Fixes
ERROR: lib32-clang-15.0.7-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk- package lib32-liblldb contains symlink .so '/usr/lib/liblldbIntelFeatures.so'
non -dev/-dbg/nativesdk- package lib32-liblldb contains symlink .so '/usr/lib/liblldb.so' [dev-so]                                                                                      ERROR: lib32-clang-15.0.7-r0 do_package_qa: Fatal QA errors were found, failing task.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 56a8534)
* The perl scan-build script need some perl-modules to be executable

Signed-off-by: Michel Zink <m.zink@rational-online.com>
(cherry picked from commit 68ec449)
--libfiles        Fully qualified library filenames for makefile depends.

This option is being used by ispc cmake.
https://github.com/ispc/ispc/blob/main/cmake/FindLLVM.cmake#L116

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
(cherry picked from commit b9df712)
Create a symbolic link lld -> ld in recipe sysroot to choose the
default linker lld when ld-is-lld is set in DISTRO_FEATURES. othereise,
we can get linking issues when '-fuse-ld=lld' is in LDFLAGS but the
actual ld is not lld.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
(cherry picked from commit 71321dd)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 013b5ee)
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
(cherry picked from commit 3523149)
It pokes at target llvm.cmake and gets the path
LLVM_TOOLS_BINARY_DIR pointing to target sysroot
however during cross builds it should be looking
for tools for cross building in native sysroot

MJ: otherwise it may fail to build with gold linker:
    DWARF error: invalid or unhandled FORM value: 0x23

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
(cherry picked from commit 5563999)
@rakuco rakuco requested a review from kraj as a code owner September 8, 2023 14:16
@rakuco rakuco changed the title Dunfell clang14 dunfell-clang14: Update from clang 12 to clang 14 Sep 8, 2023
@kraj kraj merged commit f141703 into kraj:dunfell-clang14 Sep 8, 2023
@rakuco
Copy link
Author

rakuco commented Sep 8, 2023

Thanks for the quick review, @kraj!

@kraj
Copy link
Owner

kraj commented Sep 8, 2023

Thanks for the quick review, @kraj!

I have already looked at it last week in your tree after you emailed me, so I was just waiting for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet