From c51488569df7489374b5c6b2825f187186af5f8b Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Tue, 8 Mar 2011 12:38:41 +0100 Subject: [PATCH 2/2] Revert " PR gas/12519" This reverts commit 345bbf7731af2912390e72b86807eb1b2af3e27b. --- gas/ChangeLog | 5 ----- gas/config/obj-elf.c | 24 ++++++++++++++++++------ ld/testsuite/ChangeLog | 5 ----- ld/testsuite/ld-mn10300/i135409-3.s | 2 +- ld/testsuite/ld-sh/sh64/stolib.s | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index caa9b1e..78dc2d7 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,8 +1,3 @@ -2011-02-25 Alan Modra - - PR gas/12519 - * config/obj-elf.c (elf_frob_symbol): Properly handle size expression. - 2011-02-01 Alan Modra Backport from mainline diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 969a509..c6dc8d6 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -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, 2011 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1889,11 +1889,23 @@ elf_frob_symbol (symbolS *symp, int *puntp) if (sy_obj->size != NULL) { - 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")); + 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; + } free (sy_obj->size); sy_obj->size = NULL; } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 1b8f84e..56a7a11 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,8 +1,3 @@ -2011-02-25 Alan Modra - - * ld-mn10300/i135409-3.s: Correct .size label reference. - * ld-sh/sh64/stolib.s: Likewise. - 2011-02-10 Alan Modra * ld-gc/start.d: Exclude frv-*-linux*. diff --git a/ld/testsuite/ld-mn10300/i135409-3.s b/ld/testsuite/ld-mn10300/i135409-3.s index 8113b78..e83ad96 100644 --- a/ld/testsuite/ld-mn10300/i135409-3.s +++ b/ld/testsuite/ld-mn10300/i135409-3.s @@ -10,7 +10,7 @@ A: BOTTOM: .balign 0x8 add D0,D1 - .size _func, .-_func + .size _func, .-func .data L001: diff --git a/ld/testsuite/ld-sh/sh64/stolib.s b/ld/testsuite/ld-sh/sh64/stolib.s index a5dee2b..587faa6 100644 --- a/ld/testsuite/ld-sh/sh64/stolib.s +++ b/ld/testsuite/ld-sh/sh64/stolib.s @@ -4,4 +4,4 @@ bar: ptabs r18, tr0 blink tr0, r63 -.Lfe_bar: .size bar,.Lfe_bar-bar + .Lfe_bar: .size bar,.Lfe_bar-X -- 1.7.4.1