but define a special value for 'ptr' to get behavior as of 0.9.24, as in:
/* Do all relocations. Needed before using tcc_get_symbol().
Possible values for ptr:
- TCC_RELOCATE_AUTO : Allocate memory internally
- NULL : return required memory size for the step
below
- memory address : copy code into memory passed by the caller
returns -1 on error. */
LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr);
#define TCC_RELOCATE_AUTO (void*)-1
Is this ugly? Confusing? 0.9.26 isn't out yet so we can still decide.
--- grischka
If you're going to use that method, then I'd suggest this definition
of TCC_RELOCATE_AUTO:
#define TCC_RELOCATE_AUTO (void*)&tcc_relocate
If I recall the C standard correctly, that will result on a value
that's unique from all other valid addresses even on Harvard
architectures (though porting TCC to one of those would be
"difficult"), thus ensuring that the new behavior can only be invoked
by accident if the calling code has a bug.
It also makes it easy to not run into a conflict with anything else,
which could be relevant, since I half recall some architectures having
valid negative addresses for some reason..