Re: [patch] Fix jit-reader.h for multilib

Jan Kratochvil
2015-01-11T13:14:03Z

On Sun, 11 Jan 2015 13:02:55 +0100, Yao Qi wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> > I got reported jit-reader.h is not multi-lib safe:
> >
> > --- /usr/include/gdb/jit-reader.h on x86_64 2015-01-07 11:54:27.705802129 -0500
> > +++ /usr/include/gdb/jit-reader.h on i686 2015-01-07 11:54:46.853774165 -0500
> > @@ -56,7 +56,7 @@ extern "C" {
> >
> > /* Represents an address on the target system. */
> >
> > -typedef unsigned long GDB_CORE_ADDR;
> > +typedef unsigned long long GDB_CORE_ADDR;
> >
> > /* Return status codes. */
> >
> >
> > multi-lib safety means that files with the same pathname (which is
> > /usr/include, contrary to /usr/lib vs. /usr/lib64 for example).
>
> I am sorry I can't understand what you mean here, can you elaborate?

Sorry I see I haven't finished the sentence, it should have been:

# multi-lib safety means that files with the same pathname (which is
# /usr/include, contrary to /usr/lib vs. /usr/lib64 for example)
# contain exactly the same content.

See also:
https://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks#File_conflicts

When we discuss it personally I do not think multilib should be applied to the
GDB package as there is nothing like /usr/lib{,64}/libgdb.so. There is only
/usr/bin/gdb and that has always just one arch on one system. So installing
gdb.i686 and gdb.x86_64 simultaneously does not have any benefits / makes
sense. But despites this I need it for Red Hat packaging so I am fine to also
keep it just as a downstream patch. OTOH I guess other OS packagers may also
face it so it may be easier for everyone to do it upstream.

> Do you mean sizeof (GDB_CORE_ADDR) should be the same on different
> multi-lib (i686 vs x86_64)?

For multilib it does not matter what is the runtime GDB_CORE_ADDR type but the
text defining it (in /usr/include/gdb/jit-reader.h) has to be the same for
archs sharing multilib.

IIUC GDB requires for GDB_CORE_ADDR:
* sizeof (GDB_CORE_ADDR) >= sizeof (CORE_ADDR)
* sizeof (GDB_CORE_ADDR) is preferrably the smallest available size

Jan