On 06/22/2016 07:17 PM, ayush goel wrote: > > Hi, I am working on importing gnulib library inside the gcc tree. > Should the library be imported in the top level directory along with > other libraries (like libiberty, libatomic, liboffloadmic etc), or > should it be imported inside gcc/ like it is done in the binutils-gdb > tree. There they have a gnulib directory inside gdb/ in the top level > directory.
I think that top level is better. Let me touch a bit on why gdb doesn't put it at top level. Follow the URL further below for more. The way gdb's gnulib import is set up nowadays, we have a single gnulib copy that is used by both gdb and gdbserver (two separate programs). gdb imports gnulib in a way that makes it a separate library, configured separately from the programs that use it (gdb and gdbserver), which is unlike the usual way gnulib is imported, but I think it's the right thing to do. gdb doesn't put that gnulib wrapper library at the top level, mainly just because of history -- we didn't always have that wrapper library -- and the fact that gdb/gdbserver/ itself is not at top level either, even though it would be better moved to top level. See this long email, explaining how the current gdb's gnulib import is set up: https://sourceware.org/ml/gdb-patches/2012-04/msg00426.html I suggest gcc reuses the whole of gdb's wrapper library and scripts: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=tree;f=gdb/gnulib;h=cdf326774716ae427dc4fb47c9a410fcdf715563;hb=HEAD ... but put it in the top level instead. A side effect of putting gnulib in a separately configured directory, is that you end up with a config.h in the gnulib build directory that needs to be included by the programs that make use of gnulib. Meaning, gdb #includes _two_ "config.h" files. See gdb/common/common-defs.h. Thanks, Pedro Alves