From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19085 invoked by alias); 14 Nov 2008 23:21:43 -0000 Received: (qmail 19006 invoked by uid 22791); 14 Nov 2008 23:21:42 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 14 Nov 2008 23:21:07 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mAENL5cU024492 for ; Fri, 14 Nov 2008 18:21:05 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mAENL5LP001874 for ; Fri, 14 Nov 2008 18:21:05 -0500 Received: from mesquite.lan (vpn-12-57.rdu.redhat.com [10.11.12.57]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mAENL46T016052 for ; Fri, 14 Nov 2008 18:21:04 -0500 Date: Sat, 15 Nov 2008 18:46:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [RFC] Make solib-frv.c work in a non-FDPIC environment Message-ID: <20081114162103.05241f81@mesquite.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-11/txt/msg00381.txt.bz2 This patch allows solib-frv.c to be used in a non-FDPIC environment. Such an environment is found when testing a FDPIC multilib using the FRV simulator. In such an environment, both the interpreter and loadmap addresses will be zero. Comments? * solib-frv.c (fetch_loadmap): Return early when no segments are found. (frv_relocate_main_executable): Return early when both interpreter and executable loadmap addresses are zero. Index: solib-frv.c =================================================================== RCS file: /cvs/src/src/gdb/solib-frv.c,v retrieving revision 1.22 diff -u -p -r1.22 solib-frv.c --- solib-frv.c 26 Aug 2008 17:30:35 -0000 1.22 +++ solib-frv.c 14 Nov 2008 22:40:25 -0000 @@ -124,6 +124,9 @@ fetch_loadmap (CORE_ADDR ldmaddr) nsegs = extract_unsigned_integer (ext_ldmbuf_partial.nsegs, sizeof ext_ldmbuf_partial.nsegs); + if (nsegs < 0) + return NULL; + /* Allocate space for the complete (external) loadmap. */ ext_ldmbuf_size = sizeof (struct ext_elf32_fdpic_loadmap) + (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg); @@ -860,16 +863,17 @@ static void frv_relocate_main_executable (void) { int status; - CORE_ADDR exec_addr; + CORE_ADDR exec_addr, interp_addr; struct int_elf32_fdpic_loadmap *ldm; struct cleanup *old_chain; struct section_offsets *new_offsets; int changed; struct obj_section *osect; - status = frv_fdpic_loadmap_addresses (target_gdbarch, 0, &exec_addr); + status = frv_fdpic_loadmap_addresses (target_gdbarch, + &interp_addr, &exec_addr); - if (status < 0) + if (status < 0 || (exec_addr == 0 && interp_addr == 0)) { /* Not using FDPIC ABI, so do nothing. */ return;