* ldlang.c (map_input_to_output_sections): Initialize sections

mentioned in a data statement expression.
	(lang_do_assignments_1): Add data statement's expression's
	section's vma.
	* ld-scripts/data.{s,t,d,exp}: New.
This commit is contained in:
Nathan Sidwell 2004-02-19 14:08:31 +00:00
parent a8a6d7cef4
commit 384d938fc8
7 changed files with 58 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2004-02-19 Nathan Sidwell <nathan@codesourcery.com>
* ldlang.c (map_input_to_output_sections): Initialize sections
mentioned in a data statement expression.
(lang_do_assignments_1): Add data statement's expression's
section's vma.
2004-02-18 Nathan Sidwell <nathan@codesourcery.com>
* ldgram.y (statement_anywhere): Add assert rule.

View File

@ -2098,10 +2098,14 @@ map_input_to_output_sections
target,
output_section_statement);
break;
case lang_data_statement_enum:
/* Make sure that any sections mentioned in the expression
are initialized. */
exp_init_os (s->data_statement.exp);
/* FALLTHROUGH */
case lang_fill_statement_enum:
case lang_input_section_enum:
case lang_object_symbols_statement_enum:
case lang_data_statement_enum:
case lang_reloc_statement_enum:
case lang_padding_statement_enum:
case lang_input_statement_enum:
@ -3375,9 +3379,10 @@ lang_do_assignments_1
value = exp_fold_tree (s->data_statement.exp,
abs_output_section,
lang_final_phase_enum, dot, &dot);
s->data_statement.value = value.value;
if (!value.valid_p)
einfo (_("%F%P: invalid data statement\n"));
s->data_statement.value
= value.value + value.section->bfd_section->vma;
}
{
unsigned int size;

View File

@ -1,3 +1,7 @@
2004-02-19 Nathan Sidwell <nathan@codesourcery.com>
* ld-scripts/data.{s,t,d,exp}: New.
2004-02-18 Nathan Sidwell <nathan@codesourcery.com>
* ld-scripts/assert.{s,t,exp}: New.

View File

@ -0,0 +1,9 @@
#source: data.s
#ld: -T data.t
#objdump: -s -j .text
.*: file format .*
Contents of section .text:
1000 (0410)?0000(1004)? (0810)?0000(1008)? +........ *
#pass

View File

@ -0,0 +1,20 @@
# Test DATA STATEMENT in a linker script.
# By Nathan Sidwell, CodeSourcery LLC
# Copyright 2004
# Free Software Foundation, Inc.
#
# This file 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 of the License, or
# (at your option) any later version.
#
# 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
run_dump_test data

View File

@ -0,0 +1 @@
#nothing here

View File

@ -0,0 +1,10 @@
SECTIONS
{
.text 0x1000 :
{
LONG (label)
label = .;
LONG (ADDR (.other))
}
.other : {}
}