about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-11 16:27:23 +0000
committerbors <bors@rust-lang.org>2024-10-11 16:27:23 +0000
commit01e2fff90c7ed19e1d9fb828ebc012e7b9732297 (patch)
tree49b5869e859d2415e6f0a6b02f5bb1dbf1581d8d /tests/codegen
parentf4966590d8edd5f493a1aab04016b94a75494329 (diff)
parentb18e1aa612d75114ee67091f3af82ea04a08ef36 (diff)
Auto merge of #131547 - matthiaskrgr:rollup-ui4p744, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #129079 (Create `_imp__` symbols also when doing ThinLTO)
 - #131208 (ABI: Pass aggregates by value on AIX)
 - #131394 (fix(rustdoc): add space between struct fields and their descriptions)
 - #131519 (Use Default visibility for rustc-generated C symbol declarations)
 - #131541 (compiletest: Extract auxiliary-crate properties to their own module/struct)
 - #131542 (next-solver: remove outdated FIXMEs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/default-visibility.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/codegen/default-visibility.rs b/tests/codegen/default-visibility.rs
index 884d386ec20..88ff9fee254 100644
--- a/tests/codegen/default-visibility.rs
+++ b/tests/codegen/default-visibility.rs
@@ -31,3 +31,19 @@ pub static tested_symbol: [u8; 6] = *b"foobar";
 // PROTECTED:    @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = protected constant
 // INTERPOSABLE: @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = constant
 // DEFAULT:      @{{.*}}default_visibility{{.*}}tested_symbol{{.*}} = constant
+
+pub fn do_memcmp(left: &[u8], right: &[u8]) -> i32 {
+    left.cmp(right) as i32
+}
+
+// CHECK: define {{.*}} @{{.*}}do_memcmp{{.*}} {
+// CHECK: }
+
+// `do_memcmp` should invoke core::intrinsic::compare_bytes which emits a call
+// to the C symbol `memcmp` (at least on x86_64-unknown-linux-gnu). This symbol
+// should *not* be declared hidden or protected.
+
+// HIDDEN:       declare i32 @memcmp
+// PROTECTED:    declare i32 @memcmp
+// INTERPOSABLE: declare i32 @memcmp
+// DEFAULT:      declare i32 @memcmp