[Crash-utility] Re: [PATCH v2] LoongArch64: Fixed link errors when build on LOONGARCH64 machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024/03/08 12:18, 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.
> 
> v1 -> v2:
> Fix compilation errors.

Thanks for the v2, the warnings are gone.  but I found another problem..

When we add a patch to gdb-10.2.patch, a LOONGARCH64 build will fail with
the following redefinition errors.  There is need to remove the gdb-10.2
directory before rebuilding.  It looks like it's because the patch command
cannot detect previously applied patches for newly created loongarch files,
and those files get duplicated code..

$ git am /tmp/0001-LoongArch64-Fixed-link-errors-when-build-on-LOO.patch
Applying: LoongArch64: Fixed link errors when build on LOONGARCH64 machine
$ make -j 16 warn target=LOONGARCH64
...
patching file gdb-10.2/bfd/configure.ac
Reversed (or previously applied) patch detected!  Skipping patch.
1 out of 1 hunk ignored
patching file gdb-10.2/bfd/cpu-loongarch.c   <<-- cannot detect previously applied patch
patching file gdb-10.2/bfd/elf-bfd.h
patching file gdb-10.2/bfd/elf.c
...
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -DBINDIR=\"/usr/local/bin\" -DLIBDIR=\"/usr/local/lib\" -I. -I. -I./../include -DHAVE_loongarch_elf64_vec -DHAVE_loongarch_elf32_vec -DHAVE_elf64_le_vec -DHAVE_elf64_be_vec -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -I./../zlib -g -O2 -MT elf-properties.lo -
MD -MP -MF .deps/elf-properties.Tpo -c elf-properties.c -o elf-properties.o
cpu-loongarch.c:86:33: error: redefinition of 'bfd_loongarch32_arch'
    static const bfd_arch_info_type bfd_loongarch32_arch =
                                    ^~~~~~~~~~~~~~~~~~~~
...
make: *** [Makefile:254: all] Error 2

