mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols
@ 2026-07-21  8:40 Richard Cheng
  2026-07-21 16:22 ` Dave Jiang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Richard Cheng @ 2026-07-21  8:40 UTC (permalink / raw)
  To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
	danwilliams
  Cc: iweiny, ming.li, linux-cxl, linux-kernel, newtonl, kristinc,
	kaihengf, kobak, Richard Cheng

Building cxl_test with LLVM=1 (ld.lld) fails in modpost:

"""
  cxl_core: .export_symbol section references '__wrap_...', but it
  does not seem to be an export symbol
"""

cxl_test --wraps 6 symbols that cxl_core both defines and exports.
GNU ld only wraps undefined references, but ld.lld also redirects
references to defined symbols, so cxl_core's own EXPORT_SYMBOL entries
get rewritten to __wrap_* and modpost rejects them.

cxl_core never calls these symbols, so wrap them only in the caller
modules via LDFLAGS_<module>.o instead of the global ldflags-y.

Signed-off-by: Richard Cheng <icheng@nvidia.com>
---
 tools/testing/cxl/Kbuild | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
index 2be1df80fcc9..e49ce644b4b1 100644
--- a/tools/testing/cxl/Kbuild
+++ b/tools/testing/cxl/Kbuild
@@ -4,16 +4,20 @@ ldflags-y += --wrap=is_acpi_device_node
 ldflags-y += --wrap=acpi_evaluate_integer
 ldflags-y += --wrap=acpi_pci_find_root
 ldflags-y += --wrap=nvdimm_bus_register
-ldflags-y += --wrap=cxl_await_media_ready
-ldflags-y += --wrap=devm_cxl_add_rch_dport
-ldflags-y += --wrap=cxl_endpoint_parse_cdat
-ldflags-y += --wrap=devm_cxl_endpoint_decoders_setup
 ldflags-y += --wrap=hmat_get_extended_linear_cache_size
-ldflags-y += --wrap=devm_cxl_add_dport_by_dev
-ldflags-y += --wrap=devm_cxl_switch_port_decoders_setup
 ldflags-y += --wrap=walk_hmem_resources
 ldflags-y += --wrap=region_intersects
 ldflags-y += --wrap=region_intersects_soft_reserve
+wrap_cxl_core := --wrap=cxl_await_media_ready
+wrap_cxl_core += --wrap=devm_cxl_add_rch_dport
+wrap_cxl_core += --wrap=devm_cxl_add_dport_by_dev
+wrap_cxl_core += --wrap=devm_cxl_switch_port_decoders_setup
+wrap_cxl_core += --wrap=devm_cxl_endpoint_decoders_setup
+wrap_cxl_core += --wrap=cxl_endpoint_parse_cdat
+LDFLAGS_cxl_acpi.o += $(wrap_cxl_core)
+LDFLAGS_cxl_pmem.o += $(wrap_cxl_core)
+LDFLAGS_cxl_port.o += $(wrap_cxl_core)
+LDFLAGS_cxl_mem.o  += $(wrap_cxl_core)
 
 DRIVERS := ../../../drivers
 DAX_HMEM_SRC := $(DRIVERS)/dax/hmem
-- 
2.43.0


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

* Re: [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols
  2026-07-21  8:40 [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols Richard Cheng
@ 2026-07-21 16:22 ` Dave Jiang
  2026-08-17 23:18 ` Alison Schofield
  2026-08-19 14:53 ` shaikh kamaluddin
  2 siblings, 0 replies; 5+ messages in thread
From: Dave Jiang @ 2026-07-21 16:22 UTC (permalink / raw)
  To: Richard Cheng, dave, jic23, alison.schofield, vishal.l.verma,
	djbw, danwilliams
  Cc: iweiny, ming.li, linux-cxl, linux-kernel, newtonl, kristinc,
	kaihengf, kobak



On 7/21/26 1:40 AM, Richard Cheng wrote:
> Building cxl_test with LLVM=1 (ld.lld) fails in modpost:
> 
> """
>   cxl_core: .export_symbol section references '__wrap_...', but it
>   does not seem to be an export symbol
> """
> 
> cxl_test --wraps 6 symbols that cxl_core both defines and exports.
> GNU ld only wraps undefined references, but ld.lld also redirects
> references to defined symbols, so cxl_core's own EXPORT_SYMBOL entries
> get rewritten to __wrap_* and modpost rejects them.
> 
> cxl_core never calls these symbols, so wrap them only in the caller
> modules via LDFLAGS_<module>.o instead of the global ldflags-y.
> 
> Signed-off-by: Richard Cheng <icheng@nvidia.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>


