File: archive.exp

package info (click to toggle)
binutils 2.46-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 417,696 kB
  • sloc: ansic: 1,487,508; asm: 829,455; cpp: 216,692; exp: 80,527; makefile: 73,165; sh: 24,213; yacc: 15,060; lisp: 13,632; perl: 13,404; lex: 1,714; ada: 1,681; pascal: 1,446; cs: 879; python: 638; java: 478; sed: 191; xml: 95; awk: 25
file content (255 lines) | stat: -rw-r--r-- 7,639 bytes parent folder | download | duplicates (7)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# Test for archive handling.
# Copyright (C) 2025-2026 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; see the file COPYING3. If not,
# see <http://www.gnu.org/licenses/>.
#

remote_file host delete \
    "tmpdir/ab.a" "tmpdir/cd.a" "tmpdir/abt.a" "tmpdir/cdt.a" \
    "tmpdir/abn.a" "tmpdir/abnt.a" "tmpdir/abc.a" "tmpdir/abct.a" \
    "tmpdir/abcn.a" "tmpdir/abcnt.a"

run_ld_link_tests {
    {"First regular archive create"     ""   "" "" {a.s b.s x.s} {} "ab.a"   }
    {"Second regular archive create"    ""   "" "" {c.s d.s y.s} {} "cd.a"   }
    {"First thin archive create"        "T"  "" "" {a.s b.s x.s} {} "abt.a"  }
    {"Second thin archive create"       "T"  "" "" {c.s d.s y.s} {} "cdt.a"  }
    {"Regular archive w/o index create" "S"  "" "" {a.s b.s x.s} {} "abn.a"  }
    {"Thin archive w/o index create"    "ST" "" "" {a.s b.s x.s} {} "abnt.a" }
    {"Other regular archive create"           ""   "" "" {abc.s} {} "abc.a"  }
    {"Other thin archive create"              "T"  "" "" {abc.s} {} "abct.a" }
    {"Other regular archive w/o index create" "S"  "" "" {abc.s} {} "abcn.a" }
    {"Other thin archive w/o index create"    "ST" "" "" {abc.s} {} "abcnt.a"}
}

set old_ldflags $LDFLAGS

# Prevent our otherwise unused data symbols from being GC'd on XCOFF targets.
if { [is_xcoff_format] } {
    append LDFLAGS " -unix"
}

# With Alpha/VMS NM doesn't handle executables and for MS-DOS there's no way
# to keep symbols, so filter out any NM tests.
proc ld_archive_filter_tests { arg } {
    if { ![istarget "*-*-msdos"] && ![istarget "alpha*-*-*vms*"] } {
	return $arg
    } else {
	set tests {}
	foreach test $arg {
	    if { [lindex $test 0] != "nm" } {
		lappend tests $test
	    }
	}
	return $tests
    }
}

