From: Paweł Sikora Date: Wed, 8 Jun 2011 08:23:26 +0000 (+0000) Subject: - emit proper warning about relocation in shared objects' text segment X-Git-Tag: auto/th/binutils-2_21_51_0_9-4 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fbinutils.git;a=commitdiff_plain;h=4514cdb71928a7cc32fa7edeca724699c8a21550 - emit proper warning about relocation in shared objects' text segment instead of memory gpf. ld: warning: relocation in readonly section `.rodata'. ld: warning: creating a DT_TEXTREL in a shared object. - release 4. Changed files: binutils-warn_ro_relocs.patch -> 1.1 binutils.spec -> 1.342 --- diff --git a/binutils-warn_ro_relocs.patch b/binutils-warn_ro_relocs.patch new file mode 100644 index 0000000..15e9da9 --- /dev/null +++ b/binutils-warn_ro_relocs.patch @@ -0,0 +1,52 @@ +commit cd83a0f5f7496853f21ae956ffcc3759adee1c1f +Author: H.J. Lu +Date: Wed Jun 1 19:42:00 2011 +0000 + + Properly warn relocation in readonly section in a shared object. + + 2011-06-01 H.J. Lu + + * elf32-i386.c (elf_i386_size_dynamic_sections): Properly warn + relocation in readonly section in a shared object. + * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise. + +diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c +index ee1511f..eea2263 100644 +--- a/bfd/elf32-i386.c ++++ b/bfd/elf32-i386.c +@@ -2488,13 +2488,13 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + { + srel = elf_section_data (p->sec)->sreloc; + srel->size += p->count * sizeof (Elf32_External_Rel); +- if ((p->sec->output_section->flags & SEC_READONLY) != 0) ++ if ((p->sec->output_section->flags & SEC_READONLY) != 0 ++ && (info->flags & DF_TEXTREL) == 0) + { + info->flags |= DF_TEXTREL; + if (info->warn_shared_textrel && info->shared) + info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), + p->sec->owner, p->sec); +- break; + } + } + } +diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c +index 5cbaff8..9d6d4a4 100644 +--- a/bfd/elf64-x86-64.c ++++ b/bfd/elf64-x86-64.c +@@ -2399,13 +2399,13 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, + { + srel = elf_section_data (p->sec)->sreloc; + srel->size += p->count * bed->s->sizeof_rela; +- if ((p->sec->output_section->flags & SEC_READONLY) != 0) ++ if ((p->sec->output_section->flags & SEC_READONLY) != 0 ++ && (info->flags & DF_TEXTREL) == 0) + { + info->flags |= DF_TEXTREL; + if (info->warn_shared_textrel && info->shared) + info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), + p->sec->owner, p->sec); +- break; + } + } + } diff --git a/binutils.spec b/binutils.spec index 8988349..068c23e 100644 --- a/binutils.spec +++ b/binutils.spec @@ -17,7 +17,7 @@ Summary(tr.UTF-8): GNU geliştirme araçları Summary(uk.UTF-8): Набір інструментів GNU для побудови виконуваних програм Name: binutils Version: 2.21.51.0.9 -Release: 3 +Release: 4 Epoch: 3 License: GPL v3+ Group: Development/Tools @@ -35,6 +35,7 @@ Patch7: %{name}-libtool-m.patch Patch8: %{name}-build-id.patch Patch9: %{name}-tooldir.patch Patch10: %{name}-pr12163.patch +Patch11: %{name}-warn_ro_relocs.patch URL: http://sources.redhat.com/binutils/ BuildRequires: autoconf >= 2.64 BuildRequires: automake >= 1:1.11 @@ -156,6 +157,7 @@ niektórych pakietów. %patch8 -p0 %patch9 -p1 %patch10 -p1 +%patch11 -p1 # file contains hacks for ac 2.59 only %{__rm} config/override.m4