All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Parri <parri.andrea@gmail.com>
To: Li Zetao <lizetao1@huawei.com>
Cc: linux-riscv@lists.infradead.org, dvyukov@google.com,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	linux-kernel@vger.kernel.org,
	Patrick O'Neill <patrick@rivosinc.com>,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: Re: riscv: link error when supporting KCSAN
Date: Wed, 12 Jun 2024 08:28:31 +0200	[thread overview]
Message-ID: <ZmlADwdvCHCNqg6E@andrea> (raw)
In-Reply-To: <c740ef8f-1bb4-0c4a-4b88-77dab19f3e31@huawei.com>

On Wed, Jun 12, 2024 at 11:02:32AM +0800, Li Zetao wrote:
> Hi all,
> 
> I'm developing support for KCSAN on riscv but getting the following link
> error:
> 
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L996':
> core.c:(.text+0x2b62): undefined reference to `__atomic_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1015':
> core.c:(.text+0x2c40): undefined reference to `__atomic_fetch_add_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1034':
> core.c:(.text+0x2d1e): undefined reference to `__atomic_fetch_sub_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1053':
> core.c:(.text+0x2dfc): undefined reference to `__atomic_fetch_and_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1071':
> core.c:(.text+0x2eda): undefined reference to `__atomic_fetch_or_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1090':
> core.c:(.text+0x2fb8): undefined reference to `__atomic_fetch_xor_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1109':
> core.c:(.text+0x3096): undefined reference to `__atomic_fetch_nand_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1128':
> core.c:(.text+0x3182): undefined reference to `__atomic_compare_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1147':
> core.c:(.text+0x3274): undefined reference to `__atomic_compare_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1166':
> core.c:(.text+0x3366): undefined reference to `__atomic_compare_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1220':
> core.c:(.text+0x35ec): undefined reference to `__atomic_exchange_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1239':
> core.c:(.text+0x36ce): undefined reference to `__atomic_fetch_add_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1258':
> core.c:(.text+0x37b0): undefined reference to `__atomic_fetch_sub_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1277':
> core.c:(.text+0x3892): undefined reference to `__atomic_fetch_and_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1296':
> core.c:(.text+0x3974): undefined reference to `__atomic_fetch_or_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1315':
> core.c:(.text+0x3a56): undefined reference to `__atomic_fetch_xor_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1334':
> core.c:(.text+0x3b38): undefined reference to `__atomic_fetch_nand_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1353':
> core.c:(.text+0x3c28): undefined reference to `__atomic_compare_exchange_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1372':
> core.c:(.text+0x3d1e): undefined reference to `__atomic_compare_exchange_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1391':
> core.c:(.text+0x3e14): undefined reference to `__atomic_compare_exchange_2'
> make[2]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
> make[1]: *** [/home/l00517538/PrIntFuzz/third_party/linux/Makefile:1171:
> vmlinux] Error 2
> 
> The reason for the error is that riscv only supports 32-bit or 64-bit atomic
> operations.As far as I know, this error is solved through the
> no-outline-atomics option on arm64. How can I solve this problem on riscv?

IIRC, support for inline subword atomic ops has been added to riscv/gcc
with

  https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616807.html

(-minline-atomics becoming the default behavior with the above changes).

It appears as if your compiler does not include these changes and might
have to be upgraded?

+ Patrick and Palmer, FYI.

  Andrea

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Andrea Parri <parri.andrea@gmail.com>
To: Li Zetao <lizetao1@huawei.com>
Cc: linux-riscv@lists.infradead.org, dvyukov@google.com,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	linux-kernel@vger.kernel.org,
	Patrick O'Neill <patrick@rivosinc.com>,
	Palmer Dabbelt <palmer@rivosinc.com>
Subject: Re: riscv: link error when supporting KCSAN
Date: Wed, 12 Jun 2024 08:28:31 +0200	[thread overview]
Message-ID: <ZmlADwdvCHCNqg6E@andrea> (raw)
In-Reply-To: <c740ef8f-1bb4-0c4a-4b88-77dab19f3e31@huawei.com>

On Wed, Jun 12, 2024 at 11:02:32AM +0800, Li Zetao wrote:
> Hi all,
> 
> I'm developing support for KCSAN on riscv but getting the following link
> error:
> 
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L996':
> core.c:(.text+0x2b62): undefined reference to `__atomic_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1015':
> core.c:(.text+0x2c40): undefined reference to `__atomic_fetch_add_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1034':
> core.c:(.text+0x2d1e): undefined reference to `__atomic_fetch_sub_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1053':
> core.c:(.text+0x2dfc): undefined reference to `__atomic_fetch_and_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1071':
> core.c:(.text+0x2eda): undefined reference to `__atomic_fetch_or_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1090':
> core.c:(.text+0x2fb8): undefined reference to `__atomic_fetch_xor_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1109':
> core.c:(.text+0x3096): undefined reference to `__atomic_fetch_nand_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1128':
> core.c:(.text+0x3182): undefined reference to `__atomic_compare_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1147':
> core.c:(.text+0x3274): undefined reference to `__atomic_compare_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1166':
> core.c:(.text+0x3366): undefined reference to `__atomic_compare_exchange_1'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1220':
> core.c:(.text+0x35ec): undefined reference to `__atomic_exchange_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1239':
> core.c:(.text+0x36ce): undefined reference to `__atomic_fetch_add_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1258':
> core.c:(.text+0x37b0): undefined reference to `__atomic_fetch_sub_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1277':
> core.c:(.text+0x3892): undefined reference to `__atomic_fetch_and_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1296':
> core.c:(.text+0x3974): undefined reference to `__atomic_fetch_or_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1315':
> core.c:(.text+0x3a56): undefined reference to `__atomic_fetch_xor_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1334':
> core.c:(.text+0x3b38): undefined reference to `__atomic_fetch_nand_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1353':
> core.c:(.text+0x3c28): undefined reference to `__atomic_compare_exchange_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1372':
> core.c:(.text+0x3d1e): undefined reference to `__atomic_compare_exchange_2'
> riscv64-linux-gnu-ld: kernel/kcsan/core.o: in function `.L1391':
> core.c:(.text+0x3e14): undefined reference to `__atomic_compare_exchange_2'
> make[2]: *** [scripts/Makefile.vmlinux:34: vmlinux] Error 1
> make[1]: *** [/home/l00517538/PrIntFuzz/third_party/linux/Makefile:1171:
> vmlinux] Error 2
> 
> The reason for the error is that riscv only supports 32-bit or 64-bit atomic
> operations.As far as I know, this error is solved through the
> no-outline-atomics option on arm64. How can I solve this problem on riscv?

IIRC, support for inline subword atomic ops has been added to riscv/gcc
with

  https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616807.html

(-minline-atomics becoming the default behavior with the above changes).

It appears as if your compiler does not include these changes and might
have to be upgraded?

+ Patrick and Palmer, FYI.

  Andrea

  reply	other threads:[~2024-06-12  6:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12  3:02 riscv: link error when supporting KCSAN Li Zetao
2024-06-12  3:02 ` Li Zetao
2024-06-12  6:28 ` Andrea Parri [this message]
2024-06-12  6:28   ` Andrea Parri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZmlADwdvCHCNqg6E@andrea \
    --to=parri.andrea@gmail.com \
    --cc=dvyukov@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lizetao1@huawei.com \
    --cc=palmer@rivosinc.com \
    --cc=patrick@rivosinc.com \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.