When compiling for size on clang, I came across this code that was produced:
mov edx, 0xfffffff4
mov eax, 0x10002020[edx]
In this case 0x10002020 is a global variable, which is 4 bytes long, yet it is used to access a nearby variable (0xfffffff4 + 0x10002020 = 0x10002014)
is it possible to turn off this optimization? as I would like to shuffle the .data section of my program , I want to have direct memory access to global variables - not through other global variables.
I have tried a lot of different compiler flags, but none of them worked.