public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "David F." <df7729@gmail.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: Constructor Order
Date: Sat, 24 Jun 2017 20:25:40 +0000	[thread overview]
Message-ID: <CAKv+Gu9pJxX6S=1mCDztOB-y1M0YEacVB6whH-uA_NdUXMFrzg@mail.gmail.com> (raw)
In-Reply-To: <E92EE9817A31E24EB0585FDF735412F5A7D38741@ORSMSX113.amr.corp.intel.com>

On 23 June 2017 at 02:59, Kinney, Michael D <michael.d.kinney@intel.com> wrote:
> David,
>
> Constructor order is determined by the build tool through evaluation of each of the library instance dependencies as declared in the [LibraryClasses] section of the INF.  This is a recursive algorithm to collect all the library instances because a module uses libs and each lib can use additional libs.
>
> This process is described in the EDK II Build Specification in Section 8.2.5 Post processing.
>
> https://edk2-docs.gitbooks.io/edk-ii-build-specification/content/8_pre-build_autogen_stage/82_auto-generation_process.html#82-auto-generation-process
>
> If you want a different order, then likely one or more of the lib instances being linked to a module does not have correct information about its lib dependencies in the [LibraryClasses] section of the INF.  If the dependencies are specified correctly, then the order generated by the build tool should be a valid order based on dependencies.  There are some cases where there could be ties, such that the order could be different and still correct, but there is no way to influence the order between ties.
>

Note that constructor dependencies don't apply transitively if an
intermediate library in the dependency chain has no constructor. For
example, if LibWithConstructorA depends on LibWithoutConstructorB, and
the latter depends on LibWithConstructorC, the EDK2 tools don't
guarantee that C's constructor has executed when A's constructor is
invoked.

I think this is a flaw in the implementation, but fixing this results
in circular dependencies in many platforms that I have tried. so the
best way to deal with this IMO is not to rely on constructor ordering
at all, and which means you shouldn't call other libraries from the
constructor of a library.

-- 
Ard.


      reply	other threads:[~2017-06-24 20:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 22:05 Constructor Order David F.
2017-06-23  2:59 ` Kinney, Michael D
2017-06-24 20:25   ` Ard Biesheuvel [this message]

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-list 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='CAKv+Gu9pJxX6S=1mCDztOB-y1M0YEacVB6whH-uA_NdUXMFrzg@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /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