Underlinked libs and overlinked applications - an issue?
Subsystems (3)
Hi,
I was working on the new 16.04 build system to adapt deb packaging to it. I remember somewhen back in the DPDK 2.2 and shared+combined library days I had some issues with over/underlinking - but it seems those are still existent or came back.
After a build in almost default config (just disabled the kernel modules) and set RTE_MACHINE to default I find the following.
#1
The libraries are all only linked against external things - even clearly using internal structures:
ldd usr/lib/x86_64-linux-gnu/librte_lpm.so.2
linux-vdso.so.1 => (0x00007fff7e7a5000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f175d4dd000)
/lib64/ld-linux-x86-64.so.2 (0x0000558d3afbf000)#2
The Application then seem to try to make up for that by realizing all that is missing.
But looking at the app alone it seems overlinked by that - it is not using all of these on its own.
ldd usr/bin/cmdline_test
linux-vdso.so.1 => (0x00007ffeec9ea000) librte_distributor.so.1 => not found librte_reorder.so.1 => not found
[...]
librte_jobstats.so.1 => not found
[...]
And for example none of the librte_jobstats.so.1 symbols are used "directly" in there.
I'm still digging into that concept of using a linker script for all of that and some of the new implications by that. And eventually thing "work", but this linking at least feels wrong to me.
So I wanted to ask - is that intentional - or should that be fixed? If it should be fixed are there obvious suggestions where/how? And if it is intentional - could one be so nice to elaborate it a bit for me - thanks in advance.
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
2016-05-19 17:38, Christian Ehrhardt:
Quoted 5 lines
Hi,
I was working on the new 16.04 build system to adapt deb packaging to it. I remember somewhen back in the DPDK 2.2 and shared+combined library days I had some issues with over/underlinking - but it seems those are still existent or came back.
I would say it has always been like that.
Thanks for raising the issue.
Quoted 10 lines
After a build in almost default config (just disabled the kernel modules) and set
RTE_MACHINEto default I find the following.#1
The libraries are all only linked against external things - even clearly using internal structures:
lddusr/lib/x86_64-linux-gnu/librte_lpm.so.2linux-vdso.so.1 => (0x00007fff7e7a5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f175d4dd000) /lib64/ld-linux-x86-64.so.2 (0x0000558d3afbf000)
The DT_NEEDED entries are created only for external dependencies. Probably we should create ones for internal dependencies based on the variable DEPDIRS-y.
Quoted 6 lines
#2
The Application then seem to try to make up for that by realizing all that is missing.
But looking at the app alone it seems overlinked by that - it is not using all of these on its own.
lddusr/bin/cmdline_test
Quoted 8 lines
linux-vdso.so.1 => (
0x00007ffeec9ea000) librte_distributor.so.1 => not found librte_reorder.so.1 => not found
[...]
librte_jobstats.so.1 => not found
[...]
And for example none of the librte_jobstats.so.1 symbols are used "directly" in there.
Yes every libraries are put for every apps in rte.app.mk. Probably that we could better use DEPDIRS-y for apps.
Quoted 21 lines · Thomas Monjalon
2016-05-19 17:38, Christian Ehrhardt:
Quoted 5 lines
Hi,
I was working on the new 16.04 build system to adapt deb packaging to it. I remember somewhen back in the DPDK 2.2 and shared+combined library days I had some issues with over/underlinking - but it seems those are still existent or came back.I would say it has always been like that.
Thanks for raising the issue.Quoted 10 lines
After a build in almost default config (just disabled the kernel modules) and set
RTE_MACHINEto default I find the following.#1
The libraries are all only linked against external things - even clearly using internal structures:
lddusr/lib/x86_64-linux-gnu/librte_lpm.so.2linux-vdso.so.1 => (0x00007fff7e7a5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f175d4dd000) /lib64/ld-linux-x86-64.so.2 (0x0000558d3afbf000)
Quoted 3 lines
The
DT_NEEDEDentries are created only for external dependencies. Probably we should create ones for internal dependencies based on the variable DEPDIRS-y.
Yes, DT_NEEDED for internal dependencies are needed too, see eg recent commits c6417ce61f83 and 8180554d82b3. That was part of Sergios' build system improvement patch series last spring or so (but since then abandoned), I picked up the work and been doing it in smaller pieces. Phase 1 was the external dependencies, phase 2 is internal dependencies which I'm working on. Unfortunately health issues have stalled my work a lot recently :-/
Quoted 15 lines
Quoted 6 lines
#2
The Application then seem to try to make up for that by realizing all that is missing.
But looking at the app alone it seems overlinked by that - it is not using all of these on its own.
lddusr/bin/cmdline_testQuoted 8 lines
linux-vdso.so.1 => (
0x00007ffeec9ea000) librte_distributor.so.1 => not found librte_reorder.so.1 => not found
[...]
librte_jobstats.so.1 => not found
[...]
And for example none of the librte_jobstats.so.1 symbols are used "directly" in there.
Quoted 3 lines
Yes every libraries are put for every apps in rte.app.mk. Probably that we could better use DEPDIRS-y for apps.
Another trick from Sergios' original patch series is to utilize AS_NEEDED() in the linker script, so it ends up looking something like this for shared library config (static would remain as it is now):
INPUT ( librte_eal librte_mempool librte_ring
AS_NEEDED ( librte_acl librte_timer librte_vhost <...> )
)
...and then use the linker script for linking the apps, which should simplify rte.app.mk considerably. Or so the theory goes. Anyway, the above requires DT_NEEDED for the internal libraries to be present first, but once all these pieces are in place, dynamically linked apps will only link to the libraries they actually need.
- Panu -
- Panu -
Quoted 32 lines · Panu Matilainen
Quoted 25 lines · Thomas Monjalon
2016-05-19 17:38, Christian Ehrhardt:
Quoted 7 lines
Hi,
I was working on the new 16.04 build system to adapt deb packaging to it. I remember somewhen back in the DPDK 2.2 and shared+combined library days I
had some issues with over/underlinking - but it seems those are still existent or came back.I would say it has always been like that.
Thanks for raising the issue.After a build in almost default config (just disabled the kernel modules)
Quoted 10 lines
and set
RTE_MACHINEto default I find the following.#1
The libraries are all only linked against external things - even clearly using internal structures:
lddusr/lib/x86_64-linux-gnu/librte_lpm.so.2linux-vdso.so.1 => (0x00007fff7e7a5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f175d4dd000) /lib64/ld-linux-x86-64.so.2 (0x0000558d3afbf000)Quoted 4 lines
The
DT_NEEDEDentries are created only for external dependencies. Probably we should create ones for internal dependencies based on the variable DEPDIRS-y.
Quoted 7 lines
Yes,
DT_NEEDEDfor internal dependencies are needed too, see eg recent commitsc6417ce61f83and8180554d82b3. That was part of Sergios' build system improvement patch series last spring or so (but since then abandoned), I picked up the work and been doing it in smaller pieces. Phase 1 was the external dependencies, phase 2 is internal dependencies which I'm working on. Unfortunately health issues have stalled my work a lot recently :-/
Since I work on 16.04 as released currently I almost missed those, but I at least remember seeing the first on the list.
I had almost the same change - adopting yours since it is accepted. Maybe I can provide a few more baby steps on that path - or at least a few more pieces for discussion and review.
I hope you get well soon Panu!
Quoted 30 lines
#2
Quoted 17 lines
Quoted 7 lines
The Application then seem to try to make up for that by realizing all that
is missing.
But looking at the app alone it seems overlinked by that - it is not using
all of these on its own.
lddusr/bin/cmdline_testQuoted 9 lines
linux-vdso.so.1 => (
0x00007ffeec9ea000) librte_distributor.so.1 => not found librte_reorder.so.1 => not found
[...]
librte_jobstats.so.1 => not found
[...]
And for example none of the librte_jobstats.so.1 symbols are used "directly" in there.Quoted 4 lines
Yes every libraries are put for every apps in rte.app.mk. Probably that we could better use DEPDIRS-y for apps.
Another trick from Sergios' original patch series is to utilize
AS_NEEDED()in the linker script, so it ends up looking something like this for shared library config (static would remain as it is now):INPUT (
librte_eallibrte_mempoollibrte_ring
AS_NEEDED(librte_acllibrte_timerlibrte_vhost<...> )
)
Quoted 6 lines
...and then use the linker script for linking the apps, which should simplify rte.app.mk considerably. Or so the theory goes. Anyway, the above requires
DT_NEEDEDfor the internal libraries to be present first, but once all these pieces are in place, dynamically linked apps will only link to the libraries they actually need.
Interesting approach, I wasn't even working on DPDK back then - that could really simplify the mk there.
I was experimenting with just dropping the "no-as-needed" in mk/exec-env/linuxapp/rte.vars.mk, but that seems to shoot too far - haven't had the time to look deeper.
Interested if your approach could help.
But the other part of it - getting the proper DT_NEEDED into the libs (I also consider underlinking worse than overlinking) seems to be just missing a bunch of -l - my last test build looked fine.
There is the underlinking issue of librte_eal left that Sergio mentioned back in 6d25d90c, but it seems to be the next baby step to solve most else of the underlinking.
I'll adapt it to git level and at least throw it out for discussion later on.
ok,
- little baby steps first
I'll submit a trivial patch in reply to this fixing the underlinking in
all .so's, except librte_eal.
- discussion on the remaining open issue second.
For the remaining issue I think that needs a special understanding of
linkers I still need to grasp.
But since I failed to find a good explanation for the exact case we face
here I put it in a generalized form on StackOverflow so eventually more than just us can benefit from the answer once/if we find an answer.
So to all of you - if you are not scared of the latter pages of ld/gcc man pages :-) feel free to take a look at
http://stackoverflow.com/questions/37351699/how-to-create-both-so-files-for-two-circular-depending-libraries
For us, but not important for the question in general:
liba = librte_eal, libb = librte_mempool
(and ring, ivshmem, but once it is solved once it is solved)
Time to stip for now, have a great Weekend
Christian
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
Quoted 107 lines · Christian Ehrhardt
Quoted 33 lines · Panu Matilainen
Quoted 26 lines · Thomas Monjalon
2016-05-19 17:38, Christian Ehrhardt:
Quoted 8 lines
Hi,
I was working on the new 16.04 build system to adapt deb packaging to it.
I remember somewhen back in the DPDK 2.2 and shared+combined library days I
had some issues with over/underlinking - but it seems those are still existent or came back.I would say it has always been like that.
Thanks for raising the issue.After a build in almost default config (just disabled the kernel modules)
Quoted 10 lines
and set
RTE_MACHINEto default I find the following.#1
The libraries are all only linked against external things - even clearly using internal structures:
lddusr/lib/x86_64-linux-gnu/librte_lpm.so.2linux-vdso.so.1 => (0x00007fff7e7a5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f175d4dd000) /lib64/ld-linux-x86-64.so.2 (0x0000558d3afbf000)Quoted 4 lines
The
DT_NEEDEDentries are created only for external dependencies. Probably we should create ones for internal dependencies based on the variable DEPDIRS-y.Quoted 7 lines
Yes,
DT_NEEDEDfor internal dependencies are needed too, see eg recent commitsc6417ce61f83and8180554d82b3. That was part of Sergios' build system improvement patch series last spring or so (but since then abandoned), I picked up the work and been doing it in smaller pieces. Phase 1 was the external dependencies, phase 2 is internal dependencies which I'm working on. Unfortunately health issues have stalled my work a lot recently :-/Since I work on 16.04 as released currently I almost missed those, but I at least remember seeing the first on the list.
I had almost the same change - adopting yours since it is accepted. Maybe I can provide a few more baby steps on that path - or at least a few more pieces for discussion and review.
I hope you get well soon Panu!Quoted 30 lines
#2
Quoted 17 lines
Quoted 7 lines
The Application then seem to try to make up for that by realizing all that
is missing.
But looking at the app alone it seems overlinked by that - it is not using
all of these on its own.
lddusr/bin/cmdline_testQuoted 9 lines
linux-vdso.so.1 => (
0x00007ffeec9ea000) librte_distributor.so.1 => not found librte_reorder.so.1 => not found
[...]
librte_jobstats.so.1 => not found
[...]
And for example none of the librte_jobstats.so.1 symbols are used "directly" in there.Quoted 4 lines
Yes every libraries are put for every apps in rte.app.mk. Probably that we could better use DEPDIRS-y for apps.
Another trick from Sergios' original patch series is to utilize
AS_NEEDED()in the linker script, so it ends up looking something like this for shared library config (static would remain as it is now):INPUT (
librte_eallibrte_mempoollibrte_ring
AS_NEEDED(librte_acllibrte_timerlibrte_vhost<...> )
)Quoted 6 lines
...and then use the linker script for linking the apps, which should simplify rte.app.mk considerably. Or so the theory goes. Anyway, the above requires
DT_NEEDEDfor the internal libraries to be present first, but once all these pieces are in place, dynamically linked apps will only link to the libraries they actually need.Interesting approach, I wasn't even working on DPDK back then - that could really simplify the mk there.
I was experimenting with just dropping the "no-as-needed" inmk/exec-env/linuxapp/rte.vars.mk, but that seems to shoot too far - haven't had the time to look deeper.
Interested if your approach could help.But the other part of it - getting the proper
DT_NEEDEDinto the libs (I also consider underlinking worse than overlinking) seems to be just missing a bunch of -l - my last test build looked fine.
There is the underlinking issue oflibrte_ealleft that Sergio mentioned back in6d25d90c, but it seems to be the next baby step to solve most else of the underlinking.
I'll adapt it to git level and at least throw it out for discussion later on.
PATCH 1/1 mk: fix underlinking issues of most librte libraries
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper DT_NEEDED flags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.
--- lib/librte_acl/Makefile | 1 + lib/librte_cfgfile/Makefile | 1 + lib/librte_cmdline/Makefile | 1 + lib/librte_cryptodev/Makefile | 1 + lib/librte_distributor/Makefile | 1 + lib/librte_ether/Makefile | 1 + lib/librte_hash/Makefile | 1 + lib/librte_ip_frag/Makefile | 1 + lib/librte_ivshmem/Makefile | 1 + lib/librte_jobstats/Makefile | 1 + lib/librte_kni/Makefile | 1 + lib/librte_kvargs/Makefile | 1 + lib/librte_lpm/Makefile | 1 + lib/librte_mbuf/Makefile | 1 + lib/librte_mempool/Makefile | 1 + lib/librte_meter/Makefile | 1 + lib/librte_pipeline/Makefile | 1 + lib/librte_port/Makefile | 1 + lib/librte_power/Makefile | 1 + lib/librte_reorder/Makefile | 1 + lib/librte_ring/Makefile | 1 + lib/librte_sched/Makefile | 1 + lib/librte_table/Makefile | 3 +++ lib/librte_timer/Makefile | 1 + lib/librte_vhost/Makefile | 1 + 25 files changed, 27 insertions(+)
lib/librte_acl/Makefile +1 -0
@@ -91,6 +91,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include := rte_acl_osdep.h SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += rte_acl.h # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_ACL) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_cfgfile/Makefile +1 -0
@@ -52,6 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CFGFILE) += rte_cfgfile.c SYMLINK-$(CONFIG_RTE_LIBRTE_CFGFILE)-include += rte_cfgfile.h # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_cmdline/Makefile +1 -0
@@ -62,6 +62,7 @@ INCS += cmdline_vt100.h cmdline_socket.h cmdline_cirbuf.h cmdline_parse_portlist SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS) # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_cryptodev/Makefile +1 -0
@@ -53,6 +53,7 @@ SYMLINK-y-include += rte_cryptodev_pmd.h EXPORT_MAP := rte_cryptodev_version.map # library dependencies +LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf -lrte_kvargs DEPDIRS-y += lib/librte_eal DEPDIRS-y += lib/librte_mempool DEPDIRS-y += lib/librte_ring
lib/librte_distributor/Makefile +1 -0
@@ -48,6 +48,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c SYMLINK-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)-include := rte_distributor.h # this lib needs eal +LDLIBS += -lrte_eal -lrte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_mbuf
lib/librte_ether/Makefile +1 -0
@@ -54,6 +54,7 @@ SYMLINK-y-include += rte_eth_ctrl.h SYMLINK-y-include += rte_dev_info.h # this lib depends upon: +LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf DEPDIRS-y += lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_hash/Makefile +1 -0
@@ -56,6 +56,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_thash.h SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_fbk_hash.h # this lib needs eal and ring +LDLIBS += -lrte_eal -lrte_ring DEPDIRS-$(CONFIG_RTE_LIBRTE_HASH) += lib/librte_eal lib/librte_ring include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_ip_frag/Makefile +1 -0
@@ -54,6 +54,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h # this library depends on rte_ether +LDLIBS += -lrte_mempool -lethdev DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool lib/librte_ether include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_ivshmem/Makefile +1 -0
@@ -47,6 +47,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IVSHMEM) := rte_ivshmem.c SYMLINK-$(CONFIG_RTE_LIBRTE_IVSHMEM)-include := rte_ivshmem.h # this lib needs eal +LDLIBS += -lrte_mempool DEPDIRS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += lib/librte_mempool include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_jobstats/Makefile +1 -0
@@ -48,6 +48,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c SYMLINK-$(CONFIG_RTE_LIBRTE_JOBSTATS)-include := rte_jobstats.h # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_kni/Makefile +1 -0
@@ -47,6 +47,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c SYMLINK-$(CONFIG_RTE_LIBRTE_KNI)-include := rte_kni.h # this lib needs eal +LDLIBS += -lrte_eal -lrte_mbuf -lethdev DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_eal lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_ether
lib/librte_kvargs/Makefile +1 -0
@@ -50,6 +50,7 @@ INCS := rte_kvargs.h SYMLINK-$(CONFIG_RTE_LIBRTE_KVARGS)-include := $(INCS) # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_lpm/Makefile +1 -0
@@ -54,6 +54,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_sse.h endif # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_LPM) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_mbuf/Makefile +1 -0
@@ -47,6 +47,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h # this lib needs eal +LDLIBS += -lrte_eal -lrte_mempool DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_mempool/Makefile +1 -0
@@ -45,6 +45,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += rte_mempool.c # install includes SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h +LDLIBS += -lrte_eal -lrte_ring DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/librte_eal lib/librte_ring include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_meter/Makefile +1 -0
@@ -54,6 +54,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_METER) := rte_meter.c SYMLINK-$(CONFIG_RTE_LIBRTE_METER)-include := rte_meter.h # this lib depends upon: +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_METER) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/Makefile +1 -0
@@ -52,6 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h # this lib depends upon: +LDLIBS += -lrte_table -lrte_port DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) := lib/librte_table DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_port
lib/librte_port/Makefile +1 -0
@@ -70,6 +70,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_sched.h SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_source_sink.h # this lib depends upon: +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lethdev -lrte_ip_frag DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) := lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
lib/librte_power/Makefile +1 -0
@@ -48,6 +48,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_POWER) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_reorder/Makefile +1 -0
@@ -48,6 +48,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c SYMLINK-$(CONFIG_RTE_LIBRTE_REORDER)-include := rte_reorder.h # this lib depends upon: +LDLIBS += -lrte_eal -lrte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_eal
lib/librte_ring/Makefile +1 -0
@@ -46,6 +46,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c # install includes SYMLINK-$(CONFIG_RTE_LIBRTE_RING)-include := rte_ring.h +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_sched/Makefile +1 -0
@@ -59,6 +59,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h # this lib depends upon: +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_timer DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_net lib/librte_timer
lib/librte_table/Makefile +3 -0
@@ -72,14 +72,17 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_array.h SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_stub.h # this lib depends upon: +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_port -lrte_lpm DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) := lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mempool DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) +LDLIBS += -lrte_acl DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl endif +LDLIBS += -lrte_hash DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_timer/Makefile +1 -0
@@ -47,6 +47,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c SYMLINK-$(CONFIG_RTE_LIBRTE_TIMER)-include := rte_timer.h # this lib needs eal +LDLIBS += -lrte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_TIMER) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_vhost/Makefile +1 -0
@@ -63,6 +63,7 @@ endif SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h # dependencies +LDLIBS += -lrte_eal -lethdev -lrte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mbuf
Signature · 1 line
2.7.4
Re: [PATCH] mk: fix underlinking issues of most librte libraries
2016-05-20 18:50, Christian Ehrhardt:
Quoted 5 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.
Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
Re: [PATCH] mk: fix underlinking issues of most librte libraries
Quoted 9 lines · Thomas Monjalon
2016-05-20 18:50, Christian Ehrhardt:
Quoted 5 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +6 -0
@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compat +_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")
I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
- Panu -
Re: [PATCH] mk: fix underlinking issues of most librte libraries
Hi Panu,
I already agreed to Thomas on IRC but won't have time until next week. Thanks for making a patch that does that already - I'll give it a look and some test on my end next week then.
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
Quoted 44 lines · Panu Matilainen
Quoted 12 lines · Thomas Monjalon
2016-05-20 18:50, Christian Ehrhardt:
Quoted 6 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +6
-0@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compat +_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
- Panu -
Re: [PATCH] mk: fix underlinking issues of most librte libraries
Quoted 52 lines · Christian Ehrhardt
Hi Panu,
I already agreed to Thomas on IRC but won't have time until next week. Thanks for making a patch that does that already - I'll give it a look and some test on my end next week then.Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical LtdQuoted 38 lines · Panu Matilainen
Quoted 12 lines · Thomas Monjalon
2016-05-20 18:50, Christian Ehrhardt:
Quoted 6 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +6
-0@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compat +_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")
Quoted 6 lines
Quoted 6 lines
I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
- Panu -
I did test the patch with minor diff in rte.vars.mk [1], otherwise all libraries kept needed in final library.
Patch itself looks good, overlinking problem in final binary seems fixed
[2] [3].
But this cause a compilation error for cmdline_test [4]. This is because of cyclic dependency between librte_eal <-> librte_mempool.
Other applications don't have this compilation error because they use librte_mempool, and since it is linked against application, this error not observed. cmdline_test itself doesn't have any direct call to librte_mempool.
It is possible to add workaround to cmdline_test [5], (introduce overlinking back), but should we attack on cyclic dependency instead?
Thanks,
ferruh
---
[1]
(quoted diff) +0 -0
b/mk/exec-env/linuxapp/rte.vars.mk
index d51bd17..10d37d5 100644
mk/exec-env/linuxapp/rte.vars.mk +1 -1
@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread endif # Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed +EXECENV_LDFLAGS = --as-needed EXECENV_LDLIBS = EXECENV_ASFLAGS =
[2]
# ldd build/app/testpmd
linux-vdso.so.1 (0x00007ffcff92e000)
librte_mbuf.so.2.1 => .../build/lib/librte_mbuf.so.2.1
libethdev.so.4.1 => .../build/lib/libethdev.so.4.1
librte_mempool.so.2.1 => .../build/lib/librte_mempool.so.2.1
librte_ring.so.1.1 => .../build/lib/librte_ring.so.1.1
librte_eal.so.2.1 => .../build/lib/librte_eal.so.2.1
librte_cmdline.so.2.1 => .../build/lib/librte_cmdline.so.2.1
librte_pmd_bond.so.1.1 => .../build/lib/librte_pmd_bond.so.1.1
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6879ff1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f6879c30000)
/lib64/ld-linux-x86-64.so.2 (0x0000564998dbd000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f6879a2c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6879814000)
librt.so.1 => /lib64/librt.so.1 (0x00007f687960c000)
librte_kvargs.so.1.1 => .../build/lib/librte_kvargs.so.1.1[3]
# ldd -u -r build/app/testpmd #
[4]
== Build app/cmdline_test
CC cmdline_test.o
CC commands.o
LD cmdline_test
.../build/lib/librte_eal.so: undefined reference to rte_mempool_lookup' .../build/lib/librte_eal.so: undefined reference to rte_mempool_create'
collect2: error: ld returned 1 exit status .../mk/rte.app.mk:243: recipe for target 'cmdline_test' failed make[3]: *** [cmdline_test] Error 1
[5]
app/cmdline_test/Makefile +1 -0
@@ -46,6 +46,7 @@ SRCS-y += commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +LDFLAGS += --no-as-needed # this application needs libraries first DEPDIRS-y += lib drivers
Re: [PATCH] mk: fix underlinking issues of most librte libraries
Quoted 69 lines · Ferruh Yigit
Quoted 52 lines · Christian Ehrhardt
Hi Panu,
I already agreed to Thomas on IRC but won't have time until next week. Thanks for making a patch that does that already - I'll give it a look and some test on my end next week then.Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical LtdQuoted 38 lines · Panu Matilainen
Quoted 12 lines · Thomas Monjalon
2016-05-20 18:50, Christian Ehrhardt:
Quoted 6 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +6
-0@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compat +_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")Quoted 6 lines
Quoted 6 lines
I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
- Panu -
I did test the patch with minor diff in rte.vars.mk [1], otherwise all libraries kept needed in final library.
Patch itself looks good, overlinking problem in final binary seems fixed
[2] [3].But this cause a compilation error for
cmdline_test[4]. This is because of cyclic dependency betweenlibrte_eal<->librte_mempool.
Quoted 7 lines
Other applications don't have this compilation error because they use
librte_mempool, and since it is linked against application, this error not observed.cmdline_testitself doesn't have any direct call tolibrte_mempool.It is possible to add workaround to
cmdline_test[5], (introduce overlinking back), but should we attack on cyclic dependency instead?
Cyclic dependencies are nasty, eliminating it would be good.
But in the meanwhile it can be worked around in a generic manner by handling it in the libdpdk.so linker script, see http://dpdk.org/ml/archives/dev/2016-May/039413.html
- Panu -
Quoted 72 lines
Thanks,
ferruh---
[1]
mk/exec-env/linuxapp/rte.vars.mk +1
-1@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread endif # Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed +EXECENV_LDFLAGS = --as-needed EXECENV_LDLIBS = EXECENV_ASFLAGS =[2]
# ldd build/app/testpmd linux-vdso.so.1 (0x00007ffcff92e000) librte_mbuf.so.2.1 => .../build/lib/librte_mbuf.so.2.1 libethdev.so.4.1 => .../build/lib/libethdev.so.4.1 librte_mempool.so.2.1 => .../build/lib/librte_mempool.so.2.1 librte_ring.so.1.1 => .../build/lib/librte_ring.so.1.1 librte_eal.so.2.1 => .../build/lib/librte_eal.so.2.1 librte_cmdline.so.2.1 => .../build/lib/librte_cmdline.so.2.1 librte_pmd_bond.so.1.1 => .../build/lib/librte_pmd_bond.so.1.1 libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6879ff1000) libc.so.6 => /lib64/libc.so.6 (0x00007f6879c30000) /lib64/ld-linux-x86-64.so.2 (0x0000564998dbd000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f6879a2c000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6879814000) librt.so.1 => /lib64/librt.so.1 (0x00007f687960c000) librte_kvargs.so.1.1 => .../build/lib/librte_kvargs.so.1.1[3]
# ldd -u -r build/app/testpmd #[4]
== Build app/cmdline_test
CC cmdline_test.o
CC commands.o
LDcmdline_test
.../build/lib/librte_eal.so: undefined reference torte_mempool_lookup' .../build/lib/librte_eal.so: undefined reference torte_mempool_create'
collect2: error: ld returned 1 exit status.../mk/rte.app.mk:243: recipe for target 'cmdline_test' failed make[3]: *** [cmdline_test] Error 1[5]
app/cmdline_test/Makefile +1
-0@@ -46,6 +46,7 @@ SRCS-y += commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +LDFLAGS += --no-as-needed # this application needs libraries first DEPDIRS-y += lib drivers
Re: [PATCH] mk: fix underlinking issues of most librte libraries
Quoted 75 lines · Panu Matilainen
Quoted 74 lines · Ferruh Yigit
Quoted 52 lines · Christian Ehrhardt
Hi Panu,
I already agreed to Thomas on IRC but won't have time until next week. Thanks for making a patch that does that already - I'll give it a look and some test on my end next week then.Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical LtdQuoted 38 lines · Panu Matilainen
Quoted 12 lines · Thomas Monjalon
2016-05-20 18:50, Christian Ehrhardt:
Quoted 6 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +6
-0@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compat +_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")Quoted 6 lines
Quoted 6 lines
I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
- Panu -
I did test the patch with minor diff in rte.vars.mk [1], otherwise all libraries kept needed in final library.
Patch itself looks good, overlinking problem in final binary seems fixed
[2] [3].But this cause a compilation error for
cmdline_test[4]. This is because of cyclic dependency betweenlibrte_eal<->librte_mempool.Other applications don't have this compilation error because they use
librte_mempool, and since it is linked against application, this error not observed.cmdline_testitself doesn't have any direct call tolibrte_mempool.
Quoted 9 lines
Quoted 2 lines
It is possible to add workaround to
cmdline_test[5], (introduce overlinking back), but should we attack on cyclic dependency instead?Cyclic dependencies are nasty, eliminating it would be good.
But in the meanwhile it can be worked around in a generic manner by handling it in the libdpdk.so linker script, see
http://dpdk.org/ml/archives/dev/2016-May/039413.html
Won't linker script has same problem, unless it is possible to select some libraries to force link and some other to as-needed, than this can be workaround, but I think using "--as-needed" as linker argument and applying workaround to single test application is better.
Also when overlinking removed, getting compilation error for lpcap too. Since -lpcap argument is before -lrte_pmd_pcap, symbols used by rte_pmd_pcap not resolved, increasing --start-group scope fixes this.
Not related to overlinking, but while updating linker flags, as far as I understand --whole-archive argument is only necessary for static pmd libraries, but currently has wider scope, reducing its scope to pmd slightly reduces final library sizes.
I will send a patch on top of your patch, with above updates.
Thanks,
ferruh
Quoted 75 lines
- Panu -
Quoted 72 lines
Thanks,
ferruh---
[1]
mk/exec-env/linuxapp/rte.vars.mk +1
-1@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread endif # Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed +EXECENV_LDFLAGS = --as-needed EXECENV_LDLIBS = EXECENV_ASFLAGS =[2]
# ldd build/app/testpmd linux-vdso.so.1 (0x00007ffcff92e000) librte_mbuf.so.2.1 => .../build/lib/librte_mbuf.so.2.1 libethdev.so.4.1 => .../build/lib/libethdev.so.4.1 librte_mempool.so.2.1 => .../build/lib/librte_mempool.so.2.1 librte_ring.so.1.1 => .../build/lib/librte_ring.so.1.1 librte_eal.so.2.1 => .../build/lib/librte_eal.so.2.1 librte_cmdline.so.2.1 => .../build/lib/librte_cmdline.so.2.1 librte_pmd_bond.so.1.1 => .../build/lib/librte_pmd_bond.so.1.1 libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6879ff1000) libc.so.6 => /lib64/libc.so.6 (0x00007f6879c30000) /lib64/ld-linux-x86-64.so.2 (0x0000564998dbd000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f6879a2c000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6879814000) librt.so.1 => /lib64/librt.so.1 (0x00007f687960c000) librte_kvargs.so.1.1 => .../build/lib/librte_kvargs.so.1.1[3]
# ldd -u -r build/app/testpmd #[4]
== Build app/cmdline_test
CC cmdline_test.o
CC commands.o
LDcmdline_test
.../build/lib/librte_eal.so: undefined reference torte_mempool_lookup' .../build/lib/librte_eal.so: undefined reference torte_mempool_create'
collect2: error: ld returned 1 exit status.../mk/rte.app.mk:243: recipe for target 'cmdline_test' failed make[3]: *** [cmdline_test] Error 1[5]
app/cmdline_test/Makefile +1
-0@@ -46,6 +46,7 @@ SRCS-y += commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +LDFLAGS += --no-as-needed # this application needs libraries first DEPDIRS-y += lib drivers
PATCH 1/2 mk: prevent overlinking in applications
Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application. This requires inter library dependencies resolved correctly.
Not linking all libraries cause a compile error for lpcap and possible to have other similar compiler errors, so increasing the scope of --start-group argument.
cmdline_test application causes compile error because of cyclic dependency between librte_eal <-> librte_mempool. A workaround added to cmdline_test for compile error.
---
This patch is on top of patch:
http://dpdk.org/dev/patchwork/patch/12987/
--- app/cmdline_test/Makefile | 1 + mk/exec-env/linuxapp/rte.vars.mk | 2 +- mk/rte.app.mk | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-)
app/cmdline_test/Makefile +1 -0
@@ -46,6 +46,7 @@ SRCS-y += commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +LDFLAGS += -no-as-needed # this application needs libraries first DEPDIRS-y += lib drivers
mk/exec-env/linuxapp/rte.vars.mk +1 -1
@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread endif # Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed +EXECENV_LDFLAGS = --as-needed EXECENV_LDLIBS = EXECENV_ASFLAGS =
mk/rte.app.mk +1 -2
@@ -58,6 +58,7 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib # _LDLIBS-y += --whole-archive +_LDLIBS-y += --start-group _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
@@ -111,8 +112,6 @@ _LDLIBS-y += -lcrypto endif endif # !CONFIG_RTE_BUILD_SHARED_LIBS -_LDLIBS-y += --start-group - _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
Signature · 1 line
2.5.5
PATCH 2/2 mk: reduce scope of whole-archive to pmd libraries
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
--- mk/rte.app.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mk/rte.app.mk +4 -2
@@ -57,7 +57,6 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib # Order is important: from higher level to lower level # -_LDLIBS-y += --whole-archive _LDLIBS-y += --start-group _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
@@ -129,6 +128,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) +_LDLIBS-y += --whole-archive + _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x
@@ -174,11 +175,12 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost endif # $(CONFIG_RTE_LIBRTE_VHOST) +_LDLIBS-y += --no-whole-archive + endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) _LDLIBS-y += $(EXECENV_LDLIBS) _LDLIBS-y += --end-group -_LDLIBS-y += --no-whole-archive LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
Signature · 1 line
2.5.5
Re: [PATCH 2/2] mk: reduce scope of whole-archive to pmd libraries
2016-05-27 17:48, Ferruh Yigit:
Quoted 3 lines
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
In my understanding, --whole-archive is required for static libraries used by plugins:
http://dpdk.org/commit/20afd76a
If we want to restrict it, I would say it must be around EAL, ring, mbuf, mempool, ethdev, cryptodev, etc.
Re: [PATCH 2/2] mk: reduce scope of whole-archive to pmd libraries
Quoted 8 lines · Thomas Monjalon
2016-05-27 17:48, Ferruh Yigit:
Quoted 3 lines
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
In my understanding, --whole-archive is required for static libraries used by plugins:
http://dpdk.org/commit/20afd76a
Right, required for static libraries. But more than used by plugins, required for plugin to work.
Quoted 4 lines
If we want to restrict it, I would say it must be around EAL, ring, mbuf, mempool, ethdev, cryptodev, etc.
We should restrict to plugins. What happens is, since there is no direct call to PMDs from application, PMD code is not included into final application. To force PMDs to be included into final binary, --whole-archive is required.
But --whole-archive is not required for other libraries, and just cause unnecessary increase in binary size.
Sample logs, with same setup, [1] compiled without --whole-archive, [2] is current code:
[1]:
# ./testpmd -- -i EAL: Detected 32 lcore(s) EAL: Probing VFIO support... EAL: No probed ethernet devices Interactive-mode selected USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=395456, size=2176, socket=0 Done testpmd> show port info all testpmd> quit
[2]
# ./testpmd -- -i EAL: Detected 32 lcore(s) EAL: Probing VFIO support... EAL: PCI device 0000:04:00.0 on NUMA socket 0 EAL: probe driver: 8086:1521 rte_igb_pmd EAL: PCI device 0000:08:00.0 on NUMA socket 0 EAL: probe driver: 8086:10fb rte_ixgbe_pmd EAL: PCI device 0000:08:00.1 on NUMA socket 0 EAL: probe driver: 8086:10fb rte_ixgbe_pmd EAL: PCI device 0000:0a:00.0 on NUMA socket 0 EAL: probe driver: 8086:1584 rte_i40e_pmd EAL: PCI device 0000:81:00.0 on NUMA socket 1 EAL: probe driver: 8086:10fb rte_ixgbe_pmd EAL: PCI device 0000:81:00.1 on NUMA socket 1 EAL: probe driver: 8086:10fb rte_ixgbe_pmd EAL: PCI device 0000:86:00.0 on NUMA socket 1 EAL: probe driver: 8086:15a4 rte_pmd_fm10k EAL: PCI device 0000:87:00.0 on NUMA socket 1 EAL: probe driver: 8086:15a4 rte_pmd_fm10k EAL: PCI device 0000:88:00.0 on NUMA socket 1 EAL: probe driver: 8086:1572 rte_i40e_pmd EAL: PCI device 0000:88:00.1 on NUMA socket 1 EAL: probe driver: 8086:1572 rte_i40e_pmd EAL: PCI device 0000:88:00.2 on NUMA socket 1 EAL: probe driver: 8086:1572 rte_i40e_pmd EAL: PCI device 0000:88:00.3 on NUMA socket 1 EAL: probe driver: 8086:1572 rte_i40e_pmd Interactive-mode selected USER1: create a new mbuf pool <mbuf_pool_socket_0>: n=395456, size=2176, socket=0 Configuring Port 0 (socket 0) Port 0: 90:E2:BA:0E:49:B9 Configuring Port 1 (socket 0) Port 1: 00:1B:21:76:FA:21 Checking link statuses... Port 0 Link Up - speed 10000 Mbps - full-duplex Port 1 Link Up - speed 10000 Mbps - full-duplex Done testpmd>
Re: [PATCH 2/2] mk: reduce scope of whole-archive to pmd libraries
2016-06-10 10:57, Ferruh Yigit:
Quoted 16 lines · Thomas Monjalon
Quoted 8 lines
2016-05-27 17:48, Ferruh Yigit:
Quoted 3 lines
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
In my understanding, --whole-archive is required for static libraries used by plugins:
http://dpdk.org/commit/20afd76aRight, required for static libraries. But more than used by plugins, required for plugin to work.
Quoted 3 lines
If we want to restrict it, I would say it must be around EAL, ring, mbuf, mempool, ethdev, cryptodev, etc.
Quoted 7 lines
We should restrict to plugins. What happens is, since there is no direct call to PMDs from application, PMD code is not included into final application. To force PMDs to be included into final binary, --whole-archive is required.
But --whole-archive is not required for other libraries, and just cause unnecessary increase in binary size.
Yes it is necessary for other libraries, otherwise some symbols needed by plugins won't be available.
Example:
In function `rte_pmd_af_packet_devuninit':
rte_eth_af_packet.c:(.text+0x8bf): undefined reference to rte_eth_dev_allocated' rte_eth_af_packet.c:(.text+0x930): undefined reference to rte_eth_dev_release_port'
Re: [PATCH 2/2] mk: reduce scope of whole-archive to pmd libraries
Quoted 25 lines · Thomas Monjalon
2016-06-10 10:57, Ferruh Yigit:
Quoted 16 lines · Thomas Monjalon
Quoted 8 lines
2016-05-27 17:48, Ferruh Yigit:
Quoted 3 lines
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
In my understanding, --whole-archive is required for static libraries used by plugins:
http://dpdk.org/commit/20afd76aRight, required for static libraries. But more than used by plugins, required for plugin to work.
Quoted 3 lines
If we want to restrict it, I would say it must be around EAL, ring, mbuf, mempool, ethdev, cryptodev, etc.
Quoted 7 lines
We should restrict to plugins. What happens is, since there is no direct call to PMDs from application, PMD code is not included into final application. To force PMDs to be included into final binary, --whole-archive is required.
But --whole-archive is not required for other libraries, and just cause unnecessary increase in binary size.
Quoted 7 lines
Yes it is necessary for other libraries, otherwise some symbols needed by plugins won't be available.
Example:
In function `rte_pmd_af_packet_devuninit':
rte_eth_af_packet.c:(.text+0x8bf): undefined reference torte_eth_dev_allocated' rte_eth_af_packet.c:(.text+0x930): undefined reference torte_eth_dev_release_port'
If there is a direct call to that API, linker should include required object file into final binary, --whole-archive shouldn't be required for this.
What is special for PMD's is there are not directly called, but initialized using constructors.
How are you getting above compilation error?
Thanks,
ferruh
Re: [PATCH 2/2] mk: reduce scope of whole-archive to pmd libraries
2016-06-10 12:06, Ferruh Yigit:
Quoted 33 lines · Thomas Monjalon
Quoted 25 lines
2016-06-10 10:57, Ferruh Yigit:
Quoted 16 lines · Thomas Monjalon
Quoted 8 lines
2016-05-27 17:48, Ferruh Yigit:
Quoted 3 lines
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
In my understanding, --whole-archive is required for static libraries used by plugins:
http://dpdk.org/commit/20afd76aRight, required for static libraries. But more than used by plugins, required for plugin to work.
Quoted 3 lines
If we want to restrict it, I would say it must be around EAL, ring, mbuf, mempool, ethdev, cryptodev, etc.
Quoted 7 lines
We should restrict to plugins. What happens is, since there is no direct call to PMDs from application, PMD code is not included into final application. To force PMDs to be included into final binary, --whole-archive is required.
But --whole-archive is not required for other libraries, and just cause unnecessary increase in binary size.
Quoted 7 lines
Yes it is necessary for other libraries, otherwise some symbols needed by plugins won't be available.
Example:
In function `rte_pmd_af_packet_devuninit':
rte_eth_af_packet.c:(.text+0x8bf): undefined reference torte_eth_dev_allocated' rte_eth_af_packet.c:(.text+0x930): undefined reference torte_eth_dev_release_port'
Quoted 8 lines
If there is a direct call to that API, linker should include required object file into final binary, --whole-archive shouldn't be required for this.
What is special for PMD's is there are not directly called, but initialized using constructors.
How are you getting above compilation error?
The error was generated with your patch on top of others I'm going to send. I suggest to continue the discussion/review based on the v2 coming soon.
Re: [PATCH 2/2] mk: reduce scope of whole-archive to pmd libraries
Quoted 38 lines · Thomas Monjalon
2016-06-10 12:06, Ferruh Yigit:
Quoted 37 lines · Thomas Monjalon
Quoted 25 lines
2016-06-10 10:57, Ferruh Yigit:
Quoted 16 lines · Thomas Monjalon
Quoted 8 lines
2016-05-27 17:48, Ferruh Yigit:
Quoted 3 lines
--whole-archive argument only required for pmd libraries, and currently it covers more libraries. Reducing scope of the argument to pmd libraries slightly reduce final application size.
In my understanding, --whole-archive is required for static libraries used by plugins:
http://dpdk.org/commit/20afd76aRight, required for static libraries. But more than used by plugins, required for plugin to work.
Quoted 3 lines
If we want to restrict it, I would say it must be around EAL, ring, mbuf, mempool, ethdev, cryptodev, etc.
Quoted 7 lines
We should restrict to plugins. What happens is, since there is no direct call to PMDs from application, PMD code is not included into final application. To force PMDs to be included into final binary, --whole-archive is required.
But --whole-archive is not required for other libraries, and just cause unnecessary increase in binary size.
Quoted 7 lines
Yes it is necessary for other libraries, otherwise some symbols needed by plugins won't be available.
Example:
In function `rte_pmd_af_packet_devuninit':
rte_eth_af_packet.c:(.text+0x8bf): undefined reference torte_eth_dev_allocated' rte_eth_af_packet.c:(.text+0x930): undefined reference torte_eth_dev_release_port'If there is a direct call to that API, linker should include required object file into final binary, --whole-archive shouldn't be required for this.
Quoted 8 lines
Quoted 4 lines
What is special for PMD's is there are not directly called, but initialized using constructors.
How are you getting above compilation error?
The error was generated with your patch on top of others I'm going to send. I suggest to continue the discussion/review based on the v2 coming soon.
I have quickly checked v2, you are getting this compiler error because --start-group/--end-group removed, so pmd not able to resolve the references. And you are working around this by adding all object of library unconditionally (--whole-archive). I will comment more of v2 patch.
Thanks,
ferruh
Re: [PATCH 1/2] mk: prevent overlinking in applications
In reply to Ferruh YigitHi Ferruh,
2016-05-27 17:48, Ferruh Yigit:
Quoted 7 lines
Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application. This requires inter library dependencies resolved correctly.
Not linking all libraries cause a compile error for lpcap and possible to have other similar compiler errors, so increasing the scope of --start-group argument.
What is the error?
app/cmdline_test/Makefile SRCS-y += commands.c · line 48
Quoted 12 lines
cmdline_testapplication causes compile error because of cyclic dependency betweenlibrte_eal<->librte_mempool. A workaround added tocmdline_testfor compile error.Signed-off-by Ferruh Yigit <[email protected]>app/cmdline_test/Makefile +0
-0@@ -46,6 +46,7 @@ SRCS-y += commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
A comment is required here to explain the workaround.
app/cmdline_test/Makefile SRCS-y += commands.c · line 49
Quoted 1 line
app/cmdline_test/Makefile +1
-0+LDFLAGS += -no-as-needed
The option should be --no-as-needed.
mk/exec-env/linuxapp/rte.vars.mk EXECENV_CFLAGS = -pthread · line 48
Quoted 6 lines
mk/exec-env/linuxapp/rte.vars.mk +0
-0@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread endif # Workaround lack of DT_NEEDED entry
This comment is obsolete now.
mk/exec-env/linuxapp/rte.vars.mk EXECENV_CFLAGS = -pthread · line 49
Quoted 2 lines
mk/exec-env/linuxapp/rte.vars.mk +1
-1-EXECENV_LDFLAGS = --no-as-needed +EXECENV_LDFLAGS = --as-needed
Why put this option for Linux only?
Shouldn't we restrict this option to app.mk only?
mk/rte.app.mk _LDLIBS-y += -L$(RTE_SDK_BIN)/lib · line 61
Quoted 7 lines
mk/rte.app.mk +1
-0@@ -58,6 +58,7 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib # _LDLIBS-y += --whole-archive +_LDLIBS-y += --start-group
--start-group must be used only to solve circular dependencies. Ideally we should not use it. I think it's needed only because of EAL logs using mempool (must be removed).
Why extending it?
I'm afraid we are masking some issues.
Quoted 11 lines
mk/rte.app.mk +0
-2_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder@@ -111,8 +112,6 @@ _LDLIBS-y += -lcrypto endif endif # !CONFIG_RTE_BUILD_SHARED_LIBS -_LDLIBS-y += --start-group - _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
Re: [PATCH 1/2] mk: prevent overlinking in applications
Quoted 7 lines · Thomas Monjalon
Hi Ferruh,
2016-05-27 17:48, Ferruh Yigit:
Quoted 4 lines
Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application. This requires inter library dependencies resolved correctly.
Quoted 6 lines
Quoted 3 lines
Not linking all libraries cause a compile error for lpcap and possible to have other similar compiler errors, so increasing the scope of --start-group argument.
What is the error?
This is with -as-needed flag, and static library compilation:
.../dpdk/build/lib/librte_pmd_pcap.a(rte_eth_pcap.o): In function `eth_dev_stop':
rte_eth_pcap.c:(.text+0xcc1): undefined reference to pcap_dump_close' rte_eth_pcap.c:(.text+0xcd6): undefined reference to pcap_close' rte_eth_pcap.c:(.text+0xd19): undefined reference to pcap_close' rte_eth_pcap.c:(.text+0xd58): undefined reference to pcap_close' /root/development/dpdk/build/lib/librte_pmd_pcap.a(rte_eth_pcap.o): In function `open_tx_pcap':
rte_eth_pcap.c:(.text+0x190b): undefined reference to pcap_open_dead' rte_eth_pcap.c:(.text+0x191b): undefined reference to pcap_dump_open'
...
pcap pmd has libpcap calls, but while linking final application (testpmd), linker is not able to find objects that has these.
The command line for compilation is:
gcc ... -o test ... -Wl,--whole-archive <dpdk libs> -Wl,-lpcap -Wl,--start-group <more dpdk libs> -Wl,-lrte_pmd_pcap <more dpdk libs> -Wl,--end-group -Wl,--no-whole-archive
-lpcap is provided, but since before -lrte_pmd_pcap, references not resolved.
Previously, with "-no-as-needed" flag, all shared libraries linked always, which was preventing compile error.
Quoted 6 lines
Quoted 5 lines
cmdline_testapplication causes compile error because of cyclic dependency betweenlibrte_eal<->librte_mempool. A workaround added tocmdline_testfor compile error.Signed-off-by Ferruh Yigit <[email protected]>
Quoted 9 lines
app/cmdline_test/Makefile SRCS-y += commands.c · line 48
Quoted 6 lines
app/cmdline_test/Makefile +0
-0@@ -46,6 +46,7 @@ SRCS-y += commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)A comment is required here to explain the workaround.
Sure, I will add a comment and send a new version of the patch.
Quoted 3 lines
app/cmdline_test/Makefile SRCS-y += commands.c · line 49
Quoted 1 line
app/cmdline_test/Makefile +1
-0+LDFLAGS += -no-as-neededThe option should be --no-as-needed.
Right
Quoted 9 lines
mk/exec-env/linuxapp/rte.vars.mk EXECENV_CFLAGS = -pthread · line 48
Quoted 7 lines
mk/exec-env/linuxapp/rte.vars.mk +0
-0@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread endif # Workaround lack of DT_NEEDED entryThis comment is obsolete now.
Will remove.
Quoted 5 lines
mk/exec-env/linuxapp/rte.vars.mk EXECENV_CFLAGS = -pthread · line 49
Quoted 3 lines
mk/exec-env/linuxapp/rte.vars.mk +1
-1-EXECENV_LDFLAGS = --no-as-needed +EXECENV_LDFLAGS = --as-neededWhy put this option for Linux only?
When this option not defined at all, different compilers behave different, some has --as-needed as default and cause compilation issues, I guess that is why for Linux --no-as-needed is forces. I assume BSD compilers by default use --no-as-needed, so we don't have any compilation problem.
And it looks like there is no specific reason to not force BSD to --as-needed, I will test it.
Quoted 1 line
Shouldn't we restrict this option to app.mk only?
Having --no-needed flag only for app should be OK. Let me test first, and as a result should we move this to app.mk?
Quoted 6 lines
Quoted 6 lines
mk/rte.app.mk +0
-0@@ -58,6 +58,7 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib #
Quoted 6 lines
mk/rte.app.mk _LDLIBS-y += -L$(RTE_SDK_BIN)/lib · line 61
Quoted 2 lines
mk/rte.app.mk +1
-0_LDLIBS-y += --whole-archive +_LDLIBS-y += --start-group--start-group must be used only to solve circular dependencies. Ideally we should not use it. I think it's needed only because of EAL logs using mempool (must be removed).
No, this is not the reason, please check above lpcap compile error, that is the reason of this update.
Quoted 2 lines
Why extending it?
I'm afraid we are masking some issues.
But if we have a convention to add external libraries after dpdk libraries, that also should solve this issue, but that is more update than just updating --start-group.
Quoted 13 lines
Quoted 12 lines
mk/rte.app.mk +0
-2_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder@@ -111,8 +112,6 @@ _LDLIBS-y += -lcrypto endif endif # !CONFIG_RTE_BUILD_SHARED_LIBS -_LDLIBS-y += --start-group - _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
v2 cover reduce overlinking in applications
In reply to Ferruh YigitThis is a respin of the ideas of Christian and Ferruh to limit the static application size or dynamic links to shared libraries.
It also brings some clean-up in rte.app.mk.
Ferruh Yigit (2):
mk: prevent overlinking in applications
mk: reduce scope of whole-archive static linking
Thomas Monjalon (4):
mk: sort drivers in static application link list
mk: fix driver dependencies order for static application
mk: remove library grouping during application linking
mk: sort libraries in level order when linking
mk/exec-env/linuxapp/rte.vars.mk | 3 - mk/rte.app.mk | 134 ++++++++++++++++----------------------- 2 files changed, 55 insertions(+), 82 deletions(-)
Signature · 1 line
2.7.0
PATCH v2 1/6 mk: sort drivers in static application link list
Just a clean up to prepare next patches.
--- mk/rte.app.mk | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-)
mk/rte.app.mk +17 -28
@@ -124,57 +124,46 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond - _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio -_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic -_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe -_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 -_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost +endif # $(CONFIG_RTE_LIBRTE_VHOST) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto - -# AESNI MULTI BUFFER / GCM PMDs are dependent on the IPSec_MB library -ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_MB),y) -_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) -_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -endif - -# SNOW3G PMD is dependent on the LIBSSO library +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso endif # CONFIG_RTE_LIBRTE_CRYPTODEV -ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) - -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost - -endif # $(CONFIG_RTE_LIBRTE_VHOST) - endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) _LDLIBS-y += $(EXECENV_LDLIBS)
Signature · 1 line
2.7.0
PATCH v2 2/6 mk: fix driver dependencies order for static application
In reply to Thomas MonjalonOn a linker command line, the dependencies must be declared after the libraries using them.
It will avoid some issues when building an application with static libraries and --as-needed option.
--- mk/rte.app.mk | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-)
mk/rte.app.mk +11 -27
@@ -93,22 +93,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse endif _LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lpcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lz -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -libverbs -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lsze2 -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore -_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lm -_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lz -# QAT / AESNI GCM PMDs are dependent on libcrypto (from openssl) -# for calculating HMAC precomputes -ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT),y) -_LDLIBS-y += -lcrypto -else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) -_LDLIBS-y += -lcrypto -endif endif # !CONFIG_RTE_BUILD_SHARED_LIBS _LDLIBS-y += --start-group
@@ -124,13 +108,13 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet -_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena
@@ -138,15 +122,15 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -lgxio +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede -lz _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost
@@ -156,10 +140,10 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm -lcrypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso endif # CONFIG_RTE_LIBRTE_CRYPTODEV
Signature · 1 line
2.7.0
Re: [PATCH v2 2/6] mk: fix driver dependencies order for static application
Quoted 7 lines · Thomas Monjalon
On a linker command line, the dependencies must be declared after the libraries using them.
It will avoid some issues when building an application with static libraries and --as-needed option.Signed-off-by Thomas Monjalon <[email protected]>---
Do we need this which driver used which library detail?
I think it is enough to move all external library dependencies to the last in command line, without paying attention who use it, Linker will handle the rest, if that library is not required it won't be linked against.
Re: [PATCH v2 2/6] mk: fix driver dependencies order for static application
2016-06-10 15:49, Ferruh Yigit:
Quoted 6 lines · Thomas Monjalon
Quoted 5 lines
On a linker command line, the dependencies must be declared after the libraries using them.
It will avoid some issues when building an application with static libraries and --as-needed option.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Thomas Monjalon <[email protected]>---
Do we need this which driver used which library detail?
I think it is enough to move all external library dependencies to the last in command line, without paying attention who use it, Linker will handle the rest, if that library is not required it won't be linked against.
I prefer avoiding garbage and have a justification for dependencies.
PATCH v2 3/6 mk: remove library grouping during application linking
In reply to Thomas MonjalonQuoted 1 line
From "man ld":
Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.
Remove the option since it does not seem necessary.
--- mk/rte.app.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mk/rte.app.mk +1 -3
@@ -95,8 +95,6 @@ endif _LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap endif # !CONFIG_RTE_BUILD_SHARED_LIBS -_LDLIBS-y += --start-group - _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
@@ -151,7 +149,7 @@ endif # CONFIG_RTE_LIBRTE_CRYPTODEV endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) _LDLIBS-y += $(EXECENV_LDLIBS) -_LDLIBS-y += --end-group + _LDLIBS-y += --no-whole-archive LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
Signature · 1 line
2.7.0
Re: [PATCH v2 3/6] mk: remove library grouping during application linking
Quoted 8 lines · Thomas Monjalon
From "man ld":
Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.Remove the option since it does not seem necessary.
Signed-off-by Thomas Monjalon <[email protected]>
To remove this, I think we should order libraries in a way:
pmd -> librte -> external libraries.
Than we can remove --whole-archive too.
And perhaps keep it still to wrap around librte_eal and librte_mempool, which still has cyclic dependencies.
Re: [PATCH v2 3/6] mk: remove library grouping during application linking
2016-06-10 15:54, Ferruh Yigit:
Quoted 10 lines · Thomas Monjalon
Quoted 8 lines
From "man ld":
Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.Remove the option since it does not seem necessary.
Signed-off-by Thomas Monjalon <[email protected]>
Quoted 7 lines
To remove this, I think we should order libraries in a way:
pmd -> librte -> external libraries.
Than we can remove --whole-archive too.And perhaps keep it still to wrap around
librte_ealandlibrte_mempool, which still has cyclic dependencies.
OK looks good
I let you do a v3
PATCH v2 4/6 mk: prevent overlinking in applications
In reply to Thomas MonjalonFrom: Ferruh Yigit <[email protected]>
Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application.
It can be achieved now that the libraries dependencies are handled properly.
---
v2: remove workarounds and workaround comment
--- mk/exec-env/linuxapp/rte.vars.mk | 3 --- mk/rte.app.mk | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
mk/exec-env/linuxapp/rte.vars.mk +0 -3
@@ -45,9 +45,6 @@ else EXECENV_CFLAGS = -pthread endif -# Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed - EXECENV_LDLIBS = EXECENV_ASFLAGS =
mk/rte.app.mk +3 -0
@@ -50,6 +50,9 @@ ifeq ($(NO_LDSCRIPT),) LDSCRIPT = $(RTE_LDSCRIPT) endif +# Link only the libraries used in the application +LDFLAGS += --as-needed + # default path for libs _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
Signature · 1 line
2.7.0
Re: [PATCH v2 4/6] mk: prevent overlinking in applications
Quoted 10 lines · Thomas Monjalon
From: Ferruh Yigit <[email protected]>
Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application.
It can be achieved now that the libraries dependencies are handled properly.Signed-off-by Ferruh Yigit <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
...
mk/rte.app.mk ifeq ($(NO_LDSCRIPT),) · line 54
Quoted 4 lines
endif
mk/rte.app.mk +2
-0+# Link only the libraries used in the application +LDFLAGS += --as-needed
For the case we need to have workaround for application, this doesn't let because last argument wins.
Can we say as following :
LDFLAGS = --as-needed $(LDFLAGS)
Quoted 5 lines
+
# default path for libs _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
Re: [PATCH v2 4/6] mk: prevent overlinking in applications
2016-06-10 15:56, Ferruh Yigit:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
From: Ferruh Yigit <[email protected]>
Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application.
It can be achieved now that the libraries dependencies are handled properly.
[...]
Quoted 8 lines
mk/rte.app.mk ifeq ($(NO_LDSCRIPT),) · line 54
Quoted 2 lines
mk/rte.app.mk +2
-0+# Link only the libraries used in the application +LDFLAGS += --as-neededFor the case we need to have workaround for application, this doesn't let because last argument wins.
Can we say as following :
LDFLAGS = --as-needed $(LDFLAGS)
It should be LDFLAGS := --as-needed $(LDFLAGS)
But I would prefer we avoid workarounds.
PATCH v2 5/6 mk: sort libraries in level order when linking
In reply to Thomas MonjalonAs stated in the comment:
Order is important: from higher level to lower level
This is an attempt to make the layering order better respected. It will help to restrict the --whole-archive scope for plugins.
--- mk/rte.app.mk | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-)
mk/rte.app.mk +28 -26
@@ -62,9 +62,6 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib _LDLIBS-y += --whole-archive -_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor -_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder - ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni _LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
@@ -73,34 +70,23 @@ endif _LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE) += -lrte_pipeline _LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE) += -lrte_table _LDLIBS-$(CONFIG_RTE_LIBRTE_PORT) += -lrte_port -_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER) += -lrte_timer -_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH) += -lrte_hash -_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += -lrte_jobstats -_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm -_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl + +_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor +_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder +_LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched -_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost +_LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm +_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl +_LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += -lrte_jobstats +_LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power -# The static libraries do not know their dependencies. -# So linking with static library requires explicit dependencies. -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt -_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm -ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma -endif -ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse -endif -_LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap -endif # !CONFIG_RTE_BUILD_SHARED_LIBS +_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER) += -lrte_timer +_LDLIBS-$(CONFIG_RTE_LIBRTE_HASH) += -lrte_hash +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf -_LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER) += -lethdev _LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += -lrte_cryptodev _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool
@@ -108,6 +94,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile + _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore
@@ -149,7 +136,22 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso endif # CONFIG_RTE_LIBRTE_CRYPTODEV -endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) +endif # !CONFIG_RTE_BUILD_SHARED_LIBS + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +# The static libraries do not know their dependencies. +# So linking with static library requires explicit dependencies. +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt +_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma +endif +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse +endif +_LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap +endif # !CONFIG_RTE_BUILD_SHARED_LIBS _LDLIBS-y += $(EXECENV_LDLIBS)
Signature · 1 line
2.7.0
PATCH v2 6/6 mk: reduce scope of whole-archive static linking
In reply to Thomas MonjalonFrom: Ferruh Yigit <[email protected]>
The --whole-archive argument is only required for plugins (drivers) and libraries used by these plugins.
Currently it covers all libraries.
Reducing the scope of this argument slightly reduce final application size when statically linked.
---
v2: keep some basic libs in the whole-archive scope
--- mk/rte.app.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mk/rte.app.mk +4 -4
@@ -60,8 +60,6 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib # Order is important: from higher level to lower level # -_LDLIBS-y += --whole-archive - ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni _LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem
@@ -81,6 +79,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl _LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += -lrte_jobstats _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER) += -lrte_power +_LDLIBS-y += --whole-archive + _LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER) += -lrte_timer _LDLIBS-$(CONFIG_RTE_LIBRTE_HASH) += -lrte_hash _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost
@@ -138,6 +138,8 @@ endif # CONFIG_RTE_LIBRTE_CRYPTODEV endif # !CONFIG_RTE_BUILD_SHARED_LIBS +_LDLIBS-y += --no-whole-archive + ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # The static libraries do not know their dependencies. # So linking with static library requires explicit dependencies.
@@ -155,8 +157,6 @@ endif # !CONFIG_RTE_BUILD_SHARED_LIBS _LDLIBS-y += $(EXECENV_LDLIBS) -_LDLIBS-y += --no-whole-archive - LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS) # Eliminate duplicates without sorting
Signature · 1 line
2.7.0
Re: [PATCH v2 6/6] mk: reduce scope of whole-archive static linking
Quoted 11 lines · Thomas Monjalon
From: Ferruh Yigit <[email protected]>
The --whole-archive argument is only required for plugins (drivers) and libraries used by these plugins.
Currently it covers all libraries.
Reducing the scope of this argument slightly reduce final application size when statically linked.Signed-off-by Ferruh Yigit <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
Technically the scope of --whole-archive should be PMDs, wider scope required because of unresolved references, but I think this is not good workaround.
If libraries ordered as suggested before: pmd->librte->external, won't need to extend scope of parameter
Still some applications will have problem for now, because of cyclic dependency of librte_eal and librte_mempool, which seems targeted to fix.
So, instead of adding --whole-archive as workaround that efffects whole binaries, I am for adding workaround for effected application. The be effected this problem, an application should have direct calls to librte_eal, but shouldn't have any calls to librte_mempool, I think this rare case, that is why only a unit test application effected. And when dependency issue removed we can fix this.
To be able to apply workaround per application, LDFLAGS should be set in a way to commented previous patch.
Thanks,
ferruh
Re: [PATCH v2 6/6] mk: reduce scope of whole-archive static linking
2016-06-10 16:03, Ferruh Yigit:
Quoted 17 lines · Thomas Monjalon
Quoted 11 lines
From: Ferruh Yigit <[email protected]>
The --whole-archive argument is only required for plugins (drivers) and libraries used by these plugins.
Currently it covers all libraries.
Reducing the scope of this argument slightly reduce final application size when statically linked.Signed-off-by Ferruh Yigit <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
Technically the scope of --whole-archive should be PMDs, wider scope required because of unresolved references, but I think this is not good workaround.
Quoted 8 lines
If libraries ordered as suggested before:
pmd->librte->external, won't need to extend scope of parameterStill some applications will have problem for now, because of cyclic dependency of
librte_ealandlibrte_mempool, which seems targeted to fix.So, instead of adding --whole-archive as workaround that efffects whole binaries, I am for adding workaround for effected application.
I would prefer keeping a small workaround in rte.app.mk instead of in the application makefile. We must be careful with applications which may break because of our changes. This is the kind of issue that they won't fix quickly.
Quoted 7 lines
The be effected this problem, an application should have direct calls to
librte_eal, but shouldn't have any calls tolibrte_mempool, I think this rare case, that is why only a unit test application effected. And when dependency issue removed we can fix this.To be able to apply workaround per application, LDFLAGS should be set in a way to commented previous patch.
v3 cover reduce overlinking in applications
In reply to Thomas MonjalonThis patch set updates application linking, main motivation is to reduce overlinking in application, also removes library grouping by re-ordering libraries and for static compilation reduces whole library linking to PMD libs.
There is a workaround because of librte_eal <-> librte_mempool cyclic dependency in rte.app.mk, which can be removed when issue solved.
It also brings some clean-up in rte.app.mk.
Ferruh Yigit (3):
mk: sort libraries when linking, move pmd libs to higher level
mk: sort libraries when linking, move external libs to lower level
mk: prevent overlinking in applications
Thomas Monjalon (3):
mk: sort drivers in static application link list
mk: fix driver dependencies order for static application
mk: remove library grouping during application linking
mk/exec-env/linuxapp/rte.vars.mk | 3 - mk/rte.app.mk | 152 +++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 89 deletions(-)
Signature · 1 line
2.5.5
PATCH v3 1/6 mk: sort drivers in static application link list
From: Thomas Monjalon <[email protected]>
Just a clean up to prepare next patches.
--- mk/rte.app.mk | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-)
mk/rte.app.mk +17 -28
@@ -124,57 +124,46 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond - _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio -_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet _LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic -_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe -_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 -_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet _LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost +endif # $(CONFIG_RTE_LIBRTE_VHOST) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto - -# AESNI MULTI BUFFER / GCM PMDs are dependent on the IPSec_MB library -ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_MB),y) -_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) -_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -endif - -# SNOW3G PMD is dependent on the LIBSSO library +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso endif # CONFIG_RTE_LIBRTE_CRYPTODEV -ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) - -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost - -endif # $(CONFIG_RTE_LIBRTE_VHOST) - endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) _LDLIBS-y += $(EXECENV_LDLIBS)
Signature · 1 line
2.5.5
Re: [PATCH v3 1/6] mk: sort drivers in static application link list
Quoted 3 lines · dev on behalf of Ferruh Yigit
From: Thomas Monjalon <[email protected]>
Just a clean up to prepare next patches.
One thing you have or will do with these patches is create a set of groups PMD, Core, LIB, … and sort the items in each group. I was thinking it maybe more useful to use different names for the groups instead of _LDLIBS e.g. _PMD, _CORE, _LIB(this one may not work), _XYZ then create _LDLIBS from these groups. I know it is another change and sorry I did not catch it before. This only makes sense if we need say different PMD libs in different places within the _LDLIBS variable. Something to think about if you have to make changes again.
Quoted 89 lines
Signed-off-by Thomas Monjalon <[email protected]>---
mk/rte.app.mk| 45 +++++++++++++++++----------------------------1 file changed, 17 insertions(+), 28 deletions(-)mk/rte.app.mk +0
-0@@ -124,57 +124,46 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond-
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirtifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
# plugins (link only if static libraries)mk/rte.app.mk +1
-2-_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio -_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x
_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbemk/rte.app.mk +2
-0+_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena_LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic
-_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
_LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k
+_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e
_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbemk/rte.app.mk +0
-2-_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 -_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4
_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5mk/rte.app.mk +0
-2-_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe
mk/rte.app.mk +2
-1-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet
_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qedemk/rte.app.mk +7
-1-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost +endif # $(CONFIG_RTE_LIBRTE_VHOST) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uioifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y)
-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mbmk/rte.app.mk +3
-1-_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto
mk/rte.app.mk +1
-9- -# AESNI MULTI BUFFER / GCM PMDs are dependent on the IPSec_MB library -ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_MB),y) -_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) -_LDLIBS-y += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -endif - -# SNOW3G PMD is dependent on the LIBSSO library +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso
endif #CONFIG_RTE_LIBRTE_CRYPTODEVmk/rte.app.mk +0
-6-ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) - -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost - -endif # $(CONFIG_RTE_LIBRTE_VHOST) -endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)
_LDLIBS-y += $(EXECENV_LDLIBS)
Signature · 1 line
2.5.5
PATCH v3 2/6 mk: fix driver dependencies order for static application
In reply to Ferruh YigitFrom: Thomas Monjalon <[email protected]>
On a linker command line, the dependencies must be declared after the libraries using them.
It will avoid some issues when building an application with static libraries and --as-needed option.
--- mk/rte.app.mk | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-)
mk/rte.app.mk +11 -27
@@ -93,22 +93,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse endif _LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lpcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lz -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -libverbs -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lsze2 -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore -_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lgxio -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lm -_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lz -# QAT / AESNI GCM PMDs are dependent on libcrypto (from openssl) -# for calculating HMAC precomputes -ifeq ($(CONFIG_RTE_LIBRTE_PMD_QAT),y) -_LDLIBS-y += -lcrypto -else ifeq ($(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM),y) -_LDLIBS-y += -lcrypto -endif endif # !CONFIG_RTE_BUILD_SHARED_LIBS _LDLIBS-y += --start-group
@@ -124,13 +108,13 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet -_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz _LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe _LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 _LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena
@@ -138,15 +122,15 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic _LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -lgxio +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -lm _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede -lz _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 _LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost
@@ -156,10 +140,10 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm -lcrypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso endif # CONFIG_RTE_LIBRTE_CRYPTODEV
Signature · 1 line
2.5.5
PATCH v3 3/6 mk: sort libraries when linking, move pmd libs to higher level
In reply to Ferruh YigitAs stated in the comment:
Order is important: from higher level to lower level
This is an attempt to make the layering order better respected.
Limit scope of --whole-archive to pmd libraries
--- mk/rte.app.mk | 88 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 43 deletions(-)
mk/rte.app.mk +45 -43
@@ -59,6 +59,51 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib _LDLIBS-y += --whole-archive +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +# plugins (link only if static libraries) + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet +_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz +_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena +_LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic +_LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k +_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e +_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs +_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -lgxio +_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap +_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede -lz +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 +_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost +endif # $(CONFIG_RTE_LIBRTE_VHOST) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio + +ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm -lcrypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso +endif # CONFIG_RTE_LIBRTE_CRYPTODEV + +endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) + +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore + +_LDLIBS-y += --no-whole-archive + _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
@@ -107,52 +152,9 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore - -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) -# plugins (link only if static libraries) - -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet -_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lrte_pmd_bnx2x -lz -_LDLIBS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += -lrte_pmd_cxgbe -_LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += -lrte_pmd_e1000 -_LDLIBS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += -lrte_pmd_ena -_LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += -lrte_pmd_enic -_LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += -lrte_pmd_fm10k -_LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e -_LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += -lrte_pmd_ixgbe -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs -_LDLIBS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += -lrte_pmd_mpipe -lgxio -_LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp -lm -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap -lpcap -_LDLIBS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += -lrte_pmd_qede -lz -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += -lrte_pmd_szedata2 -lsze2 -_LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += -lrte_pmd_virtio -ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost -endif # $(CONFIG_RTE_LIBRTE_VHOST) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio - -ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -lrte_pmd_aesni_mb -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -lrte_pmd_aesni_gcm -lcrypto -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += -lrte_pmd_null_crypto -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += -lrte_pmd_qat -lcrypto -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -lrte_pmd_snow3g -_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += -L$(LIBSSO_PATH)/build -lsso -endif # CONFIG_RTE_LIBRTE_CRYPTODEV - -endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB) _LDLIBS-y += $(EXECENV_LDLIBS) _LDLIBS-y += --end-group -_LDLIBS-y += --no-whole-archive LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
Signature · 1 line
2.5.5
Re: [PATCH v3 3/6] mk: sort libraries when linking, move pmd libs to higher level
2016-06-10 19:32, Ferruh Yigit:
Quoted 6 lines
As stated in the comment:
Order is important: from higher level to lower levelThis is an attempt to make the layering order better respected.
Limit scope of --whole-archive to pmd libraries
Compared to the link order in the v2, you did two things:
1/ move PMDs to the first position
2/ restrict --whole-archive to PMDs only
Having the PMDs first, helps the linker to get all the PMD dependencies in the static binary. Thus it seems we do not need --whole-archive for the PMD dependencies (ethdev, mbuf, etc).
But, if an external PMD is loaded via dlopen, it is possible that it needs a symbol which was not used by the internal PMDs. So it will not be found in the statically linked binary.
Let's take another example: if we disable the internal PMDs with their config options from the static build, and we decide to build them separately as DSOs. We won't be able to load them as plugins because they depend on symbols which won't be found in the static binary.
To make it short, the PMDs must be considered as plugins. Therefore, we must not rely on their availability to link the required symbols in a static binary.
To make sure the plugin loading will be always well achieved, we must link the static PMDs at the last position.
If you agree, I vote for the v2 of this patchset.
Re: [PATCH v3 3/6] mk: sort libraries when linking, move pmd libs to higher level
Quoted 12 lines · Thomas Monjalon
2016-06-10 19:32, Ferruh Yigit:
Quoted 6 lines
As stated in the comment:
Order is important: from higher level to lower levelThis is an attempt to make the layering order better respected.
Limit scope of --whole-archive to pmd libraries
Compared to the link order in the v2, you did two things:
1/ move PMDs to the first position
2/ restrict --whole-archive to PMDs only
Quoted 10 lines
Having the PMDs first, helps the linker to get all the PMD dependencies in the static binary. Thus it seems we do not need --whole-archive for the PMD dependencies (ethdev, mbuf, etc).
But, if an external PMD is loaded via dlopen, it is possible that it needs a symbol which was not used by the internal PMDs. So it will not be found in the statically linked binary.
Let's take another example: if we disable the internal PMDs with their config options from the static build, and we decide to build them separately as DSOs. We won't be able to load them as plugins because they depend on symbols which won't be found in the static binary.
So you want to keep all objects in final binary (used or unused) because of the possibility that any plugin may use them.
But what is the list to include here, whole dpdk?, -since we may not know what API will plugin call.
What I am confused is --whole-archive only used when dpdk compiled as static, if dpdk compiled as shared, each PMD should have proper dependencies [1], and if external PMD compiled properly there shouldn't be a problem. So do we have a case that dpdk compiled statically into final binary but we still want to load some plugins dynamically?
Quoted 6 lines
To make it short, the PMDs must be considered as plugins. Therefore, we must not rely on their availability to link the required symbols in a static binary.
To make sure the plugin loading will be always well achieved, we must link the static PMDs at the last position.
I think this is not the issue of linking PMD's first or last, but expanding --whole-archive to cover other libraries other than PMDs.
Quoted 2 lines
If you agree, I vote for the v2 of this patchset.
If this is breaking something and best way to fix is not in external PMD but in here, please feel free to go with v2.
[1] Like all has mbuf.so dependency:
# ldd build/lib/librte_pmd_ring.so
linux-vdso.so.1 (0x00007ffe3d78a000)
librte_eal.so.2.1 => not found
librte_ring.so.1.1 => not found
librte_mbuf.so.2.1 => not found
libethdev.so.4.1 => not found
librte_kvargs.so.1.1 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007f8ab5ae1000)
/lib64/ld-linux-x86-64.so.2 (0x0000556616488000)# ldd build/lib/librte_pmd_af_packet.so
linux-vdso.so.1 (0x00007ffcb0572000)
librte_mbuf.so.2.1 => not found
libethdev.so.4.1 => not found
librte_kvargs.so.1.1 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007f7fbd4aa000)
/lib64/ld-linux-x86-64.so.2 (0x00005604556d2000)# ldd build/lib/librte_pmd_null.so
linux-vdso.so.1 (0x00007ffdf08cf000)
librte_mbuf.so.2.1 => not found
libethdev.so.4.1 => not found
librte_kvargs.so.1.1 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fca6fbfc000)
/lib64/ld-linux-x86-64.so.2 (0x000055fe7dd4a000)Thanks,
ferruh
Re: [PATCH v3 3/6] mk: sort libraries when linking, move pmd libs to higher level
2016-06-13 11:04, Ferruh Yigit:
Quoted 24 lines · Thomas Monjalon
Quoted 12 lines
2016-06-10 19:32, Ferruh Yigit:
Quoted 6 lines
As stated in the comment:
Order is important: from higher level to lower levelThis is an attempt to make the layering order better respected.
Limit scope of --whole-archive to pmd libraries
Compared to the link order in the v2, you did two things:
1/ move PMDs to the first position
2/ restrict --whole-archive to PMDs onlyQuoted 10 lines
Having the PMDs first, helps the linker to get all the PMD dependencies in the static binary. Thus it seems we do not need --whole-archive for the PMD dependencies (ethdev, mbuf, etc).
But, if an external PMD is loaded via dlopen, it is possible that it needs a symbol which was not used by the internal PMDs. So it will not be found in the statically linked binary.
Let's take another example: if we disable the internal PMDs with their config options from the static build, and we decide to build them separately as DSOs. We won't be able to load them as plugins because they depend on symbols which won't be found in the static binary.
Quoted 2 lines
So you want to keep all objects in final binary (used or unused) because of the possibility that any plugin may use them.
Yes
Quoted 2 lines
But what is the list to include here, whole dpdk?, -since we may not know what API will plugin call.
The list of the libraries candidates to be called from a driver can be discussed. The top layers like lpm or distributor should not be in this list I think.
Quoted 5 lines
What I am confused is --whole-archive only used when dpdk compiled as static, if dpdk compiled as shared, each PMD should have proper dependencies [1], and if external PMD compiled properly there shouldn't be a problem. So do we have a case that dpdk compiled statically into final binary but we still want to load some plugins dynamically?
Yes a plugin can be loaded from a static binary. Breaking this feature would need a separate discussion and notices.
Quoted 8 lines
Quoted 5 lines
To make it short, the PMDs must be considered as plugins. Therefore, we must not rely on their availability to link the required symbols in a static binary.
To make sure the plugin loading will be always well achieved, we must link the static PMDs at the last position.I think this is not the issue of linking PMD's first or last, but expanding --whole-archive to cover other libraries other than PMDs.
Yes, linking PMD at the end is a way to force us to keep some libraries in --whole-archive.
Quoted 4 lines
Quoted 1 line
If you agree, I vote for the v2 of this patchset.
If this is breaking something and best way to fix is not in external PMD but in here, please feel free to go with v2.
I don't see any other solution.
But I'm sure we could discuss it more and/or improve it in the future.
Re: [PATCH v3 3/6] mk: sort libraries when linking, move pmd libs to higher level
Quoted 37 lines · Thomas Monjalon
2016-06-13 11:04, Ferruh Yigit:
Quoted 24 lines · Thomas Monjalon
Quoted 12 lines
2016-06-10 19:32, Ferruh Yigit:
Quoted 6 lines
As stated in the comment:
Order is important: from higher level to lower levelThis is an attempt to make the layering order better respected.
Limit scope of --whole-archive to pmd libraries
Compared to the link order in the v2, you did two things:
1/ move PMDs to the first position
2/ restrict --whole-archive to PMDs onlyQuoted 10 lines
Having the PMDs first, helps the linker to get all the PMD dependencies in the static binary. Thus it seems we do not need --whole-archive for the PMD dependencies (ethdev, mbuf, etc).
But, if an external PMD is loaded via dlopen, it is possible that it needs a symbol which was not used by the internal PMDs. So it will not be found in the statically linked binary.
Let's take another example: if we disable the internal PMDs with their config options from the static build, and we decide to build them separately as DSOs. We won't be able to load them as plugins because they depend on symbols which won't be found in the static binary.Quoted 2 lines
So you want to keep all objects in final binary (used or unused) because of the possibility that any plugin may use them.
Yes
Quoted 2 lines
But what is the list to include here, whole dpdk?, -since we may not know what API will plugin call.
The list of the libraries candidates to be called from a driver can be discussed. The top layers like lpm or distributor should not be in this list I think.
Quoted 8 lines
Quoted 5 lines
What I am confused is --whole-archive only used when dpdk compiled as static, if dpdk compiled as shared, each PMD should have proper dependencies [1], and if external PMD compiled properly there shouldn't be a problem. So do we have a case that dpdk compiled statically into final binary but we still want to load some plugins dynamically?
Yes a plugin can be loaded from a static binary. Breaking this feature would need a separate discussion and notices.
Thanks for clarifying, I wasn't aware of this.
So I am leaving this patch, please just ping if anything required from me.
Quoted 21 lines
Quoted 9 lines
Quoted 6 lines
To make it short, the PMDs must be considered as plugins. Therefore, we must not rely on their availability to link the required symbols in a static binary.
To make sure the plugin loading will be always well achieved, we must link the static PMDs at the last position.I think this is not the issue of linking PMD's first or last, but expanding --whole-archive to cover other libraries other than PMDs.
Yes, linking PMD at the end is a way to force us to keep some libraries in --whole-archive.
Quoted 4 lines
Quoted 1 line
If you agree, I vote for the v2 of this patchset.
If this is breaking something and best way to fix is not in external PMD but in here, please feel free to go with v2.
I don't see any other solution.
But I'm sure we could discuss it more and/or improve it in the future.
PATCH v3 4/6 mk: sort libraries when linking, move external libs to lower level
In reply to Ferruh YigitAs stated in the comment:
Order is important: from higher level to lower level
This is an attempt to make the layering order better respected.
--- mk/rte.app.mk | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
mk/rte.app.mk +15 -15
@@ -125,21 +125,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost -# The static libraries do not know their dependencies. -# So linking with static library requires explicit dependencies. -ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm -_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt -_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm -ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma -endif -ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) -_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse -endif -_LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap -endif # !CONFIG_RTE_BUILD_SHARED_LIBS - _LDLIBS-y += --start-group _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs
@@ -156,6 +141,21 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-y += $(EXECENV_LDLIBS) _LDLIBS-y += --end-group +# The static libraries do not know their dependencies. +# So linking with static library requires explicit dependencies. +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm +_LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt +_LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lm +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lnuma +endif +ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n) +_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse +endif +_LDLIBS-$(CONFIG_RTE_PORT_PCAP) += -lpcap +endif # !CONFIG_RTE_BUILD_SHARED_LIBS + LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS) # Eliminate duplicates without sorting
Signature · 1 line
2.5.5
PATCH v3 5/6 mk: remove library grouping during application linking
In reply to Ferruh YigitFrom: Thomas Monjalon <[email protected]>
Quoted 1 line
From "man ld":
Using this option has a significant performance cost. It is best to use it only when there are unavoidable circular references between two or more archives.
Remove the option since it does not seem necessary.
--- mk/rte.app.mk | 3 --- 1 file changed, 3 deletions(-)
mk/rte.app.mk +0 -3
@@ -125,8 +125,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lrte_vhost -_LDLIBS-y += --start-group - _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
@@ -139,7 +137,6 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile _LDLIBS-y += $(EXECENV_LDLIBS) -_LDLIBS-y += --end-group # The static libraries do not know their dependencies. # So linking with static library requires explicit dependencies.
Signature · 1 line
2.5.5
PATCH v3 6/6 mk: prevent overlinking in applications
In reply to Ferruh YigitReplace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application.
It can be achieved now that the libraries dependencies are handled properly.
--- mk/exec-env/linuxapp/rte.vars.mk | 3 --- mk/rte.app.mk | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-)
mk/exec-env/linuxapp/rte.vars.mk +0 -3
@@ -45,9 +45,6 @@ else EXECENV_CFLAGS = -pthread endif -# Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed - EXECENV_LDLIBS = EXECENV_ASFLAGS =
mk/rte.app.mk +8 -0
@@ -50,6 +50,14 @@ ifeq ($(NO_LDSCRIPT),) LDSCRIPT = $(RTE_LDSCRIPT) endif +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +# Workaround to eal <-> mempool cyclic dependency +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +endif + +# Link only the libraries used in the application +_LDLIBS-y += --as-needed + # default path for libs _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
Signature · 1 line
2.5.5
Re: [PATCH v3 6/6] mk: prevent overlinking in applications
Hi Ferruh,
2016-06-10 19:32, Ferruh Yigit:
mk/rte.app.mk ifeq ($(NO_LDSCRIPT),) · line 59
Quoted 13 lines
mk/rte.app.mk +7
-0@@ -50,6 +50,14 @@ ifeq ($(NO_LDSCRIPT),) LDSCRIPT = $(RTE_LDSCRIPT) endif +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +# Workaround to eal <-> mempool cyclic dependency +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +endif + +# Link only the libraries used in the application +_LDLIBS-y += --as-needed
I think we do not need this workaround.
The dependency of EAL logs on mempool is now removed.
We only have the dependency of EAL ivshmem on librte_ivshmem header (which needs mempool and rings headers).
Re: [PATCH v3 6/6] mk: prevent overlinking in applications
Quoted 9 lines · Thomas Monjalon
Hi Ferruh,
2016-06-10 19:32, Ferruh Yigit:
Quoted 6 lines
mk/rte.app.mk +0
-0@@ -50,6 +50,14 @@ ifeq ($(NO_LDSCRIPT),) LDSCRIPT = $(RTE_LDSCRIPT) endif
Quoted 13 lines
mk/rte.app.mk ifeq ($(NO_LDSCRIPT),) · line 59
Quoted 7 lines
mk/rte.app.mk +7
-0+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +# Workaround to eal <-> mempool cyclic dependency +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +endif + +# Link only the libraries used in the application +_LDLIBS-y += --as-neededI think we do not need this workaround.
The dependency of EAL logs on mempool is now removed.
We only have the dependency of EAL ivshmem onlibrte_ivshmemheader (which needs mempool and rings headers).
I missed that dependency removed, this is good, I will send a new version of the patch.
Thanks,
ferruh
Re: [PATCH v3 6/6] mk: prevent overlinking in applications
Hi,
great work on cleaning that up already.
I applied v3 of the series and see already much better results.
But I found some more that should be part of this.
I don't know how generally available a similar solution is, but usually in our build dpkg-shlibdeps checks for under/overlinking issues. I let that run on a dir built from git plus v3 of the series in discussion here.
There are two way of open dependency issues left:
1. some libraries use symbols of other libraries they are not linked with correctly yet
2. the appliactions are still overlinking
We need to finalize #1 first before being able to tackle #2 without breaking something.
I'll send a patch for the following so it can be part of your v4
$ for binfile in $(find debian/build/shared-root/lib -executable -type f; find debian/build/shared-root/app -executable -type f;); do printf "\n\n\nTesting %s\n" $binfile; dpkg-shlibdeps -e $binfile -ldebian/build/shared-root/lib/ | grep -v "installed in their package's directory"; done
Testing debian/build/shared-root/lib/librte_port.so.3
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_sched_port_dequeue used by debian/build/shared-root/lib/librte_port.so.3 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_sched_port_enqueue used by debian/build/shared-root/lib/librte_port.so.3 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_pmd_bond.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_mempool_create used by debian/build/shared-root/lib/librte_pmd_bond.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_ring_create used by debian/build/shared-root/lib/librte_pmd_bond.so.1 found in none of the libraries
Testing debian/build/shared-root/lib/librte_pipeline.so.3
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol per_lcore__lcore_id used by debian/build/shared-root/lib/librte_pipeline.so.3 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_pipeline.so.3 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_pipeline.so.3 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_free used by debian/build/shared-root/lib/librte_pipeline.so.3 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_pipeline.so.3 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_zmalloc_socket used by debian/build/shared-root/lib/librte_pipeline.so.3 found in none of the libraries
Testing debian/build/shared-root/lib/librte_pmd_null_crypto.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_ring_create used by debian/build/shared-root/lib/librte_pmd_null_crypto.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_kvargs_parse used by debian/build/shared-root/lib/librte_pmd_null_crypto.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_kvargs_free used by debian/build/shared-root/lib/librte_pmd_null_crypto.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_kvargs_process used by debian/build/shared-root/lib/librte_pmd_null_crypto.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_ring_lookup used by debian/build/shared-root/lib/librte_pmd_null_crypto.so.1 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_pmd_vhost.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_eal_driver_register used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol pthread_join used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol pthread_cancel used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_zmalloc_socket used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol pthread_create used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol per_lcore__lcore_id used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_socket_id used by debian/build/shared-root/lib/librte_pmd_vhost.so.1 found in none of the libraries
dpkg-shlibdeps: warning: 2 other similar warnings have been skipped (use -v to see them all)
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_pmd_fm10k.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_kvargs_count used by debian/build/shared-root/lib/librte_pmd_fm10k.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_kvargs_free used by debian/build/shared-root/lib/librte_pmd_fm10k.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_kvargs_parse used by debian/build/shared-root/lib/librte_pmd_fm10k.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_kvargs_process used by debian/build/shared-root/lib/librte_pmd_fm10k.so.1 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_pmd_pcap.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_eal_driver_register used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_cycles_vmware_tsc_map used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_zmalloc_socket used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_get_tsc_hz used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_free used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_socket_id used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol eal_timer_source used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_pmd_pcap.so.1 found in none of the libraries
dpkg-shlibdeps: warning: 2 other similar warnings have been skipped (use -v to see them all)
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_sched.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_zmalloc used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol __rte_panic used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol per_lcore__lcore_id used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_free used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_get_tsc_hz used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_cycles_vmware_tsc_map used by debian/build/shared-root/lib/librte_sched.so.1 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_pmd_af_packet.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_zmalloc_socket used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_free used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_socket_id used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_driver_register used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol per_lcore__lcore_id used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_pmd_af_packet.so.1 found in none of the libraries
Testing debian/build/shared-root/lib/librte_port.so.2
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_sched_port_enqueue used by debian/build/shared-root/lib/librte_port.so.2 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_sched_port_dequeue used by debian/build/shared-root/lib/librte_port.so.2 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_pmd_null.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_zmalloc_socket used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_socket_id used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_cpu_get_flag_enabled used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_free used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol per_lcore__lcore_id used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_eal_driver_register used by debian/build/shared-root/lib/librte_pmd_null.so.1 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Testing debian/build/shared-root/lib/librte_ip_frag.so.1
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
dpkg-shlibdeps: warning: symbol rte_eal_has_hugepages used by debian/build/shared-root/lib/librte_ip_frag.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_log used by debian/build/shared-root/lib/librte_ip_frag.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol per_lcore__lcore_id used by debian/build/shared-root/lib/librte_ip_frag.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_zmalloc_socket used by debian/build/shared-root/lib/librte_ip_frag.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_cpu_get_flag_enabled used by debian/build/shared-root/lib/librte_ip_frag.so.1 found in none of the libraries
dpkg-shlibdeps: warning: symbol rte_mem_virt2phy used by debian/build/shared-root/lib/librte_ip_frag.so.1 found in none of the libraries
dpkg-shlibdeps: warning: binaries to analyze should already be installed in their package's directory
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd
Quoted 30 lines · Ferruh Yigit
Quoted 9 lines · Thomas Monjalon
Hi Ferruh,
2016-06-10 19:32, Ferruh Yigit:
Quoted 6 lines
mk/rte.app.mk +0
-0@@ -50,6 +50,14 @@ ifeq ($(NO_LDSCRIPT),) LDSCRIPT = $(RTE_LDSCRIPT) endifQuoted 13 lines
mk/rte.app.mk ifeq ($(NO_LDSCRIPT),) · line 59
Quoted 7 lines
mk/rte.app.mk +7
-0+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +# Workaround to eal <-> mempool cyclic dependency +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +endif + +# Link only the libraries used in the application +_LDLIBS-y += --as-neededI think we do not need this workaround.
The dependency of EAL logs on mempool is now removed.
We only have the dependency of EAL ivshmem onlibrte_ivshmemheader (which needs mempool and rings headers).I missed that dependency removed, this is good, I will send a new version of the patch.
Thanks,
ferruh
PATCH 1/1 mk: fix missing DEPDIRS to avoid libarary underlinking
After several cleanups libraries are now linked against the libs the refer as DEPDIR which is great. But that now made it visible that some DEPDIRS where still missing.
This patch is adding the missing depdirs to avoid any library referring to symbols they are not linked against (found with dpkg-shlibs).
--- drivers/crypto/null/Makefile | 2 ++ drivers/net/af_packet/Makefile | 1 + drivers/net/bonding/Makefile | 2 ++ drivers/net/fm10k/Makefile | 1 + drivers/net/null/Makefile | 1 + drivers/net/pcap/Makefile | 1 + drivers/net/vhost/Makefile | 3 +++ lib/librte_ip_frag/Makefile | 1 + lib/librte_pipeline/Makefile | 1 + lib/librte_port/Makefile | 1 + lib/librte_sched/Makefile | 1 + 11 files changed, 15 insertions(+)
drivers/crypto/null/Makefile +2 -0
@@ -55,5 +55,7 @@ SYMLINK-y-include += DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_cryptodev +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_ring +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_kvargs include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/af_packet/Makefile +1 -0
@@ -54,5 +54,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/bonding/Makefile +2 -0
@@ -64,5 +64,7 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/fm10k/Makefile +1 -0
@@ -100,5 +100,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR) += fm10k_rxtx_vec.c DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_eal lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_net +DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_kvargs include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/null/Makefile +1 -0
@@ -57,5 +57,6 @@ SYMLINK-y-include += rte_eth_null.h DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/pcap/Makefile +1 -0
@@ -59,5 +59,6 @@ SYMLINK-y-include += DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/vhost/Makefile +3 -0
@@ -36,6 +36,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_vhost.a +LDLIBS += -lpthread + CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
@@ -58,5 +60,6 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_kvargs DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_vhost +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_ip_frag/Makefile +1 -0
@@ -55,5 +55,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h # this library depends on rte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool lib/librte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/Makefile +1 -0
@@ -54,5 +54,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) := lib/librte_table DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_port +DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_port/Makefile +1 -0
@@ -75,5 +75,6 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag +DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_sched/Makefile +1 -0
@@ -61,5 +61,6 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_net lib/librte_timer +DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_eal include $(RTE_SDK)/mk/rte.lib.mk
Signature · 1 line
2.7.4
Re: [PATCH] mk: fix missing DEPDIRS to avoid libarary underlinking
2016-06-13 11:48, Christian Ehrhardt:
drivers/net/af_packet/Makefile SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c · line 57
Quoted 7 lines
drivers/net/af_packet/Makefile +1
-0@@ -54,5 +54,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_eal
It looks more logical to have eal as first DEPDIR in these lists.
drivers/net/vhost/Makefile include $(RTE_SDK)/mk/rte.vars.mk · line 40
Quoted 8 lines
drivers/net/vhost/Makefile +2
-0@@ -36,6 +36,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_vhost.a +LDLIBS += -lpthread +
It is not a DEPDIR but an external dependency.
It deserves a separate patch.
Do we need it in rte.app.mk? It is an EAL dependency as well.
Re: [PATCH] mk: fix missing DEPDIRS to avoid libarary underlinking
On Mon, Jun 13, 2016 at 12:08 PM, Thomas Monjalon <[email protected]
Quoted 7 lines
wrote:
2016-06-13 11:48, Christian Ehrhardt:
drivers/net/af_packet/Makefile SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) +=
Quoted 3 lines
drivers/net/af_packet/Makefile +0
-0@@ -54,5 +54,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) +=
rte_eth_af_packet.c
Quoted 6 lines
drivers/net/af_packet/Makefile SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c · line 57
Quoted 4 lines
drivers/net/af_packet/Makefile +1
-0DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ealIt looks more logical to have eal as first DEPDIR in these lists.
Yeah, thought about alphanumeric order, but eal first should be most appropriate.
Quoted 10 lines
drivers/net/vhost/Makefile include $(RTE_SDK)/mk/rte.vars.mk · line 40
Quoted 8 lines
drivers/net/vhost/Makefile +2
-0@@ -36,6 +36,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_vhost.a +LDLIBS += -lpthread +It is not a DEPDIR but an external dependency.
It deserves a separate patch.
Quoted 1 line
Yes, sorry for just wrapping it in.
Will send a v2 with both changes later.
Quoted 2 lines
Do we need it in rte.app.mk? It is an EAL dependency as well.
Not IMHO:
EAL depends on it so librte_eal.so depends on it as it should (just reverified by ldd).
I don't see a reason that any app created should depend on pthread other than if it actually uses libpthread.
v2 cover mk: fix more library underlinking
After several cleanups libraries are now linked against the libs they refer as DEPDIR which is great.
But that now also made it visible that some references where still missing.
The following two patches try to fix that:
[PATCH v2 1/2] mk: fix missing vhost dependency to pthread to avoid [PATCH v2 2/2] mk: fix missing DEPDIRS to avoid libarary underlinking
PATCH v2 1/2 mk: fix missing vhost dependency to pthread to avoid libarary underlinking
Add the missing external dependency to pthread to avoid referring to symbols the library is not linked against.
--- drivers/net/vhost/Makefile | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vhost/Makefile +2 -0
@@ -36,6 +36,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # LIB = librte_pmd_vhost.a +LDLIBS += -lpthread + CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS)
Signature · 1 line
2.7.4
PATCH v2 2/2 mk: fix missing DEPDIRS to avoid libarary underlinking
In reply to Christian EhrhardtThis patch adds missing DEPDIRS to avoid any library referring to symbols they are not linked against.
--- drivers/crypto/null/Makefile | 2 ++ drivers/net/af_packet/Makefile | 1 + drivers/net/bonding/Makefile | 2 ++ drivers/net/fm10k/Makefile | 1 + drivers/net/null/Makefile | 1 + drivers/net/pcap/Makefile | 1 + drivers/net/vhost/Makefile | 1 + lib/librte_ip_frag/Makefile | 1 + lib/librte_pipeline/Makefile | 1 + lib/librte_port/Makefile | 1 + lib/librte_sched/Makefile | 1 + 11 files changed, 13 insertions(+)
drivers/crypto/null/Makefile +2 -0
@@ -55,5 +55,7 @@ SYMLINK-y-include += DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_cryptodev +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_ring +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_kvargs include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/af_packet/Makefile +1 -0
@@ -51,6 +51,7 @@ CFLAGS += $(WERROR_FLAGS) SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c # this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs
drivers/net/bonding/Makefile +2 -0
@@ -64,5 +64,7 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/fm10k/Makefile +1 -0
@@ -100,5 +100,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR) += fm10k_rxtx_vec.c DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_eal lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_net +DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_kvargs include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/null/Makefile +1 -0
@@ -54,6 +54,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += rte_eth_null.c SYMLINK-y-include += rte_eth_null.h # this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_kvargs
drivers/net/pcap/Makefile +1 -0
@@ -56,6 +56,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += rte_eth_pcap.c SYMLINK-y-include += # this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs
drivers/net/vhost/Makefile +1 -0
@@ -56,6 +56,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += rte_eth_vhost.c SYMLINK-y-include += rte_eth_vhost.h # this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_kvargs
lib/librte_ip_frag/Makefile +1 -0
@@ -54,6 +54,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h # this library depends on rte_ether +DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool lib/librte_ether include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_pipeline/Makefile +1 -0
@@ -52,6 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h # this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) := lib/librte_table DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_port
lib/librte_port/Makefile +1 -0
@@ -75,5 +75,6 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag +DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_sched/Makefile +1 -0
@@ -59,6 +59,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h # this lib depends upon: +DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_net lib/librte_timer
Signature · 1 line
2.7.4
Thomas Monjalon
AppliedRe: [PATCH v2 0/2] mk: fix more library underlinking
In reply to Christian Ehrhardt2016-06-13 13:06, Christian Ehrhardt:
Quoted 7 lines
After several cleanups libraries are now linked against the libs they refer as DEPDIR which is great.
But that now also made it visible that some references where still missing.The following two patches try to fix that:
[PATCH v2 1/2] mk: fix missing vhost dependency to pthread to avoid [PATCH v2 2/2] mk: fix missing DEPDIRS to avoid libarary underlinking
Applied, thanks
Thomas Monjalon
AppliedRe: [PATCH v2 0/6] reduce overlinking in applications
In reply to Thomas Monjalon2016-06-10 15:19, Thomas Monjalon:
Quoted 9 lines
This is a respin of the ideas of Christian and Ferruh to limit the static application size or dynamic links to shared libraries.
It also brings some clean-up in rte.app.mk.
Ferruh Yigit (2):
mk: prevent overlinking in applications
mk: reduce scope of whole-archive static linking
Quoted 5 lines
Thomas Monjalon (4):
mk: sort drivers in static application link list
mk: fix driver dependencies order for static application
mk: remove library grouping during application linking
mk: sort libraries in level order when linking
Applied
Re: [PATCH] mk: fix underlinking issues of most librte libraries
In reply to Panu Matilainen2016-05-24 12:56, Panu Matilainen:
Quoted 22 lines · Thomas Monjalon
Quoted 9 lines
2016-05-20 18:50, Christian Ehrhardt:
Quoted 5 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +0
-0
mk/rte.lib.mk else · line 81
Quoted 5 lines
mk/rte.lib.mk +2
-0@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compat
We need some comments to explain why they are ignored.
Quoted 7 lines
mk/rte.lib.mk +3
-0+_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS))I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
I'm familiar with gmake and I do not think it can be improved more ;) Please send a patch. Thanks
Re: [PATCH] mk: fix underlinking issues of most librte libraries
Quoted 26 lines · Thomas Monjalon
2016-05-24 12:56, Panu Matilainen:
Quoted 25 lines · Thomas Monjalon
Quoted 9 lines
2016-05-20 18:50, Christian Ehrhardt:
Quoted 5 lines
The individual libraries have various cross dependencies. This is already refelcted in the DEPDIR dependency, but not yet in proper
DT_NEEDEDflags in the .so's.
This adds the -l flags so that is properly stored in the .so's ELF headers.Why not filling LDLIBS by parsing DEPDIRS-y in rte.lib.mk?
A fair question :) The thought has passed my mind too, but I thought it'd be too messy with differing library vs directory names and other exceptions. But in reality manually maintained separate LDLIBS is only going to get out of sync sooner or later, and turns out its not that bad anyway:
mk/rte.lib.mk +0
-0@@ -77,6 +77,12 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif
Quoted 4 lines
mk/rte.lib.mk else · line 81
Quoted 2 lines
mk/rte.lib.mk +2
-0+# Translate DEPDIRS-y into LDLIBS +IGNORE_DEPS = -lrte_eal/% -lrte_net -lrte_compatWe need some comments to explain why they are ignored.
Yup. It'd be more clear if this filtering was done before translating directories to -lrte_foo but this was the first variant I came across that worked :) The issue is that librte_eal/common, librte_net and librte_compat are common directory dependencies but no actual library is generated from them so they just need to be weeded out of the equation, the revised version makes this more clear.
Quoted 5 lines
Quoted 4 lines
mk/rte.lib.mk +3
-0+_LDDIRS = $(subst librte_ether,libethdev,$(DEPDIRS-y)) +_LDDEPS = $(subst lib/lib,-l,$(_LDDIRS)) +LDLIBS += $(filter-out $(IGNORE_DEPS), $(_LDDEPS))
Quoted 7 lines
Quoted 3 lines
I'm also sure somebody more familiar with gmake could improve it, but it seems to work quite fine here. I'll wait a bit to see if there are other suggestions before sending it as a proper patch.
I'm familiar with gmake and I do not think it can be improved more ;) Please send a patch. Thanks
Ok, will do.
- Panu -