# Single archive tests.
run_ld_link_tests [list \
    [list "Regular archive link" \
	"-e ff" "tmpdir/ab.a --verbose --print-map" \
	"" {abc.s} \
	[ld_archive_filter_tests {{ld abc.vd} \
				  {nm "" abc.nd} \
				  {nm "" nx.nd}}] \
	"abc" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
setup_xfail "binutils/33485" "cris-*-*aout*" "i\[3-7\]86-*-bsd*" \
    "i\[3-7\]86-*-msdos*" "ns32k-*-*" "pdp11-*-*"
setup_xfail "binutils/33600" "alpha*-*-*vms*"
if { [is_xcoff_format] } {
    setup_xfail "binutils/33600" "*-*-*"
}
run_ld_link_tests [list \
    [list "Thin archive link" \
	"-e ff" "tmpdir/abt.a --verbose --print-map" \
	"" {abc.s} \
	[ld_archive_filter_tests {{ld abtc.vd} \
				  {nm "" abc.nd} \
				  {nm "" nx.nd}}] \
	"abtc" \
    ] \
]

# Single whole archive tests.
run_ld_link_tests [list \
    [list "Regular whole archive link" \
	"-e ff" "--whole-archive tmpdir/ab.a --verbose --print-map" \
	"" {abc.s} \
	[ld_archive_filter_tests {{ld abwc.vd} \
				  {nm "" abc.nd} \
				  {nm "" x.nd}}] \
	"abwc" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
setup_xfail "binutils/33600" "alpha*-*-*vms*"
if { [is_xcoff_format] } {
    setup_xfail "binutils/33600" "*-*-*"
}
run_ld_link_tests [list \
    [list "Thin whole archive link" \
	"-e ff" "--whole-archive tmpdir/abt.a --verbose --print-map" \
	"" {abc.s} \
	[ld_archive_filter_tests {{ld abwtc.vd} \
				  {nm "" abc.nd} \
				  {nm "" x.nd}}] \
	"abwtc" \
    ] \
]

# Group archive tests.
run_ld_link_tests [list \
    [list "Regular non-group archive link reject" \
	"-e ff tmpdir/ab.a" "tmpdir/abc.a" \
	"" {} \
	{{ld abcn.ed}} \
	"abcn" \
    ] \
    [list "Thin non-group archive link reject" \
	"-e ff tmpdir/abt.a" "tmpdir/abct.a" \
	"" {} \
	{{ld abcn.ed}} \
	"abtctn" \
    ] \
    [list "Regular group archive link accept" \
	"-e ff -\\( tmpdir/ab.a" "tmpdir/abc.a -\\) --verbose --print-map" \
	"" {} \
	[ld_archive_filter_tests {{ld abcg.vd} \
				  {nm "" abc.nd} \
				  {nm "" nx.nd}}] \
	"abcg" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
setup_xfail "binutils/33485" "cris-*-*aout*" "i\[3-7\]86-*-bsd*" \
    "i\[3-7\]86-*-msdos*" "ns32k-*-*" "pdp11-*-*"
setup_xfail "binutils/33600" "alpha*-*-*vms*"
if { [is_xcoff_format] } {
    setup_xfail "binutils/33600" "*-*-*"
}
run_ld_link_tests [list \
    [list "Thin group archive link accept" \
	"-e ff -\\( tmpdir/abt.a" "tmpdir/abct.a -\\) --verbose --print-map" \
	"" {} \
	[ld_archive_filter_tests {{ld abtctg.vd} \
				  {nm "" abc.nd} \
				  {nm "" nx.nd}}] \
	"abtctg" \
    ] \
]

# Dual archive tests.
run_ld_link_tests [list \
    [list "Regular archive plus regular link" \
	"-e ff" "tmpdir/ab.a tmpdir/cd.a" \
	"" {abcde.s} \
	[ld_archive_filter_tests {{nm "" abcde.nd} \
				  {nm "" nx.nd} \
				  {nm "" ny.nd}}] \
	"abcde" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
setup_xfail "binutils/33485" "cris-*-*aout*" "i\[3-7\]86-*-bsd*" \
    "i\[3-7\]86-*-msdos*" "ns32k-*-*" "pdp11-*-*"
run_ld_link_tests [list \
    [list "Regular archive plus thin link" \
	"-e ff" "tmpdir/ab.a tmpdir/cdt.a" \
	"" {abcde.s} \
	[ld_archive_filter_tests {{nm "" abcde.nd} \
				  {nm "" nx.nd} \
				  {nm "" ny.nd}}] \
	"abcdte" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
setup_xfail "binutils/33485" "cris-*-*aout*" "i\[3-7\]86-*-bsd*" \
    "i\[3-7\]86-*-msdos*" "ns32k-*-*" "pdp11-*-*"
run_ld_link_tests [list \
    [list "Thin archive plus regular link" \
	"-e ff" "tmpdir/abt.a tmpdir/cd.a" \
	"" {abcde.s} \
	[ld_archive_filter_tests {{nm "" abcde.nd} \
				  {nm "" nx.nd} \
				  {nm "" ny.nd}}] \
	"abtcde" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
setup_xfail "binutils/33485" "cris-*-*aout*" "i\[3-7\]86-*-bsd*" \
    "i\[3-7\]86-*-msdos*" "ns32k-*-*" "pdp11-*-*"
run_ld_link_tests [list \
    [list "Thin archive plus thin link" \
	"-e ff" "tmpdir/abt.a tmpdir/cdt.a" \
	"" {abcde.s} \
	[ld_archive_filter_tests {{nm "" abcde.nd} \
				  {nm "" nx.nd} \
				  {nm "" ny.nd}}] \
	"abtcdte" \
    ] \
]

# Dual whole archive tests.
run_ld_link_tests [list \
    [list "Regular archive plus whole regular link" \
	"-e ff" "tmpdir/ab.a --whole-archive tmpdir/cd.a" \
	"" {abcde.s} \
	[ld_archive_filter_tests {{nm "" abcde.nd} \
				  {nm "" nx.nd} \
				  {nm "" y.nd}}] \
	"abcdwe" \
    ] \
]
setup_xfail "binutils/33484" "alpha*-*-linux*ecoff*" "alpha*-*-osf*"
run_ld_link_tests [list \
    [list "Regular archive plus whole thin link" \
	"-e ff" "tmpdir/ab.a --whole-archive tmpdir/cdt.a" \
	"" {abcde.s} \
	[ld_archive_filter_tests {{nm "" abcde.nd} \
				  {nm "" nx.nd} \
				  {nm "" y.nd}}] \
	"abcdwte" \
    ] \
]

set LDFLAGS $old_ldflags

# Alpha/VMS archives always have an index and XCOFF targets currently
# accept archives without one.
if { [istarget "alpha*-*-*vms*"] || [is_xcoff_format] } {
    return
}

# Single non-index archive tests.
run_ld_link_tests [list \
    [list "Regular archive w/o index link" \
	"-e ff" "tmpdir/abn.a" \
	"" {abc.s} \
	{{ld abc.ed}} \
	"abnc" \
    ] \
    [list "Thin archive w/o index link" \
	"-e ff" "tmpdir/abnt.a" \
	"" {abc.s} \
	{{ld abct.ed}} \
	"abnct" \
    ] \
]