From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31501 invoked by alias); 6 Dec 2017 07:27:38 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 31481 invoked by uid 89); 6 Dec 2017 07:27:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-pg0-f51.google.com Received: from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com) (74.125.83.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Dec 2017 07:27:34 +0000 Received: by mail-pg0-f51.google.com with SMTP id w7so1851569pgv.6 for ; Tue, 05 Dec 2017 23:27:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=6kaTAnkJ0xcL4mXaEh18YB0A2QKNaut747jl9+BWNC8=; b=q/3uJAXYhYnyWZ1634ilOS8sAxC7ZS5PUGnlZRFIEQ7mx9cL8NRMy2jbYsge5fao+5 vBSptuwXbzJxncJ+r+hwjgv9Eg7zIlZ/Vs/AMkhSgTIDEAMJyeGX9YOzO1fjnGg2gHC4 u1xj0N/+lIo+8vxR3Vmn0+JtWO04p3OsPAeM3qzZWOD1C/VhCaHxRscMt7VfBSOMP6rO AV4kkX54tbFMShTbeg/7QvWRumIDkgp/XqnHsKlEoimxZv3LhJ4NmDB/ovm48Rcug/xX MoSGvYn6oa1gUlYSHODojMKEFFVImd91fi3ryTO2Eve78AYEfcW/b5marizGrQXBkbkz Qjxg== X-Gm-Message-State: AKGB3mIHUYsqznwwhmQEqSOzAsa7Cob+LBr1OcnPP/W9VQfZmTb2xzNw fOL7GqXTc284nJX/bCHShQjpnw== X-Google-Smtp-Source: AGs4zMbBEFQGgKNnyvfTG4rjuo3WVo7ga2e5KsNGcX9Oftz//0y3gb1rE+gLaW3UXCa6V07zoiS7uA== X-Received: by 10.98.202.26 with SMTP id n26mr1808895pfg.202.1512545252622; Tue, 05 Dec 2017 23:27:32 -0800 (PST) Received: from bubble.grove.modra.org (CPE-58-175-244-173.hdcz1.win.bigpond.net.au. [58.175.244.173]) by smtp.gmail.com with ESMTPSA id w64sm3636532pfj.62.2017.12.05.23.27.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 23:27:31 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 26E39C2FCA; Wed, 6 Dec 2017 17:57:28 +1030 (ACDT) Date: Wed, 06 Dec 2017 07:27:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: Fix Common symbol override test fails Message-ID: <20171206072728.GD13179@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00049.txt.bz2 Fixes fails on SH and NDS32 introduced by dyn_reloc tidy. See the comment for why check_relocs should generally ignore non-ALLOC sections. * elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-nds32.c (nds32_elf_check_relocs): Likewise. * elf32-or1k.c (or1k_elf_check_relocs): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c588280..91027d2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,13 @@ 2017-12-06 Alan Modra + * elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections. + * elf32-m32r.c (m32r_elf_check_relocs): Likewise. + * elf32-nds32.c (nds32_elf_check_relocs): Likewise. + * elf32-or1k.c (or1k_elf_check_relocs): Likewise. + * elf32-sh.c (sh_elf_check_relocs): Likewise. + +2017-12-06 Alan Modra + * elf32-hppa.c (struct elf32_hppa_dyn_reloc_entry): Delete. Use struct elf_dyn_relocs throughout file instead. (elf32_hppa_adjust_dynamic_symbol): Comment tidy. diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 3867542..17b188b 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -1165,6 +1165,15 @@ lm32_elf_check_relocs (bfd *abfd, if (bfd_link_relocatable (info)) return TRUE; + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym); diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 39c7f75..cd9f9d2 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3547,6 +3547,15 @@ m32r_elf_check_relocs (bfd *abfd, if (bfd_link_relocatable (info)) return TRUE; + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + sreloc = NULL; symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index bfd21ae..80765c7 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -6100,6 +6100,15 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (bfd_link_relocatable (info)) return TRUE; + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); sym_hashes_end = diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index d1d27f1..424a2d3 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -1301,6 +1301,15 @@ or1k_elf_check_relocs (bfd *abfd, if (bfd_link_relocatable (info)) return TRUE; + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 420931b..0ed0deb 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -5782,6 +5782,15 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (bfd_link_relocatable (info)) return TRUE; + /* Don't do anything special with non-loaded, non-alloced sections. + In particular, any relocs in such sections should not affect GOT + and PLT reference counting (ie. we don't allow them to create GOT + or PLT entries), there's no possibility or desire to optimize TLS + relocs, and there's not much point in propagating relocs to shared + libs that the dynamic linker won't relocate. */ + if ((sec->flags & SEC_ALLOC) == 0) + return TRUE; + BFD_ASSERT (is_sh_elf (abfd)); symtab_hdr = &elf_symtab_hdr (abfd); -- Alan Modra Australia Development Lab, IBM