$ grep BFD gdb-10.2/bfd/cpu-loongarch.c
/* BFD support for LoongArch.
      This file is part of BFD, the Binary File Descriptor library.
/* BFD support for LoongArch.
      This file is part of BFD, the Binary File Descriptor library.


I found that it's due to not using '/dev/null' for the newly added files
in gdb-10.2.patch.  I'd like to fix this issue before applying this patch.

I've attached two patches:
- 1/2 fixes the issue above.
- 2/2 is Ming's patch and I added "rm -f gdb-10.2/gdb/loongarch-linux-tdep.c"
   for the file modified multiple times (but not included in gdb-10.2.tar.gz.)
   
Ming, Lianbo, could you check these?

Thanks,
Kazu


> 
> Reported-by: Xiujie Jiang <jiangxiujie@xxxxxxxxxx>
> Signed-off-by: Ming Wang <wangming01@xxxxxxxxxxx>
> ---
>   gdb-10.2.patch | 33 +++++++++++++++++++++++++++++++++
>   1 file changed, 33 insertions(+)
> 
> diff --git a/gdb-10.2.patch b/gdb-10.2.patch
> index a7018a2..5d34407 100644
> --- a/gdb-10.2.patch
> +++ b/gdb-10.2.patch
> @@ -16057,3 +16057,36 @@ 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,30 @@ _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>
> ++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);
> ++
> ++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));
> ++}
From 32737e592c375973d924f1098d96376f64d20e02 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
Date: Wed, 13 Mar 2024 15:43:20 +0900
Subject: [PATCH 1/2] gdb-10.2.patch: Fix duplicated code by re-applying patch

When adding a patch to gdb-10.2.patch, a LOONGARCH64 build will fail
with the following redefinition errors.  There is need to remove the
gdb-10.2 directory before rebuilding.  It's because the patch command
cannot detect previously applied patches for newly created loongarch
files and those files get duplicated code.

  $ git am /tmp/0001-LoongArch64-Fixed-link-errors-when-build-on-LOO.patch
  Applying: LoongArch64: Fixed link errors when build on LOONGARCH64 machine
  $ make -j 16 warn target=LOONGARCH64
  ...
  patching file gdb-10.2/bfd/configure.ac
  Reversed (or previously applied) patch detected!  Skipping patch.
  1 out of 1 hunk ignored
  patching file gdb-10.2/bfd/cpu-loongarch.c   <<-- cannot detect previously applied patch
  patching file gdb-10.2/bfd/elf-bfd.h
  patching file gdb-10.2/bfd/elf.c
  ...
  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -DBINDIR=\"/usr/local/bin\" ...
  cpu-loongarch.c:86:33: error: redefinition of 'bfd_loongarch32_arch'
     static const bfd_arch_info_type bfd_loongarch32_arch =
                                     ^~~~~~~~~~~~~~~~~~~~
  ...
  make: *** [Makefile:254: all] Error 2

To fix this, change the file path of newly created files from "*.orig"
to "/dev/null" so that patch command can detect previously applied
patches.

Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 gdb-10.2.patch | 62 +++++++++++++++++++++++++-------------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index a7018a249118..fbf79104368f 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -3589,7 +3589,7 @@ exit 0
      m32c_elf32_vec)		 tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
      m32r_elf32_vec)		 tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
      m32r_elf32_le_vec)		 tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
---- gdb-10.2/bfd/cpu-loongarch.c.orig
+--- /dev/null
 +++ gdb-10.2/bfd/cpu-loongarch.c
 @@ -0,0 +1,61 @@
 +/* BFD support for LoongArch.
@@ -3836,7 +3836,7 @@ exit 0
  
  bfd_boolean
  _bfd_elf_is_function_type (unsigned int type)
---- gdb-10.2/bfd/elfnn-loongarch.c.orig
+--- /dev/null
 +++ gdb-10.2/bfd/elfnn-loongarch.c
 @@ -0,0 +1,4128 @@
 +/* LoongArch-specific support for NN-bit ELF.
@@ -7967,7 +7967,7 @@ exit 0
 +#define elf_backend_hash_symbol elf_loongarch64_hash_symbol
 +
 +#include "elfNN-target.h"
---- gdb-10.2/bfd/elfxx-loongarch.c.orig
+--- /dev/null
 +++ gdb-10.2/bfd/elfxx-loongarch.c
 @@ -0,0 +1,1618 @@
 +/* LoongArch-specific support for ELF.
@@ -9588,7 +9588,7 @@ exit 0
 +  return ((loongarch_reloc_howto_type *)
 +	  howto)->adjust_reloc_bits(howto, fix_val);
 +}
---- gdb-10.2/bfd/elfxx-loongarch.h.orig
+--- /dev/null
 +++ gdb-10.2/bfd/elfxx-loongarch.h
 @@ -0,0 +1,45 @@
 +/* LoongArch-specific backend routines.
@@ -9841,7 +9841,7 @@ exit 0
  	m32r-linux-nat.c \
  	m32r-linux-tdep.c \
  	m32r-tdep.c \
---- gdb-10.2/gdb/arch/loongarch.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/arch/loongarch.c
 @@ -0,0 +1,75 @@
 +/* Copyright (C) 2021 Free Software Foundation, Inc.
@@ -9919,7 +9919,7 @@ exit 0
 +{
 +    return loongarch_create_target_description (rlen, flen, 0, 0, 0);
 +}
---- gdb-10.2/gdb/arch/loongarch.h.orig
+--- /dev/null
 +++ gdb-10.2/gdb/arch/loongarch.h
 @@ -0,0 +1,35 @@
 +/*
@@ -10059,7 +10059,7 @@ exit 0
  	riscv/32bit-cpu.xml \
  	riscv/32bit-fpu.xml \
  	riscv/64bit-cpu.xml \
---- gdb-10.2/gdb/features/loongarch/base32.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/base32.c
 @@ -0,0 +1,48 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10110,7 +10110,7 @@ exit 0
 +  tdesc_create_reg (feature, "badv", regnum++, 1, "general", 32, "code_ptr");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/base32.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/base32.xml
 @@ -0,0 +1,46 @@
 +<?xml version="1.0"?>
@@ -10159,7 +10159,7 @@ exit 0
 +  <reg name="pc" bitsize="32" type="code_ptr" group="general"/>
 +  <reg name="badv" bitsize="32" type="code_ptr" group="general"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/base64.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/base64.c
 @@ -0,0 +1,48 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10210,7 +10210,7 @@ exit 0
 +  tdesc_create_reg (feature, "badv", regnum++, 1, "general", 64, "code_ptr");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/base64.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/base64.xml
 @@ -0,0 +1,46 @@
 +<?xml version="1.0"?>
@@ -10259,7 +10259,7 @@ exit 0
 +  <reg name="pc" bitsize="64" type="code_ptr" group="general"/>
 +  <reg name="badv" bitsize="64" type="code_ptr" group="general"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/fpu32.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/fpu32.c
 @@ -0,0 +1,54 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10316,7 +10316,7 @@ exit 0
 +  tdesc_create_reg (feature, "fcsr", regnum++, 1, "float", 32, "uint32");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/fpu32.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/fpu32.xml
 @@ -0,0 +1,53 @@
 +<?xml version="1.0"?>
@@ -10372,7 +10372,7 @@ exit 0
 +  <reg name="fcc7" bitsize="8" type="uint8" group="float"/>
 +  <reg name="fcsr" bitsize="32" type="uint32" group="float"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/fpu64.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/fpu64.c
 @@ -0,0 +1,62 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10437,7 +10437,7 @@ exit 0
 +  tdesc_create_reg (feature, "fcsr", regnum++, 1, "float", 32, "uint32");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/fpu64.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/fpu64.xml
 @@ -0,0 +1,58 @@
 +<?xml version="1.0"?>
@@ -10498,7 +10498,7 @@ exit 0
 +  <reg name="fcc7" bitsize="8" type="uint8" group="float"/>
 +  <reg name="fcsr" bitsize="32" type="uint32" group="float"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/lasx.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lasx.c
 @@ -0,0 +1,80 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10581,7 +10581,7 @@ exit 0
 +  tdesc_create_reg (feature, "xr31", regnum++, 1, "lasx", 256, "lasxv");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/lasx.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lasx.xml
 @@ -0,0 +1,59 @@
 +<?xml version="1.0"?>
@@ -10643,7 +10643,7 @@ exit 0
 +  <reg name="xr30" bitsize="256" type="lasxv" group="lasx"/>
 +  <reg name="xr31" bitsize="256" type="lasxv" group="lasx"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/lbt32.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lbt32.c
 @@ -0,0 +1,19 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10665,7 +10665,7 @@ exit 0
 +  tdesc_create_reg (feature, "x86_top", regnum++, 1, "lbt", 8, "uint8");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/lbt32.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lbt32.xml
 @@ -0,0 +1,17 @@
 +<?xml version="1.0"?>
@@ -10685,7 +10685,7 @@ exit 0
 +  <reg name="EFLAG" bitsize="32" type="uint32" group="lbt"/>
 +  <reg name="x86_top" bitsize="8" type="uint8" group="lbt"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/lbt64.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lbt64.c
 @@ -0,0 +1,19 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10707,7 +10707,7 @@ exit 0
 +  tdesc_create_reg (feature, "x86_top", regnum++, 1, "lbt", 8, "uint8");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/lbt64.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lbt64.xml
 @@ -0,0 +1,17 @@
 +<?xml version="1.0"?>
@@ -10727,7 +10727,7 @@ exit 0
 +  <reg name="EFLAG" bitsize="32" type="uint32" group="lbt"/>
 +  <reg name="x86_top" bitsize="8" type="uint8" group="lbt"/>
 +</feature>
---- gdb-10.2/gdb/features/loongarch/lsx.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lsx.c
 @@ -0,0 +1,80 @@
 +/* THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi:set ro:
@@ -10810,7 +10810,7 @@ exit 0
 +  tdesc_create_reg (feature, "vr31", regnum++, 1, "lsx", 128, "lsxv");
 +  return regnum;
 +}
---- gdb-10.2/gdb/features/loongarch/lsx.xml.orig
+--- /dev/null
 +++ gdb-10.2/gdb/features/loongarch/lsx.xml
 @@ -0,0 +1,59 @@
 +<?xml version="1.0"?>
@@ -10872,7 +10872,7 @@ exit 0
 +  <reg name="vr30" bitsize="128" type="lsxv" group="lsx"/>
 +  <reg name="vr31" bitsize="128" type="lsxv" group="lsx"/>
 +</feature>
---- gdb-10.2/gdb/loongarch-linux-tdep.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/loongarch-linux-tdep.c
 @@ -0,0 +1,709 @@
 +/* Target-dependent code for GNU/Linux LoongArch.
@@ -11584,7 +11584,7 @@ exit 0
 +  gdbarch_register_osabi (bfd_arch_loongarch, bfd_mach_loongarch64,
 +                          GDB_OSABI_LINUX, loongarch_linux_init_abi);
 +}
---- gdb-10.2/gdb/loongarch-linux-tdep.h.orig
+--- /dev/null
 +++ gdb-10.2/gdb/loongarch-linux-tdep.h
 @@ -0,0 +1,48 @@
 +/* GNU/Linux on LoongArch target support, prototypes.
@@ -11635,7 +11635,7 @@ exit 0
 +extern const struct regset loongarch_elf_lasxregset;
 +
 +#endif
---- gdb-10.2/gdb/loongarch-tdep.c.orig
+--- /dev/null
 +++ gdb-10.2/gdb/loongarch-tdep.c
 @@ -0,0 +1,1926 @@
 +/* Target-dependent code for GNU/Linux LoongArch.
@@ -13564,7 +13564,7 @@ exit 0
 +When non-zero, loongarch specific debugging is enabled."),
 +			     NULL, NULL, &setdebuglist, &showdebuglist);
 +}
---- gdb-10.2/gdb/loongarch-tdep.h.orig
+--- /dev/null
 +++ gdb-10.2/gdb/loongarch-tdep.h
 @@ -0,0 +1,61 @@
 +/* Target-dependent code for GNU/Linux LoongArch.
@@ -13735,7 +13735,7 @@ exit 0
  #define NT_SIGINFO	0x53494749	/* Fields of siginfo_t.  */
  #define NT_FILE		0x46494c45	/* Description of mapped files.  */
  
