This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [m68k] Add uClinux-specific code generation options


Bernardo wrote:

> Richard Henderson wrote:
> > On Wed, Sep 03, 2003 at 11:41:07PM +0200, Bernardo Innocenti wrote:
> > 
> >>+#define LEA(sym,reg)	movel	a5@(_current_shared_library_a5_offset_), 
> > 
> > I assume _current_shared_library_a5_offset_ is some sort of magic
> > assembler/linker symbol?  

> Yes. It's declared in a startup file provided by uClibc, and it's
> initialized in a function called before main().

Actually this is provided by a linker symbol :-)

I'll try to give a brief explanation of shared libraries in our no MMU world 
in case anybody really cares...

Each program and library that it uses is allocated its own data segment.  At the start of each of these we maintain a (small) table of pointers to all of the various data segments.  This means that the function prologue code can do:

	move.l a5@(my_offset), a5

to guarantee that a5 now points to its data segment (& GOT) regardless of which module it came from.  Hence that module can access its data segment and GOT.

We process each of the various GOTs at load time to relocate everything appropriately (including references between different modules).


Regards,

Pauli
---
Dr Paul Dale, Software Grunt, http://www.SnapGear.com
SnapGear - Custom Embedded Solutions and Security Appliances



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