From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91748 invoked by alias); 31 Mar 2016 11:13:19 -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 91717 invoked by uid 89); 31 Mar 2016 11:13:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,NO_RDNS_DOTCOM_HELO,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3879, H*Ad:D*ieee.org, HContent-transfer-encoding:7bit, relationship X-HELO: vms173015pub.verizon.net Received: from vms173015pub.verizon.net (HELO vms173015pub.verizon.net) (206.46.173.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 31 Mar 2016 11:13:08 +0000 Received: from vz-proxy-l007.mx.aol.com ([64.236.82.151]) by vms173015.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0O4W00BE4HTCI640@vms173015.mailsrvcs.net> for binutils@sourceware.org; Thu, 31 Mar 2016 06:12:48 -0500 (CDT) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=WcjxEBVX c=1 sm=1 tr=0 a=eaPqxu9IKnv3tbb7QsXVMw==:117 a=8nJEP1OIZ-IA:10 a=7OsogOcEt9IA:10 a=9kz5Voqow1WJQDjnbcoA:9 a=ySPX8f_U66kOz_ta:21 a=MDVjtfvn9xCUrWVk:21 a=wPNLvfGTeEIA:10 Received: by 72.73.38.181 with SMTP id 314bd4f4; Thu, 31 Mar 2016 11:12:48 GMT Message-id: <1459422766.9097.169.camel@jericho> Subject: Re: Missing TO_ADDR From: Dan Reply-to: dgisselq@ieee.org To: Alan Modra Cc: dgisselq@ieee.org, binutils@sourceware.org Date: Thu, 31 Mar 2016 11:13:00 -0000 In-reply-to: <20160331073959.GT15812@bubble.grove.modra.org> References: <20160330073151.GK15812@bubble.grove.modra.org> <1459339484.9097.134.camel@jericho> <20160331073959.GT15812@bubble.grove.modra.org> Content-type: text/plain; charset=ISO-8859-1 MIME-version: 1.0 Content-transfer-encoding: 7bit X-SW-Source: 2016-03/txt/msg00453.txt.bz2 Are you sure you want to take the TO_SIZE directives *away* from the minfo statements? With the TO_SIZE directives, the addresses add up: last address plus size adds up to the next address, and you can see nothing missing. Without the TO_SIZE directives, the units don't match. Dan On Thu, 2016-03-31 at 18:09 +1030, Alan Modra wrote: > On Wed, Mar 30, 2016 at 08:04:44AM -0400, Dan wrote: > > Don't forget the "minfo ("0x%V %W", section->vma ..." line that needs > > its "section->size" parameter changed to TO_ADDR(section->size), or the > > "lma = last->lma+last->size" that needs to be changed to "lma = > > last->lma + TO_ADDR(last->size);". At least according to my last git > > pull, those changes still needed to be made as well. > > Yes, there are other places missing TO_ADDR, and one of the minfo > lines wrongly invokes TO_ADDR. Thanks for the prod. > > * ldlang.c (TO_ADDR, TO_SIZE, opb_shift): Move earlier in file. > (lang_insert_orphan): Use TO_ADDR in __stop sym calculation. > (print_input_section): Don't use TO_ADDR when printing section > size. > (lang_size_sections_1): Use TO_ADDR in overlay lma calculation. > (lang_size_sections): Use TO_ADDR in relro end calculation. > > diff --git a/ld/ldlang.c b/ld/ldlang.c > index cb6aab6..9fca810 100644 > --- a/ld/ldlang.c > +++ b/ld/ldlang.c > @@ -49,7 +49,13 @@ > #define offsetof(TYPE, MEMBER) ((size_t) & (((TYPE*) 0)->MEMBER)) > #endif > > -/* Locals variables. */ > +/* Convert between addresses in bytes and sizes in octets. > + For currently supported targets, octets_per_byte is always a power > + of two, so we can use shifts. */ > +#define TO_ADDR(X) ((X) >> opb_shift) > +#define TO_SIZE(X) ((X) << opb_shift) > + > +/* Local variables. */ > static struct obstack stat_obstack; > static struct obstack map_obstack; > > @@ -68,6 +74,7 @@ static lang_statement_list_type *stat_save[10]; > static lang_statement_list_type **stat_save_ptr = &stat_save[0]; > static struct unique_sections *unique_section_list; > static struct asneeded_minfo *asneeded_list_head; > +static unsigned int opb_shift = 0; > static bfd_boolean maybe_overlays = FALSE; > > /* Forward declarations. */ > @@ -1887,7 +1894,7 @@ lang_insert_orphan (asection *s, > before sizing dynamic sections. */ > dot = os->bfd_section->vma; > exp_fold_tree (start_assign->exp, os->bfd_section, &dot); > - dot += s->size; > + dot += TO_ADDR (s->size); > exp_fold_tree (stop_assign->exp, os->bfd_section, &dot); > } > > @@ -3209,15 +3216,6 @@ ldlang_open_output (lang_statement_union_type *statement) > } > } > > -/* Convert between addresses in bytes and sizes in octets. > - For currently supported targets, octets_per_byte is always a power > - of two, so we can use shifts. */ > -#define TO_ADDR(X) ((X) >> opb_shift) > -#define TO_SIZE(X) ((X) << opb_shift) > - > -/* Support the above. */ > -static unsigned int opb_shift = 0; > - > static void > init_opb (void) > { > @@ -4225,7 +4223,7 @@ print_input_section (asection *i, bfd_boolean is_discarded) > size = 0; > } > > - minfo ("0x%V %W %B\n", addr, TO_ADDR (size), i->owner); > + minfo ("0x%V %W %B\n", addr, size, i->owner); > > if (size != i->rawsize && i->rawsize != 0) > { > @@ -5132,7 +5130,7 @@ lang_size_sections_1 > /* If this is an overlay, set the current lma to that > at the end of the previous section. */ > if (os->sectype == overlay_section) > - lma = last->lma + last->size; > + lma = last->lma + TO_ADDR (last->size); > > /* Otherwise, keep the same lma to vma relationship > as the previous section. */ > @@ -5524,7 +5522,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions) > > end = start = sec->vma; > if (!IS_TBSS (sec)) > - end += sec->size; > + end += TO_ADDR (sec->size); > bump = desired_end - end; > /* We'd like to increase START by BUMP, but we must heed > alignment so the increase might be less than optimum. */ >