|
3 | 3 | // also https://github.com/rust-lang/rust/issues/73295 and
|
4 | 4 | // https://github.com/rust-lang/rust/issues/37530.
|
5 | 5 |
|
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 |
30 | 9 |
|
31 | 10 | // The test scenario is specifically about visibility of symbols exported out of dynamically linked
|
32 | 11 | // libraries.
|
|
37 | 16 | // the symbol should be exported; we don't want that - we want to test the *default*
|
38 | 17 | // export setting instead).
|
39 | 18 | #[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