gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: ALPHA native object relocation committed to gclcvs


From: Camm Maguire
Subject: [Gcl-devel] Re: ALPHA native object relocation committed to gclcvs
Date: 18 Apr 2005 17:29:28 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!

Leon Bottou <address@hidden> writes:

> On Friday 15 April 2005 11:13 am, you wrote:
> > There is also this annoying aspect about bfd that they define the
> > reloc_howto_type to be constant, which on alpha, actually puts it into
> > read-only memory, making your *(void **)& workaround segfault. 
> 
> Hmm. I had forgotten that hack.
> What about this brutal solution?
> 
> static void
> alphaelf_write(void **pointer, void* value)
> {
> #if HAVE_MPROTECT
>   int pagesize = getpagesize();
>   bfd_vma start = ptrvma(pointer) & ~(pagesize-1);
>   mprotect( vmaptr(start), pagesize, PROT_READ|PROT_WRITE);
> #endif
>   *pointer = value;
> }
> 

This might work for machines implementing read-only memory this way,
but would it not be more portable to redirect the howto pointer
instead of the special_function pointer?  (Haven't yet checked that
this isn't const too.)  I.e. make our own little table of howto
structs initialized from the bfd versions then modified with a new
special_function, then in fix_relocs, redirect the howto pointer to
the new versions.

BTW, committed a minor but important fix to the alpha relocation code
a few days ago.

Take care,

> 
> 
> 

-- 
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]