This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] compile: Use libcc1.so->libcc1.so.0


On 04/21/2015 10:36 PM, Jan Kratochvil wrote:
> (2) Currently GDB does only dlopen("libcc1.so") and then depending on which
>     libcc1.so version it would find first it would succeed/fail.
>     I guess it is more convenient to do dlopen("libcc1.so.1") instead
>     (where ".1"=".x" corresponds to GCC_FE_VERSION_x).
>     That is this patch (with x=0).

I don't agree with tying the so version with GCC_FE_VERSION.
The so version is supposed to indicate binary compatibility.
And the ABI is maintained as long as the ABI of the single
entry point -- gcc_c_fe_context -- is maintained.

We can bump GCC_C_FE_VERSION_x leaving the .so version alone,
and on the plugin/gcc side, add new functions at the end of
the context vtable, keeping the vtable compatible
with GCC_C_FE_VERSION_0:

/* The type of the initialization function.  The caller passes in the
   desired base version and desired C-specific version.  If the
   request can be satisfied, a compatible gcc_context object will be
                               ^^^^^^^^^^
   returned.  Otherwise, the function returns NULL.  */

typedef struct gcc_c_context *gcc_c_fe_context_function
    (enum gcc_base_api_version,
     enum gcc_c_api_version);

With that, an older gdb that requests GCC_FE_VERSION_0
should still work.  A newer gdb that understands both v1
and v0 can first try GCC_FE_VERSION_1, and if that fails,
try GCC_FE_VERSION_0, etc.

It's that code that does the initialization/handshake
on both ends (gdb/gcc) that should decide which versions
each end supports.  Doesn't have to be a single version.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]