old-cross-binutils/gold/testsuite/memory_test.sh
Nick Clifton ea5cae92bd * script-sections.cc(class Memory_region): Remove
current_lma_offset_ field.  Rename current_vma_offset_ to
        current_offset_.  Add last_section_ field.
        (Memory_region::get_current_vma_address): Rename to
        get_current_address.
        (Memory_region::get_current_lma_address): Delete.
        (Memory_region::increment_vma_offset): Rename to
        increment_offset.
        (Memory_region::increment_lma_offset): Delete.
        (Memory_region::attributes_compatible): New method.  Returns
        true if the provided section is compatible with the region.
        (Memory_region::get_last_section): New method.  Returns the last
        section to use the region.
        (Memory_region::set_last_section): New method.  Stores the last
        section to use the region.
        (Script_sections::block_in_region): New method.  Returns true if
        a block of memory is contained within a region.
        (Script_sections::find_memory_region): New method.  Locates a
        memory region to be used to set a VMA or LMA address.
        (Output_section_definition::set_section_addresses): Add code to
        check for addresses set by memory regions.
        (Output_segment::set_section_addresses): Remove memory region
        walking code.
        (Script_sections::create_segment): Add a warning if a header
        segment is created outside of any region.
        * script-sections.h (class Script_sections): Add prototypes for
        find_memory_region and block_in_region methods.
        * testsuite/memory_test.s: Use .long instead of .word.
        * testsuite/memory_test.t: Add some more output sections.
        * testsuite/memory_test.sh: Update expected output.

        * ld.texinfo: Update description of computation of VMA and LMA
        addresses for output sections.

        * ld-scripts/rgn-at5.t: Add some more output sections.
        * ld-scripts/rgn-at5.d: Update expected output.
2010-10-06 08:58:59 +00:00

57 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
# memory_test.sh -- test MEMORY regions.
# Copyright 2010 Free Software Foundation, Inc.
# Written by Nick Clifton <nickc@redhat.com>
# This file is part of gold.
# 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.
# 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., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
# NOTE: The linker script used in this test (memory_test.t)
# should be the same as the one used in the rgn-at5 linker
# test (ld/testsuite/ld-scripts/rgn-at5.t).
#
# Modulo some section ordering the output from GOLD in this
# test should be the same as the output from GNU LD in the
# rgn-at5 test.
check()
{
file=$1
pattern=$2
found=`grep "$pattern" $file`
if test -z "$found"; then
echo "pattern \"$pattern\" not found in file $file."
echo $found
exit 1
fi
}
check memory_test.stdout \
" LOAD 0x001000 0x0*02000 0x0*02000 0x0*04 0x0*04 R 0x1000"
check memory_test.stdout \
" LOAD 0x001004 0x0*01000 0x0*02004 0x0*04 0x0*04 R 0x1000"
check memory_test.stdout \
" LOAD 0x001008 0x0*02008 0x0*02008 0x0*08 0x0*08 R 0x1000"
check memory_test.stdout \
" LOAD 0x002000 0x0*05000 0x0*05000 0x0*04 0x0*04 R 0x1000"
check memory_test.stdout \
" LOAD 0x00203c 0x0*04000 0x0*0603c 0x0*04 0x0*04 R 0x1000"
exit 0