Re: [PATCH] Link gnulib in gdbserver.

Pedro Alves
2012-04-11T18:11:19Z

On 04/11/2012 07:50 AM, Yao Qi wrote:

> As suggested in this patch review, we can use gnulib in gdbserver.
>
> [PATCH] Use sized types in tracepoint
> http://sourceware.org/ml/gdb-patches/2012-03/msg00604.html
>
> This patch is to make sure gnulib is built with gdbserver, and linked
> with gdbserver.
>
> Some code is copied from gdb/configure.ac and gdb/Makefile.in directly.
> It takes me some time to handle gnulib which is not a sub-dir of gdbserver.

I say it was pretty fast. :-) Thanks for doing this.

> When invoking Makefile in gnulib/, we pass top_srcdir, srcdir, and VPATH
> to overwrite its default one.
>
> Since we only have one subdir in gdbserver, so I don't use subdir_do here.

I wonder if we shouldn't still use it, by making it handle the
VPATH, etc. passing itself. I think it's likely we'll make
gdbserver depend on other top level libs in the future. But doing
it when we actually need it is quite fine with me.

On 04/11/2012 07:50 AM, Yao Qi wrote:
> * Makefile.in: Define abs_top_srcdir and abs_srcdir.
> (INCLUDE_CFLAGS): Append GNULIB_INCLUDE_DIR.
> (install-only, install-info:, clean:): Handle sub dir gnulib.

^ ^
Spurious ':'s ?

> (all-lib, am--refresh): New target.

"targets".

> (memmem.o): Remove target.
> * configure.ac: Remove AC_CONFIG_LIBOBJ_DIR.
> Invoke gl_EARLY. Invoke AC_CHECK_PROGS for make.
> (AC_REPLACE_FUNCS): Remove memmem.
> Invoke gl_INIT and AM_INIT_AUTOMAKE.
> (AC_OUTPUT): Generate Makefile in gnulib/.
> * aclocal.m4, config.in, configure: Regenerated.

On 04/11/2012 07:50 AM, Yao Qi wrote:
> +$(GNULIB_LIB) $(GNULIB_H): all-lib
> +all-lib: gnulib/Makefile
> +# @$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=gnulib subdir_do

Leftover.

> + @cd gnulib; $(MAKE) $(FLAGS_TO_PASS) all

Otherwise this is fine with me.

It might be useful to have an aclocal.m4 rule in the
Makefile.in, but it's fine with me to add it as follow ups.

We may end up with trouble in how the IPA is built as soon as
something in the code that is also built by the IPA relies on
gnulib, but we can cross that bridge when we get to it.
It is only built on x86 GNU/Linux, which always has stdint.h,
and, it doesn't use memmem.

--
Pedro Alves