1#!/bin/sh
2
3# memory_test.sh -- test MEMORY regions.
4
5# Copyright (C) 2010-2016 Free Software Foundation, Inc.
6# Written by Nick Clifton  <nickc@redhat.com>
7
8# This file is part of gold.
9
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 3 of the License, or
13# (at your option) any later version.
14
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
23# MA 02110-1301, USA.
24
25
26# NOTE: The linker script used in this test (memory_test.t)
27# should be the same as the one used in the rgn-at5 linker
28# test (ld/testsuite/ld-scripts/rgn-at5.t).
29#
30# Modulo some section ordering the output from GOLD in this
31# test should be the same as the output from GNU LD in the
32# rgn-at5 test.
33
34check()
35{
36    file=$1
37    pattern=$2
38    found=`grep "$pattern" $file`
39    if test -z "$found"; then
40        echo "pattern \"$pattern\" not found in file $file."
41	echo $found
42        exit 1
43    fi
44}
45
46check memory_test.stdout \
47  "  LOAD           0x001000 0x0*02000 0x0*02000 0x0*04 0x0*04 R   0x1000"
48check memory_test.stdout \
49  "  LOAD           0x001004 0x0*01000 0x0*02004 0x0*04 0x0*04 R   0x1000"
50check memory_test.stdout \
51  "  LOAD           0x001008 0x0*02008 0x0*02008 0x0*08 0x0*08 R   0x1000"
52check memory_test.stdout \
53  "  LOAD           0x002000 0x0*05000 0x0*05000 0x0*04 0x0*04 R   0x1000"
54check memory_test.stdout \
55  "  LOAD           0x00203c 0x0*04000 0x0*0603c 0x0*04 0x0*04 R   0x1000"
56
57exit 0
58