> ---
>  tools/testing/cxl/Kbuild | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
> index 2be1df80fcc9..e49ce644b4b1 100644
> --- a/tools/testing/cxl/Kbuild
> +++ b/tools/testing/cxl/Kbuild
> @@ -4,16 +4,20 @@ ldflags-y += --wrap=is_acpi_device_node
>  ldflags-y += --wrap=acpi_evaluate_integer
>  ldflags-y += --wrap=acpi_pci_find_root
>  ldflags-y += --wrap=nvdimm_bus_register
> -ldflags-y += --wrap=cxl_await_media_ready
> -ldflags-y += --wrap=devm_cxl_add_rch_dport
> -ldflags-y += --wrap=cxl_endpoint_parse_cdat
> -ldflags-y += --wrap=devm_cxl_endpoint_decoders_setup
>  ldflags-y += --wrap=hmat_get_extended_linear_cache_size
> -ldflags-y += --wrap=devm_cxl_add_dport_by_dev
> -ldflags-y += --wrap=devm_cxl_switch_port_decoders_setup
>  ldflags-y += --wrap=walk_hmem_resources
>  ldflags-y += --wrap=region_intersects
>  ldflags-y += --wrap=region_intersects_soft_reserve
> +wrap_cxl_core := --wrap=cxl_await_media_ready
> +wrap_cxl_core += --wrap=devm_cxl_add_rch_dport
> +wrap_cxl_core += --wrap=devm_cxl_add_dport_by_dev
> +wrap_cxl_core += --wrap=devm_cxl_switch_port_decoders_setup
> +wrap_cxl_core += --wrap=devm_cxl_endpoint_decoders_setup
> +wrap_cxl_core += --wrap=cxl_endpoint_parse_cdat
> +LDFLAGS_cxl_acpi.o += $(wrap_cxl_core)
> +LDFLAGS_cxl_pmem.o += $(wrap_cxl_core)
> +LDFLAGS_cxl_port.o += $(wrap_cxl_core)
> +LDFLAGS_cxl_mem.o  += $(wrap_cxl_core)
>  
>  DRIVERS := ../../../drivers
>  DAX_HMEM_SRC := $(DRIVERS)/dax/hmem


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

