From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8261 invoked by alias); 2 Jan 2013 19:11:07 -0000 Received: (qmail 8252 invoked by uid 22791); 2 Jan 2013 19:11:06 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Jan 2013 19:10:59 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r02JAxA3009048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Jan 2013 14:10:59 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r02JAvbr009663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 2 Jan 2013 14:10:58 -0500 From: Tom Tromey To: Binutils Development Subject: section indices for special sections Date: Wed, 02 Jan 2013 19:11:00 -0000 Message-ID: <87txqzwgce.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain 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 X-SW-Source: 2013-01/txt/msg00010.txt.bz2 I was hoping to use the BFD section index in gdb to identify a section, to remove some redundant information from symbols and also shrink their size. However, I discovered that the various special sections like *ABS* are global, not per-BFD, and their 'index' fields are not useful. I wonder what you think of the appended patch. It gives negative indices to these special sections. If it seems ok I would either have gdb look at the size of the std_section array, or introduce a new define so gdb can know how many special sections to expect. I regression tested this against ld, gas, and binutils, but not gdb. I suspect it may have issues there, so I would only want to apply it after finishing my gdb patch series and testing this. Tom * section.c (BFD_FAKE_SECTION): Set 'index' field. * bfd-in2.h: Rebuild. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index ceacf8f..a5ff702 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1693,7 +1693,7 @@ extern asection _bfd_std_section[4]; #define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ /* name, id, index, next, prev, flags, user_set_vma, */ \ - { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ + { NAME, IDX, - IDX - 1, NULL, NULL, FLAGS, 0, \ \ /* linker_mark, linker_has_input, gc_mark, decompress_status, */ \ 0, 0, 1, 0, \ diff --git a/bfd/section.c b/bfd/section.c index a59bc71..6a417d1 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -663,7 +663,7 @@ CODE_FRAGMENT . .#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ . {* name, id, index, next, prev, flags, user_set_vma, *} \ -. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ +. { NAME, IDX, - IDX - 1, NULL, NULL, FLAGS, 0, \ . \ . {* linker_mark, linker_has_input, gc_mark, decompress_status, *} \ . 0, 0, 1, 0, \ -- 1.7.7.6