public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] linking question
@ 2009-02-23 13:55 Will Wagner
  2009-02-23 17:30 ` [ECOS] " John Dallaway
  0 siblings, 1 reply; 2+ messages in thread
From: Will Wagner @ 2009-02-23 13:55 UTC (permalink / raw)
  To: ecos-discuss

Hi All,

I'm interested in changing how my app links so that all the ecos functions come before my 
app functions. I assume to do this I need to shift my app code into different sections ie 
.text.app and .gnu.linkonce.app and then change the linker script file.

Would that work?

My next question is how to specify that I want my code in a different section. I know how 
to do it by adding declarations to the source code but would like to not have to do that. 
Is there an easy way of changing the sections for a file or archive?

Thanks.

Will
-- 
------------------------------------------------------------------------
Will Wagner                                     will_wagner@carallon.com
Development Manager                      Office Tel: +44 (0)20 7371 2032
Carallon Ltd, Studio G20, Shepherds Building, Rockley Rd, London W14 0DA
------------------------------------------------------------------------


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

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

* [ECOS] Re: linking question
  2009-02-23 13:55 [ECOS] linking question Will Wagner
@ 2009-02-23 17:30 ` John Dallaway
  0 siblings, 0 replies; 2+ messages in thread
From: John Dallaway @ 2009-02-23 17:30 UTC (permalink / raw)
  To: Will Wagner; +Cc: ecos-discuss

Hi Will

Will Wagner wrote:

> I'm interested in changing how my app links so that all the ecos
> functions come before my app functions. I assume to do this I need to
> shift my app code into different sections ie .text.app and
> .gnu.linkonce.app and then change the linker script file.
> 
> Would that work?

It would probably be easier to distinguish your application code using
object code filenames or by placing it all in an archive file with a
specific name. Take a look at the LD documentation on input sections:

http://sourceware.org/binutils/docs-2.19/ld/Input-Section-Basics.html

> My next question is how to specify that I want my code in a different
> section. I know how to do it by adding declarations to the source code
> but would like to not have to do that. Is there an easy way of changing
> the sections for a file or archive?

Fairly easy, but you will need to edit the linker script. Normally the
SECTION_text() macro in the eCos architecture-specific linker script
(*.ld) will gather the .text sections of _all_ object code files as follows:

  *(.text*)

But you can exclude the .text sections of a specific set of files as
follows:

  *(EXCLUDE_FILE (mycode1.o mycode2.o) .text*)

and it would appear that you can exclude the .text sections from an
entire archive using something like:

  *(EXCLUDE_FILE (mycode.a:) .text*)

You can then gather the .text sections of the excluded objects into a
new section using a new macro such as SECTION_mytext().

Finally, you will need to reference the new SECTION_mytext() macro
within the relevant .ldi files in your eCos platform HAL package.

John Dallaway

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

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

end of thread, other threads:[~2009-02-23 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-23 13:55 [ECOS] linking question Will Wagner
2009-02-23 17:30 ` [ECOS] " John Dallaway

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).