summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-dynamic/export-dynamic-symbol.exp
blob: 9aa30e9d5204e1fd4242b7a63e06080b00835d62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Expect script for ld --export-dynamic-symbol tests
#   Copyright (C) 2020-2021 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# 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.
#

if ![is_elf_format] {
    return
}

# Skip targets where -shared or -pie is not supported
if { ![check_shared_lib_support] || ![check_pie_support] } {
    return
}

# Skip targets that have poor PIE support, resulting in failures due to
# PHDR segment not covered by LOAD segment errors.
if { ([istarget "bfin-*-*"] && ![istarget "bfin-*-linux*"])
     || [istarget "mn10300-*-*"]
     || [istarget "score-*-*"] } {
    return
}

set old_ASFLAGS $ASFLAGS

# These targets require extra GAS options when building code for shared
# libraries.
if [istarget "nds32*-*"] {
    append ASFLAGS " -mpic"
}
if [istarget "tic6x-*-*"] {
    append ASFLAGS " -mpic -mpid=near"
}
if [istarget "sparc*-*-*"] {
    append ASFLAGS " -K PIC -Av9"
}

set old_LDFLAGS $LDFLAGS

# These targets require a non-default emulation for successful shared
# library/executable builds.
if [istarget "tic6x-*-*"] {
    append LDFLAGS " -melf32_tic6x_le"
}

set build_tests {
  {"Build libpr25910.a"
   "" "" ""
   {foo.s} {} "libpr25910.a"}
}

run_ld_link_tests $build_tests

set test_list [lsort [glob -nocomplain $srcdir/$subdir/export-dynamic-symbol-*.d]]
foreach test_file $test_list {
    set test_name [file rootname $test_file]
    verbose $test_name
    run_dump_test $test_name
}

set ASFLAGS $old_ASFLAGS
set LDFLAGS $old_LDFLAGS