DPDK usage discussions
 help / color / mirror / Atom feed
From: Hui Liu <onlyflyer@gmail.com>
To: users@dpdk.org
Subject: [dpdk-users] DPDK library link issue with __attribute__((constructor))
Date: Sun, 4 Mar 2018 21:08:45 -0800	[thread overview]
Message-ID: <CAF=f7313pVcOsy8+g297OpAnMbxgBkutYtxqoy_YVSz1t987oA@mail.gmail.com> (raw)

Hi Guys,

I am using DPDK with the yocto build system.

I found some static library is not linked because of the linker's as-needed
decision.

Some .a file use __attribute__((constructor)) to register their APIs,
we only know if we use these APIs at runtime, but linker make the decision
early and then discarded them.

I tried a lot to link the library I need:

1, use -Wl, --no-as-needed, for example:
gcc a.c *-Wl, --no-as-needed* -ldl -ldpdk

2, Put the library explicitly to the linker like this:
gcc a.c -Wl, --no-as-needed -ldl -ldpdk *-lrte_mempool*

At last, I still didn't find my library in the elf file.

Is there anything else I can try to link these library?

-- 
Thanks & Best Regards
Liu Hui
--

             reply	other threads:[~2018-03-05  5:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  5:08 Hui Liu [this message]
2018-03-05  9:15 ` Hui Liu
2018-03-05 13:28   ` Wiles, Keith
2018-03-07  1:02     ` Hui Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF=f7313pVcOsy8+g297OpAnMbxgBkutYtxqoy_YVSz1t987oA@mail.gmail.com' \
    --to=onlyflyer@gmail.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).