-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Unexpected assembly output using relative offsets in inline assembler #47093
Comments
Build it with command
But
|
This bug affects some tests : https://github.com/llvm/llvm-project/blob/main/lld/test/ELF/avr-reloc.s#L64 |
The above patches fix the bug that the llvm-objdump can not correctly decode RJMP/RCALL and the relative branch instructions. However clang still emits wrong addend field in the .rela.text of AVR relocatable ELF files, which leads to the original bug reported by @s-ol . I guess the bug may be inside the AVR MC layer. |
In #59962 I have an example which has nothing to do with clang, it shows that |
duplicate to #60019 . |
Input:
|
Extended Description
While porting C source (https://github.com/cpldcpu/light_ws2812/blob/master/light_ws2812_AVR/Light_WS2812/light_ws2812.c) to Zig, which uses LLVM as a backend, I noticed that the "rjmp .+0" instructions that are used as 2-cycle NOPs under avr-gcc assembled to "rjmp .-2" (infinite loops) under Zig and LLVM/Clang.
Here is some code to reproduce:
(this file is also attached as demo_c.c)
Note that just inspecting the object file created using clang will confusingly show "rjmp .+0" thrice since the actual offset is set using relocation fixups at that stage.
The text was updated successfully, but these errors were encountered: