All of lore.kernel.org
 help / color / mirror / Atom feed
* How to include pre-build object file (.o) in DPDK makefile?
@ 2016-09-16 17:04 Lu, Patrick
  2016-09-16 18:05 ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Lu, Patrick @ 2016-09-16 17:04 UTC (permalink / raw)
  To: dev

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/

Thanks,

Patrick

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

* Re: How to include pre-build object file (.o) in DPDK makefile?
  2016-09-16 17:04 How to include pre-build object file (.o) in DPDK makefile? Lu, Patrick
@ 2016-09-16 18:05 ` Ferruh Yigit
  2016-09-16 18:30   ` Lu, Patrick
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2016-09-16 18:05 UTC (permalink / raw)
  To: Lu, Patrick, dev

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

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

* Re: How to include pre-build object file (.o) in DPDK makefile?
  2016-09-16 18:05 ` Ferruh Yigit
@ 2016-09-16 18:30   ` Lu, Patrick
  2016-09-19 11:38     ` Neil Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Lu, Patrick @ 2016-09-16 18:30 UTC (permalink / raw)
  To: Yigit, Ferruh, dev

-----Original Message-----
From: Yigit, Ferruh 
Sent: Friday, September 16, 2016 11:05 AM
To: Lu, Patrick <patrick.lu@intel.com>; dev@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.

Sincerely,

Patrick

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

* Re: How to include pre-build object file (.o) in DPDK makefile?
  2016-09-16 18:30   ` Lu, Patrick
@ 2016-09-19 11:38     ` Neil Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Horman @ 2016-09-19 11:38 UTC (permalink / raw)
  To: Lu, Patrick; +Cc: Yigit, Ferruh, dev

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@intel.com>; dev@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
> 
> 

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

end of thread, other threads:[~2016-09-19 11:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 17:04 How to include pre-build object file (.o) in DPDK makefile? Lu, Patrick
2016-09-16 18:05 ` Ferruh Yigit
2016-09-16 18:30   ` Lu, Patrick
2016-09-19 11:38     ` Neil Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.