Re: [PATCH V17 2/7] dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled

Miguel Ojeda <[email protected]>
Newsgroups dev.linux.lists.llvm,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux,org.ozlabs.lists.linuxppc-dev
Message-ID <CANiq72nw6SM21M3y=xXd81kT+bPbctnpPVi4QGL4K2XUS6bUzg@mail.gmail.com>
On Wed, Jul 8, 2026 at 10:25 AM Mukesh Kumar Chaurasiya (IBM)
<[email protected]> wrote:
>
> When building with LLVM=1 for architectures like powerpc where
> CONFIG_DMA_SHARED_BUFFER is not enabled, the build fails with:
>
>   ld.lld: error: undefined symbol: dma_resv_reset_max_fences
>   >>> referenced by helpers.c
>   >>>               rust/helpers/helpers.o:(rust_helper_dma_resv_unlock)
>
> The issue occurs because:
> 1. CONFIG_DEBUG_MUTEXES=y is enabled
> 2. CONFIG_DMA_SHARED_BUFFER is not enabled
> 3. dma_resv_reset_max_fences() is declared in the header when
>    CONFIG_DEBUG_MUTEXES is set
> 4. But the function is only compiled in drivers/dma-buf/dma-resv.c,
>    which is only built when CONFIG_DMA_SHARED_BUFFER is enabled
> 5. Rust helpers call dma_resv_unlock() which calls
>    dma_resv_reset_max_fences(), causing an undefined symbol
>
> Fix this by compiling `dma-resv.c` file only when CONFIG_DMA_SHARED_BUFFER
> is enabled.
>
> Fixes: 9b836641d3bf ("rust: helpers: Add bindings/wrappers for dma_resv_lock")
> Reviewed-by: Christian König <[email protected]>
> Reviewed-by: Gary Guo <[email protected]>
> Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]>

Andreas sent a similar one to:

  https://lore.kernel.org/rust-for-linux/[email protected]/

This is earlier, but please see his approach & Sashiko's note.

Backlinking here for reference.

Cheers,
Miguel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.