* Re: [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols
  2026-07-21  8:40 [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols Richard Cheng
  2026-07-21 16:22 ` Dave Jiang
@ 2026-08-17 23:18 ` Alison Schofield
  2026-08-19 14:53 ` shaikh kamaluddin
  2 siblings, 0 replies; 5+ messages in thread
From: Alison Schofield @ 2026-08-17 23:18 UTC (permalink / raw)
  To: Richard Cheng
  Cc: dave, jic23, dave.jiang, vishal.l.verma, djbw, danwilliams,
	iweiny, ming.li, linux-cxl, linux-kernel, newtonl, kristinc,
	kaihengf, kobak

On Tue, Jul 21, 2026 at 04:40:09PM +0800, Richard Cheng wrote:
> Building cxl_test with LLVM=1 (ld.lld) fails in modpost:
> 
> """
>   cxl_core: .export_symbol section references '__wrap_...', but it
>   does not seem to be an export symbol
> """
> 
> cxl_test --wraps 6 symbols that cxl_core both defines and exports.
> GNU ld only wraps undefined references, but ld.lld also redirects
> references to defined symbols, so cxl_core's own EXPORT_SYMBOL entries
> get rewritten to __wrap_* and modpost rejects them.
> 
> cxl_core never calls these symbols, so wrap them only in the caller
> modules via LDFLAGS_<module>.o instead of the global ldflags-y.

Reviewed-by: Alison Schofield <alison.schofield@intel.com>

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

* Re: [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols
  2026-07-21  8:40 [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols Richard Cheng
  2026-07-21 16:22 ` Dave Jiang
  2026-08-17 23:18 ` Alison Schofield
@ 2026-08-19 14:53 ` shaikh kamaluddin
  2026-08-20  2:09   ` Richard Cheng
  2 siblings, 1 reply; 5+ messages in thread
From: shaikh kamaluddin @ 2026-08-19 14:53 UTC (permalink / raw)
  To: Richard Cheng
  Cc: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
	danwilliams, iweiny, ming.li, linux-cxl, linux-kernel, newtonl,
	kristinc, kaihengf, kobak

On Tue, Jul 21, 2026 at 04:40:09PM +0800, Richard Cheng wrote:
> Building cxl_test with LLVM=1 (ld.lld) fails in modpost:
> 
> """
>   cxl_core: .export_symbol section references '__wrap_...', but it
>   does not seem to be an export symbol
> """
> 
> cxl_test --wraps 6 symbols that cxl_core both defines and exports.
> GNU ld only wraps undefined references, but ld.lld also redirects
> references to defined symbols, so cxl_core's own EXPORT_SYMBOL entries
> get rewritten to __wrap_* and modpost rejects them.
> 
> cxl_core never calls these symbols, so wrap them only in the caller
> modules via LDFLAGS_<module>.o instead of the global ldflags-y.
> 
> Signed-off-by: Richard Cheng <icheng@nvidia.com>
> ---
>  tools/testing/cxl/Kbuild | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
> index 2be1df80fcc9..e49ce644b4b1 100644
> --- a/tools/testing/cxl/Kbuild
> +++ b/tools/testing/cxl/Kbuild
> @@ -4,16 +4,20 @@ ldflags-y += --wrap=is_acpi_device_node
>  ldflags-y += --wrap=acpi_evaluate_integer
>  ldflags-y += --wrap=acpi_pci_find_root
>  ldflags-y += --wrap=nvdimm_bus_register
> -ldflags-y += --wrap=cxl_await_media_ready
> -ldflags-y += --wrap=devm_cxl_add_rch_dport
> -ldflags-y += --wrap=cxl_endpoint_parse_cdat
> -ldflags-y += --wrap=devm_cxl_endpoint_decoders_setup
>  ldflags-y += --wrap=hmat_get_extended_linear_cache_size
> -ldflags-y += --wrap=devm_cxl_add_dport_by_dev
> -ldflags-y += --wrap=devm_cxl_switch_port_decoders_setup
>  ldflags-y += --wrap=walk_hmem_resources
>  ldflags-y += --wrap=region_intersects
>  ldflags-y += --wrap=region_intersects_soft_reserve
> +wrap_cxl_core := --wrap=cxl_await_media_ready
> +wrap_cxl_core += --wrap=devm_cxl_add_rch_dport
> +wrap_cxl_core += --wrap=devm_cxl_add_dport_by_dev
> +wrap_cxl_core += --wrap=devm_cxl_switch_port_decoders_setup
> +wrap_cxl_core += --wrap=devm_cxl_endpoint_decoders_setup
> +wrap_cxl_core += --wrap=cxl_endpoint_parse_cdat
> +LDFLAGS_cxl_acpi.o += $(wrap_cxl_core)
> +LDFLAGS_cxl_pmem.o += $(wrap_cxl_core)
> +LDFLAGS_cxl_port.o += $(wrap_cxl_core)
> +LDFLAGS_cxl_mem.o  += $(wrap_cxl_core)
>  
>  DRIVERS := ../../../drivers
>  DAX_HMEM_SRC := $(DRIVERS)/dax/hmem
> -- 
> 2.43.0
>

Hi Richard,

I was hitting the same tools/testing/cxl build failure on current cxl/next.
modpost was failing on wrapped CXL symbols, for example:

.export_symbol section references '__wrap_devm_cxl_add_rch_dport',
but it does not seem to be an export symbol

.export_symbol section references '__wrap_devm_cxl_add_dport_by_dev',
but it does not seem to be an export symbol

.export_symbol section references '__wrap_cxl_await_media_ready',
but it does not seem to be an export symbol

I found this patch while investigating the failure and applied it to my tree. 
With the patch applied, the wrapped-symbol build issue is resolved and tools/testing/cxl 
builds successfully for me.

Tested-by: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>

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

* Re: [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols
  2026-08-19 14:53 ` shaikh kamaluddin
@ 2026-08-20  2:09   ` Richard Cheng
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Cheng @ 2026-08-20  2:09 UTC (permalink / raw)
  To: shaikh kamaluddin
  Cc: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
	danwilliams, iweiny, ming.li, linux-cxl, linux-kernel, newtonl,
	kristinc, kaihengf, kobak

On Wed, Aug 19, 2026 at 08:23:47PM +0800, shaikh kamaluddin wrote:
> On Tue, Jul 21, 2026 at 04:40:09PM +0800, Richard Cheng wrote:
> > Building cxl_test with LLVM=1 (ld.lld) fails in modpost:
> > 
> > """
> >   cxl_core: .export_symbol section references '__wrap_...', but it
> >   does not seem to be an export symbol
> > """
> > 
> > cxl_test --wraps 6 symbols that cxl_core both defines and exports.
> > GNU ld only wraps undefined references, but ld.lld also redirects
> > references to defined symbols, so cxl_core's own EXPORT_SYMBOL entries
> > get rewritten to __wrap_* and modpost rejects them.
> > 
> > cxl_core never calls these symbols, so wrap them only in the caller
> > modules via LDFLAGS_<module>.o instead of the global ldflags-y.
> > 
> > Signed-off-by: Richard Cheng <icheng@nvidia.com>
> > ---
> >  tools/testing/cxl/Kbuild | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> > 
> > diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
> > index 2be1df80fcc9..e49ce644b4b1 100644
> > --- a/tools/testing/cxl/Kbuild
> > +++ b/tools/testing/cxl/Kbuild
> > @@ -4,16 +4,20 @@ ldflags-y += --wrap=is_acpi_device_node
> >  ldflags-y += --wrap=acpi_evaluate_integer
> >  ldflags-y += --wrap=acpi_pci_find_root
> >  ldflags-y += --wrap=nvdimm_bus_register
> > -ldflags-y += --wrap=cxl_await_media_ready
> > -ldflags-y += --wrap=devm_cxl_add_rch_dport
> > -ldflags-y += --wrap=cxl_endpoint_parse_cdat
> > -ldflags-y += --wrap=devm_cxl_endpoint_decoders_setup
> >  ldflags-y += --wrap=hmat_get_extended_linear_cache_size
> > -ldflags-y += --wrap=devm_cxl_add_dport_by_dev
> > -ldflags-y += --wrap=devm_cxl_switch_port_decoders_setup
> >  ldflags-y += --wrap=walk_hmem_resources
> >  ldflags-y += --wrap=region_intersects
> >  ldflags-y += --wrap=region_intersects_soft_reserve
> > +wrap_cxl_core := --wrap=cxl_await_media_ready
> > +wrap_cxl_core += --wrap=devm_cxl_add_rch_dport
> > +wrap_cxl_core += --wrap=devm_cxl_add_dport_by_dev
> > +wrap_cxl_core += --wrap=devm_cxl_switch_port_decoders_setup
> > +wrap_cxl_core += --wrap=devm_cxl_endpoint_decoders_setup
> > +wrap_cxl_core += --wrap=cxl_endpoint_parse_cdat
> > +LDFLAGS_cxl_acpi.o += $(wrap_cxl_core)
> > +LDFLAGS_cxl_pmem.o += $(wrap_cxl_core)
> > +LDFLAGS_cxl_port.o += $(wrap_cxl_core)
> > +LDFLAGS_cxl_mem.o  += $(wrap_cxl_core)
> >  
> >  DRIVERS := ../../../drivers
> >  DAX_HMEM_SRC := $(DRIVERS)/dax/hmem
> > -- 
> > 2.43.0
> >
> 
> Hi Richard,
> 
> I was hitting the same tools/testing/cxl build failure on current cxl/next.
> modpost was failing on wrapped CXL symbols, for example:
> 
> .export_symbol section references '__wrap_devm_cxl_add_rch_dport',
> but it does not seem to be an export symbol
> 
> .export_symbol section references '__wrap_devm_cxl_add_dport_by_dev',
> but it does not seem to be an export symbol
> 
> .export_symbol section references '__wrap_cxl_await_media_ready',
> but it does not seem to be an export symbol
> 
> I found this patch while investigating the failure and applied it to my tree. 
> With the patch applied, the wrapped-symbol build issue is resolved and tools/testing/cxl 
> builds successfully for me.
> 
> Tested-by: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>

Hi Shaikh,

Happy to hear that, appreciate for this.

Best regards,
Richard Cheng.

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

end of thread, other threads:[~2026-08-20  2:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-21  8:40 [PATCH] tools/testing/cxl: Don't wrap cxl_core's own exported symbols Richard Cheng
2026-07-21 16:22 ` Dave Jiang
2026-08-17 23:18 ` Alison Schofield
2026-08-19 14:53 ` shaikh kamaluddin
2026-08-20  2:09   ` Richard Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®