This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH for i386: --no-copy-relocs
"H . J . Lu" <hjl@lucon.org> writes:
> > 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.
I don't understand what you mean.
The COPY reloc is used when a variable appears in a shared library,
and it is referenced by the main executable, and the main executable
does not use the GOT to reference it. We have two choices: 1) put a
dynamic reloc in the text section of the main executable, which means
that the text section must be modified by the dynamic linker, and
therefore is not shareable between processes; 2) link the reference in
the main executable to refer to the data segment of the main
executable, and use a COPY reloc to tell the dynamic linker to
initialize that portion of the data segment.
Ian