[ was: Re: gdbserver build broken with -fsanitize=address ] On 1/6/21 8:39 AM, Tom de Vries wrote: > [ was: Re: [PATCH] gdb: improve command completion for 'print', 'x', and > 'display' ] > > On 12/11/20 11:07 PM, Andrew Burgess wrote: >> * Tom Tromey [2020-12-03 10:03:06 -0700]: >> >>>>>>>> "Andrew" == Andrew Burgess writes: >>> >>>>> skip_* are intended for use by gdb commands -- they originally lived in >>>>> gdb/cli/ -- so if they do the wrong thing in some situation, they should >>>>> definitely be changed. >>> >>> Andrew> Like this? >>> >>> Works for me, thanks. >> >> Turns out that libinproctrace.so did not link against libiberty, so I >> fixed that and pushed the patch below. >> > > Hi, > > I tried to build gdb with asan (using CFLAGS/CXXFLAGS="-O0 -g > -fsanitize=address" and LDFLAGS=-lasan), and ran into: > ... > /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: ../libiberty/libiberty.a(safe-ctype.o): > relocation R_X86_64_32 against `.data' can not be used when making a > shared object; recompile with -fPIC > collect2: error: ld returned 1 exit status > make[1]: *** [libinproctrace.so] Error 1 > ... > > Using this patch, I got things building again: > ... > diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in > index a2fe302d247..671cc67177e 100644 > --- a/gdbserver/Makefile.in > +++ b/gdbserver/Makefile.in > @@ -102,7 +102,7 @@ CC_LD = $(CXX) $(CXX_DIALECT) > INCLUDE_DIR = ${srcdir}/../include > INCLUDE_DEP = $$(INCLUDE_DIR) > > -LIBIBERTY_BUILDDIR = ../libiberty > +LIBIBERTY_BUILDDIR = ../libiberty/noasan > LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a > > GDBSUPPORT_BUILDDIR = ../gdbsupport > ... > but this means that libiberty/noasan is also used for the gdbserver > binary, which is probably too restrictive. > Attached patch fixes the issue. Any comments? Thanks, - Tom