Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression test for AVR rjmp offset #131755

Merged
merged 6 commits into from
Oct 18, 2024

Commits on Oct 15, 2024

  1. Start test case for rjmp regression test

    This commit introduces a minimal `![no_core]`-test case running on AVR,
    that contains the MCWE mentioned in [129301]. The test case itself does
    not have any assertions yet, but it shows the minimal set an language
    items necessary within the test case.
    
    [129301]: rust-lang#129301 (comment)
    jfrimmel committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    da44e3f View commit details
    Browse the repository at this point in the history
  2. Add check-annotations ensuring correct label

    The issue was, that the disassembled label was placed one instruction
    further down than expected. Therefore the test annotations check, that
    the label is placed above the loop-contents (writing the one value, then
    writing the other one).
    jfrimmel committed Oct 15, 2024
    Configuration menu
    Copy the full SHA
    652ba66 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    db6c736 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2024

  1. Convert to a rmake-test

    Since the `tests/assembly` use `emit=asm`, the issue is not observable
    as reported in the linked issue. Therefore the existing test case is
    converted and a simple `rmake`-test is added. The test only checks, if
    the correct `rjmp`-offset is used.
    jfrimmel committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    ab00841 View commit details
    Browse the repository at this point in the history
  2. Simplify test and make it more reliable

    The new `rmake`-content asserts the exact assembly sequence for the loop
    preventing false-negatives if some instructions would change and thus
    the label offset might need to change.
    jfrimmel committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    bb8db13 View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2024

  1. Use rust-lld instead of avr-gcc as the linker

    This fixes the [build error] caused by the `avr-gcc` (used as linker)
    not being available in the Rust CI. This is a viable solution, which
    shows the wrong/right behavior and, since no functions from `libgcc` are
    called, does not produce errors. This was discussed [here]. Another
    small problem is, that `lld` doesn't link the correct startup-code by
    default. This is not a problem for this test (since it does not actually
    use anything the startup code is needed for (no variables, no stack, no
    interrupts)), but this causes the `main`-function to be removed by the
    default flag `--gc-sections`. Therefore the `rmake`-driver also adds the
    linker flag `--entry=main` to mark the `main`-function as the entry
    point and thus preventing it from getting removed. The code would work
    on a real AVR device.
    
    [build error]: rust-lang#131755 (comment)
    [here]: rust-lang#131755 (comment)
    jfrimmel committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    a35ed2f View commit details
    Browse the repository at this point in the history