[all-commits] [llvm/llvm-project] cc2b09: [Clang][LoongArch] Generate _mcount instead of mco...

Nathan Chancellor via All-commits all-commits at lists.llvm.org
Fri Sep 8 10:54:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cc2b09bee017147527e7bd1eb5272f4f70a7b900
      https://github.com/llvm/llvm-project/commit/cc2b09bee017147527e7bd1eb5272f4f70a7b900
  Author: Nathan Chancellor <nathan at kernel.org>
  Date:   2023-09-08 (Fri, 08 Sep 2023)

  Changed paths:
    M clang/lib/Basic/Targets/LoongArch.h
    M clang/test/CodeGen/mcount.c

  Log Message:
  -----------
  [Clang][LoongArch] Generate _mcount instead of mcount (#65657)

When building the LoongArch Linux kernel without
`CONFIG_DYNAMIC_FTRACE`, the build fails to link because the mcount
symbol is `mcount`, not `_mcount` like GCC generates and the kernel
expects:

```
ld.lld: error: undefined symbol: mcount
>>> referenced by version.c
>>>               init/version.o:(early_hostname) in archive vmlinux.a
>>> referenced by do_mounts.c
>>>               init/do_mounts.o:(rootfs_init_fs_context) in archive vmlinux.a
>>> referenced by main.c
>>>               init/main.o:(__traceiter_initcall_level) in archive vmlinux.a
>>> referenced 97011 more times
>>> did you mean: _mcount
>>> defined in: vmlinux.a(arch/loongarch/kernel/mcount.o)
```

Set `MCountName` in `LoongArchTargetInfo` to `_mcount`, which resolves
the build failure.




More information about the All-commits mailing list