Repository navigation
[AUTOMATED] Type a parameter read only at field offsets of 0x1000 or more as a pointer - #1994
Conversation
e6df964 to
5d64b05
Compare
…more as a pointer
5d64b05 to
0cf20c2
Compare
… far field-offset reading The section test read every constant outside the image's data sections and code as a field offset. Two kinds of constant there are still addresses: one of 1 MiB or more (a microcontroller's peripheral or RAM word, a relocatable object's extern slot, text decoded as code), and one at most 0x100 bytes below a data section, where `table[c - 'a']` puts the base of a byte table at the start of its section. Both now keep the old grading, so either can only restore the output the image had before the far-offset reading. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
…ge test and spec `absolute.c` (GCC 15, recipe and hashes in the fixture README) adds a read of the absolute address 0x40020000 at an offset in the parameter, a byte table at the start of `.rodata` indexed from a character, and a relocatable object's extern table; each parameter stays an integer. Spec 05 describes the two limits, names the context fields `ArchContext::`, and records that a field address subtracted from another pointer is refused at any offset. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Three more assertions in kuna-ptrfromuse-faroffset.xml pass: 5,558 in all. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
|
[AUTOMATED] I pushed three commits on top of your rebased head (d675c76). The section test also read some absolute addresses as field offsets. With GCC on x86-64: cat > absolute.c <<'C'
extern char ext_table[];
static const char letters[32] = "abcdefghijklmnopqrstuvwxyz";
unsigned int read_reg(unsigned long off) { return *(volatile unsigned int *)(0x40020000UL + off); }
int letter_rank(long c) { return letters[c - 'a']; }
int get_ext(long i) { return ext_table[i]; }
C
gcc -O2 -fPIC -shared -nostdlib -o absolute.so absolute.c && gcc -O2 -c -o absolute.o absolute.c
kuna decompile-all absolute.so; kuna decompile-all absolute.oBefore the fix,
|
What this changes
A pointer parameter that a function reads only at offsets of 0x1000 or more is declared an integer. When a function starts at such an offset, the read prints as a subscript of that function. With GCC on x86-64 Linux:
With this change:
The change
ptrfromusetellsp->fieldfromtable[i]by whether the constant could be a global's address. In an image with a section table, a constant outside every data section and outside the code is now a field offset, and so is a function's address..rodatathat firmware links into.text. Images without a section table are unchanged.charptr,castarithandfloatreguse the same test. For example, zlib'sdeflate_statereads print as((int *)a0)[0x52d]instead of*(int *)&((char *)0x14b4)[(long)a0].Tests
tests/stages/kuna-ptrfromuse-faroffset.xmlloads five GCC 15 images fromtests/fixtures/field-offset-pointers/. Parameters read at 0x1000 and 0x48a0 becomevoid *, and parameters that index.data,.bssand.texttables stay integers. The five assertions for the fix fail on main, and no existing test expectation changes. In Kuna's Go 386 fixtures,runtime.wbBufFlush1and its caller lose their pointer parameter, because the walk now reaches the existing refusal of a pointer difference.Model:
anthropic/claude-opus-5-5