This is the mail archive of the binutils@sources.redhat.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]

Option to suppress 386_COPY relocs on Linux ia32



I am back tackling this old problem that still make our life difficult with
respect to using the combination of C++ dynamic cast between an exec and
a -B symbolic shared lib (with gcc 2.95), see the test case that was
attached with :
http://sources.redhat.com/ml/binutils/2000-03/msg00269.html

We concluded that a good way of fixing it was to suppress the COPY relocs
which is what I am doing now (see ref:
http://sources.redhat.com/ml/binutils/2000-03/msg00270.html).

I have now a better understanding and a more complete C only test case
(attached) that shows that only the ld for Linux ia32 is not able to
suppress COPY relocs when generating an executable.

I have run this test on:
Tru64 5.1
Irix 6.5.5
HP-UX 11
HP-UX 10-20
AIX 4.3.3
Solaris sparc 2.7
Solaris x86
Linux  alpha
Linux ia64
Linux ia32  (FAILS !)

It only fails on Linux ia32, showing that no platform (but solaris sparc)
will ever attempt producing COPY relocs. The COPY relocs can be suppressed
on Solaris sparc by compiling the main executable with -K PIC (the -K PIC
option is passed to the assembler, which generates different code, which in
turn does not trigger the generation of COPY relocs by the linker).

Interestingly, Solaris x86 does not have a -K PIC compiler (or assembler
option), in effect the code is always generated PIC and the Solaris x86
linker (as with Solaris sparc in the presence of -K PIC) does not generate
COPY relocs, it does not generate copy relocs either (and produces a good
executable passing the test) when the code is compiled on Linux ia32 (gcc
2.95) and linked on Solaris x86, showing that the linker is the component
that we need to modify.

I currently have a modified Linux ia32 ld which does not generate COPYs when
an external symbol (in a shared library) is referenced from the .data
section of an executable.

It was a quick modif (as I wanted to know if I was on the right track) which
I am currently refining before submiting it as a patch. I am proposing to
add a new command line flag -nocopy-relocs and it seems that most
modifications will go into one file: elf32-i386.c

If you have remarks, pls shoot.

Jose


t143mp2.tar.gz


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