From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3837 invoked by alias); 25 Mar 2005 16:00:50 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 3815 invoked from network); 25 Mar 2005 16:00:46 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 25 Mar 2005 16:00:46 -0000 Received: from drow by nevyn.them.org with local (Exim 4.50 #1 (Debian)) id 1DErFR-0004DW-Mg for ; Fri, 25 Mar 2005 11:01:21 -0500 Date: Sat, 26 Mar 2005 00:35:00 -0000 From: Daniel Jacobowitz To: binutils@sources.redhat.com Subject: ARM: Fix DT_TEXTREL generation Message-ID: <20050325160121.GA16066@nevyn.them.org> Mail-Followup-To: binutils@sources.redhat.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6+20040907i X-SW-Source: 2005-03/txt/msg00779.txt.bz2 I posted this patch a couple days ago, but at the bottom of a thread ... tsk tsk. This patch prevents the incorrect generation of a DT_TEXTREL tag in ARM shared libraries. The problem was that p->count was correctly updated, but we would sometimes create new relocs_copied entries with a zero count; and when checking for text relocations, we don't look at the count, just whether the pointer is non-NULL. The cleanest fix is to avoid creating a new relocs_copied structure if we aren't going to increment it. OK for HEAD? Any objection to fixing this on 2.16 also? -- Daniel Jacobowitz CodeSourcery, LLC 2005-03-18 Daniel Jacobowitz * elf32-arm.c (elf32_arm_check_relocs): Increment count for all relocation types. Don't count relocations which will use a PLT. Index: binutils/bfd/elf32-arm.c =================================================================== --- binutils.orig/bfd/elf32-arm.c 2005-03-18 13:20:03.152084693 -0500 +++ binutils/bfd/elf32-arm.c 2005-03-18 17:00:25.694851664 -0500 @@ -4093,18 +4093,9 @@ elf32_arm_check_relocs (bfd *abfd, struc relocs_copied field of the hash table entry. */ if ((info->shared || htab->root.is_relocatable_executable) && (sec->flags & SEC_ALLOC) != 0 - && ((r_type != R_ARM_PC24 - && r_type != R_ARM_PLT32 -#ifndef OLD_ARM_ABI - && r_type != R_ARM_CALL - && r_type != R_ARM_JUMP24 - && r_type != R_ARM_PREL31 -#endif - && r_type != R_ARM_REL32 - && r_type != R_ARM_THM_PC22) - || (h != NULL - && (! info->symbolic - || !h->def_regular)))) + && (r_type == R_ARM_ABS32 + || (h != NULL && ! h->needs_plt + && (! info->symbolic || ! h->def_regular)))) { struct elf32_arm_relocs_copied *p, **head; @@ -4184,9 +4175,7 @@ elf32_arm_check_relocs (bfd *abfd, struc p->count = 0; } - if (r_type == R_ARM_ABS32 - || r_type == R_ARM_REL32) - p->count += 1; + p->count += 1; } break;