X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=ld%2Fmri.c;h=e5c379c8b6091331688362d5430da8e5920d01bf;hb=75c6c844d9df37761e0e834df057b89e41816e55;hp=f7edd8817ffe713af0b74089d77a7f9666473008;hpb=e5caa5e0caf09b4927fbe0520056c5eac9056fe5;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/mri.c b/ld/mri.c index f7edd8817f..e5c379c8b6 100644 --- a/ld/mri.c +++ b/ld/mri.c @@ -1,31 +1,32 @@ /* mri.c -- handle MRI style linker scripts - Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2002, - 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. + Contributed by Steve Chamberlain . -This file is part of GLD, the Gnu Linker. + This file is part of the GNU Binutils. -GLD is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. -GLD is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + 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. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ - This bit does the tree decoration when MRI style link scripts - are parsed. - Contributed by Steve Chamberlain . */ +/* This bit does the tree decoration when MRI style link scripts + are parsed. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" +#include "bfdlink.h" +#include "ctf-api.h" #include "ld.h" #include "ldexp.h" #include "ldlang.h" @@ -44,14 +45,16 @@ struct section_name_struct { int ok_to_load; }; -unsigned int symbol_truncate = 10000; -struct section_name_struct *order; -struct section_name_struct *only_load; -struct section_name_struct *address; -struct section_name_struct *alias; +static unsigned int symbol_truncate = 10000; +static etree_type *base; /* Relocation base - or null */ -struct section_name_struct *alignment; -struct section_name_struct *subalignment; +static struct section_name_struct *order; +static struct section_name_struct *only_load; +static struct section_name_struct *address; +static struct section_name_struct *alias; + +static struct section_name_struct *alignment; +static struct section_name_struct *subalignment; static struct section_name_struct ** lookup (const char *name, struct section_name_struct **list) @@ -68,7 +71,8 @@ lookup (const char *name, struct section_name_struct **list) ptr = &((*ptr)->next); } - *ptr = xmalloc (sizeof (struct section_name_struct)); + *ptr = (struct section_name_struct *) + xmalloc (sizeof (struct section_name_struct)); return ptr; } @@ -120,19 +124,6 @@ mri_draw_tree (void) if (done_tree) return; -#if 0 /* We don't bother with memory regions. */ - /* Create the regions. */ - { - lang_memory_region_type *r; - - r = lang_memory_region_lookup("long"); - r->current = r->origin = exp_get_vma (base, (bfd_vma)0, "origin", - lang_first_phase_enum); - r->length = (bfd_size_type) exp_get_vma (0, ~(bfd_vma) 0, "length", - lang_first_phase_enum); - } -#endif - /* Now build the statements for the ldlang machine. */ /* Attach the addresses of any which have addresses, @@ -219,25 +210,27 @@ mri_draw_tree (void) base = p->vma ? p->vma : exp_nameop (NAME, "."); lang_enter_output_section_statement (p->name, base, - p->ok_to_load ? 0 : noload_section, - align, subalign, NULL); + p->ok_to_load ? normal_section : noload_section, + align, subalign, NULL, 0, 0); base = 0; - tmp = xmalloc (sizeof *tmp); + tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); tmp->next = NULL; tmp->spec.name = p->name; tmp->spec.exclude_name_list = NULL; - tmp->spec.sorted = FALSE; + tmp->spec.sorted = none; + tmp->spec.section_flag_list = NULL; lang_add_wild (NULL, tmp, FALSE); /* If there is an alias for this section, add it too. */ for (aptr = alias; aptr; aptr = aptr->next) if (strcmp (aptr->alias, p->name) == 0) { - tmp = xmalloc (sizeof *tmp); + tmp = (struct wildcard_list *) xmalloc (sizeof *tmp); tmp->next = NULL; tmp->spec.name = aptr->name; tmp->spec.exclude_name_list = NULL; - tmp->spec.sorted = FALSE; + tmp->spec.sorted = none; + tmp->spec.section_flag_list = NULL; lang_add_wild (NULL, tmp, FALSE); } @@ -255,9 +248,6 @@ mri_load (const char *name) { base = 0; lang_add_input_file (name, lang_input_file_is_file_enum, NULL); -#if 0 - lang_leave_output_section_statement (0, "*default*"); -#endif } void @@ -297,20 +287,14 @@ mri_format (const char *name) if (strcmp (name, "S") == 0) lang_add_output_format ("srec", NULL, NULL, 1); - else if (strcmp (name, "IEEE") == 0) - lang_add_output_format ("ieee", NULL, NULL, 1); - - else if (strcmp (name, "COFF") == 0) - lang_add_output_format ("coff-m68k", NULL, NULL, 1); - else - einfo (_("%P%F: unknown format type %s\n"), name); + einfo (_("%F%P: unknown format type %s\n"), name); } void mri_public (const char *name, etree_type *exp) { - lang_add_assignment (exp_assop ('=', name, exp)); + lang_add_assignment (exp_assign (name, exp, FALSE)); } void