LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [mark:arm64/kcsan 11/13] ld.lld: error: undefined symbol: __tsan_atomic64_fetch_add
@ 2021-09-29 21:48 kernel test robot
  2021-09-30  5:47 ` Marco Elver
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-09-29 21:48 UTC (permalink / raw)
  To: Mark Rutland; +Cc: llvm, kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1916 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/kcsan
head:   4fe9d6c2ef85257d80291086e4514eaaebd3504e
commit: f5bc7f69b328f00a6accd9a11f5981d2d0c11cb5 [11/13] kcsan: remove atomic builtin support
config: x86_64-randconfig-a011-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id=f5bc7f69b328f00a6accd9a11f5981d2d0c11cb5
        git remote add mark https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git
        git fetch --no-tags mark arm64/kcsan
        git checkout f5bc7f69b328f00a6accd9a11f5981d2d0c11cb5
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: __tsan_atomic64_fetch_add
   >>> referenced by initcall.h:10 (include/trace/events/initcall.h:10)
   >>>               main.o:(__traceiter_initcall_level) in archive init/built-in.a
   >>> referenced by initcall.h:10 (include/trace/events/initcall.h:10)
   >>>               main.o:(__traceiter_initcall_level) in archive init/built-in.a
   >>> referenced by initcall.h:10 (include/trace/events/initcall.h:10)
   >>>               main.o:(__traceiter_initcall_level) in archive init/built-in.a
   >>> referenced 744943 more times

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32987 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [mark:arm64/kcsan 11/13] ld.lld: error: undefined symbol: __tsan_atomic64_fetch_add
  2021-09-29 21:48 [mark:arm64/kcsan 11/13] ld.lld: error: undefined symbol: __tsan_atomic64_fetch_add kernel test robot
@ 2021-09-30  5:47 ` Marco Elver
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2021-09-30  5:47 UTC (permalink / raw)
  To: Mark Rutland; +Cc: kernel test robot, llvm, kbuild-all, linux-kernel

On Thu, Sep 30, 2021 at 05:48AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git arm64/kcsan
> head:   4fe9d6c2ef85257d80291086e4514eaaebd3504e
> commit: f5bc7f69b328f00a6accd9a11f5981d2d0c11cb5 [11/13] kcsan: remove atomic builtin support
> config: x86_64-randconfig-a011-20210929 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id=f5bc7f69b328f00a6accd9a11f5981d2d0c11cb5
>         git remote add mark https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git
>         git fetch --no-tags mark arm64/kcsan
>         git checkout f5bc7f69b328f00a6accd9a11f5981d2d0c11cb5
>         # save the attached .config to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
> >> ld.lld: error: undefined symbol: __tsan_atomic64_fetch_add
>    >>> referenced by initcall.h:10 (include/trace/events/initcall.h:10)
>    >>>               main.o:(__traceiter_initcall_level) in archive init/built-in.a
>    >>> referenced by initcall.h:10 (include/trace/events/initcall.h:10)
>    >>>               main.o:(__traceiter_initcall_level) in archive init/built-in.a
>    >>> referenced by initcall.h:10 (include/trace/events/initcall.h:10)
>    >>>               main.o:(__traceiter_initcall_level) in archive init/built-in.a
>    >>> referenced 744943 more times

This was another reason why I added the __tsan_atomic instrumentation
calls -- to avoid chasing the odd driver or however this happened using
builtin atomics and the blame always falling on KCSAN. ;-)

This happened more than once, and I just got frustrated and added them,
also in preparation of other odd arches wanting it. I think KCSAN isn't
meant to be the do-not-use-atomic-builtins linter.

If you can somehow keep them, I would prefer that, just to avoid going
back to a world where I have to chase the odd builtin atomic user after
they broke the KCSAN build.

Would a $(call cc-option,-mno-outline-atomics) help?

--- a/kernel/kcsan/Makefile
+++ b/kernel/kcsan/Makefile
@@ -8,7 +8,8 @@ CFLAGS_REMOVE_debugfs.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
 
 CFLAGS_core.o := $(call cc-option,-fno-conserve-stack) \
-	-fno-stack-protector -DDISABLE_BRANCH_PROFILING
+	-fno-stack-protector -DDISABLE_BRANCH_PROFILING \
+	$(call cc-option,-mno-outline-atomics)
 
 obj-y := core.o debugfs.o report.o
 obj-$(CONFIG_KCSAN_SELFTEST) += selftest.o

A quick test with a compiler version which generated outline
atomics suggests that this works.

Thanks,
-- Marco

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-30  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 21:48 [mark:arm64/kcsan 11/13] ld.lld: error: undefined symbol: __tsan_atomic64_fetch_add kernel test robot
2021-09-30  5:47 ` Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).