From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28524 invoked by alias); 13 Nov 2004 12:02:07 -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 28138 invoked from network); 13 Nov 2004 12:02:01 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 13 Nov 2004 12:02:01 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iADC21fk006480 for ; Sat, 13 Nov 2004 07:02:01 -0500 Received: from localhost (mail@vpn50-32.rdu.redhat.com [172.16.50.32]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iADC20r32539 for ; Sat, 13 Nov 2004 07:02:00 -0500 Received: from rsandifo by localhost with local (Exim 3.35 #1) id 1CSwbP-0001Qw-00 for binutils@sources.redhat.com; Sat, 13 Nov 2004 12:01:59 +0000 To: binutils@sources.redhat.com Subject: RFA: Small fix to elf-eh-frame.c for MIPS ELF64 From: Richard Sandiford Date: Sat, 13 Nov 2004 12:02:00 -0000 Message-ID: <877joqkle1.fsf@redhat.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-11/txt/msg00208.txt.bz2 _bfd_elf_discard_section_eh_frame has the following code to handle the personality data: ENSURE_NO_RELOCS (buf); /* Ensure we have a reloc here, against a global symbol. */ if (GET_RELOC (buf) != NULL) { ... cookie->rel++; } This causes problems on MIPS because ELF64 composite relocations are represented as a sequence of normal relocations against the same address. There might be more than one relocation to skip here. One fix would be to replace: cookie->rel++; with: SKIP_RELOCS (buf + 1); This is safe because of the ENSURE_NO_RELOCS() line quoted above, and I'd be happy to write it like that if preferred. I thought the attached patch was slightly more readable and self-contained though. The testcase is in the main patch that I'm about to post (which also mentions the testing procedure). I've split this bit out because it wasn't really related to the rest. OK to install? Richard bfd/ * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Deal with composite relocations against the personality data. --- bfd/elf-eh-frame.c.orig Fri Oct 8 13:40:53 2004 +++ bfd/elf-eh-frame.c Sat Nov 13 09:41:56 2004 @@ -499,7 +499,10 @@ _bfd_elf_discard_section_eh_frame cie.personality = h; } - cookie->rel++; + /* Cope with MIPS-style composite relocations. */ + do + cookie->rel++; + while (GET_RELOC (buf) != NULL); } buf += per_width; }