gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Re: ia64 function descriptors and unexec


From: Camm Maguire
Subject: Re: [Gcl-devel] Re: ia64 function descriptors and unexec
Date: 04 Nov 2003 20:25:41 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  

OK, I believe at long last I have a fix, but I'd like to make sure it
is not accidental, i.e. possibly vanishing with future ia64 toolchain
development. 

Andreas Schwab <address@hidden> writes:

> [removing emacs-devel from cc: since it's off-topic there.]
> 
> Camm Maguire <address@hidden> writes:
> 
> > Far better than trying to probe ld.so's function descriptor table, I
> > should rather ammend the lisp compiler to write a static function
> > structure into each produced C source file before compilation, with the
> > structure's pointer element statically initialized to the static
> > function in the same file.  I then use the address for this structure at
> > runtime in setting the lisp symbol's function definition.  This should
> > work, right?
> 
> I have rechecked the specs, and actually the key point isn't static
> vs. dynamic assignment, but rather local vs. dynamic symbols.  A function
> descriptor for a symbol in a shared library will be allocated by the
> dynamic linker, whereas those for symbols in the executable are allocated
> by the static linker.  So you only have to make sure that all function
> pointers in the executable only refer to functions therein.
> 

When I first read this, I was more confused by the meaning of the term
'local' and what I've been seeing.  Briefly I have two possible
recourses, both of which are employed in the present fix:

1)  If the function is static, and this static address is dynamically
    loaded into a structure at runtime, all is well -- the address
    stored and used is outside of ld.so's memory map:

static void foo () {}

void
bar_init () {

        make_lisp_function("FOO",foo);

}

2)  If the function is not static, then its address must be assigned
    to a static variable  initialized at compile time:

void foo() {}

void
bar_init() {

        {
                static lisp_function_body f={....,foo,....}
                make_lisp_function_from_body("FOO",&f);
        }
}

I.e. functions 'local' to the program but visible between C source
files still go through dynamic function generation in ld.so.

This has the distinct disadvantage that the body of the function is
not handled by the main memory management system/gbc.

I suppose the right thing to do is to write static stubs for all
functions. 

Advise/comments most welcome.

Take care,

> Andreas.
> 
> -- 
> Andreas Schwab, SuSE Labs, address@hidden
> SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
> Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]