Hi, Kazu On 3/6/24 15:50, HAGIO KAZUHITO(萩尾 一仁) wrote: > On 2024/02/29 12:33, Ming Wang wrote: >> The following link error exists when building with LOONGARCH64 >> machine: >> >> /usr/bin/ld: proc-service.o: in function `.LVL71': >> proc-service.c:(.text+0x324): undefined reference to `fill_gregset ... >> /usr/bin/ld: proc-service.o: in function `.LVL77': >> proc-service.c:(.text+0x364): undefined reference to `supply_gregset ... >> /usr/bin/ld: proc-service.o: in function `.LVL87': >> proc-service.c:(.text+0x3c4): undefined reference to `fill_fpregset ... >> /usr/bin/ld: proc-service.o: in function `.LVL93': >> proc-service.c:(.text+0x404): undefined reference to `supply_fpregset >> collect2: error: ld returned 1 exit status >> >> The cause of the error is that the definition of a function such as >> fill_gregset is not implemented. This patch is used to fix this error. >> >> Reported-by: Xiujie Jiang <jiangxiujie@xxxxxxxxxx> >> Signed-off-by: Ming Wang <wangming01@xxxxxxxxxxx> >> --- >> gdb-10.2.patch | 40 ++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 40 insertions(+) >> >> diff --git a/gdb-10.2.patch b/gdb-10.2.patch >> index a7018a2..a418209 100644 >> --- a/gdb-10.2.patch >> +++ b/gdb-10.2.patch >> @@ -16057,3 +16057,43 @@ exit 0 >> m10200-dis.c >> m10200-opc.c >> m10300-dis.c >> +--- gdb-10.2/gdb/loongarch-linux-tdep.c.orig >> ++++ gdb-10.2/gdb/loongarch-linux-tdep.c >> +@@ -707,3 +707,37 @@ _initialize_loongarch_linux_tdep () >> + gdbarch_register_osabi (bfd_arch_loongarch, bfd_mach_loongarch64, >> + GDB_OSABI_LINUX, loongarch_linux_init_abi); >> + } >> ++ >> ++/* Wrapper functions. These are only used by libthread_db. */ >> ++#include <sys/procfs.h> >> ++void >> ++supply_gregset (struct regcache *regcache, >> ++ const prgregset_t *gregset) >> ++{ >> ++ loongarch_elf_gregset.supply_regset (NULL, regcache, -1, gregset, >> ++ sizeof (prgregset_t)); >> ++} >> ++ >> ++void >> ++fill_gregset (const struct regcache *regcache, >> ++ prgregset_t *gregset, int regno) >> ++{ >> ++ loongarch_elf_gregset.collect_regset (NULL, regcache, regno, gregset, >> ++ sizeof (prgregset_t)); >> ++} >> ++ >> ++void >> ++supply_fpregset (struct regcache *regcache, >> ++ const prfpregset_t *fpregset) >> ++{ >> ++ loongarch_elf_fpregset.supply_regset (NULL, regcache, -1, fpregset, >> ++ sizeof (prfpregset_t)); >> ++} >> ++ >> ++void >> ++fill_fpregset (const struct regcache *regcache, >> ++ prfpregset_t *fpregset, int regno) >> ++{ >> ++ loongarch_elf_fpregset.collect_regset (NULL, regcache, regno, fpregset, >> ++ sizeof (prfpregset_t)); >> ++} > the following warnings are emitted, is it possible to suppress these? Thanks. I will fix the compilation warnings in the next version. > > $ make -j 16 warn target=LOONGARCH64 > > loongarch-linux-tdep.c:714:1: warning: no previous declaration for 'void supply_gregset(regcache*, const elf_greg_t (*)[27])' [-Wmissing-declarations] > supply_gregset (struct regcache *regcache, > ^~~~~~~~~~~~~~ > loongarch-linux-tdep.c:722:1: warning: no previous declaration for 'void fill_gregset(const regcache*, elf_greg_t (*)[27], int)' [-Wmissing-declarations] > fill_gregset (const struct regcache *regcache, > ^~~~~~~~~~~~ > loongarch-linux-tdep.c:730:1: warning: no previous declaration for 'void supply_fpregset(regcache*, const prfpregset_t*)' [-Wmissing-declarations] > supply_fpregset (struct regcache *regcache, > ^~~~~~~~~~~~~~~ > loongarch-linux-tdep.c:738:1: warning: no previous declaration for 'void fill_fpregset(const regcache*, prfpregset_t*, int)' [-Wmissing-declarations] > fill_fpregset (const struct regcache *regcache, > ^~~~~~~~~~~~~ > > Looking at the gdb repository, the functions above are in gdb/loongarch-linux-nat.c > and it includes "gregset.h"? Yes. When I was simplifying the gdb backport patch, I simplified the gdb/loongarch-linux-nat.c file in order to minimize changes. At that time I did a build verification under x86 without any problems. Recently I received feedback that there were linking errors when building under LoongArch64 machines. Also to minimize changes, I implemented the missing functions in the gdb/loongarch-linux-tdep.c file instead of continuing to backport the gdb/loongarch-linux-nat.c file. I just tried adding a statement to solve the compilation warning, modified as follows: +extern void supply_gregset (struct regcache *regcache,const prgregset_t *gregset); +extern void fill_gregset (const struct regcache *regcache, prgregset_t *gregset, int regno); +extern void supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregset); +extern void fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregset, int regno); Sorry for the problem with the previous test and not testing the local build. Thanks, Ming -- Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/ Contribution Guidelines: https://github.com/crash-utility/crash/wiki