Skip to content

Commit 2aa739f

Browse files
committed
Only run the new default-hidden-visibility test on x86_64/linux.
1 parent c181b37 commit 2aa739f

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ change-id = 118703
207207
# Defaults to `host`. If you set this explicitly, you likely want to add all
208208
# host triples to this list as well in order for those host toolchains to be
209209
# able to compile programs for their native target.
210-
#target = build.host (list of triples)
210+
target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "i686-unknown-linux-gnu", "i686-pc-windows-msvc"]
211211

212212
# Use this directory to store build artifacts. Paths are relative to the current directory, not to
213213
# the root of the repository.

tests/codegen/default-hidden-visibility.rs

+17-25
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,9 @@
33
// also https://github.com/rust-lang/rust/issues/73295 and
44
// https://github.com/rust-lang/rust/issues/37530.
55

6-
// We test 3 combinations of command-line flags:
7-
// * No extra command-line flag: DEFAULT
8-
// * Overriding to "yes": YES
9-
// * Overriding to "no": NO
10-
//
11-
// revisions:DEFAULT YES NO
12-
// [YES] compile-flags: -Zdefault-hidden-visibility=yes
13-
// [NO] compile-flags: -Zdefault-hidden-visibility=no
14-
15-
// `compiler/rustc_target/src/spec/base/wasm.rs` has a different default value of
16-
// `default_hidden_visibility` - it wouldn't match the test expectations below.
17-
// And therefore we skip this test on WASM:
18-
//
19-
// ignore-wasm32
20-
21-
// We verify that using the command line marks the `exported_symbol` as `hidden`
22-
// and that it is not `hidden` otherwise. We don't verify other attributes of
23-
// the symbol, because they vary depending on the target (e.g. in the `DEFAULT`
24-
// behavior on `i686-unknown-linux-musl` the symbol is `internal constant` while
25-
// on `x86_64-unknown-linux-gnu` it is just `constant`).
26-
//
27-
// DEFAULT-NOT: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} ={{.*}} hidden
28-
// NO-NOT: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} ={{.*}} hidden
29-
// YES: @{{.*}}default_hidden_visibility{{.*}}exported_symbol{{.*}} ={{.*}} hidden
6+
// revisions:DEFAULT YES NO
7+
//[YES] compile-flags: -Zdefault-hidden-visibility=yes
8+
//[NO] compile-flags: -Zdefault-hidden-visibility=no
309

3110
// The test scenario is specifically about visibility of symbols exported out of dynamically linked
3211
// libraries.
@@ -37,4 +16,17 @@
3716
// the symbol should be exported; we don't want that - we want to test the *default*
3817
// export setting instead).
3918
#[used]
40-
pub static exported_symbol: [u8; 6] = *b"foobar";
19+
pub static tested_symbol: [u8; 6] = *b"foobar";
20+
21+
// Exact LLVM IR differs depending on the target triple (e.g. `hidden constant`
22+
// vs `internal constant` vs `constant`). Because of this, we only apply the
23+
// specific test expectations below to one specific target triple. If needed,
24+
// additional targets can be covered by adding copies of this test file with
25+
// a different `only-X` directive.
26+
//
27+
// only-x86_64
28+
// only-linux
29+
30+
// DEFAULT: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant
31+
// YES: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = hidden constant
32+
// NO: @{{.*}}default_hidden_visibility{{.*}}tested_symbol{{.*}} = constant

0 commit comments

Comments
 (0)