[dpdk-dev] weak functions in some drivers

Sergio Gonzalez Monroy sergio.gonzalez.monroy at intel.com
Fri Jul 1 12:05:26 CEST 2016


On 01/07/2016 10:42, Elo, Matias (Nokia - FI/Espoo) wrote:
>>>>>> What is not clear to me is motivation to use weak here instead of simply
>>> using >CONFIG_RTE_I40E_INC_VECTOR
>>>>>> macro to exclude stubs in i40e_rxtx.c. It will make library smaller and avoid
>>> issues like this one
>>>>>> which are quite hard to troubleshoot.
>>>>> Since this issue seen in fd.io, I didn't investigated more, but I don't
>>>>> want to clock your valid question, this is an attempt to resurrect the
>>>>> question ...
>>>> Hi,
>>>>
>>>> We are having exactly the same problem. For us the aforementioned
>>> workaround doesn't seem to work and vector mode is always disabled with the
>>> i40e drivers. If I modify i40e_rxtx.c and exclude the stub functions using
>>> CONFIG_RTE_I40E_INC_VECTOR everything works as expected.
>>>> We are building DPDK with the CONFIG_RTE_BUILD_COMBINE_LIBS option
>>> enabled and link DPDK library to our application.
>>>> Any other ideas how this could be fixed?
>>>>
>>>> Regards,
>>>> Matias
>>>>
>>> So you have tried to link a combined static lib with --whole-archive
>>> -ldpdk --no-whole-archive and still get the wrong/weak function definition?
>>>
>>> Sergio
>> I actually just managed to fix the problem. In our case I had to add
>> '-Wl,--whole-archive,-ldpdk,--no-whole-archive'  to the end of AM_LDFLAGS.
>>
> It turned out that the problem actually wasn't fixed.
>
> DPDK is built with CONFIG_RTE_BUILD_COMBINE_LIBS=y and EXTRA_CFLAGS="-fPIC"
>
> What we are linking originally:
> 	-l:libdpdk.a
>
> This works otherwise but vector mode i40e is not enabled.
>
> When trying:
> 	-Wl,--whole-archive,-l:libdpdk.a,--no-whole-archive
>
> Linking fails with ' undefined reference' errors to several dpdk functions (rte_eal_init, rte_cpu_get_flag_enabled, rte_eth_stats_get...).
>
> Btw. there seems to be a Stack Overflow question related to this: http://stackoverflow.com/questions/38064021/dpdk-include-libraries-in-dpdk-application-compiled-as-shared-library
>
> -Matias

What DPDK version are you using?


More information about the dev mailing list