From d8273f3bf31a2982d64c8d4dd49bba59090f55d9 Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Thu, 11 Jan 2001 19:42:47 +0000 Subject: [PATCH] Fix weak symbols for 68HC11 as --- gas/ChangeLog | 6 ++++++ gas/config/tc-m68hc11.c | 27 +++++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 55c624d0a89..d9a5dd91164 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2001-01-11 Stephane Carrez + + * config/tc-m68hc11.c (md_estimate_size_before_relax):Don't + relax weak symbols. + (relaxable_symbol): New function. + 2001-01-11 Andreas Jaeger * config/tc-i386.h (TC_RELOC_GLOBAL_OFFSET_TABLE): Removed, it's diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 81311084c47..4bbaaac9c71 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -1,5 +1,5 @@ /* tc-m68hc11.c -- Assembler code for the Motorola 68HC11 & 68HC12. - Copyright (C) 1999, 2000 Free Software Foundation. + Copyright (C) 1999, 2000, 2001 Free Software Foundation. Written by Stephane Carrez (stcarrez@worldnet.fr) This file is part of GAS, the GNU Assembler. @@ -2527,6 +2527,16 @@ md_convert_frag (abfd, sec, fragP) } } +/* On an ELF system, we can't relax an externally visible symbol, + as well as a weak symbol. The weak symbol can be overriden + at final link time by a non weak symbol. */ +static int +relaxable_symbol (symbol) + symbolS* symbol; +{ + return ! S_IS_EXTERNAL (symbol) && ! S_IS_WEAK (symbol); +} + /* Force truly undefined symbols to their maximum size, and generally set up the frag list to be relaxed. */ int @@ -2549,7 +2559,8 @@ md_estimate_size_before_relax (fragP, segment) || IS_OPCODE (fragP->fr_opcode[0], M6812_BSR)); /* A relaxable case. */ - if (S_GET_SEGMENT (fragP->fr_symbol) == segment) + if (S_GET_SEGMENT (fragP->fr_symbol) == segment + && relaxable_symbol (fragP->fr_symbol)) { fragP->fr_subtype = ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE); } @@ -2575,7 +2586,8 @@ md_estimate_size_before_relax (fragP, segment) case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF): assert (current_architecture & cpu6811); - if (S_GET_SEGMENT (fragP->fr_symbol) == segment) + if (S_GET_SEGMENT (fragP->fr_symbol) == segment + && relaxable_symbol (fragP->fr_symbol)) { fragP->fr_subtype = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE); @@ -2600,7 +2612,8 @@ md_estimate_size_before_relax (fragP, segment) case ENCODE_RELAX (STATE_INDEXED_OFFSET, STATE_UNDF): assert (current_architecture & cpu6812); - if (S_GET_SEGMENT (fragP->fr_symbol) == segment) + if (S_GET_SEGMENT (fragP->fr_symbol) == segment + && relaxable_symbol (fragP->fr_symbol)) { fragP->fr_subtype = ENCODE_RELAX (STATE_INDEXED_OFFSET, STATE_BITS5); @@ -2622,7 +2635,8 @@ md_estimate_size_before_relax (fragP, segment) case ENCODE_RELAX (STATE_XBCC_BRANCH, STATE_UNDF): assert (current_architecture & cpu6812); - if (S_GET_SEGMENT (fragP->fr_symbol) == segment) + if (S_GET_SEGMENT (fragP->fr_symbol) == segment + && relaxable_symbol (fragP->fr_symbol)) { fragP->fr_subtype = ENCODE_RELAX (STATE_XBCC_BRANCH, STATE_BYTE); } @@ -2646,7 +2660,8 @@ md_estimate_size_before_relax (fragP, segment) case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH_6812, STATE_UNDF): assert (current_architecture & cpu6812); - if (S_GET_SEGMENT (fragP->fr_symbol) == segment) + if (S_GET_SEGMENT (fragP->fr_symbol) == segment + && relaxable_symbol (fragP->fr_symbol)) { fragP->fr_subtype = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH_6812, STATE_BYTE); -- 2.30.2