From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23262 invoked by alias); 25 Feb 2011 13:40:45 -0000 Received: (qmail 23247 invoked by uid 22791); 25 Feb 2011 13:40:43 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pw0-f41.google.com (HELO mail-pw0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Feb 2011 13:40:37 +0000 Received: by pwi10 with SMTP id 10so508681pwi.0 for ; Fri, 25 Feb 2011 05:40:35 -0800 (PST) Received: by 10.142.187.2 with SMTP id k2mr1690169wff.97.1298641235441; Fri, 25 Feb 2011 05:40:35 -0800 (PST) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id w19sm990492wfd.8.2011.02.25.05.40.32 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Feb 2011 05:40:33 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id D7AA516DE62C; Sat, 26 Feb 2011 00:10:26 +1030 (CST) Date: Fri, 25 Feb 2011 13:40:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: PR12519 ELF .size expressions Message-ID: <20110225134026.GC5959@bubble.grove.modra.org> Mail-Followup-To: binutils@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes 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: 2011-02/txt/msg00311.txt.bz2 Fixes code handling ELF .size expressions that can't be evaluated immediately for some reasone, for example if the .size directive was given at the beginning of the function referencing a label at the end of the function. Also corrects a couple of errors in the testsuite that the old .size code wrongly accepted. gas/ PR gas/12519 * config/obj-elf.c (elf_frob_symbol): Properly handle size expression. ld/testsuite/ * ld-mn10300/i135409-3.s: Correct .size label reference. * ld-sh/sh64/stolib.s: Likewise. Index: gas/config/obj-elf.c =================================================================== RCS file: /cvs/src/src/gas/config/obj-elf.c,v retrieving revision 1.136 diff -u -p -r1.136 obj-elf.c --- gas/config/obj-elf.c 18 Nov 2010 16:00:25 -0000 1.136 +++ gas/config/obj-elf.c 25 Feb 2011 13:27:51 -0000 @@ -1,6 +1,6 @@ /* ELF object file format Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1889,23 +1889,11 @@ elf_frob_symbol (symbolS *symp, int *pun if (sy_obj->size != NULL) { - switch (sy_obj->size->X_op) - { - case O_subtract: - S_SET_SIZE (symp, - (S_GET_VALUE (sy_obj->size->X_add_symbol) - + sy_obj->size->X_add_number - - S_GET_VALUE (sy_obj->size->X_op_symbol))); - break; - case O_constant: - S_SET_SIZE (symp, - (S_GET_VALUE (sy_obj->size->X_add_symbol) - + sy_obj->size->X_add_number)); - break; - default: - as_bad (_(".size expression too complicated to fix up")); - break; - } + if (resolve_expression (sy_obj->size) + && sy_obj->size->X_op == O_constant) + S_SET_SIZE (symp, sy_obj->size->X_add_number); + else + as_bad (_(".size expression does not evaluate to a constant")); free (sy_obj->size); sy_obj->size = NULL; } Index: ld/testsuite/ld-mn10300/i135409-3.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-mn10300/i135409-3.s,v retrieving revision 1.1 diff -u -p -r1.1 i135409-3.s --- ld/testsuite/ld-mn10300/i135409-3.s 13 Nov 2007 10:40:27 -0000 1.1 +++ ld/testsuite/ld-mn10300/i135409-3.s 25 Feb 2011 13:27:51 -0000 @@ -10,7 +10,7 @@ A: BOTTOM: .balign 0x8 add D0,D1 - .size _func, .-func + .size _func, .-_func .data L001: Index: ld/testsuite/ld-sh/sh64/stolib.s =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-sh/sh64/stolib.s,v retrieving revision 1.1 diff -u -p -r1.1 stolib.s --- ld/testsuite/ld-sh/sh64/stolib.s 15 Oct 2003 06:23:55 -0000 1.1 +++ ld/testsuite/ld-sh/sh64/stolib.s 25 Feb 2011 13:27:51 -0000 @@ -4,4 +4,4 @@ bar: ptabs r18, tr0 blink tr0, r63 - .Lfe_bar: .size bar,.Lfe_bar-X +.Lfe_bar: .size bar,.Lfe_bar-bar -- Alan Modra Australia Development Lab, IBM