about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/run-make/avr-rjmp-offset/rmake.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/run-make/avr-rjmp-offset/rmake.rs b/tests/run-make/avr-rjmp-offset/rmake.rs
index 28018f59c5b..89cbca309be 100644
--- a/tests/run-make/avr-rjmp-offset/rmake.rs
+++ b/tests/run-make/avr-rjmp-offset/rmake.rs
@@ -1,4 +1,5 @@
 //@ needs-llvm-components: avr
+//@ needs-rust-lld
 //! Regression test for #129301/llvm-project#106722 within `rustc`.
 //!
 //! Some LLVM-versions had wrong offsets in the local labels, causing the first
@@ -17,6 +18,13 @@ fn main() {
         .opt_level("s")
         .panic("abort")
         .target("avr-unknown-gnu-atmega328")
+        // normally one links with `avr-gcc`, but this is not available in CI,
+        // hence this test diverges from the default behavior to enable linking
+        // at all, which is necessary for the test (to resolve the labels). To
+        // not depend on a special linker script, the main-function is marked as
+        // the entry function, causing the linker to not remove it.
+        .linker("rust-lld")
+        .link_arg("--entry=main")
         .output("compiled")
         .run();
 
@@ -35,6 +43,7 @@ fn main() {
     // fore the relative jump has an impact on the label offset. Old versions
     // of the Rust compiler did produce a label `rjmp .-4` (misses the first
     // instruction in the loop).
+    assert!(disassembly.contains("<main>"), "no main function in output");
     disassembly
         .trim()
         .lines()