From ae2a2f6cc2e2eb1c8221837814f3a4251de2af13 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 8 Jul 1998 18:06:49 +0000 Subject: [PATCH] * ldgram.y: Change MAX to MAX_K and MIN to MIN_K, to avoid conflicts with system header files. Change all uses. --- ld/ChangeLog | 3 +++ ld/ldexp.c | 72 +++++++++++++++++++++++++++++++++++++++--------------------- ld/ldgram.y | 10 ++++----- ld/ldlang.c | 2 +- ld/ldlex.l | 4 ++-- 5 files changed, 58 insertions(+), 33 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index dea7752..72d785a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,8 @@ Wed Jul 8 14:03:12 1998 Ian Lance Taylor + * ldgram.y: Change MAX to MAX_K and MIN to MIN_K, to avoid + conflicts with system header files. Change all uses. + * Makefile.am (MAINTAINERCLEANFILES): Define. * Makefile.in: Rebuild. diff --git a/ld/ldexp.c b/ld/ldexp.c index 0581517..59ceb1e 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -1,5 +1,5 @@ /* This module handles expression trees. -Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. +Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (sac@cygnus.com). This file is part of GLD, the Gnu Linker. @@ -15,8 +15,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GLD; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ /* This module is in charge of working out the contents of expressions. @@ -106,6 +107,7 @@ exp_print_token (code) { SEARCH_DIR,"SEARCH_DIR" }, { MAP,"MAP" }, { QUAD,"QUAD" }, + { SQUAD,"SQUAD" }, { LONG,"LONG" }, { SHORT,"SHORT" }, { BYTE,"BYTE" }, @@ -151,9 +153,9 @@ check (os, name, op) const char *op; { if (os == NULL) - einfo ("%F%P: %s uses undefined section %s\n", op, name); + einfo (_("%F%P: %s uses undefined section %s\n"), op, name); if (! os->processed) - einfo ("%F%P: %s forward reference of section %s\n", op, name); + einfo (_("%F%P: %s forward reference of section %s\n"), op, name); } etree_type * @@ -265,14 +267,14 @@ fold_binary (tree, current_section, allocation_done, dot, dotp) { case '%': if (other.value == 0) - einfo ("%F%S %% by zero\n"); + einfo (_("%F%S %% by zero\n")); result.value = ((bfd_signed_vma) result.value % (bfd_signed_vma) other.value); break; case '/': if (other.value == 0) - einfo ("%F%S / by zero\n"); + einfo (_("%F%S / by zero\n")); result.value = ((bfd_signed_vma) result.value / (bfd_signed_vma) other.value); break; @@ -295,6 +297,16 @@ fold_binary (tree, current_section, allocation_done, dot, dotp) BOP(ANDAND,&&); BOP(OROR,||); + case MAX_K: + if (result.value < other.value) + result = other; + break; + + case MIN_K: + if (result.value > other.value) + result = other; + break; + default: FAIL(); } @@ -381,20 +393,30 @@ fold_name (tree, current_section, allocation_done, dot) else if (allocation_done == lang_final_phase_enum || allocation_done == lang_allocating_phase_enum) { - lang_output_section_statement_type *os; - - os = (lang_output_section_statement_lookup - (h->u.def.section->output_section->name)); - - /* FIXME: Is this correct if this section is being - linked with -R? */ - result = new_rel ((h->u.def.value - + h->u.def.section->output_offset), - os); + asection *output_section; + + output_section = h->u.def.section->output_section; + if (output_section == NULL) + einfo (_("%X%S: unresolvable symbol `%s' referenced in expression\n"), + tree->name.name); + else + { + lang_output_section_statement_type *os; + + os = (lang_output_section_statement_lookup + (bfd_get_section_name (output_bfd, + output_section))); + + /* FIXME: Is this correct if this section is + being linked with -R? */ + result = new_rel ((h->u.def.value + + h->u.def.section->output_offset), + os); + } } } else if (allocation_done == lang_final_phase_enum) - einfo ("%F%S: undefined symbol `%s' referenced in expression\n", + einfo (_("%F%S: undefined symbol `%s' referenced in expression\n"), tree->name.name); } break; @@ -563,7 +585,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) { /* Assignment to dot can only be done during allocation */ if (tree->type.node_class == etree_provide) - einfo ("%F%S can not PROVIDE assignment to location counter\n"); + einfo (_("%F%S can not PROVIDE assignment to location counter\n")); if (allocation_done == lang_allocating_phase_enum || (allocation_done == lang_final_phase_enum && current_section == abs_output_section)) @@ -573,11 +595,11 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) lang_allocating_phase_enum, dot, dotp); if (! result.valid) - einfo ("%F%S invalid assignment to location counter\n"); + einfo (_("%F%S invalid assignment to location counter\n")); else { if (current_section == NULL) - einfo ("%F%S assignment to location counter invalid outside of SECTION\n"); + einfo (_("%F%S assignment to location counter invalid outside of SECTION\n")); else { bfd_vma nextdot; @@ -587,7 +609,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) if (nextdot < dot && current_section != abs_output_section) { - einfo ("%F%S cannot move location counter backwards (from %V to %V)\n", + einfo (_("%F%S cannot move location counter backwards (from %V to %V)\n"), dot, nextdot); } else @@ -615,7 +637,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) if (h == (struct bfd_link_hash_entry *) NULL) { if (tree->type.node_class == etree_assign) - einfo ("%P%F:%s: hash creation failed\n", + einfo (_("%P%F:%s: hash creation failed\n"), tree->assign.dst); } else if (tree->type.node_class == etree_provide @@ -889,7 +911,7 @@ exp_get_vma (tree, def, name, allocation_done) { r = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done); if (! r.valid && name != NULL) - einfo ("%F%S nonconstant expression for %s\n", name); + einfo (_("%F%S nonconstant expression for %s\n"), name); return r.value; } else @@ -922,7 +944,7 @@ exp_get_abs_int (tree, def, name, allocation_done) res.value += res.section->bfd_section->vma; } else { - einfo ("%F%S non constant expression for %s\n",name); + einfo (_("%F%S non constant expression for %s\n"),name); } return res.value; } diff --git a/ld/ldgram.y b/ld/ldgram.y index 68ff0a2..28fe573 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -125,7 +125,7 @@ static int error_index; %token NOLOAD DSECT COPY INFO OVERLAY %token NAME LNAME DEFINED TARGET_K SEARCH_DIR MAP ENTRY %token NEXT -%token SIZEOF ADDR LOADADDR MAX MIN +%token SIZEOF ADDR LOADADDR MAX_K MIN_K %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS %token ORIGIN FILL %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS @@ -735,10 +735,10 @@ exp : { $$ = exp_unop(ALIGN_K,$3); } | NAME { $$ = exp_nameop(NAME,$1); } - | MAX '(' exp ',' exp ')' - { $$ = exp_binop (MAX, $3, $5 ); } - | MIN '(' exp ',' exp ')' - { $$ = exp_binop (MIN, $3, $5 ); } + | MAX_K '(' exp ',' exp ')' + { $$ = exp_binop (MAX_K, $3, $5 ); } + | MIN_K '(' exp ',' exp ')' + { $$ = exp_binop (MIN_K, $3, $5 ); } ; diff --git a/ld/ldlang.c b/ld/ldlang.c index 71e16cc..2106b3e 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -4242,7 +4242,7 @@ lang_enter_overlay_section (name) if (overlay_max == NULL) overlay_max = size; else - overlay_max = exp_binop (MAX, overlay_max, size); + overlay_max = exp_binop (MAX_K, overlay_max, size); } /* Finish a section in an overlay. There isn't any special to do diff --git a/ld/ldlex.l b/ld/ldlex.l index 09c89ad..113db13 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -239,8 +239,8 @@ V_IDENTIFIER [*?.$_a-zA-Z][*?_a-zA-Z0-9]* "ALIGN" { RTOKEN(ALIGN_K);} "ADDR" { RTOKEN(ADDR);} "LOADADDR" { RTOKEN(LOADADDR);} -"MAX" { RTOKEN(MAX); } -"MIN" { RTOKEN(MIN); } +"MAX" { RTOKEN(MAX_K); } +"MIN" { RTOKEN(MIN_K); } "ENTRY" { RTOKEN(ENTRY);} "EXTERN" { RTOKEN(EXTERN);} "NEXT" { RTOKEN(NEXT);} -- 2.7.4