-
Notifications
You must be signed in to change notification settings - Fork 14
Switch lookup tables end up in .data instead of .text by default #69
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
Comments
I realize that this would be correct behavior if we didn't use progmem for lookup tables (but we want to use progmem for them, as agreed in #47) and copied |
I thought #47 was, basically, about figuring out that these particular constants should be loaded via |
I think I may have misunderstood this issue before - I need to read up a bit on which sections are actually used on AVR. From what I understand, the issue is that even when switch lookup tables are placed in the program memory address space, they are located in the wrong section? If this is the case, I think we can add hooks to |
By the way, I don't think I can delete "dylanmckay marked this as a duplicate of #47 " |
I think I managed to un-mark it. |
We should be able to solve this by placing the switch table into one of the sections merged into |
I've been struggling for a couple days now on why my CHIP-8 firmware doesn't work anymore, even when downgrading to the exact same rustc/llvm versions as before. Then I found out that it's not because of anything in the compiler, but it's because in the meantime I switched over to using Xargo for linking instead of a custom shell script.
The following program should demonstrate the problem. It is the result of compiling a switch, not unlike the one in #47. The stripped-down IR is as follows:
I can compile this on f1e3b63, i.e. with all the horrible kludges that force
lpm
to be used for loading globals, and the resulting assembly ofcoords_keys
looks fine:In fact, the above code is correct in that I can link it with a custom linker script and get a working program:
but with the default linker script, the lookup tables end up in
.data
:The customized linker script
lookup-text.ld
is as follows:The customization compared to the default
avr-gcc
linker script is as follows (it moves.rodata
to.text
):The text was updated successfully, but these errors were encountered: