PATCH: Add STO_COPY
H. J. Lu
hjl@lucon.org
Fri Apr 4 01:15:00 GMT 2003
The copy relocation doesn't work with protected symbols:
http://sources.redhat.com/ml/binutils/2003-03/msg00413.html
I'd like to take the STO_COPY approach. Its advantage is it is binary
compatible with the existing ld.so. The only drawback is the st_other
field is very limited. I chose 0x80 which has been used in binutils
by alpha and m68hc11. It is not the case we take one away from the
future gABI change. I will check it in if I haven't heard any strong
objections by next Monday.
H.J.
---
bfd/
2003-03-28 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Set STO_COPY
for R_386_COPY relocation.
include/elf/
2003-03-28 H.J. Lu <hjl@gnu.org>
* common.h (STO_COPY): New.
--- binutils/bfd/elf32-i386.c.copy 2003-03-07 16:44:56.000000000 -0800
+++ binutils/bfd/elf32-i386.c 2003-03-28 11:21:26.000000000 -0800
@@ -1493,6 +1493,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
{
htab->srelbss->_raw_size += sizeof (Elf32_External_Rel);
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+ h->other |= STO_COPY;
}
/* We need to figure out the alignment required for this symbol. I
--- common.h.copy 2003-04-01 14:29:10.000000000 -0800
+++ common.h 2003-04-03 17:06:28.000000000 -0800
@@ -431,6 +431,11 @@ Foundation, Inc., 59 Temple Place - Suit
#define ELF32_ST_VISIBILITY ELF_ST_VISIBILITY
#define ELF64_ST_VISIBILITY ELF_ST_VISIBILITY
+/* Use one bit in the st_other field to indicate if a definition comes
+ from a copy relocation. It is used by a copy relocation against a
+ protected symbol. Bits in st_other are very limited. 0x80 has
+ already been used by alpha and m68hc11. We reuse it here. */
+#define STO_COPY 0x80
#define STN_UNDEF 0 /* Undefined symbol index */
More information about the Binutils
mailing list