Index: bfd/elf32-i386.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-i386.c,v retrieving revision 1.51 diff -u -p -r1.51 elf32-i386.c --- elf32-i386.c 2001/09/27 16:18:42 1.51 +++ elf32-i386.c 2001/09/29 10:19:06 @@ -1136,7 +1136,17 @@ elf_i386_adjust_dynamic_symbol (info, h) /* If there are no references to this symbol that do not use the GOT, we don't need to generate a copy reloc. */ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) - return true; + { + return true; + } + else + /* If nocopy reloc was explicitly asked for, we wont generete + them either */ + if (info->nocopyreloc) + { + h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF; + return true; + } eh = (struct elf_i386_link_hash_entry *) h; for (p = eh->dyn_relocs; p != NULL; p = p->next) Index: ld/ld.texinfo =================================================================== RCS file: /cvs/src/src/ld/ld.texinfo,v retrieving revision 1.51 diff -u -p -r1.51 ld.texinfo --- ld.texinfo 2001/09/24 18:35:08 1.51 +++ ld.texinfo 2001/09/29 10:19:34 @@ -840,8 +840,9 @@ for Solaris compatibility. @item -z @var{keyword} The recognized keywords are @code{initfirst}, @code{interpose}, @code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen}, -@code{nodump}, @code{now}, @code{origin}, @code{combreloc} and -@code{nocombreloc}. The other keywords are +@code{nodump}, @code{now}, @code{origin}, @code{combreloc}, @code{nocombreloc} +and @code{nocopyreloc}. +The other keywords are ignored for Solaris compatibility. @code{initfirst} marks the object to be initialized first at runtime before any other objects. @code{interpose} marks the object that its symbol table interposes @@ -858,6 +859,7 @@ of this object will ignore any default l @code{combreloc} combines multiple reloc sections and sorts them to make dynamic symbol lookup caching possible. @code{nocombreloc} disables multiple reloc sections combining. +@code{nocopyreloc} disables production of copy relocs. @kindex -( @cindex groups of archives Index: ld/NEWS =================================================================== RCS file: /cvs/src/src/ld/NEWS,v retrieving revision 1.18 diff -u -p -r1.18 NEWS --- NEWS 2001/08/23 15:14:18 1.18 +++ NEWS 2001/09/29 10:19:35 @@ -1,4 +1,6 @@ -*- text -*- +* Support for -z nocopyreloc in the x86 ELF linker, which disables production + of copy relocs. Warning: this can lead to a non-sharable text segment. * Support for -z combreloc in the ELF linker, which puts dynamic relocations against the same symbol together, so that dynamic linker Index: ld/emultempl/elf32.em =================================================================== RCS file: /cvs/src/src/ld/emultempl/elf32.em,v retrieving revision 1.59 diff -u -p -r1.59 elf32.em --- elf32.em 2001/09/19 05:33:35 1.59 +++ elf32.em 2001/09/29 10:19:41 @@ -1517,6 +1517,8 @@ cat >>e${EMULATION_NAME}.c <