Placing objects into a split address space at link time

Peter Bigot bigotp@acm.org
Wed Apr 25 15:14:00 GMT 2012


I'm supporting a microcontroller with a split 20-bit address space:
RAM and ROM exists up to 1 MB, but there's an interrupt table that's
located at a fixed address just below the 64kB boundary.  This has
traditionally been handled with ROM and FAR_ROM regions denoting the
available space below and above the vector region.  Correspondingly,
there are .text/.data and .fartext/.fardata sections.  This works fine
when symbols are explicitly placed in one of these sections.

To simplify use in higher level languages, I'd like to delay
assignment of a function or data object to a specific region until a
non-relocatable link phase: thus the compiler would place, for
example, all functions in section ".anytext", and the linker would
look at the contents and reassign their section based on available
space and perhaps other parameters.  (I recognize that may be
necessary to use function-specific sections like .anytext.printf to
prevent aggregating everything into one huge unsplittable blob before
this phase can be reached.)

I've been unable to find any prior art showing how to do this in
binutils. Is my plan a reasonable approach, or is there a better
solution to this problem?

Thanks.

Peter



More information about the Binutils mailing list