public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Jonathan Larmour <jifl@eCosCentric.com>
To: Chris Zimman <czimman@bloomberg.com>
Cc: Andrew Lunn <andrew@lunn.ch>,  ecos-discuss@sourceware.org
Subject: Re: [ECOS] ARM EABI port / static constructor priority removal
Date: Wed, 02 Apr 2008 14:20:00 -0000	[thread overview]
Message-ID: <47F39605.8070605@eCosCentric.com> (raw)
In-Reply-To: <F31C1582037F5041B0CD525FD870AE6A774248@ny2545.corp.bloomberg.com>

Chris Zimman wrote:
>> Also ugly. You break the nice packing model. Say i have an out of tree
>> package, a device driver for the wall clock on my hardware. The
>> current code allows my code to have a static initializer with priority
>> that is after I2C is up and running and it is totally independent of
>> the in tree code.

And also needs to be run _after_ the kernel code, but potentially before
the libc code (which may reference the RTC), etc.etc. It's just not
feasible while retaining modularity which is far more valuable.

>> I don't need to modify the in tree code at all. The
>> linker sorts it all out. Your suggestion would force me to modify the
>> in tree list of constructors.
> 
> With what you're talking about here, you'd have to modify cyg_type.h anyway

Not really. In cyg_type.h CYG_INIT_APPLICATION is defined, and priorities
60000 up to 65534 are free for application use.

> if you want to add a new init priority unless you want to keep it private,
> which is kind of bogus.  With the current model anyhow, you *have* to be
> aware of the ordering in cyg_type.h and known what values are assigned to
> which constructors.  That's pretty ugly in and of itself.

Arguably not with a reserved range for application use.

> There's also no inherent reason you would have to modify in tree code to
> accomplish what you're suggesting.  Sections can be created for just that
> purpose.  Even enforcing startup ordering rules is pretty straight forward
> that way.

It's potentially feasible to create a section (not .ctors, something
eCos-specific) that contains a list of tuples - a priority number and a
function pointer. But then a) the list needs to be sorted at runtime which
is very bad; and b) it seems very much that we're just swapping one
extension for another.

Although reworking our abstraction to _permit_ this mode of operation
(without requiring it for GCC users) might make eCos more portable to other
compilers by making this sort of thing possible.

>> The same could be said for application code. My application wants a
>> static constructor called after the OS is up an running, but before
>> main() is called. Should i modify the OS to list my application
>> constructors?
> 
> It's not about the use of static constructors in general, it's about relying
> on non-portable behavior with respect to using them (construction ordering).

It's not the best solution, but it may be the least worst.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
 **  Visit us at ESC Silicon Valley <http://www.embedded.com/esc/sv>  **
 **  April 15-17 2008, Booth 3012, San Jose McEnery Convention Center **
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2008-04-02 14:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26 18:06 Chris Zimman
2008-03-26 18:09 ` Andrew Lunn
2008-03-26 18:18   ` Chris Zimman
2008-03-26 18:25     ` Andrew Lunn
2008-03-26 18:32       ` Chris Zimman
2008-03-26 18:38         ` Andrew Lunn
2008-03-26 18:42           ` Chris Zimman
2008-03-26 18:56             ` Andrew Lunn
2008-03-26 19:10               ` Chris Zimman
2008-04-02 14:20                 ` Jonathan Larmour [this message]
2008-04-02 14:52                   ` Chris Zimman
2008-03-26 20:47           ` Fabian Scheler
2008-03-27  1:53             ` Chris Zimman

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=47F39605.8070605@eCosCentric.com \
    --to=jifl@ecoscentric.com \
    --cc=andrew@lunn.ch \
    --cc=czimman@bloomberg.com \
    --cc=ecos-discuss@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).