From: Ian Lance Taylor Date: Sat, 12 Jun 1999 21:24:56 +0000 (+0000) Subject: This fixes ! to work as documented in a memory region attribute list. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aa8804e46ee31cc1d2e00f57467c8e5a4a84a273;p=binutils-gdb.git This fixes ! to work as documented in a memory region attribute list. From Thomas Zenker : * ldgram.y (attributes_opt): Use attributes_list instead of NAME. (attributes_list, attributes_string): New nonterminals. * ldlang.c (lang_set_flags): Add invert parameter. Don't handle '!'. * ldlang.c (lang_set_flags): Update declaration. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 060b9abceb8..cbc6f9b2aa4 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +1999-06-13 Ian Lance Taylor + + From Thomas Zenker : + * ldgram.y (attributes_opt): Use attributes_list instead of NAME. + (attributes_list, attributes_string): New nonterminals. + * ldlang.c (lang_set_flags): Add invert parameter. Don't handle + '!'. + * ldlang.c (lang_set_flags): Update declaration. + 1999-06-12 Ian Lance Taylor * emultempl/pe.em (gld_${EMULATION_NAME}_after_parse): Don't add diff --git a/ld/ldgram.y b/ld/ldgram.y index a1f3ed60c22..002b9fbe1f5 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -1,5 +1,5 @@ /* A YACC grammer to parse a superset of the AT&T linker scripting languaue. - Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com). @@ -132,7 +132,7 @@ static int error_index; %token ORIGIN FILL %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS %token ALIGNMOD AT PROVIDE -%type assign_op atype +%type assign_op atype attributes_opt %type filename %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K %token FORMAT PUBLIC DEFSYMEND BASE ALIAS TRUNCATE REL @@ -610,15 +610,24 @@ length_spec: "length", lang_first_phase_enum); } - + ; attributes_opt: - '(' NAME ')' - { - lang_set_flags(region, $2); - } - | - + /* empty */ + { /* dummy action to avoid bison 1.25 error message */ } + | '(' attributes_list ')' + ; + +attributes_list: + attributes_string + | attributes_list attributes_string + ; + +attributes_string: + NAME + { lang_set_flags (region, $1, 0); } + | '!' NAME + { lang_set_flags (region, $2, 1); } ; startup: diff --git a/ld/ldlang.c b/ld/ldlang.c index a2c533d7a81..862e4e2dbbf 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3255,21 +3255,18 @@ lang_place_orphans () void -lang_set_flags (ptr, flags) +lang_set_flags (ptr, flags, invert) lang_memory_region_type *ptr; CONST char *flags; + int invert; { - flagword *ptr_flags = &ptr->flags; + flagword *ptr_flags; - ptr->flags = ptr->not_flags = 0; + ptr_flags = invert ? &ptr->not_flags : &ptr->flags; while (*flags) { switch (*flags) { - case '!': - ptr_flags = (ptr_flags == &ptr->flags) ? &ptr->not_flags : &ptr->flags; - break; - case 'A': case 'a': *ptr_flags |= SEC_ALLOC; break; diff --git a/ld/ldlang.h b/ld/ldlang.h index 7bd79720228..8c63938e651 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -1,5 +1,6 @@ /* ldlang.h - linker command language support - Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. + Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999 + Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -383,7 +384,8 @@ extern struct memory_region_struct *lang_memory_region_lookup extern struct memory_region_struct *lang_memory_region_default PARAMS ((asection *)); extern void lang_map PARAMS ((void)); -extern void lang_set_flags PARAMS ((lang_memory_region_type *, const char *)); +extern void lang_set_flags PARAMS ((lang_memory_region_type *, const char *, + int)); extern void lang_add_output PARAMS ((const char *, int from_script)); extern void lang_enter_output_section_statement PARAMS ((const char *output_section_statement_name,