2 ms·
Thank you! Is it relevant today at all, or is there an use-case for it today?
by johnisgood 2y ago
Thank you! Is it relevant today at all, or is there an use-case for it today?
- aap_ 2y agoNo, if you need fixed addresses i suppose a linker script would be the way to go? Or in this case you'd just serialize the data such that it doesn't contain any pointers in the first place.
- ddulaney 2y agoIf you even can with ASLR. Most modern boxes would disable stuff like this.
- mananaysiempre 2y agoThere are better tools to do this these days—with the GNU toolchain, for example, you’d use a linker script and make sure you’re building a non-position-independent static executable. Alternatively, you could use self-relative pointers: instead of having foo_t *foo and putting p there, have ptrdiff_t foo and put ((char *)p - (char *)&foo) there.