Linker - overlays/software caching

Nick Kelsey fsf@silicondust.com
Wed Jan 14 19:10:00 GMT 2004


Hi all,

I am currently working on a software overlay/caching solution for two chip
architectures.

Both architectures have a limited amount of high speed program memory and I
would like to implement automatic code caching/overlays to page in functions
from slower memorys.

The current proof of concept caches whole functions at a time (direct
mapped, 256 byte block size, n blocks per function). I am
using -ffunction-sections with gcc so every function is in its own section.

The calling convention differs depending on what is calling what but I can
fix in the linker in the relaxation pass.

I have a few linker problems to solve...

1) I need to align every function in the .text section to 256 bytes. Can
this be done in the linker/linker script or do I need to get gcc to renerate
align directives?

2) Overlays/Handling the run address....

I have used the linkers overlay support before and it has two problems -
need for the script to specify what goes it which overlay manually, and gdb
doesn't know which overlay is loaded and gets really confused.

One way I have solved this in the past (vm implementation) was to create a
fake address for the code and let the linker store the code in it
sequentially as normal (which in this case will be several times longer than
the real available memory)... then add code to gdb to detect that it is
running in the overlay range and fake the program counter to so gdb is
happy.

I am happy writing the code to do this but I would like to do a sanity
check - espically if this has been solved in the past. If it is interesting
to anyone I will submit the code back to fsf.

Any thoughts or advice would be appreciated.

Thanks

Nick



More information about the Binutils mailing list