This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Re: libiberty...


Hi Scott,

>The dynamic linker cannot fix this up.  To do so it would have to write
>to the code segment, which is read only.

Well yes, but that's not impossible to fix.  You just need to use mprotect and 
sys_cacheflush in the appropriate places.  It's ugly and will be bad for 
performance, but it can be made to work.  The only reason it doesn't at the 
moment is laziness -- nobody has wanted the functionality bad enough to 
actually write the code.

>Quite frankly, I wish the linker would fix up the reloc quietly and just
>do the right thing.

I have no problem with that.

>I am concerned however that there may be othe r
>relocs, particularly data relocs that need to be turned into some other
>type for inclusion in the shared library.  I may be needlessly concerned
>here, but I would rather be safe than sorry.

It will be OK, I think.  You will get some ABS32 relocs in read-only segments 
that need the same mprotect trick, and again there will be a cost in speed of 
loading and run-time memory use, but aside from that I can't see anything 
that might go wrong.

(Actually, given that -fPIC consumes an extra general purpose register for the 
GOT pointer, you could even make some sort of a case for saying that some 
performance-critical shared libraries might be better compiled without.)

p.



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