diff options
| author | Mark Hatle <mark.hatle@kernel.crashing.org> | 2021-01-23 20:06:52 -0600 |
|---|---|---|
| committer | Mark Hatle <mark.hatle@kernel.crashing.org> | 2021-02-03 10:03:34 -0600 |
| commit | e0b98958b4f5fbc346c8bca8ad4fc432f53f0435 (patch) | |
| tree | 69eb9712bf657f54422b9238ba1546c4cfec7c9d /meta-microblaze/recipes-devtools/gdb | |
| parent | 613da127377fe5cc623ddfa5d3babc3666a2d6b6 (diff) | |
| download | meta-xilinx-e0b98958b4f5fbc346c8bca8ad4fc432f53f0435.tar.gz | |
meta-microblaze gdb: Backport gdb 9.2 from master YP, and lock down version
We're not ready to move to a newer version of gdb at this time, so lock down on version 9.2.
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Diffstat (limited to 'meta-microblaze/recipes-devtools/gdb')
19 files changed, 1503 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc b/meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc new file mode 100644 index 00000000..017b61ef --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-9.2.inc | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3" | ||
| 2 | LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \ | ||
| 3 | file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \ | ||
| 4 | file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \ | ||
| 5 | file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674" | ||
| 6 | |||
| 7 | SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \ | ||
| 8 | file://0001-make-man-install-relative-to-DESTDIR.patch \ | ||
| 9 | file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \ | ||
| 10 | file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \ | ||
| 11 | file://0004-Add-support-for-Renesas-SH-sh4-architecture.patch \ | ||
| 12 | file://0005-Dont-disable-libreadline.a-when-using-disable-static.patch \ | ||
| 13 | file://0006-use-asm-sgidefs.h.patch \ | ||
| 14 | file://0007-Use-exorted-definitions-of-SIGRTMIN.patch \ | ||
| 15 | file://0008-Change-order-of-CFLAGS.patch \ | ||
| 16 | file://0009-resolve-restrict-keyword-conflict.patch \ | ||
| 17 | file://0010-Fix-invalid-sigprocmask-call.patch \ | ||
| 18 | file://0011-gdbserver-ctrl-c-handling.patch \ | ||
| 19 | " | ||
| 20 | SRC_URI[md5sum] = "db95524e554870209ab7d9f8fd8dc557" | ||
| 21 | SRC_URI[sha256sum] = "360cd7ae79b776988e89d8f9a01c985d0b1fa21c767a4295e5f88cb49175c555" | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-common.inc b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc new file mode 100644 index 00000000..08f615ad --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-common.inc | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | SUMMARY = "GNU debugger" | ||
| 2 | HOMEPAGE = "http://www.gnu.org/software/gdb/" | ||
| 3 | SECTION = "devel" | ||
| 4 | DEPENDS = "expat zlib ncurses virtual/libiconv ${LTTNGUST} bison-native" | ||
| 5 | |||
| 6 | LTTNGUST = "lttng-ust" | ||
| 7 | LTTNGUST_arc = "" | ||
| 8 | LTTNGUST_aarch64 = "" | ||
| 9 | LTTNGUST_mipsarch = "" | ||
| 10 | LTTNGUST_sh4 = "" | ||
| 11 | |||
| 12 | inherit autotools texinfo | ||
| 13 | |||
| 14 | UPSTREAM_CHECK_GITTAGREGEX = "gdb\-(?P<pver>.+)\-release" | ||
| 15 | |||
| 16 | B = "${WORKDIR}/build-${TARGET_SYS}" | ||
| 17 | |||
| 18 | EXTRA_OEMAKE = "'SUBDIRS=intl mmalloc libiberty opcodes bfd sim gdb etc utils'" | ||
| 19 | |||
| 20 | EXPAT = "--with-expat --with-libexpat-prefix=${STAGING_DIR_HOST}" | ||
| 21 | |||
| 22 | EXTRA_OECONF = "--disable-gdbtk --disable-x --disable-werror \ | ||
| 23 | --with-curses --disable-multilib --disable-sim \ | ||
| 24 | --without-lzma --without-guile \ | ||
| 25 | ${GDBPROPREFIX} ${EXPAT} \ | ||
| 26 | ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \ | ||
| 27 | --disable-rpath \ | ||
| 28 | --disable-gas --disable-binutils \ | ||
| 29 | --disable-ld --disable-gold \ | ||
| 30 | --disable-gprof \ | ||
| 31 | " | ||
| 32 | |||
| 33 | PACKAGECONFIG ??= "readline" | ||
| 34 | # Use --without-system-readline to compile with readline 5. | ||
| 35 | PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline" | ||
| 36 | PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python3,python3 python3-codecs" | ||
| 37 | PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace" | ||
| 38 | # ncurses is already a hard DEPENDS, but would be added here if it weren't | ||
| 39 | PACKAGECONFIG[tui] = "--enable-tui,--disable-tui" | ||
| 40 | |||
| 41 | GDBPROPREFIX = "--program-prefix=''" | ||
| 42 | |||
| 43 | do_configure () { | ||
| 44 | # override this function to avoid the autoconf/automake/aclocal/autoheader | ||
| 45 | # calls for now | ||
| 46 | (cd ${S} && gnu-configize) || die "failure in running gnu-configize" | ||
| 47 | oe_runconf | ||
| 48 | } | ||
| 49 | |||
| 50 | # we don't want gdb to provide bfd/iberty/opcodes, which instead will override the | ||
| 51 | # right bits installed by binutils. Same for bfd.info -- also from binutils. | ||
| 52 | do_install_append() { | ||
| 53 | rm -rf ${D}${libdir} | ||
| 54 | rm -rf ${D}${includedir} | ||
| 55 | rm -rf ${D}${datadir}/locale | ||
| 56 | rm -f ${D}${infodir}/bfd.info | ||
| 57 | } | ||
| 58 | |||
| 59 | RRECOMMENDS_gdb_append_linux = " glibc-thread-db " | ||
| 60 | RRECOMMENDS_gdb_append_linux-gnueabi = " glibc-thread-db " | ||
| 61 | RRECOMMENDS_gdbserver_append_linux = " glibc-thread-db " | ||
| 62 | RRECOMMENDS_gdbserver_append_linux-gnueabi = " glibc-thread-db " | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc new file mode 100644 index 00000000..c9daf25a --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian.inc | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | inherit cross-canadian | ||
| 2 | inherit python3-dir | ||
| 3 | |||
| 4 | SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)" | ||
| 5 | PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
| 6 | BPN = "gdb" | ||
| 7 | |||
| 8 | DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext \ | ||
| 9 | virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-libc" | ||
| 10 | |||
| 11 | GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'" | ||
| 12 | |||
| 13 | # Overrides PACKAGECONFIG variables in gdb-common.inc | ||
| 14 | PACKAGECONFIG ??= "python readline" | ||
| 15 | PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,nativesdk-python3, \ | ||
| 16 | nativesdk-python3-core \ | ||
| 17 | nativesdk-python3-codecs nativesdk-python3-netclient \ | ||
| 18 | " | ||
| 19 | PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline" | ||
| 20 | |||
| 21 | SSTATE_DUPWHITELIST += "${STAGING_DATADIR}/gdb" | ||
| 22 | |||
| 23 | do_configure_prepend() { | ||
| 24 | cat > ${WORKDIR}/python << EOF | ||
| 25 | #! /bin/sh | ||
| 26 | case "\$2" in | ||
| 27 | --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; | ||
| 28 | --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; | ||
| 29 | --exec-prefix) echo "${exec_prefix}" ;; | ||
| 30 | *) exit 1 ;; | ||
| 31 | esac | ||
| 32 | exit 0 | ||
| 33 | EOF | ||
| 34 | chmod +x ${WORKDIR}/python | ||
| 35 | } | ||
| 36 | |||
| 37 | # we don't want gdb to provide bfd/iberty/opcodes, which instead will override the | ||
| 38 | # right bits installed by binutils. | ||
| 39 | do_install_append() { | ||
| 40 | rm -rf ${D}${exec_prefix}/lib | ||
| 41 | cross_canadian_bindirlinks | ||
| 42 | } | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb new file mode 100644 index 00000000..30103594 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross-canadian_9.2.bb | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | require gdb-common.inc | ||
| 2 | require gdb-cross-canadian.inc | ||
| 3 | require gdb-${PV}.inc | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc new file mode 100644 index 00000000..ebe329f6 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross.inc | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | require gdb-common.inc | ||
| 2 | |||
| 3 | DEPENDS = "expat-native ncurses-native flex-native bison-native" | ||
| 4 | |||
| 5 | inherit python3native | ||
| 6 | |||
| 7 | # Overrides PACKAGECONFIG variables in gdb-common.inc | ||
| 8 | PACKAGECONFIG ??= "python readline" | ||
| 9 | PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3-native" | ||
| 10 | PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline-native" | ||
| 11 | |||
| 12 | do_compile_prepend() { | ||
| 13 | export STAGING_LIBDIR="${STAGING_LIBDIR_NATIVE}" | ||
| 14 | export STAGING_INCDIR="${STAGING_INCDIR_NATIVE}" | ||
| 15 | } | ||
| 16 | |||
| 17 | #EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'" | ||
| 18 | |||
| 19 | GDBPROPREFIX = "" | ||
| 20 | |||
| 21 | PN = "gdb-cross-${TARGET_ARCH}" | ||
| 22 | BPN = "gdb" | ||
| 23 | |||
| 24 | # Ignore how TARGET_ARCH is computed. | ||
| 25 | TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" | ||
| 26 | |||
| 27 | inherit cross | ||
| 28 | inherit gettext | ||
| 29 | |||
| 30 | datadir .= "/gdb-${TARGET_SYS}${TARGET_VENDOR}-${TARGET_OS}" | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb b/meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb new file mode 100644 index 00000000..50cf159f --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb-cross_9.2.bb | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | require gdb-cross.inc | ||
| 2 | require gdb-${PV}.inc | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb.inc b/meta-microblaze/recipes-devtools/gdb/gdb.inc new file mode 100644 index 00000000..249e24dc --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb.inc | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | require gdb-common.inc | ||
| 2 | |||
| 3 | inherit gettext | ||
| 4 | |||
| 5 | #LDFLAGS_append = " -s" | ||
| 6 | #export CFLAGS_append=" -L${STAGING_LIBDIR}" | ||
| 7 | |||
| 8 | # cross-canadian must not see this | ||
| 9 | PACKAGES =+ "gdbserver" | ||
| 10 | FILES_gdbserver = "${bindir}/gdbserver" | ||
| 11 | |||
| 12 | ALLOW_EMPTY_gdbserver_riscv64 = "1" | ||
| 13 | ALLOW_EMPTY_gdbserver_riscv32 = "1" | ||
| 14 | |||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch new file mode 100644 index 00000000..82287ea1 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | From 036f8e1d387f65e52cb021dbb1bd28e8b75cf017 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 2 Mar 2015 02:27:55 +0000 | ||
| 4 | Subject: [PATCH] make man install relative to DESTDIR | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | sim/common/Makefile.in | 2 +- | ||
| 11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 12 | |||
| 13 | diff --git a/sim/common/Makefile.in b/sim/common/Makefile.in | ||
| 14 | index c6de14122c..c4b1214946 100644 | ||
| 15 | --- a/sim/common/Makefile.in | ||
| 16 | +++ b/sim/common/Makefile.in | ||
| 17 | @@ -35,7 +35,7 @@ tooldir = $(libdir)/$(target_alias) | ||
| 18 | datarootdir = @datarootdir@ | ||
| 19 | datadir = @datadir@ | ||
| 20 | mandir = @mandir@ | ||
| 21 | -man1dir = $(mandir)/man1 | ||
| 22 | +man1dir = $(DESTDIR)$(mandir)/man1 | ||
| 23 | infodir = @infodir@ | ||
| 24 | includedir = @includedir@ | ||
| 25 | |||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch new file mode 100644 index 00000000..6067caf6 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From 6bff2862f9597f324a9385eb2f828e838e51a8a1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 23 Mar 2016 06:30:09 +0000 | ||
| 4 | Subject: [PATCH] mips-linux-nat: Define _ABIO32 if not defined | ||
| 5 | |||
| 6 | This helps building gdb on mips64 on musl, since | ||
| 7 | musl does not provide sgidefs.h this define is | ||
| 8 | only defined when GCC is using o32 ABI, in that | ||
| 9 | case gcc emits it as built-in define and hence | ||
| 10 | it works ok for mips32 | ||
| 11 | |||
| 12 | Upstream-Status: Pending | ||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | --- | ||
| 15 | gdb/mips-linux-nat.c | 4 ++++ | ||
| 16 | 1 file changed, 4 insertions(+) | ||
| 17 | |||
| 18 | diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c | ||
| 19 | index 104c972f24..7f575b3363 100644 | ||
| 20 | --- a/gdb/mips-linux-nat.c | ||
| 21 | +++ b/gdb/mips-linux-nat.c | ||
| 22 | @@ -41,6 +41,10 @@ | ||
| 23 | #ifndef PTRACE_GET_THREAD_AREA | ||
| 24 | #define PTRACE_GET_THREAD_AREA 25 | ||
| 25 | #endif | ||
| 26 | +/* musl does not define and relies on compiler built-in macros for it */ | ||
| 27 | +#ifndef _ABIO32 | ||
| 28 | +#define _ABIO32 1 | ||
| 29 | +#endif | ||
| 30 | |||
| 31 | class mips_linux_nat_target final : public linux_nat_trad_target | ||
| 32 | { | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch new file mode 100644 index 00000000..c4bab7bb --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | From d5817bcf2f7313699bfa85b41220d862db327664 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 30 Apr 2016 18:32:14 -0700 | ||
| 4 | Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems | ||
| 5 | |||
| 6 | Upstream-Status: Pending | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | gdb/gdbserver/linux-ppc-low.c | 6 ++++++ | ||
| 11 | gdb/nat/ppc-linux.h | 6 ++++++ | ||
| 12 | 2 files changed, 12 insertions(+) | ||
| 13 | |||
| 14 | diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c | ||
| 15 | index 5d8d67bec2..ffcf65ab58 100644 | ||
| 16 | --- a/gdb/gdbserver/linux-ppc-low.c | ||
| 17 | +++ b/gdb/gdbserver/linux-ppc-low.c | ||
| 18 | @@ -23,7 +23,13 @@ | ||
| 19 | #include "elf/common.h" | ||
| 20 | #include <sys/uio.h> | ||
| 21 | #include <elf.h> | ||
| 22 | +#if !defined(__GLIBC__) | ||
| 23 | +# define pt_regs uapi_pt_regs | ||
| 24 | +#endif | ||
| 25 | #include <asm/ptrace.h> | ||
| 26 | +#if !defined(__GLIBC__) | ||
| 27 | +# undef pt_regs | ||
| 28 | +#endif | ||
| 29 | |||
| 30 | #include "arch/ppc-linux-common.h" | ||
| 31 | #include "arch/ppc-linux-tdesc.h" | ||
| 32 | diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h | ||
| 33 | index d937a65b69..1fd54b4a0e 100644 | ||
| 34 | --- a/gdb/nat/ppc-linux.h | ||
| 35 | +++ b/gdb/nat/ppc-linux.h | ||
| 36 | @@ -18,7 +18,13 @@ | ||
| 37 | #ifndef NAT_PPC_LINUX_H | ||
| 38 | #define NAT_PPC_LINUX_H | ||
| 39 | |||
| 40 | +#if !defined(__GLIBC__) | ||
| 41 | +# define pt_regs uapi_pt_regs | ||
| 42 | +#endif | ||
| 43 | #include <asm/ptrace.h> | ||
| 44 | +#if !defined(__GLIBC__) | ||
| 45 | +# undef pt_regs | ||
| 46 | +#endif | ||
| 47 | #include <asm/cputable.h> | ||
| 48 | |||
| 49 | /* This sometimes isn't defined. */ | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch new file mode 100644 index 00000000..fd165d4b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch | |||
| @@ -0,0 +1,911 @@ | |||
| 1 | From 505f10a0ea1a8bba0584859d9a348bb779593ec2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 2 Mar 2015 02:31:12 +0000 | ||
| 4 | Subject: [PATCH] Add support for Renesas SH (sh4) architecture. | ||
| 5 | |||
| 6 | gdb (7.4-1~cvs20111117.2) experimental; urgency=low | ||
| 7 | . | ||
| 8 | * Add Renesas SH (sh4) support (Closes: #576242) | ||
| 9 | - Thanks Nobuhiro Iwamatsu, Takashi Yoshii. | ||
| 10 | Author: Hector Oron <zumbi@debian.org> | ||
| 11 | Bug-Debian: http://bugs.debian.org/576242 | ||
| 12 | |||
| 13 | Upstream-Status: Pending | ||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | --- | ||
| 16 | gdb/Makefile.in | 2 + | ||
| 17 | gdb/configure.host | 1 + | ||
| 18 | gdb/sh-linux-tdep.c | 519 +++++++++++++++++++++++++++ | ||
| 19 | gdb/sh-tdep.c | 53 ++- | ||
| 20 | gdb/sh-tdep.h | 49 +++ | ||
| 21 | gdb/testsuite/gdb.asm/asm-source.exp | 5 + | ||
| 22 | gdb/testsuite/gdb.asm/sh.inc | 3 +- | ||
| 23 | gdb/testsuite/gdb.base/annota1.c | 3 + | ||
| 24 | gdb/testsuite/gdb.base/annota3.c | 4 + | ||
| 25 | gdb/testsuite/gdb.base/sigall.c | 3 + | ||
| 26 | gdb/testsuite/gdb.base/signals.c | 4 + | ||
| 27 | 11 files changed, 617 insertions(+), 29 deletions(-) | ||
| 28 | |||
| 29 | diff --git a/gdb/Makefile.in b/gdb/Makefile.in | ||
| 30 | index c3e074b21f..42dd7af59c 100644 | ||
| 31 | --- a/gdb/Makefile.in | ||
| 32 | +++ b/gdb/Makefile.in | ||
| 33 | @@ -2317,6 +2317,8 @@ ALLDEPFILES = \ | ||
| 34 | sh-nbsd-nat.c \ | ||
| 35 | sh-nbsd-tdep.c \ | ||
| 36 | sh-tdep.c \ | ||
| 37 | + sh-linux-tdep.c \ | ||
| 38 | + sh-linux-nat.c \ | ||
| 39 | sol2-tdep.c \ | ||
| 40 | solib-aix.c \ | ||
| 41 | solib-svr4.c \ | ||
| 42 | diff --git a/gdb/configure.host b/gdb/configure.host | ||
| 43 | index ce52823729..5b5173a71a 100644 | ||
| 44 | --- a/gdb/configure.host | ||
| 45 | +++ b/gdb/configure.host | ||
| 46 | @@ -148,6 +148,7 @@ riscv*-*-linux*) gdb_host=linux ;; | ||
| 47 | |||
| 48 | s390*-*-linux*) gdb_host=linux ;; | ||
| 49 | |||
| 50 | +sh*-*-linux*) gdb_host=linux ;; | ||
| 51 | sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu) | ||
| 52 | gdb_host=nbsd ;; | ||
| 53 | sh*-*-openbsd*) gdb_host=nbsd ;; | ||
| 54 | diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c | ||
| 55 | index 13c10eeeda..1d0d583a64 100644 | ||
| 56 | --- a/gdb/sh-linux-tdep.c | ||
| 57 | +++ b/gdb/sh-linux-tdep.c | ||
| 58 | @@ -18,14 +18,37 @@ | ||
| 59 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 60 | |||
| 61 | #include "defs.h" | ||
| 62 | +#include "gdbcore.h" | ||
| 63 | +#include "frame.h" | ||
| 64 | +#include "frame-base.h" | ||
| 65 | +#include "frame-unwind.h" | ||
| 66 | +#include "dwarf2-frame.h" | ||
| 67 | +#include "value.h" | ||
| 68 | +#include "regcache.h" | ||
| 69 | +#include "inferior.h" | ||
| 70 | #include "osabi.h" | ||
| 71 | |||
| 72 | +#include "reggroups.h" | ||
| 73 | +#include "arch-utils.h" | ||
| 74 | +#include "floatformat.h" | ||
| 75 | #include "solib-svr4.h" | ||
| 76 | #include "symtab.h" | ||
| 77 | +#include "gdb_string.h" | ||
| 78 | +#include "command.h" | ||
| 79 | +#include "gdb_assert.h" | ||
| 80 | |||
| 81 | #include "trad-frame.h" | ||
| 82 | #include "tramp-frame.h" | ||
| 83 | |||
| 84 | +#include <sys/ptrace.h> | ||
| 85 | +#include <sys/types.h> | ||
| 86 | +#include <sys/param.h> | ||
| 87 | +#include <sys/user.h> | ||
| 88 | +#include <sys/syscall.h> | ||
| 89 | + | ||
| 90 | +#include <asm/ptrace.h> | ||
| 91 | + | ||
| 92 | +#include "regset.h" | ||
| 93 | #include "glibc-tdep.h" | ||
| 94 | #include "sh-tdep.h" | ||
| 95 | #include "linux-tdep.h" | ||
| 96 | @@ -181,9 +204,505 @@ static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame = { | ||
| 97 | sh_linux_rt_sigreturn_init | ||
| 98 | }; | ||
| 99 | |||
| 100 | +/* Recognizing signal handler frames. */ | ||
| 101 | + | ||
| 102 | +/* GNU/Linux has two flavors of signals. Normal signal handlers, and | ||
| 103 | + "realtime" (RT) signals. The RT signals can provide additional | ||
| 104 | + information to the signal handler if the SA_SIGINFO flag is set | ||
| 105 | + when establishing a signal handler using `sigaction'. It is not | ||
| 106 | + unlikely that future versions of GNU/Linux will support SA_SIGINFO | ||
| 107 | + for normal signals too. */ | ||
| 108 | + | ||
| 109 | +/* When the SH Linux kernel calls a signal handler and the | ||
| 110 | + SA_RESTORER flag isn't set, the return address points to a bit of | ||
| 111 | + code on the stack. This function returns whether the PC appears to | ||
| 112 | + be within this bit of code. | ||
| 113 | + | ||
| 114 | + The instruction sequence for normal signals is | ||
| 115 | + mov.w 1f,r3 | ||
| 116 | + trapa #16 | ||
| 117 | + or r0, r0 | ||
| 118 | + or r0, r0 | ||
| 119 | + or r0, r0 | ||
| 120 | + or r0, r0 | ||
| 121 | + or r0, r0 | ||
| 122 | + 1: .word __NR_sigreturn | ||
| 123 | + or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077. | ||
| 124 | + | ||
| 125 | + Checking for the code sequence should be somewhat reliable, because | ||
| 126 | + the effect is to call the system call sigreturn. This is unlikely | ||
| 127 | + to occur anywhere other than a signal trampoline. | ||
| 128 | + | ||
| 129 | + It kind of sucks that we have to read memory from the process in | ||
| 130 | + order to identify a signal trampoline, but there doesn't seem to be | ||
| 131 | + any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to | ||
| 132 | + only call us if no function name could be identified, which should | ||
| 133 | + be the case since the code is on the stack. | ||
| 134 | + | ||
| 135 | + Detection of signal trampolines for handlers that set the | ||
| 136 | + SA_RESTORER flag is in general not possible. Unfortunately this is | ||
| 137 | + what the GNU C Library has been doing for quite some time now. | ||
| 138 | + However, as of version 2.1.2, the GNU C Library uses signal | ||
| 139 | + trampolines (named __restore and __restore_rt) that are identical | ||
| 140 | + to the ones used by the kernel. Therefore, these trampolines are | ||
| 141 | + supported too. */ | ||
| 142 | + | ||
| 143 | +#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */ | ||
| 144 | +#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */ | ||
| 145 | +#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */ | ||
| 146 | + | ||
| 147 | +#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */ | ||
| 148 | +#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */ | ||
| 149 | +#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */ | ||
| 150 | + | ||
| 151 | +static const unsigned short linux_sigtramp_code[] = | ||
| 152 | +{ | ||
| 153 | + LINUX_SIGTRAMP_INSN0, | ||
| 154 | + LINUX_SIGTRAMP_INSN1, | ||
| 155 | + LINUX_SIGTRAMP_INSN2, | ||
| 156 | + LINUX_SIGTRAMP_INSN2, | ||
| 157 | + LINUX_SIGTRAMP_INSN2, | ||
| 158 | + LINUX_SIGTRAMP_INSN2, | ||
| 159 | + LINUX_SIGTRAMP_INSN2, | ||
| 160 | + __NR_sigreturn | ||
| 161 | +}; | ||
| 162 | + | ||
| 163 | +#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code) | ||
| 164 | + | ||
| 165 | +/* If PC is in a sigtramp routine, return the address of the start of | ||
| 166 | + the routine. Otherwise, return 0. */ | ||
| 167 | + | ||
| 168 | +static CORE_ADDR | ||
| 169 | +sh_linux_sigtramp_start (struct frame_info *next_frame) | ||
| 170 | +{ | ||
| 171 | + CORE_ADDR pc = get_frame_pc (next_frame); | ||
| 172 | + gdb_byte buf[LINUX_SIGTRAMP_LEN]; | ||
| 173 | + | ||
| 174 | + /* We only recognize a signal trampoline if PC is at the start of | ||
| 175 | + one of the three instructions. We optimize for finding the PC at | ||
| 176 | + the start, as will be the case when the trampoline is not the | ||
| 177 | + first frame on the stack. We assume that in the case where the | ||
| 178 | + PC is not at the start of the instruction sequence, there will be | ||
| 179 | + a few trailing readable bytes on the stack. */ | ||
| 180 | + | ||
| 181 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN)) | ||
| 182 | + return 0; | ||
| 183 | + | ||
| 184 | + if (buf[0] != LINUX_SIGTRAMP_INSN0) | ||
| 185 | + { | ||
| 186 | + if (buf[0] != LINUX_SIGTRAMP_INSN1) | ||
| 187 | + return 0; | ||
| 188 | + | ||
| 189 | + pc -= 2; | ||
| 190 | + | ||
| 191 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN)) | ||
| 192 | + return 0; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0) | ||
| 196 | + return 0; | ||
| 197 | + | ||
| 198 | + return pc; | ||
| 199 | +} | ||
| 200 | + | ||
| 201 | +/* This function does the same for RT signals. Here the instruction | ||
| 202 | + sequence is | ||
| 203 | + mov.w 1f,r3 | ||
| 204 | + trapa #16 | ||
| 205 | + or r0, r0 | ||
| 206 | + or r0, r0 | ||
| 207 | + or r0, r0 | ||
| 208 | + or r0, r0 | ||
| 209 | + or r0, r0 | ||
| 210 | + 1: .word __NR_rt_sigreturn | ||
| 211 | + or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad. | ||
| 212 | + | ||
| 213 | + The effect is to call the system call rt_sigreturn. */ | ||
| 214 | + | ||
| 215 | +#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */ | ||
| 216 | +#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */ | ||
| 217 | +#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */ | ||
| 218 | + | ||
| 219 | +static const unsigned short linux_rt_sigtramp_code[] = | ||
| 220 | +{ | ||
| 221 | + LINUX_RT_SIGTRAMP_INSN0, | ||
| 222 | + LINUX_RT_SIGTRAMP_INSN1, | ||
| 223 | + LINUX_RT_SIGTRAMP_INSN2, | ||
| 224 | + LINUX_RT_SIGTRAMP_INSN2, | ||
| 225 | + LINUX_RT_SIGTRAMP_INSN2, | ||
| 226 | + LINUX_RT_SIGTRAMP_INSN2, | ||
| 227 | + LINUX_RT_SIGTRAMP_INSN2, | ||
| 228 | + __NR_rt_sigreturn | ||
| 229 | +}; | ||
| 230 | + | ||
| 231 | +#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code) | ||
| 232 | + | ||
| 233 | +/* If PC is in a RT sigtramp routine, return the address of the start | ||
| 234 | + of the routine. Otherwise, return 0. */ | ||
| 235 | + | ||
| 236 | +static CORE_ADDR | ||
| 237 | +sh_linux_rt_sigtramp_start (struct frame_info *next_frame) | ||
| 238 | +{ | ||
| 239 | + CORE_ADDR pc = get_frame_pc (next_frame); | ||
| 240 | + gdb_byte buf[LINUX_RT_SIGTRAMP_LEN]; | ||
| 241 | + | ||
| 242 | + /* We only recognize a signal trampoline if PC is at the start of | ||
| 243 | + one of the two instructions. We optimize for finding the PC at | ||
| 244 | + the start, as will be the case when the trampoline is not the | ||
| 245 | + first frame on the stack. We assume that in the case where the | ||
| 246 | + PC is not at the start of the instruction sequence, there will be | ||
| 247 | + a few trailing readable bytes on the stack. */ | ||
| 248 | + | ||
| 249 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN)) | ||
| 250 | + return 0; | ||
| 251 | + | ||
| 252 | + if (buf[0] != LINUX_RT_SIGTRAMP_INSN0) | ||
| 253 | + { | ||
| 254 | + if (buf[0] != LINUX_RT_SIGTRAMP_INSN1) | ||
| 255 | + return 0; | ||
| 256 | + | ||
| 257 | + pc -= 2; | ||
| 258 | + | ||
| 259 | + if (!safe_frame_unwind_memory (next_frame, pc, buf, | ||
| 260 | + LINUX_RT_SIGTRAMP_LEN)) | ||
| 261 | + return 0; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0) | ||
| 265 | + return 0; | ||
| 266 | + | ||
| 267 | + return pc; | ||
| 268 | +} | ||
| 269 | + | ||
| 270 | +/* Return whether PC is in a GNU/Linux sigtramp routine. */ | ||
| 271 | + | ||
| 272 | +static int | ||
| 273 | +sh_linux_sigtramp_p (struct frame_info *this_frame) | ||
| 274 | +{ | ||
| 275 | + CORE_ADDR pc = get_frame_pc (this_frame); | ||
| 276 | + char *name; | ||
| 277 | + | ||
| 278 | + find_pc_partial_function (pc, &name, NULL, NULL); | ||
| 279 | + | ||
| 280 | + /* If we have NAME, we can optimize the search. The trampolines are | ||
| 281 | + named __restore and __restore_rt. However, they aren't dynamically | ||
| 282 | + exported from the shared C library, so the trampoline may appear to | ||
| 283 | + be part of the preceding function. This should always be sigaction, | ||
| 284 | + __sigaction, or __libc_sigaction (all aliases to the same function). */ | ||
| 285 | + if (name == NULL || strstr (name, "sigaction") != NULL) | ||
| 286 | + return (sh_linux_sigtramp_start (this_frame) != 0 | ||
| 287 | + || sh_linux_rt_sigtramp_start (this_frame) != 0); | ||
| 288 | + | ||
| 289 | + return (strcmp ("__restore", name) == 0 | ||
| 290 | + || strcmp ("__restore_rt", name) == 0); | ||
| 291 | +} | ||
| 292 | + | ||
| 293 | +/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */ | ||
| 294 | +#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12 | ||
| 295 | + | ||
| 296 | + | ||
| 297 | +/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp | ||
| 298 | + routine, return the address of the associated sigcontext structure. */ | ||
| 299 | + | ||
| 300 | +static CORE_ADDR | ||
| 301 | +sh_linux_sigcontext_addr (struct frame_info *this_frame) | ||
| 302 | +{ | ||
| 303 | + CORE_ADDR pc; | ||
| 304 | + CORE_ADDR sp; | ||
| 305 | + | ||
| 306 | + sp = get_frame_register_unsigned (this_frame, SP_REGNUM); | ||
| 307 | + | ||
| 308 | + pc = sh_linux_sigtramp_start (this_frame); | ||
| 309 | + if (pc) | ||
| 310 | + { | ||
| 311 | + return sp; | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + pc = sh_linux_rt_sigtramp_start (this_frame); | ||
| 315 | + if (pc) | ||
| 316 | + { | ||
| 317 | + CORE_ADDR ucontext_addr; | ||
| 318 | + | ||
| 319 | + /* The sigcontext structure is part of the user context. A | ||
| 320 | + pointer to the user context is passed as the third argument | ||
| 321 | + to the signal handler. */ | ||
| 322 | + ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2); | ||
| 323 | + return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + error ("Couldn't recognize signal trampoline."); | ||
| 327 | + return 0; | ||
| 328 | +} | ||
| 329 | + | ||
| 330 | +/* Signal trampolines. */ | ||
| 331 | +extern struct sh_frame_cache *sh_alloc_frame_cache (void); | ||
| 332 | + | ||
| 333 | +static struct sh_frame_cache * | ||
| 334 | +sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
| 335 | +{ | ||
| 336 | + struct sh_frame_cache *cache; | ||
| 337 | + struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ()); | ||
| 338 | + CORE_ADDR sigcontext_addr; | ||
| 339 | + | ||
| 340 | + if (*this_cache) | ||
| 341 | + return *this_cache; | ||
| 342 | + | ||
| 343 | + cache = sh_alloc_frame_cache (); | ||
| 344 | + | ||
| 345 | + cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM); | ||
| 346 | + sigcontext_addr = tdep->sigcontext_addr (this_frame); | ||
| 347 | + if (tdep->sc_reg_offset) | ||
| 348 | + { | ||
| 349 | + int i; | ||
| 350 | + | ||
| 351 | + gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS); | ||
| 352 | + | ||
| 353 | + for (i = 0; i < tdep->sc_num_regs; i++) | ||
| 354 | + if (tdep->sc_reg_offset[i] != -1) | ||
| 355 | + cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i]; | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + *this_cache = cache; | ||
| 359 | + return cache; | ||
| 360 | +} | ||
| 361 | + | ||
| 362 | +static void | ||
| 363 | +sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache, | ||
| 364 | + struct frame_id *this_id) | ||
| 365 | +{ | ||
| 366 | + struct sh_frame_cache *cache = | ||
| 367 | + sh_linux_sigtramp_frame_cache (this_frame, this_cache); | ||
| 368 | + | ||
| 369 | + (*this_id) = frame_id_build (cache->base + 64, cache->pc); | ||
| 370 | +} | ||
| 371 | + | ||
| 372 | +extern struct value * sh_frame_prev_register (); | ||
| 373 | +static struct value * | ||
| 374 | +sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame, | ||
| 375 | + void **this_cache, int regnum) | ||
| 376 | +{ | ||
| 377 | + sh_linux_sigtramp_frame_cache (this_frame, this_cache); | ||
| 378 | + | ||
| 379 | + return sh_frame_prev_register (this_frame, this_cache, regnum); | ||
| 380 | +} | ||
| 381 | + | ||
| 382 | +static int | ||
| 383 | +sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self, | ||
| 384 | + struct frame_info *this_frame, | ||
| 385 | + void **this_prologue_cache) | ||
| 386 | +{ | ||
| 387 | + struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); | ||
| 388 | + | ||
| 389 | + /* We shouldn't even bother if we don't have a sigcontext_addr | ||
| 390 | + handler. */ | ||
| 391 | + if (tdep->sigcontext_addr == NULL) | ||
| 392 | + return 0; | ||
| 393 | + | ||
| 394 | + if (tdep->sigtramp_p != NULL) | ||
| 395 | + { | ||
| 396 | + if (tdep->sigtramp_p (this_frame)) | ||
| 397 | + return 1; | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + return 0; | ||
| 401 | +} | ||
| 402 | + | ||
| 403 | +static const struct frame_unwind sh_linux_sigtramp_frame_unwind = | ||
| 404 | +{ | ||
| 405 | + SIGTRAMP_FRAME, | ||
| 406 | + sh_linux_sigtramp_frame_this_id, | ||
| 407 | + sh_linux_sigtramp_frame_prev_register, | ||
| 408 | + NULL, | ||
| 409 | + sh_linux_sigtramp_frame_sniffer | ||
| 410 | +}; | ||
| 411 | + | ||
| 412 | +/* Supply register REGNUM from the buffer specified by GREGS and LEN | ||
| 413 | + in the general-purpose register set REGSET to register cache | ||
| 414 | + REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | ||
| 415 | + | ||
| 416 | +void | ||
| 417 | +sh_supply_gregset (const struct regset *regset, struct regcache *regcache, | ||
| 418 | + int regnum, const void *gregs, size_t len) | ||
| 419 | +{ | ||
| 420 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
| 421 | + const char *regs = gregs; | ||
| 422 | + int i; | ||
| 423 | + | ||
| 424 | + gdb_assert (len == tdep->sizeof_gregset); | ||
| 425 | + | ||
| 426 | + for (i = 0; i < tdep->gregset_num_regs; i++) | ||
| 427 | + { | ||
| 428 | + if ((regnum == i || regnum == -1) | ||
| 429 | + && tdep->gregset_reg_offset[i] != -1) | ||
| 430 | + regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]); | ||
| 431 | + } | ||
| 432 | +} | ||
| 433 | + | ||
| 434 | +/* Collect register REGNUM from the register cache REGCACHE and store | ||
| 435 | + it in the buffer specified by GREGS and LEN as described by the | ||
| 436 | + general-purpose register set REGSET. If REGNUM is -1, do this for | ||
| 437 | + all registers in REGSET. */ | ||
| 438 | + | ||
| 439 | +void | ||
| 440 | +sh_collect_gregset (const struct regset *regset, | ||
| 441 | + const struct regcache *regcache, | ||
| 442 | + int regnum, void *gregs, size_t len) | ||
| 443 | +{ | ||
| 444 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
| 445 | + char *regs = gregs; | ||
| 446 | + int i; | ||
| 447 | + | ||
| 448 | + gdb_assert (len == tdep->sizeof_gregset); | ||
| 449 | + | ||
| 450 | + for (i = 0; i < tdep->gregset_num_regs; i++) | ||
| 451 | + { | ||
| 452 | + if ((regnum == i || regnum == -1) | ||
| 453 | + && tdep->gregset_reg_offset[i] != -1) | ||
| 454 | + regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]); | ||
| 455 | + } | ||
| 456 | +} | ||
| 457 | + | ||
| 458 | +/* Supply register REGNUM from the buffer specified by FPREGS and LEN | ||
| 459 | + in the floating-point register set REGSET to register cache | ||
| 460 | + REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ | ||
| 461 | + | ||
| 462 | +static void | ||
| 463 | +sh_supply_fpregset (const struct regset *regset, struct regcache *regcache, | ||
| 464 | + int regnum, const void *fpregs, size_t len) | ||
| 465 | +{ | ||
| 466 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
| 467 | + const char *regs = fpregs; | ||
| 468 | + int i; | ||
| 469 | + | ||
| 470 | + gdb_assert (len == tdep->sizeof_fpregset); | ||
| 471 | + for (i = 0; i < 16; i++) | ||
| 472 | + { | ||
| 473 | + if (regnum == i+25 || regnum == -1) | ||
| 474 | + regcache_raw_supply (regcache, i+25, regs + i*4); | ||
| 475 | + } | ||
| 476 | + if (regnum == FPSCR_REGNUM || regnum == -1) | ||
| 477 | + regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4); | ||
| 478 | + if (regnum == FPUL_REGNUM || regnum == -1) | ||
| 479 | + regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4); | ||
| 480 | +} | ||
| 481 | + | ||
| 482 | +/* Collect register REGNUM from the register cache REGCACHE and store | ||
| 483 | + it in the buffer specified by FPREGS and LEN as described by the | ||
| 484 | + floating-point register set REGSET. If REGNUM is -1, do this for | ||
| 485 | + all registers in REGSET. */ | ||
| 486 | + | ||
| 487 | +static void | ||
| 488 | +sh_collect_fpregset (const struct regset *regset, | ||
| 489 | + const struct regcache *regcache, | ||
| 490 | + int regnum, void *fpregs, size_t len) | ||
| 491 | +{ | ||
| 492 | + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); | ||
| 493 | + char *regs = fpregs; | ||
| 494 | + int i; | ||
| 495 | + | ||
| 496 | + gdb_assert (len == tdep->sizeof_fpregset); | ||
| 497 | + for (i = 0; i < 16; i++) | ||
| 498 | + { | ||
| 499 | + if (regnum == i+25 || regnum == -1) | ||
| 500 | + regcache_raw_collect (regcache, i+25, regs + i*4); | ||
| 501 | + } | ||
| 502 | + if (regnum == FPSCR_REGNUM || regnum == -1) | ||
| 503 | + regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4); | ||
| 504 | + if (regnum == FPUL_REGNUM || regnum == -1) | ||
| 505 | + regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4); | ||
| 506 | +} | ||
| 507 | + | ||
| 508 | +/* Return the appropriate register set for the core section identified | ||
| 509 | + by SECT_NAME and SECT_SIZE. */ | ||
| 510 | + | ||
| 511 | +const struct regset * | ||
| 512 | +sh_linux_regset_from_core_section (struct gdbarch *gdbarch, | ||
| 513 | + const char *sect_name, size_t sect_size) | ||
| 514 | +{ | ||
| 515 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
| 516 | + | ||
| 517 | + if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset) | ||
| 518 | + { | ||
| 519 | + if (tdep->gregset == NULL) | ||
| 520 | + tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset, | ||
| 521 | + sh_collect_gregset); | ||
| 522 | + return tdep->gregset; | ||
| 523 | + } | ||
| 524 | + | ||
| 525 | + if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)) | ||
| 526 | + { | ||
| 527 | + if (tdep->fpregset == NULL) | ||
| 528 | + tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset, | ||
| 529 | + sh_collect_fpregset); | ||
| 530 | + return tdep->fpregset; | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + return NULL; | ||
| 534 | +} | ||
| 535 | + | ||
| 536 | +/* The register sets used in GNU/Linux ELF core-dumps are identical to | ||
| 537 | + the register sets in `struct user' that are used for a.out | ||
| 538 | + core-dumps. These are also used by ptrace(2). The corresponding | ||
| 539 | + types are `elf_gregset_t' for the general-purpose registers (with | ||
| 540 | + `elf_greg_t' the type of a single GP register) and `elf_fpregset_t' | ||
| 541 | + for the floating-point registers. | ||
| 542 | + | ||
| 543 | + Those types used to be available under the names `gregset_t' and | ||
| 544 | + `fpregset_t' too, and GDB used those names in the past. But those | ||
| 545 | + names are now used for the register sets used in the `mcontext_t' | ||
| 546 | + type, which have a different size and layout. */ | ||
| 547 | + | ||
| 548 | +/* Mapping between the general-purpose registers in `struct user' | ||
| 549 | + format and GDB's register cache layout. */ | ||
| 550 | + | ||
| 551 | +/* From <sys/reg.h>. */ | ||
| 552 | +static int sh_linux_gregset_reg_offset[] = | ||
| 553 | +{ | ||
| 554 | + 0, 4, 8, 12, 16, 20, 24, 28, | ||
| 555 | + 32, 36, 40, 44, 48, 52, 56, 60, | ||
| 556 | + | ||
| 557 | + REG_PC*4, REG_PR*4, REG_GBR*4, -1, | ||
| 558 | + REG_MACH*4, REG_MACL*4, REG_SR*4, | ||
| 559 | +}; | ||
| 560 | + | ||
| 561 | +/* Mapping between the general-purpose registers in `struct | ||
| 562 | + sigcontext' format and GDB's register cache layout. */ | ||
| 563 | + | ||
| 564 | +/* From <asm/sigcontext.h>. */ | ||
| 565 | +static int sh_linux_sc_reg_offset[] = | ||
| 566 | +{ | ||
| 567 | + 4, 8, 12, 16, 20, 24, 28, 32, | ||
| 568 | + 36, 40, 44, 48, 52, 56, 60, 64, | ||
| 569 | + 68, 72, 80, -1, | ||
| 570 | + 84, 88, 76 | ||
| 571 | +}; | ||
| 572 | + | ||
| 573 | static void | ||
| 574 | sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||
| 575 | { | ||
| 576 | + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | ||
| 577 | + bfd abfd; | ||
| 578 | + | ||
| 579 | + tdep->gregset_reg_offset = sh_linux_gregset_reg_offset; | ||
| 580 | + tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset); | ||
| 581 | + tdep->sizeof_gregset = 23 * 4; | ||
| 582 | + | ||
| 583 | + tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */ | ||
| 584 | + | ||
| 585 | + tdep->sigtramp_p = sh_linux_sigtramp_p; | ||
| 586 | + tdep->sigcontext_addr = sh_linux_sigcontext_addr; | ||
| 587 | + tdep->sc_reg_offset = sh_linux_sc_reg_offset; | ||
| 588 | + tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset); | ||
| 589 | + | ||
| 590 | + frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind); | ||
| 591 | + | ||
| 592 | + /* If we have a register mapping, enable the generic core file | ||
| 593 | + support, unless it has already been enabled. */ | ||
| 594 | + if (tdep->gregset_reg_offset | ||
| 595 | + && !gdbarch_regset_from_core_section_p (gdbarch)) | ||
| 596 | + set_gdbarch_regset_from_core_section (gdbarch, | ||
| 597 | + sh_linux_regset_from_core_section); | ||
| 598 | + | ||
| 599 | linux_init_abi (info, gdbarch); | ||
| 600 | |||
| 601 | /* GNU/Linux uses SVR4-style shared libraries. */ | ||
| 602 | diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c | ||
| 603 | index e3aee0ac28..5958cf3688 100644 | ||
| 604 | --- a/gdb/sh-tdep.c | ||
| 605 | +++ b/gdb/sh-tdep.c | ||
| 606 | @@ -21,6 +21,9 @@ | ||
| 607 | sac@cygnus.com. */ | ||
| 608 | |||
| 609 | #include "defs.h" | ||
| 610 | +#include "arch-utils.h" | ||
| 611 | +#include "command.h" | ||
| 612 | +#include "dummy-frame.h" | ||
| 613 | #include "frame.h" | ||
| 614 | #include "frame-base.h" | ||
| 615 | #include "frame-unwind.h" | ||
| 616 | @@ -66,23 +69,6 @@ static const char *const sh_cc_enum[] = { | ||
| 617 | |||
| 618 | static const char *sh_active_calling_convention = sh_cc_gcc; | ||
| 619 | |||
| 620 | -#define SH_NUM_REGS 67 | ||
| 621 | - | ||
| 622 | -struct sh_frame_cache | ||
| 623 | -{ | ||
| 624 | - /* Base address. */ | ||
| 625 | - CORE_ADDR base; | ||
| 626 | - LONGEST sp_offset; | ||
| 627 | - CORE_ADDR pc; | ||
| 628 | - | ||
| 629 | - /* Flag showing that a frame has been created in the prologue code. */ | ||
| 630 | - int uses_fp; | ||
| 631 | - | ||
| 632 | - /* Saved registers. */ | ||
| 633 | - CORE_ADDR saved_regs[SH_NUM_REGS]; | ||
| 634 | - CORE_ADDR saved_sp; | ||
| 635 | -}; | ||
| 636 | - | ||
| 637 | static int | ||
| 638 | sh_is_renesas_calling_convention (struct type *func_type) | ||
| 639 | { | ||
| 640 | @@ -1050,7 +1036,7 @@ sh_treat_as_flt_p (struct type *type) | ||
| 641 | return 0; | ||
| 642 | /* Otherwise if the type of that member is float, the whole type is | ||
| 643 | treated as float. */ | ||
| 644 | - if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT) | ||
| 645 | + if (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) == TYPE_CODE_FLT) | ||
| 646 | return 1; | ||
| 647 | /* Otherwise it's not treated as float. */ | ||
| 648 | return 0; | ||
| 649 | @@ -1100,7 +1086,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, | ||
| 650 | in four registers available. Loop thru args from first to last. */ | ||
| 651 | for (argnum = 0; argnum < nargs; argnum++) | ||
| 652 | { | ||
| 653 | - type = value_type (args[argnum]); | ||
| 654 | + type = check_typedef (value_type (args[argnum])); | ||
| 655 | len = TYPE_LENGTH (type); | ||
| 656 | val = sh_justify_value_in_reg (gdbarch, args[argnum], len); | ||
| 657 | |||
| 658 | @@ -1835,7 +1821,7 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, | ||
| 659 | reg->how = DWARF2_FRAME_REG_UNDEFINED; | ||
| 660 | } | ||
| 661 | |||
| 662 | -static struct sh_frame_cache * | ||
| 663 | +struct sh_frame_cache * | ||
| 664 | sh_alloc_frame_cache (void) | ||
| 665 | { | ||
| 666 | struct sh_frame_cache *cache; | ||
| 667 | @@ -1862,7 +1848,7 @@ sh_alloc_frame_cache (void) | ||
| 668 | return cache; | ||
| 669 | } | ||
| 670 | |||
| 671 | -static struct sh_frame_cache * | ||
| 672 | +struct sh_frame_cache * | ||
| 673 | sh_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
| 674 | { | ||
| 675 | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||
| 676 | @@ -1929,9 +1915,9 @@ sh_frame_cache (struct frame_info *this_frame, void **this_cache) | ||
| 677 | return cache; | ||
| 678 | } | ||
| 679 | |||
| 680 | -static struct value * | ||
| 681 | -sh_frame_prev_register (struct frame_info *this_frame, | ||
| 682 | - void **this_cache, int regnum) | ||
| 683 | +struct value * | ||
| 684 | +sh_frame_prev_register (struct frame_info *this_frame, void **this_cache, | ||
| 685 | + int regnum) | ||
| 686 | { | ||
| 687 | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||
| 688 | struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); | ||
| 689 | @@ -1945,7 +1931,7 @@ sh_frame_prev_register (struct frame_info *this_frame, | ||
| 690 | the current frame. Frob regnum so that we pull the value from | ||
| 691 | the correct place. */ | ||
| 692 | if (regnum == gdbarch_pc_regnum (gdbarch)) | ||
| 693 | - regnum = PR_REGNUM; | ||
| 694 | + regnum = PR_REGNUM; /* XXX: really? */ | ||
| 695 | |||
| 696 | if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1) | ||
| 697 | return frame_unwind_got_memory (this_frame, regnum, | ||
| 698 | @@ -2234,8 +2220,8 @@ sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch, | ||
| 699 | static struct gdbarch * | ||
| 700 | sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
| 701 | { | ||
| 702 | - struct gdbarch *gdbarch; | ||
| 703 | struct gdbarch_tdep *tdep; | ||
| 704 | + struct gdbarch *gdbarch; | ||
| 705 | |||
| 706 | /* If there is already a candidate, use it. */ | ||
| 707 | arches = gdbarch_list_lookup_by_info (arches, &info); | ||
| 708 | @@ -2247,6 +2233,18 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
| 709 | tdep = XCNEW (struct gdbarch_tdep); | ||
| 710 | gdbarch = gdbarch_alloc (&info, tdep); | ||
| 711 | |||
| 712 | + /* General-purpose registers. */ | ||
| 713 | + tdep->gregset = NULL; | ||
| 714 | + tdep->gregset_reg_offset = NULL; | ||
| 715 | + tdep->gregset_num_regs = 23; | ||
| 716 | + tdep->sizeof_gregset = 0; | ||
| 717 | + | ||
| 718 | + /* Floating-point registers. */ | ||
| 719 | + tdep->fpregset = NULL; | ||
| 720 | + tdep->sizeof_fpregset = 34*4; | ||
| 721 | + | ||
| 722 | + tdep->jb_pc_offset = -1; | ||
| 723 | + | ||
| 724 | set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); | ||
| 725 | set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); | ||
| 726 | set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); | ||
| 727 | @@ -2398,10 +2396,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
| 728 | break; | ||
| 729 | } | ||
| 730 | |||
| 731 | + dwarf2_append_unwinders (gdbarch); | ||
| 732 | + | ||
| 733 | /* Hook in ABI-specific overrides, if they have been registered. */ | ||
| 734 | gdbarch_init_osabi (info, gdbarch); | ||
| 735 | |||
| 736 | - dwarf2_append_unwinders (gdbarch); | ||
| 737 | frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind); | ||
| 738 | frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind); | ||
| 739 | |||
| 740 | diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h | ||
| 741 | index 76e2e76e39..2710f63010 100644 | ||
| 742 | --- a/gdb/sh-tdep.h | ||
| 743 | +++ b/gdb/sh-tdep.h | ||
| 744 | @@ -21,6 +21,12 @@ | ||
| 745 | |||
| 746 | /* Contributed by Steve Chamberlain sac@cygnus.com. */ | ||
| 747 | |||
| 748 | +struct frame_info; | ||
| 749 | +struct gdbarch; | ||
| 750 | +struct reggroup; | ||
| 751 | +struct regset; | ||
| 752 | +struct regcache; | ||
| 753 | + | ||
| 754 | /* Registers for all SH variants. Used also by sh3-rom.c. */ | ||
| 755 | enum | ||
| 756 | { | ||
| 757 | @@ -29,6 +35,7 @@ enum | ||
| 758 | ARG0_REGNUM = 4, | ||
| 759 | ARGLAST_REGNUM = 7, | ||
| 760 | FP_REGNUM = 14, | ||
| 761 | + SP_REGNUM = 15, | ||
| 762 | PC_REGNUM = 16, | ||
| 763 | PR_REGNUM = 17, | ||
| 764 | GBR_REGNUM = 18, | ||
| 765 | @@ -81,6 +88,24 @@ enum | ||
| 766 | FV0_REGNUM = 76, | ||
| 767 | FV_LAST_REGNUM = 79 | ||
| 768 | }; | ||
| 769 | +#define SH_NUM_REGS 67 | ||
| 770 | + | ||
| 771 | +struct sh_frame_cache | ||
| 772 | +{ | ||
| 773 | + /* Base address. */ | ||
| 774 | + CORE_ADDR base; | ||
| 775 | + LONGEST sp_offset; | ||
| 776 | + CORE_ADDR pc; | ||
| 777 | + | ||
| 778 | + /* Flag showing that a frame has been created in the prologue code. */ | ||
| 779 | + int uses_fp; | ||
| 780 | + | ||
| 781 | + /* Saved registers. */ | ||
| 782 | + CORE_ADDR saved_regs[SH_NUM_REGS]; | ||
| 783 | + CORE_ADDR saved_sp; | ||
| 784 | +}; | ||
| 785 | + | ||
| 786 | +extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache); | ||
| 787 | |||
| 788 | /* This structure describes a register in a core-file. */ | ||
| 789 | struct sh_corefile_regmap | ||
| 790 | @@ -89,8 +114,32 @@ struct sh_corefile_regmap | ||
| 791 | unsigned int offset; | ||
| 792 | }; | ||
| 793 | |||
| 794 | +/* sh architecture specific information. */ | ||
| 795 | struct gdbarch_tdep | ||
| 796 | { | ||
| 797 | + /* General-purpose registers. */ | ||
| 798 | + struct regset *gregset; | ||
| 799 | + int *gregset_reg_offset; | ||
| 800 | + int gregset_num_regs; | ||
| 801 | + size_t sizeof_gregset; | ||
| 802 | + | ||
| 803 | + /* Floating-point registers. */ | ||
| 804 | + struct regset *fpregset; | ||
| 805 | + size_t sizeof_fpregset; | ||
| 806 | + | ||
| 807 | + /* Offset of saved PC in jmp_buf. */ | ||
| 808 | + int jb_pc_offset; | ||
| 809 | + | ||
| 810 | + /* Detect sigtramp. */ | ||
| 811 | + int (*sigtramp_p) (struct frame_info *); | ||
| 812 | + | ||
| 813 | + /* Get address of sigcontext for sigtramp. */ | ||
| 814 | + CORE_ADDR (*sigcontext_addr) (struct frame_info *); | ||
| 815 | + | ||
| 816 | + /* Offset of registers in `struct sigcontext'. */ | ||
| 817 | + int *sc_reg_offset; | ||
| 818 | + int sc_num_regs; | ||
| 819 | + | ||
| 820 | /* Non-NULL when debugging from a core file. Provides the offset | ||
| 821 | where each general-purpose register is stored inside the associated | ||
| 822 | core file section. */ | ||
| 823 | diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp | ||
| 824 | index 4914498f98..6e25cbed18 100644 | ||
| 825 | --- a/gdb/testsuite/gdb.asm/asm-source.exp | ||
| 826 | +++ b/gdb/testsuite/gdb.asm/asm-source.exp | ||
| 827 | @@ -116,6 +116,11 @@ switch -glob -- [istarget] { | ||
| 828 | append link-flags " -m elf32ppc" | ||
| 829 | } | ||
| 830 | } | ||
| 831 | + "sh*-linux*" { | ||
| 832 | + set asm-arch sh-linux | ||
| 833 | + set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}" | ||
| 834 | + set debug-flags "-gdwarf-2" | ||
| 835 | + } | ||
| 836 | "sh*-*-*" { | ||
| 837 | set asm-arch sh | ||
| 838 | set debug-flags "-gdwarf-2" | ||
| 839 | diff --git a/gdb/testsuite/gdb.asm/sh.inc b/gdb/testsuite/gdb.asm/sh.inc | ||
| 840 | index a4a5fc545e..89efed7795 100644 | ||
| 841 | --- a/gdb/testsuite/gdb.asm/sh.inc | ||
| 842 | +++ b/gdb/testsuite/gdb.asm/sh.inc | ||
| 843 | @@ -40,9 +40,8 @@ | ||
| 844 | mov.l .Lconst\@,r1 | ||
| 845 | bra .Lafterconst\@ | ||
| 846 | nop | ||
| 847 | - nop | ||
| 848 | -.Lconst\@: | ||
| 849 | .align 2 | ||
| 850 | +.Lconst\@: | ||
| 851 | .long \subr | ||
| 852 | .align 1 | ||
| 853 | .Lafterconst\@: | ||
| 854 | diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c | ||
| 855 | index 424e1b8327..0de2e7b633 100644 | ||
| 856 | --- a/gdb/testsuite/gdb.base/annota1.c | ||
| 857 | +++ b/gdb/testsuite/gdb.base/annota1.c | ||
| 858 | @@ -1,6 +1,9 @@ | ||
| 859 | #include <stdio.h> | ||
| 860 | #include <signal.h> | ||
| 861 | |||
| 862 | +#ifdef __sh__ | ||
| 863 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
| 864 | +#endif | ||
| 865 | |||
| 866 | void | ||
| 867 | handle_USR1 (int sig) | ||
| 868 | diff --git a/gdb/testsuite/gdb.base/annota3.c b/gdb/testsuite/gdb.base/annota3.c | ||
| 869 | index 424e1b8327..952aaf218a 100644 | ||
| 870 | --- a/gdb/testsuite/gdb.base/annota3.c | ||
| 871 | +++ b/gdb/testsuite/gdb.base/annota3.c | ||
| 872 | @@ -1,6 +1,10 @@ | ||
| 873 | #include <stdio.h> | ||
| 874 | #include <signal.h> | ||
| 875 | |||
| 876 | +#ifdef __sh__ | ||
| 877 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
| 878 | +#endif | ||
| 879 | + | ||
| 880 | |||
| 881 | void | ||
| 882 | handle_USR1 (int sig) | ||
| 883 | diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c | ||
| 884 | index 81f3b08d6b..1574b2d6cb 100644 | ||
| 885 | --- a/gdb/testsuite/gdb.base/sigall.c | ||
| 886 | +++ b/gdb/testsuite/gdb.base/sigall.c | ||
| 887 | @@ -1,6 +1,9 @@ | ||
| 888 | #include <signal.h> | ||
| 889 | #include <unistd.h> | ||
| 890 | |||
| 891 | +#ifdef __sh__ | ||
| 892 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
| 893 | +#endif | ||
| 894 | |||
| 895 | /* Signal handlers, we set breakpoints in them to make sure that the | ||
| 896 | signals really get delivered. */ | ||
| 897 | diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c | ||
| 898 | index 756606880f..1205a9bc9c 100644 | ||
| 899 | --- a/gdb/testsuite/gdb.base/signals.c | ||
| 900 | +++ b/gdb/testsuite/gdb.base/signals.c | ||
| 901 | @@ -3,6 +3,10 @@ | ||
| 902 | #include <signal.h> | ||
| 903 | #include <unistd.h> | ||
| 904 | |||
| 905 | +#ifdef __sh__ | ||
| 906 | +#define signal(a,b) /* Signals not supported on this target - make them go away */ | ||
| 907 | +#define alarm(a) /* Ditto for alarm() */ | ||
| 908 | +#endif | ||
| 909 | |||
| 910 | static int count = 0; | ||
| 911 | |||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch new file mode 100644 index 00000000..d0360da4 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From d132f21d89157e980574da7d0c949f6dd17df8c3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 30 Apr 2016 15:25:03 -0700 | ||
| 4 | Subject: [PATCH] Dont disable libreadline.a when using --disable-static | ||
| 5 | |||
| 6 | If gdb is configured with --disable-static then this is dutifully passed to | ||
| 7 | readline which then disables libreadline.a, which causes a problem when gdb | ||
| 8 | tries to link against that. | ||
| 9 | |||
| 10 | To ensure that readline always builds static libraries, pass --enable-static to | ||
| 11 | the sub-configure. | ||
| 12 | |||
| 13 | Upstream-Status: Pending | ||
| 14 | Signed-off-by: Ross Burton <ross.burton@intel.com> | ||
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 16 | --- | ||
| 17 | Makefile.def | 3 ++- | ||
| 18 | Makefile.in | 2 +- | ||
| 19 | 2 files changed, 3 insertions(+), 2 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/Makefile.def b/Makefile.def | ||
| 22 | index 311feb9de3..24c0685d48 100644 | ||
| 23 | --- a/Makefile.def | ||
| 24 | +++ b/Makefile.def | ||
| 25 | @@ -105,7 +105,8 @@ host_modules= { module= libiconv; | ||
| 26 | missing= install-html; | ||
| 27 | missing= install-info; }; | ||
| 28 | host_modules= { module= m4; }; | ||
| 29 | -host_modules= { module= readline; }; | ||
| 30 | +host_modules= { module= readline; | ||
| 31 | + extra_configure_flags='--enable-static';}; | ||
| 32 | host_modules= { module= sid; }; | ||
| 33 | host_modules= { module= sim; }; | ||
| 34 | host_modules= { module= texinfo; no_install= true; }; | ||
| 35 | diff --git a/Makefile.in b/Makefile.in | ||
| 36 | index 1aabf6ede4..d957efde81 100644 | ||
| 37 | --- a/Makefile.in | ||
| 38 | +++ b/Makefile.in | ||
| 39 | @@ -25510,7 +25510,7 @@ configure-readline: | ||
| 40 | $$s/$$module_srcdir/configure \ | ||
| 41 | --srcdir=$${topdir}/$$module_srcdir \ | ||
| 42 | $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ | ||
| 43 | - --target=${target_alias} \ | ||
| 44 | + --target=${target_alias} --enable-static \ | ||
| 45 | || exit 1 | ||
| 46 | @endif readline | ||
| 47 | |||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch new file mode 100644 index 00000000..d222d010 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 329e5bf29e934ba99622372a9660865864bb0298 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andre McCurdy <amccurdy@gmail.com> | ||
| 3 | Date: Sat, 30 Apr 2016 15:29:06 -0700 | ||
| 4 | Subject: [PATCH] use <asm/sgidefs.h> | ||
| 5 | |||
| 6 | Build fix for MIPS with musl libc | ||
| 7 | |||
| 8 | The MIPS specific header <sgidefs.h> is provided by glibc and uclibc | ||
| 9 | but not by musl. Regardless of the libc, the kernel headers provide | ||
| 10 | <asm/sgidefs.h> which provides the same definitions, so use that | ||
| 11 | instead. | ||
| 12 | |||
| 13 | Upstream-Status: Pending | ||
| 14 | |||
| 15 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> | ||
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 17 | --- | ||
| 18 | gdb/mips-linux-nat.c | 2 +- | ||
| 19 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c | ||
| 22 | index 7f575b3363..dc93a64a93 100644 | ||
| 23 | --- a/gdb/mips-linux-nat.c | ||
| 24 | +++ b/gdb/mips-linux-nat.c | ||
| 25 | @@ -31,7 +31,7 @@ | ||
| 26 | #include "gdb_proc_service.h" | ||
| 27 | #include "gregset.h" | ||
| 28 | |||
| 29 | -#include <sgidefs.h> | ||
| 30 | +#include <asm/sgidefs.h> | ||
| 31 | #include "nat/gdb_ptrace.h" | ||
| 32 | #include <asm/ptrace.h> | ||
| 33 | #include "inf-ptrace.h" | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch new file mode 100644 index 00000000..09896611 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0007-Use-exorted-definitions-of-SIGRTMIN.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From 782bb2ab9b104dad4bbaed1d9ac769ce7e5b9f4d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 30 Apr 2016 15:31:40 -0700 | ||
| 4 | Subject: [PATCH] Use exorted definitions of SIGRTMIN | ||
| 5 | |||
| 6 | Define W_STOPCODE if not defined already | ||
| 7 | |||
| 8 | __SIGRTMIN is internal to glibc and other libcs e.g. musl | ||
| 9 | may not provide them | ||
| 10 | |||
| 11 | Fixes | ||
| 12 | https://sourceware.org/bugzilla/show_bug.cgi?id=13012 | ||
| 13 | |||
| 14 | Upstream-Status: Submitted | ||
| 15 | |||
| 16 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 17 | --- | ||
| 18 | gdb/linux-nat.c | 4 ++-- | ||
| 19 | gdb/nat/linux-nat.h | 4 ++++ | ||
| 20 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c | ||
| 23 | index 4484fa5c87..3bb0ee7a49 100644 | ||
| 24 | --- a/gdb/linux-nat.c | ||
| 25 | +++ b/gdb/linux-nat.c | ||
| 26 | @@ -4588,6 +4588,6 @@ lin_thread_get_thread_signals (sigset_t *set) | ||
| 27 | /* NPTL reserves the first two RT signals, but does not provide any | ||
| 28 | way for the debugger to query the signal numbers - fortunately | ||
| 29 | they don't change. */ | ||
| 30 | - sigaddset (set, __SIGRTMIN); | ||
| 31 | - sigaddset (set, __SIGRTMIN + 1); | ||
| 32 | + sigaddset (set, SIGRTMIN); | ||
| 33 | + sigaddset (set, SIGRTMIN + 1); | ||
| 34 | } | ||
| 35 | diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h | ||
| 36 | index 44dcbb7758..975d7276f6 100644 | ||
| 37 | --- a/gdb/nat/linux-nat.h | ||
| 38 | +++ b/gdb/nat/linux-nat.h | ||
| 39 | @@ -91,4 +91,8 @@ extern void linux_stop_lwp (struct lwp_info *lwp); | ||
| 40 | |||
| 41 | extern int lwp_is_stepping (struct lwp_info *lwp); | ||
| 42 | |||
| 43 | +#ifndef W_STOPCODE | ||
| 44 | +#define W_STOPCODE(sig) ((sig) << 8 | 0x7f) | ||
| 45 | +#endif | ||
| 46 | + | ||
| 47 | #endif /* NAT_LINUX_NAT_H */ | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch new file mode 100644 index 00000000..18168c6b --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | From 40c9c174590ce6fdc873b453285249fe957f376d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Sat, 30 Apr 2016 15:35:39 -0700 | ||
| 4 | Subject: [PATCH] Change order of CFLAGS | ||
| 5 | |||
| 6 | Lets us override Werror if need be | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate | ||
| 9 | |||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | gdb/gdbserver/Makefile.in | 2 +- | ||
| 13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in | ||
| 16 | index 16a9f2fd38..b9c8cd9c41 100644 | ||
| 17 | --- a/gdb/gdbserver/Makefile.in | ||
| 18 | +++ b/gdb/gdbserver/Makefile.in | ||
| 19 | @@ -146,7 +146,7 @@ PTHREAD_LIBS = @PTHREAD_LIBS@ | ||
| 20 | INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \ | ||
| 21 | ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS) | ||
| 22 | INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS) | ||
| 23 | -INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER | ||
| 24 | +INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${COMPILER_CFLAGS} -DGDBSERVER | ||
| 25 | |||
| 26 | # LDFLAGS is specifically reserved for setting from the command line | ||
| 27 | # when running make. | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch new file mode 100644 index 00000000..8f15c49d --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | From 5b69a98f6bb7363a1f79f29bac2b25b7df6d2fdd Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 10 May 2016 08:47:05 -0700 | ||
| 4 | Subject: [PATCH] resolve restrict keyword conflict | ||
| 5 | |||
| 6 | GCC detects that we call 'restrict' as param name in function | ||
| 7 | signatures and complains since both params are called 'restrict' | ||
| 8 | therefore we use __restrict to denote the C99 keywork | ||
| 9 | |||
| 10 | Upstream-Status: Pending | ||
| 11 | |||
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 13 | --- | ||
| 14 | gnulib/import/sys_time.in.h | 8 ++++---- | ||
| 15 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/gnulib/import/sys_time.in.h b/gnulib/import/sys_time.in.h | ||
| 18 | index d535a6a48b..7c34d5a1aa 100644 | ||
| 19 | --- a/gnulib/import/sys_time.in.h | ||
| 20 | +++ b/gnulib/import/sys_time.in.h | ||
| 21 | @@ -93,20 +93,20 @@ struct timeval | ||
| 22 | # define gettimeofday rpl_gettimeofday | ||
| 23 | # endif | ||
| 24 | _GL_FUNCDECL_RPL (gettimeofday, int, | ||
| 25 | - (struct timeval *restrict, void *restrict) | ||
| 26 | + (struct timeval *__restrict, void *__restrict) | ||
| 27 | _GL_ARG_NONNULL ((1))); | ||
| 28 | _GL_CXXALIAS_RPL (gettimeofday, int, | ||
| 29 | - (struct timeval *restrict, void *restrict)); | ||
| 30 | + (struct timeval *__restrict, void *__restrict)); | ||
| 31 | # else | ||
| 32 | # if !@HAVE_GETTIMEOFDAY@ | ||
| 33 | _GL_FUNCDECL_SYS (gettimeofday, int, | ||
| 34 | - (struct timeval *restrict, void *restrict) | ||
| 35 | + (struct timeval *__restrict, void *__restrict) | ||
| 36 | _GL_ARG_NONNULL ((1))); | ||
| 37 | # endif | ||
| 38 | /* Need to cast, because on glibc systems, by default, the second argument is | ||
| 39 | struct timezone *. */ | ||
| 40 | _GL_CXXALIAS_SYS_CAST (gettimeofday, int, | ||
| 41 | - (struct timeval *restrict, void *restrict)); | ||
| 42 | + (struct timeval *__restrict, void *__restrict)); | ||
| 43 | # endif | ||
| 44 | _GL_CXXALIASWARN (gettimeofday); | ||
| 45 | # if defined __cplusplus && defined GNULIB_NAMESPACE | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch new file mode 100644 index 00000000..5209c002 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | From bc1f01ff5e524f7777083024bce348a9b0017a7a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yousong Zhou <yszhou4tech@gmail.com> | ||
| 3 | Date: Fri, 24 Mar 2017 10:36:03 +0800 | ||
| 4 | Subject: [PATCH] Fix invalid sigprocmask call | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | The POSIX document says | ||
| 10 | |||
| 11 | The pthread_sigmask() and sigprocmask() functions shall fail if: | ||
| 12 | |||
| 13 | [EINVAL] | ||
| 14 | The value of the how argument is not equal to one of the defined values. | ||
| 15 | |||
| 16 | and this is how musl-libc is currently doing. Fix the call to be safe | ||
| 17 | and correct | ||
| 18 | |||
| 19 | [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html | ||
| 20 | |||
| 21 | gdb/ChangeLog: | ||
| 22 | 2017-03-24 Yousong Zhou <yszhou4tech@gmail.com> | ||
| 23 | |||
| 24 | * common/signals-state-save-restore.c (save_original_signals_state): | ||
| 25 | Fix invalid sigprocmask call. | ||
| 26 | |||
| 27 | Upstream-Status: Pending [not author, cherry-picked from LEDE https://bugs.lede-project.org/index.php?do=details&task_id=637&openedfrom=-1%2Bweek] | ||
| 28 | Signed-off-by: André Draszik <adraszik@tycoint.com> | ||
| 29 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 30 | --- | ||
| 31 | gdb/gdbsupport/signals-state-save-restore.c | 2 +- | ||
| 32 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 33 | |||
| 34 | diff --git a/gdb/gdbsupport/signals-state-save-restore.c b/gdb/gdbsupport/signals-state-save-restore.c | ||
| 35 | index c292d498da..af9dcaeb08 100644 | ||
| 36 | --- a/gdb/gdbsupport/signals-state-save-restore.c | ||
| 37 | +++ b/gdb/gdbsupport/signals-state-save-restore.c | ||
| 38 | @@ -38,7 +38,7 @@ save_original_signals_state (bool quiet) | ||
| 39 | int i; | ||
| 40 | int res; | ||
| 41 | |||
| 42 | - res = gdb_sigmask (0, NULL, &original_signal_mask); | ||
| 43 | + res = gdb_sigmask (SIG_BLOCK, NULL, &original_signal_mask); | ||
| 44 | if (res == -1) | ||
| 45 | perror_with_name (("sigprocmask")); | ||
| 46 | |||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch b/meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch new file mode 100644 index 00000000..eedd94c4 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | From 3d6700d38153a0ec8e0800de703a5089a8cd3d2d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Thu, 29 Nov 2018 18:00:23 -0800 | ||
| 4 | Subject: [PATCH] gdbserver ctrl-c handling | ||
| 5 | |||
| 6 | This problem was created by the upstream commit 78708b7c8c | ||
| 7 | After applying the commit, it will send SIGINT to the process | ||
| 8 | group(-signal_pid). | ||
| 9 | But if we use gdbserver send SIGINT, and the attached process is not a | ||
| 10 | process | ||
| 11 | group leader, then the "kill (-signal_pid, SIGINT)" returns error and | ||
| 12 | fails to | ||
| 13 | interrupt the attached process. | ||
| 14 | |||
| 15 | Upstream-Status: Submitted | ||
| 16 | [https://sourceware.org/bugzilla/show_bug.cgi?id=18945] | ||
| 17 | |||
| 18 | Author: Josh Gao | ||
| 19 | Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com> | ||
| 20 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 21 | --- | ||
| 22 | gdb/gdbserver/linux-low.c | 4 +--- | ||
| 23 | 1 file changed, 1 insertion(+), 3 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c | ||
| 26 | index 4255795ea6..762f8bafb6 100644 | ||
| 27 | --- a/gdb/gdbserver/linux-low.c | ||
| 28 | +++ b/gdb/gdbserver/linux-low.c | ||
| 29 | @@ -5904,9 +5904,7 @@ linux_look_up_symbols (void) | ||
| 30 | static void | ||
| 31 | linux_request_interrupt (void) | ||
| 32 | { | ||
| 33 | - /* Send a SIGINT to the process group. This acts just like the user | ||
| 34 | - typed a ^C on the controlling terminal. */ | ||
| 35 | - kill (-signal_pid, SIGINT); | ||
| 36 | + kill (signal_pid, SIGINT); | ||
| 37 | } | ||
| 38 | |||
| 39 | /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET | ||
diff --git a/meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb b/meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb new file mode 100644 index 00000000..d70757a1 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gdb/gdb_9.2.bb | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | require gdb.inc | ||
| 2 | require gdb-${PV}.inc | ||
| 3 | |||
| 4 | inherit python3-dir | ||
| 5 | |||
| 6 | EXTRA_OEMAKE_append_libc-musl = "\ | ||
| 7 | gt_cv_func_gnugettext1_libc=yes \ | ||
| 8 | gt_cv_func_gnugettext2_libc=yes \ | ||
| 9 | gl_cv_func_working_strerror=yes \ | ||
| 10 | gl_cv_func_strerror_0_works=yes \ | ||
| 11 | gl_cv_func_gettimeofday_clobber=no \ | ||
| 12 | " | ||
| 13 | |||
| 14 | do_configure_prepend() { | ||
| 15 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then | ||
| 16 | cat > ${WORKDIR}/python << EOF | ||
| 17 | #!/bin/sh | ||
| 18 | case "\$2" in | ||
| 19 | --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}/" ;; | ||
| 20 | --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}${PYTHON_ABI}" ;; | ||
| 21 | --exec-prefix) echo "${exec_prefix}" ;; | ||
| 22 | *) exit 1 ;; | ||
| 23 | esac | ||
| 24 | exit 0 | ||
| 25 | EOF | ||
| 26 | chmod +x ${WORKDIR}/python | ||
| 27 | fi | ||
| 28 | } | ||
