https://sourceware.org/bugzilla/show_bug.cgi?id=24993
Raj Vishwanathan <raj.vishwanathan at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |raj.vishwanathan at gmail dot
com
--- Comment #4 from Raj Vishwanathan <raj.vishwanathan at gmail dot com> ---
The error is message is ambiguous but correct. This happens because the .sdata
os of size 6 (6 chars) but the minimum riscv instruction is 2 bytes. It
overshoots the .sdata section and hence the correct "is out of bounds." (out of
.sdata section bounds).
-D on a data section can create odd/impossible decodings.
Infact, if you initialize the code as
char __attribute__ ((aligned(2))) x = 'x';
char a = 0x1f;
char b = 0x03;
char c = 0x3f;
char d = 0x3f;
char e = 0x1f;
int main()
{
return a + b + c + d + e;
}
It will output
Disassembly of section .sdata:
0000000000011194 <x>:
11194: .insn 2, 0x1f78
0000000000011195 <a>:
11195: Address 0x11195 is out of bounds.
0000000000011196 <b>:
11196: ld t5,499(t5)
0000000000011197 <c>:
11197: Address 0x11197 is out of bounds.
0000000000011198 <d>:
11198: Address 0x11198 is out of bounds.
0000000000011199 <e>:
11199: Address 0x11199 is out of bounds.
because 0x1f and 0x3f indicate a 48 or 64 byte RV instruction
And the same code on x86 will output
Disassembly of section .data:
0000000000004000 <x>:
4000: 78 js 4021 <_end+0x19>
0000000000004001 <a>:
4001: 1f (bad)
0000000000004002 <b>:
4002: 03 add (%rdi),%edi
0000000000004003 <c>:
4003: 3f (bad)
0000000000004004 <d>:
4004: 3f (bad)
0000000000004005 <e>:
4005: 1f (bad)
This suggests 2 things.
1.Unfair to use -D on a data section and hope for sane output
2. Fix the document or error message to suggest "Caveat Emptor" if you use -D
for decoding data sections in elf.
--
You are receiving this mail because:
You are on the CC list for the bug.