diff options
author | Mark Hatle <mark.hatle@amd.com> | 2024-07-23 16:56:25 -0600 |
---|---|---|
committer | Mark Hatle <mark.hatle@amd.com> | 2024-07-24 20:54:18 -0600 |
commit | fe74892eda4264c1c1839144460a0c41ee88aafe (patch) | |
tree | 186c006e3b0c41c9e023c4384d24681e473c2a4b | |
parent | d059ba9a0a3c5cc209cfb10d4f81ad4cbc3c5700 (diff) | |
download | meta-xilinx-fe74892eda4264c1c1839144460a0c41ee88aafe.tar.gz |
meta-microblaze: gdb: Fix target GDB compilation for Linux native
Add patch for Linux native issue
Add library linkage to libatomic to address:
ld: /usr/include/c++/13.3.0/bits/atomic_base.h:1015:(.text+0x16d0c): undefined reference to `__atomic_compare_exchange_1'
Also remove extra files no longer required.
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
4 files changed, 29 insertions, 75 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc deleted file mode 100644 index c463574b..00000000 --- a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | inherit cross-canadian | ||
2 | inherit python3-dir | ||
3 | inherit pkgconfig | ||
4 | |||
5 | SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)" | ||
6 | PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
7 | BPN = "gdb" | ||
8 | |||
9 | DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext nativesdk-gmp \ | ||
10 | virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc" | ||
11 | |||
12 | GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'" | ||
13 | |||
14 | # Overrides PACKAGECONFIG variables in gdb-common.inc | ||
15 | PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}" | ||
16 | PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,nativesdk-python3, \ | ||
17 | nativesdk-python3-core \ | ||
18 | nativesdk-python3-codecs nativesdk-python3-netclient \ | ||
19 | " | ||
20 | PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline" | ||
21 | PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, nativesdk-elfutils" | ||
22 | |||
23 | SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_DATADIR}/gdb" | ||
24 | |||
25 | do_configure:prepend() { | ||
26 | cat > ${WORKDIR}/python << EOF | ||
27 | #! /bin/sh | ||
28 | case "\$2" in | ||
29 | --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; | ||
30 | --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; | ||
31 | --exec-prefix) echo "${exec_prefix}" ;; | ||
32 | *) exit 1 ;; | ||
33 | esac | ||
34 | exit 0 | ||
35 | EOF | ||
36 | chmod +x ${WORKDIR}/python | ||
37 | } | ||
38 | |||
39 | # we don't want gdb to provide bfd/iberty/opcodes, which instead will override the | ||
40 | # right bits installed by binutils. | ||
41 | do_install:append() { | ||
42 | rm -rf ${D}${exec_prefix}/lib | ||
43 | cross_canadian_bindirlinks | ||
44 | } | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc deleted file mode 100644 index b418f3a3..00000000 --- a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | require gdb-common.inc | ||
2 | |||
3 | DEPENDS = "expat-native gmp-native ncurses-native flex-native bison-native" | ||
4 | |||
5 | inherit python3native pkgconfig | ||
6 | |||
7 | # Overrides PACKAGECONFIG variables in gdb-common.inc | ||
8 | PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}" | ||
9 | PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3-native" | ||
10 | PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline-native" | ||
11 | PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils-native" | ||
12 | |||
13 | do_compile:prepend() { | ||
14 | export STAGING_LIBDIR="${STAGING_LIBDIR_NATIVE}" | ||
15 | export STAGING_INCDIR="${STAGING_INCDIR_NATIVE}" | ||
16 | } | ||
17 | |||
18 | #EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'" | ||
19 | |||
20 | GDBPROPREFIX = "" | ||
21 | |||
22 | PN = "gdb-cross-${TARGET_ARCH}" | ||
23 | BPN = "gdb" | ||
24 | |||
25 | # Ignore how TARGET_ARCH is computed. | ||
26 | TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" | ||
27 | |||
28 | inherit cross | ||
29 | inherit gettext | ||
30 | |||
31 | datadir .= "/gdb-${TARGET_SYS}${TARGET_VENDOR}-${TARGET_OS}" | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc index 151e7c25..4e8993c4 100644 --- a/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc +++ b/meta-microblaze/recipes-devtools/gdb/gdb-microblaze.inc | |||
@@ -7,6 +7,8 @@ FILESEXTRAPATHS:append := ":${THISDIR}/gdb" | |||
7 | # Our changes are all local, no real patch-status | 7 | # Our changes are all local, no real patch-status |
8 | ERROR_QA:remove = "patch-status" | 8 | ERROR_QA:remove = "patch-status" |
9 | 9 | ||
10 | LDFLAGS:append:class-target:microblaze = " -latomic" | ||
11 | |||
10 | SRC_URI:append:microblaze = " \ | 12 | SRC_URI:append:microblaze = " \ |
11 | file://0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \ | 13 | file://0001-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \ |
12 | file://0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \ | 14 | file://0002-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch \ |
@@ -51,4 +53,5 @@ SRC_URI:append:microblaze = " \ | |||
51 | file://0052-Wrong-target-description-accepted-by-microblaze-arch.patch \ | 53 | file://0052-Wrong-target-description-accepted-by-microblaze-arch.patch \ |
52 | file://0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch \ | 54 | file://0053-Merge-gdb-microblaze-linux-tdep.c-to-gdb-14-and-fix-.patch \ |
53 | file://0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch \ | 55 | file://0054-Roll-back-an-improvement-which-inlines-target_gdbarc.patch \ |
56 | file://0055-fix-microblaze-linux-nat.patch \ | ||
54 | " | 57 | " |
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch new file mode 100644 index 00000000..a0ac4d39 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0055-fix-microblaze-linux-nat.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | Fix compilation error on Linux native GDB | ||
2 | |||
3 | Signed-off-by: Mark Hatle <mark.hatle@amd.com> | ||
4 | |||
5 | Index: gdb-14.2/gdb/microblaze-linux-nat.c | ||
6 | =================================================================== | ||
7 | --- gdb-14.2.orig/gdb/microblaze-linux-nat.c | ||
8 | +++ gdb-14.2/gdb/microblaze-linux-nat.c | ||
9 | @@ -96,7 +96,7 @@ static int | ||
10 | microblaze_register_u_addr (struct gdbarch *gdbarch, int regno) | ||
11 | { | ||
12 | int u_addr = -1; | ||
13 | - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
14 | + microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch); | ||
15 | /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace | ||
16 | * interface, and not the wordsize of the program's ABI. */ | ||
17 | int wordsize = sizeof (long); | ||
18 | @@ -191,7 +192,7 @@ static void | ||
19 | fetch_register (struct regcache *regcache, int tid, int regno) | ||
20 | { | ||
21 | struct gdbarch *gdbarch = regcache->arch (); | ||
22 | - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
23 | + microblaze_gdbarch_tdep *tdep = gdbarch_tdep<microblaze_gdbarch_tdep> (gdbarch); | ||
24 | /* This isn't really an address. But ptrace thinks of it as one. */ | ||
25 | CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno); | ||
26 | int bytes_transferred; | ||