patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] mk: avoid combining -r and -export-dynamic linker options
@ 2020-01-27  1:33 Rafael Ávila de Espíndola
  2020-01-27  8:30 ` [dpdk-stable] [seastar-dev] " Avi Kivity
  2020-01-27  8:34 ` Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael Ávila de Espíndola @ 2020-01-27  1:33 UTC (permalink / raw)
  To: seastar-dev; +Cc: Rafael Ávila de Espíndola, stable

Running ld with -r switches the linker to a very special mode where
some other linker options don't make sense.

In particular, -export-dynamic normally requires that all global
symbols be included in the dynamic symbol table, but a .o file doesn't
even have a dynamic symbol table.

When given both options it looks like the gnu linker just ignores
-export-dynamic.

Unfortunately some versions of lld (https://lld.llvm.org/) have a bug
that causes it to try to create a dynamic symbol table in the output
.o file and ends up corrupting it
(https://bugs.llvm.org/show_bug.cgi?id=43552). Current (git) version
of lld now issues an error.

This patch filters out -export-dynamic from $(LDFLAGS) when using
-r. With this patch I can build dpdk with lld.

Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")
Cc: stable@dpdk.org

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
(cherry picked from commit 5a352a3a98e3297555cb08d2db6e45a93ce7e058)
---
Once seastar is updated to use this it should be possible to build
seastar and scylla with lld, which might help with the bots running
out of resources during the link.

 mk/internal/rte.compile-pre.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
index 0cf3791b4..82fe098f7 100644
--- a/mk/internal/rte.compile-pre.mk
+++ b/mk/internal/rte.compile-pre.mk
@@ -61,7 +61,7 @@ CHECK_EXPERIMENTAL = $(EXPERIMENTAL_CHECK) $(SRCDIR)/$(EXPORT_MAP) $@
 
 PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
 PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@.pmd.o $@.pmd.c
-PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
+PMDINFO_LD = $(CROSS)ld -r $(filter-out -export-dynamic,$(LDFLAGS)) -o $@.o $@.pmd.o $@
 PMDINFO_TO_O = if grep -q 'RTE_PMD_REGISTER_.*(.*)' $<; then \
 	echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
 	$(PMDINFO_GEN) && \
-- 
2.24.1


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

* Re: [dpdk-stable] [seastar-dev] [PATCH] mk: avoid combining -r and -export-dynamic linker options
  2020-01-27  1:33 [dpdk-stable] [PATCH] mk: avoid combining -r and -export-dynamic linker options Rafael Ávila de Espíndola
@ 2020-01-27  8:30 ` Avi Kivity
  2020-01-27  8:34 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2020-01-27  8:30 UTC (permalink / raw)
  To: Rafael Ávila de Espíndola, seastar-dev; +Cc: stable


On 27/01/2020 03.33, Rafael Ávila de Espíndola wrote:
> Running ld with -r switches the linker to a very special mode where
> some other linker options don't make sense.
>
> In particular, -export-dynamic normally requires that all global
> symbols be included in the dynamic symbol table, but a .o file doesn't
> even have a dynamic symbol table.
>
> When given both options it looks like the gnu linker just ignores
> -export-dynamic.
>
> Unfortunately some versions of lld (https://lld.llvm.org/) have a bug
> that causes it to try to create a dynamic symbol table in the output
> .o file and ends up corrupting it
> (https://bugs.llvm.org/show_bug.cgi?id=43552). Current (git) version
> of lld now issues an error.
>
> This patch filters out -export-dynamic from $(LDFLAGS) when using
> -r. With this patch I can build dpdk with lld.
>
> Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")
> Cc: stable@dpdk.org
>
> Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
> (cherry picked from commit 5a352a3a98e3297555cb08d2db6e45a93ce7e058)
> ---
> Once seastar is updated to use this it should be possible to build
> seastar and scylla with lld, which might help with the bots running
> out of resources during the link.


That turned out to be a configuration problem (docker was limited to a 
small number of tasks, and multithreaded linking overflowed it).


Not to say we shouldn't support lld, of course.


>   mk/internal/rte.compile-pre.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
> index 0cf3791b4..82fe098f7 100644
> --- a/mk/internal/rte.compile-pre.mk
> +++ b/mk/internal/rte.compile-pre.mk
> @@ -61,7 +61,7 @@ CHECK_EXPERIMENTAL = $(EXPERIMENTAL_CHECK) $(SRCDIR)/$(EXPORT_MAP) $@
>   
>   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
>   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@.pmd.o $@.pmd.c
> -PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> +PMDINFO_LD = $(CROSS)ld -r $(filter-out -export-dynamic,$(LDFLAGS)) -o $@.o $@.pmd.o $@
>   PMDINFO_TO_O = if grep -q 'RTE_PMD_REGISTER_.*(.*)' $<; then \
>   	echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
>   	$(PMDINFO_GEN) && \

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

* Re: [dpdk-stable] [seastar-dev] [PATCH] mk: avoid combining -r and -export-dynamic linker options
  2020-01-27  1:33 [dpdk-stable] [PATCH] mk: avoid combining -r and -export-dynamic linker options Rafael Ávila de Espíndola
  2020-01-27  8:30 ` [dpdk-stable] [seastar-dev] " Avi Kivity
@ 2020-01-27  8:34 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2020-01-27  8:34 UTC (permalink / raw)
  To: Rafael Ávila de Espíndola, seastar-dev; +Cc: stable

I'm guessing you need to get it to upstream dpdk.git before the stable@ 
will be honored.

On 27/01/2020 03.33, Rafael Ávila de Espíndola wrote:
> Running ld with -r switches the linker to a very special mode where
> some other linker options don't make sense.
>
> In particular, -export-dynamic normally requires that all global
> symbols be included in the dynamic symbol table, but a .o file doesn't
> even have a dynamic symbol table.
>
> When given both options it looks like the gnu linker just ignores
> -export-dynamic.
>
> Unfortunately some versions of lld (https://lld.llvm.org/) have a bug
> that causes it to try to create a dynamic symbol table in the output
> .o file and ends up corrupting it
> (https://bugs.llvm.org/show_bug.cgi?id=43552). Current (git) version
> of lld now issues an error.
>
> This patch filters out -export-dynamic from $(LDFLAGS) when using
> -r. With this patch I can build dpdk with lld.
>
> Fixes: 3d781ca32874 ("mk: do post processing on objects that register a driver")
> Cc: stable@dpdk.org
>
> Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
> (cherry picked from commit 5a352a3a98e3297555cb08d2db6e45a93ce7e058)
> ---
> Once seastar is updated to use this it should be possible to build
> seastar and scylla with lld, which might help with the bots running
> out of resources during the link.
>
>   mk/internal/rte.compile-pre.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mk/internal/rte.compile-pre.mk b/mk/internal/rte.compile-pre.mk
> index 0cf3791b4..82fe098f7 100644
> --- a/mk/internal/rte.compile-pre.mk
> +++ b/mk/internal/rte.compile-pre.mk
> @@ -61,7 +61,7 @@ CHECK_EXPERIMENTAL = $(EXPERIMENTAL_CHECK) $(SRCDIR)/$(EXPORT_MAP) $@
>   
>   PMDINFO_GEN = $(RTE_SDK_BIN)/app/dpdk-pmdinfogen $@ $@.pmd.c
>   PMDINFO_CC = $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@.pmd.o $@.pmd.c
> -PMDINFO_LD = $(CROSS)ld $(LDFLAGS) -r -o $@.o $@.pmd.o $@
> +PMDINFO_LD = $(CROSS)ld -r $(filter-out -export-dynamic,$(LDFLAGS)) -o $@.o $@.pmd.o $@
>   PMDINFO_TO_O = if grep -q 'RTE_PMD_REGISTER_.*(.*)' $<; then \
>   	echo "$(if $V,$(PMDINFO_GEN),  PMDINFO $@.pmd.c)" && \
>   	$(PMDINFO_GEN) && \

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

end of thread, other threads:[~2020-01-28 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27  1:33 [dpdk-stable] [PATCH] mk: avoid combining -r and -export-dynamic linker options Rafael Ávila de Espíndola
2020-01-27  8:30 ` [dpdk-stable] [seastar-dev] " Avi Kivity
2020-01-27  8:34 ` Avi Kivity

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).