tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc_relocate() and tcc_relocate_ex()


From: grischka
Subject: Re: [Tinycc-devel] tcc_relocate() and tcc_relocate_ex()
Date: Wed, 29 Aug 2012 16:04:55 +0200
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

Michael Matz wrote:
I'd actually like to know some details why you can't just use tcc_relocate()?

So Sean meanwhile answered this extensively, but I'd actually ask back why the answer to this question matters? The _ex function exposes a strict superset of possibilities of the non _ex variant, that much is very obvious, so asking why the more limited API isn't enough for everyone, when it once was more capable and actually used in that extended fashion seems patronizing to me. There's clearly a use for the extended API (clearly in the sense, it once worked, now with the limited API it doesn't, and I don't see how to work around the limitation with the current API), and exporting the relevant, though renamed symbol, isn't affecting the future of libtcc stability, insofar it exists (which it doesn't), at all.

The "strict superset" thing isn't true anymore since someone added
SELINUX support to tcc_relocate.


So, while the complaint about the leak is correct, the conservatism about exporting one internal function (whose functionality once was available as an exported function that was removed from the API) is hypocritic at best.
Sorry for that assessment.  IOW: I don't understand your reservations.

To make it short: just export the damn thing.  It makes sense.


Well I hope this damn thing makes sense because I wrote it. ;)

Anyway, we're not in a hurry, are we?

What about this:  Keep the 0.9.25 declaration of tcc_relocate, which was:

   /* copy code into memory passed in by the caller and do all relocations
      (needed before using tcc_get_symbol()).
      returns -1 on error and required size if ptr is NULL */
    LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr);

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]