diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c1ce396f59..d898b1d232 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2001-10-03 Vassili Karpov + + * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Handle nocopyreloc. + 2001-10-03 Thiemo Seufer * elf64-mips.c (elf_backend_may_use_rela_p): New define. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 719a209491..e249304476 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1127,6 +1127,13 @@ elf_i386_adjust_dynamic_symbol (info, h) if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) return true; + /* If -z nocopyreloc was given, we won't generate 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) { diff --git a/include/ChangeLog b/include/ChangeLog index 99bd932027..030ebfe788 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2001-10-03 Vassili Karpov + + * bfdlink.h (struct bfd_link_info): Add nocopyreloc field. + 2001-09-24 Kaveh R. Ghazi * libiberty.h (reconcat): New function. diff --git a/include/bfdlink.h b/include/bfdlink.h index 9ada606e31..0865594380 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -294,6 +294,10 @@ struct bfd_link_info and sorted so that relocs against the same symbol come together. */ boolean combreloc; + /* True if executable should not contain copy relocs. + Setting this true may result in a non-sharable text segment. */ + boolean nocopyreloc; + /* How many spare .dynamic DT_NULL entries should be added? */ unsigned int spare_dynamic_tags; }; diff --git a/ld/ChangeLog b/ld/ChangeLog index 29b2647526..819f5fab98 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2001-10-03 Vassili Karpov + + * emultempl/elf32.em (parse_args): Handle -z nocopyreloc. + * NEWS: Mention -z nocopyreloc. + * ld.texinfo (Options): Describe nocopyreloc. + 2001-10-03 Alan Modra * configure: Regenerate. diff --git a/ld/NEWS b/ld/NEWS index 27dc89105f..70997ef23e 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,4 +1,7 @@ -*- text -*- +* Support for -z nocopyreloc in the x86 ELF linker, which disables + production of copy relocs. Warning: using this option may result in + non-sharable applications. * Support for -z combreloc in the ELF linker, which puts dynamic relocations against the same symbol together, so that dynamic linker diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index f2011cece4..c9cf50d914 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1517,6 +1517,8 @@ cat >>e${EMULATION_NAME}.c <