1# Expect script for ld --just-symbols tests.
2#   Copyright (C) 2020 Free Software Foundation, Inc.
3#
4# This file is part of the GNU Binutils.
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19# MA 02110-1301, USA.
20#
21
22# SH/PE targets complain about zero VMA.
23# i386-msdos doesn't have .data
24# tic30-coff has a weird 32-bit reloc that divides sym value by four
25# alpha-dec-vms wants a bunch of libs to link
26if { [istarget sh-*-pe]
27     || [istarget *-*-msdos]
28     || [istarget *c30-*-*]
29     || [istarget alpha-*-vms] } {
30    return
31}
32
33set saved_LDFLAGS "$LDFLAGS"
34if { [is_pecoff_format] } then {
35    # Avoid auto image-basing.
36    set LDFLAGS "$LDFLAGS --image-base 0"
37} elseif { [is_xcoff_format] } then {
38    set LDFLAGS "$LDFLAGS -bnogc"
39}
40
41run_ld_link_tests [list \
42    [list "Object for --just-symbols test" \
43     "$LDFLAGS -r -T just-symbols.ld" "" \
44     "" \
45     {just-symbols-0.s} \
46     {} \
47     "just-symbols-0.o"] \
48    [list "Executable for --just-symbols test" \
49     "$LDFLAGS -e 0 -T just-symbols.ld" "" \
50     "" \
51     {just-symbols-0.s} \
52     {} \
53     "just-symbols-0"] \
54    [list "Object with --just-symbols test" \
55     "$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0.o" "" \
56     "" \
57     {just-symbols-1.s} \
58     {{objdump {-s -j .data} just-symbols-1.dd}} \
59     "just-symbols-1obj"] \
60    [list "Executable with --just-symbols test" \
61     "$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0" "" \
62     "" \
63     {just-symbols-1.s} \
64     {{objdump {-s -j .data} just-symbols-1.dd}} \
65     "just-symbols-1exe"] \
66]
67
68set LDFLAGS "$saved_LDFLAGS"
69