[dpdk-dev] How to include pre-build object file (.o) in DPDK makefile?

Neil Horman nhorman at tuxdriver.com
Mon Sep 19 13:38:12 CEST 2016


On Fri, Sep 16, 2016 at 06:30:10PM +0000, Lu, Patrick wrote:
> -----Original Message-----
> From: Yigit, Ferruh 
> Sent: Friday, September 16, 2016 11:05 AM
> To: Lu, Patrick <patrick.lu at intel.com>; dev at dpdk.org
> Subject: Re: [dpdk-dev] How to include pre-build object file (.o) in DPDK makefile?
> 
> On 9/16/2016 6:04 PM, Lu, Patrick wrote:
> > Hi,
> > 
> > I'm trying to include some hand written assembly (compiled by yasm) in my DPDK program. I couldn't find any example linking the DPDK C code with pre-compiled .o file. I've searched the mk/ and found OBJS-y seems the right variable to include .o file, but when generating the final executable, OBJS-y contains only main.o (generating from main.c).
> > 
> > I've tried to put my .o file in both source directory as well as 
> > build/
> > 
> 
> Possible to use EXTRA_LDLIBS to provide the object file name, and put object file into build folder.
> 
> Following example worked for me:
> 
> $ nm foo.o
> 0000000000000000 T foo
> 
> $ cp foo.o examples/skeleton/build/
> 
> $ make -C examples/skeleton EXTRA_LDLIBS="foo.o"
> make: Entering directory '.../examples/skeleton'
>   CC basicfwd.o
>   LD basicfwd
>   INSTALL-APP basicfwd
>   INSTALL-MAP basicfwd.map
> make: Leaving directory '.../examples/skeleton'
> 
> $ nm examples/skeleton/build/basicfwd | grep foo 000000000055fd1d T foo
> 
> Perfect! This works for me.
> 
Just out of curiosity, why not just specify the source file in SRCS-y for your
target binary?  rte.pre-compile.mk has an assembly target for .S->.o
transitions.

Neil

> Sincerely,
> 
> Patrick
> 
> 


More information about the dev mailing list