This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Locating library modules during link



Stan Katz wrote:

> Hi,
>
> [...] The hardware I am using (Hitachi SH2) has fast internal Flash and Ram [...]
>
> The problem is that for production we will be generating several systems containing different combinations of the
> drivers, and we plan to add drivers as the new hardware is developed. The original plan was to place all the drivers
> in a library archive and to let the linker select the needed drivers. This is also now working.
>
> The problem is combining the 2 requirements.

[...]

> Unfortunately however, the linker seems to allocate
> the library data last (which is as I expected) and by the time any code from the library is included the internal
> Flash is already full with other code and the .libtext data ends up after the .text.
>

Perhaps you can't have your cake and eat it. If you whish to load more instruction/data to the fast memory than its total
capacity, you shouldn't expect the linker to decide which sections is more important to you.

>
> Any other ideas out there, or am I going to have to look into extending the linker ?
>

You might consider putting everything in explicit files and use #if (HAS_DRIVER_XYZ) / #endif around the complete source
code (after a few header files that gets the applicable value for HAS_DRIVER_XYZ) for the device-specific portions of your
application source code. This way, you bring the code selection decisions up front, to the source code, and make it
explicit.

I used this approach in a project, with a special-purpose C preprocessor that could give the complete project source code
filtered for a specific configuration.

>
> Stan Katz
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

--

- Thierry Moreau

CONNOTECH Experts-conseils inc.
9130 Place de Montgolfier
Montreal, Qc
H2M 2A1

Tel.: (514)385-5691
Fax:  (514)385-5900

e-mail: thierry.moreau@connotech.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]