PATCH for i386: --no-copy-relocs

H . J . Lu hjl@lucon.org
Tue Jun 19 08:37:00 GMT 2001


On Mon, Jun 18, 2001 at 06:14:16PM -0700, Ian Lance Taylor wrote:
> "Jose Luu" <jluu@mainsoft.com> writes:
> 
> > as outlined in message
> > http://sources.redhat.com/ml/binutils/2000-12/msg00183.html and
> > references, here is my patch to solve the aforementionned problem.
> > 
> > The patch has been extensively tested with our software (several
> > million lines) and has been shipped to customers since march, so I
> > am now trusting it. We compile it in such a way that the
> > --no-copy-relocs option is always on unless the -shared option is
> > active.
> > 
> > Whether we want this mode as default or not is a matter of debate:
> > This copying of relocations from shared libs into the main
> > executable seems to come from the i386 ABI, no other ABI seems to
> > need it, I don't know if it is a requirement that executables use
> > it. The problem I am solving is a byproduct of its usage.
> 
> If I read your patch correctly, the dynamic linker will be required to
> modify the text section, which means that it can not be shared when
> multiple processes run the executable.  I do not think that should be
> default.  Also, I think your patch needs to create a DT_TEXTREL if it
> does not already do so.

Definitely. Otherwise if it is true, the dynamic linker may be very
upset.

> 
> The COPY reloc is there in order to keep the text section read-only.
> The i386 is not the only ABI which uses it.  Several others do as
> well.

Is that for symbols in the .rodata (.text?) section? Can we tell gcc
to put such symbols in the .data section?  The SVR4 mips ABI has the
similar issue.


H.J.



More information about the Binutils mailing list