---- gdb-10.2/include/elf/loongarch.h.orig
+--- /dev/null
 +++ gdb-10.2/include/elf/loongarch.h
 @@ -0,0 +1,267 @@
 +/* Copyright (C) 2021-2022 Free Software Foundation, Inc.
@@ -14005,7 +14005,7 @@ exit 0
 +  (!((EF_LOONGARCH_ABI(abi) & EF_LOONGARCH_ABI_FLOAT_MASK) ^ EF_LOONGARCH_ABI_DOUBLE_FLOAT_MASK))
 +
 +#endif /* _ELF_LOONGARCH_H */
---- gdb-10.2/include/opcode/loongarch.h.orig
+--- /dev/null
 +++ gdb-10.2/include/opcode/loongarch.h
 @@ -0,0 +1,239 @@
 +/* LoongArch assembler/disassembler support.
@@ -14343,7 +14343,7 @@ exit 0
  
  extern disassembler_ftype csky_get_disassembler (bfd *);
  extern disassembler_ftype rl78_get_disassembler (bfd *);
---- gdb-10.2/opcodes/loongarch-coder.c.orig
+--- /dev/null
 +++ gdb-10.2/opcodes/loongarch-coder.c
 @@ -0,0 +1,481 @@
 +/* LoongArch opcode support.
@@ -14827,7 +14827,7 @@ exit 0
 +      *dest++ = *src++;
 +    }
 +}
---- gdb-10.2/opcodes/loongarch-dis.c.orig
+--- /dev/null
 +++ gdb-10.2/opcodes/loongarch-dis.c
 @@ -0,0 +1,342 @@
 +/* LoongArch opcode support.
@@ -15172,7 +15172,7 @@ exit 0
 +  my_disinfo.target = pc;
 +  disassemble_one (insn, &my_disinfo);
 +}
---- gdb-10.2/opcodes/loongarch-opc.c.orig
+--- /dev/null
 +++ gdb-10.2/opcodes/loongarch-opc.c
 @@ -0,0 +1,870 @@
 +/* LoongArch opcode support.
-- 
2.31.1

From 8af275efc7d00a8d21c8655a9b507dbea826fe78 Mon Sep 17 00:00:00 2001
From: Ming Wang <wangming01@xxxxxxxxxxx>
Date: Fri, 8 Mar 2024 11:18:53 +0800
Subject: [PATCH 2/2] LoongArch64: Fixed link errors when build on LOONGARCH64
 machine

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.

[ kh: added rm command for gdb files added and modified multiple times. ]

Reported-by: Xiujie Jiang <jiangxiujie@xxxxxxxxxx>
Signed-off-by: Ming Wang <wangming01@xxxxxxxxxxx>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 gdb-10.2.patch | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index fbf79104368f..7416efed9d05 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -18,6 +18,10 @@ tar xvzmf gdb-10.2.tar.gz \
 	gdb-10.2/gdb/objfiles.h \
 	gdb-10.2/bfd/elf-bfd.h
 
+# For newly added gdb files, remove them to be its original state.
+
+rm -f gdb-10.2/gdb/loongarch-linux-tdep.c
+
 exit 0
 
 --- gdb-10.2/Makefile.in.orig
@@ -16057,3 +16061,36 @@ 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,30 @@ _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>
++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);
++
++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));
++}
-- 
2.31.1

--
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

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux