[dpdk-dev] weak functions in some drivers

Damjan Marion (damarion) damarion at cisco.com
Tue Jun 21 18:08:32 CEST 2016



> On 21 Jun 2016, at 09:01, Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> 
> Hi Damjan,
> 
> On 6/21/2016 4:01 PM, Damjan Marion (damarion) wrote:
>> 
>> Hello,
>> 
>> We just spent few hours troubleshooting why vPMD is not working
>> in i40e driver. Conclusion was that problem is caused by linker 
>> linking the wrong instance of the i40e_rx_vec_dev_conf_condition_check(...).
>> 
>> That function is defined 2 times, once in i40e_rxtx.c and once in 
>> i40e_rxtx_vec.c. First one is defined as weak and it just returns -1.
>> 
>> librte_pmd_i40e.a contains both versions:
>> 
>> $ objdump -x librte_pmd_i40e.a| grep i40e_rx_vec_dev_conf_condition_check
>> 0000000000006ca0  w    F .text	0000000000000006 i40e_rx_vec_dev_conf_condition_check
>> 00000000000007c1 g     F .text.unlikely	000000000000001c i40e_rx_vec_dev_conf_condition_check
>> 
>> However when we are linking our app, linker was picking 1st (weak) one and vPMD init was failing.
> App is linking with correct instance of the function for me, how can I
> reproduce this linkage issue?
> 
>> 
>> Workaround we applied to get int working:  -Wl,--whole-archive <LIBS> -Wl,—no-whole-archive
> These flags already wraps PMD libraries, can you please give more detail
> about workaround?
> 

You can see our exact fix here:

https://git.fd.io/cgit/vpp/commit/?id=0977e4baabd97d1de711a3d7a0f285364a84159c

If you want to repro just pick the commit before this one…

Thanks,

Damjan




More information about the dev mailing list