Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recursive configure invocation #102

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions projects/gdb/0001-Remove-pythead-cancel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
From 98a6ccec8b6f1be7dc7a496776fc65e7319a0b32 Mon Sep 17 00:00:00 2001
From: Konrad Eisele <[email protected]>
Date: Sat, 29 Jun 2024 15:30:02 +0200
Subject: [PATCH] Remove pythead cancel

---
gdb/arch/amd64-linux-tdesc.c | 1 +
gdb/arch/i386-linux-tdesc.c | 1 +
gdbserver/linux-low.cc | 44 ++++++++++++++++++------------------
gprofng/libcollector/iolib.c | 6 ++---
4 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/gdb/arch/amd64-linux-tdesc.c b/gdb/arch/amd64-linux-tdesc.c
index e9c4a99806d..df479ed54d0 100644
--- a/gdb/arch/amd64-linux-tdesc.c
+++ b/gdb/arch/amd64-linux-tdesc.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <unordered_map>
#include "arch/x86-linux-tdesc.h"
#include "arch/amd64-linux-tdesc.h"
#include "arch/amd64.h"
diff --git a/gdb/arch/i386-linux-tdesc.c b/gdb/arch/i386-linux-tdesc.c
index 9f12e59d214..444e54e1fb5 100644
--- a/gdb/arch/i386-linux-tdesc.c
+++ b/gdb/arch/i386-linux-tdesc.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

+#include <unordered_map>
#include "arch/x86-linux-tdesc.h"
#include "arch/i386-linux-tdesc.h"
#include "arch/i386.h"
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 266c7de8fb8..8e812c07ba5 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -105,32 +105,32 @@

#ifndef HAVE_ELF32_AUXV_T
/* Copied from glibc's elf.h. */
-typedef struct
-{
- uint32_t a_type; /* Entry type */
- union
- {
- uint32_t a_val; /* Integer value */
- /* We use to have pointer elements added here. We cannot do that,
- though, since it does not work when using 32-bit definitions
- on 64-bit platforms and vice versa. */
- } a_un;
-} Elf32_auxv_t;
+/* typedef struct */
+/* { */
+/* uint32_t a_type; /\* Entry type *\/ */
+/* union */
+/* { */
+/* uint32_t a_val; /\* Integer value *\/ */
+/* /\* We use to have pointer elements added here. We cannot do that, */
+/* though, since it does not work when using 32-bit definitions */
+/* on 64-bit platforms and vice versa. *\/ */
+/* } a_un; */
+/* } Elf32_auxv_t; */
#endif

#ifndef HAVE_ELF64_AUXV_T
/* Copied from glibc's elf.h. */
-typedef struct
-{
- uint64_t a_type; /* Entry type */
- union
- {
- uint64_t a_val; /* Integer value */
- /* We use to have pointer elements added here. We cannot do that,
- though, since it does not work when using 32-bit definitions
- on 64-bit platforms and vice versa. */
- } a_un;
-} Elf64_auxv_t;
+/* typedef struct */
+/* { */
+/* uint64_t a_type; /\* Entry type *\/ */
+/* union */
+/* { */
+/* uint64_t a_val; /\* Integer value *\/ */
+/* /\* We use to have pointer elements added here. We cannot do that, */
+/* though, since it does not work when using 32-bit definitions */
+/* on 64-bit platforms and vice versa. *\/ */
+/* } a_un; */
+/* } Elf64_auxv_t; */
#endif

/* See nat/linux-nat.h. */
diff --git a/gprofng/libcollector/iolib.c b/gprofng/libcollector/iolib.c
index 9f210589dfa..b048408885b 100644
--- a/gprofng/libcollector/iolib.c
+++ b/gprofng/libcollector/iolib.c
@@ -582,7 +582,7 @@ remapBlock (DataHandle *hndl, unsigned iflow, unsigned ichunk)

/* 6618470: disable thread cancellation */
int old_cstate;
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &old_cstate);
+ //pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &old_cstate);

/* Open the file. */
int iter = 0;
@@ -684,7 +684,7 @@ remapBlock (DataHandle *hndl, unsigned iflow, unsigned ichunk)
1, hndl->fname);
exit:
/* Restore the previous cancellation state */
- pthread_setcancelstate (old_cstate, NULL);
+ //pthread_setcancelstate (old_cstate, NULL);

return rc;
}
@@ -1069,7 +1069,7 @@ __collector_write_string (DataHandle *hndl, char *src, int len)

/* 6618470: disable thread cancellation */
int old_cstate;
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &old_cstate);
+ //pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &old_cstate);
/* block all signals */
CALL_UTIL (sigprocmask)(SIG_SETMASK, &new_mask, &old_mask);

--
2.34.1

32 changes: 32 additions & 0 deletions projects/gdb/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
GDB_ANDROID_DEPS = gmp mpfr

$(eval $(call project-define,gdb))

$(GDB_ANDROID):
cd $(GDB_ANDROID_BUILD_DIR) && make -j $(THREADS)
cd $(GDB_ANDROID_BUILD_DIR) && make install
touch $@

$(GDB_ANDROID_BUILD_DIR): $(ANDROID_CONFIG_SITE)
-mkdir $@
cd $@ && $(GDB_SRCS)/configure $(ANDROID_EXTRA_CONFIGURE_FLAGS) \
--with-gmp=$(abspath $(ANDROID_OUT_DIR)) \
--with-mpfr=$(abspath $(ANDROID_OUT_DIR)) \
--disable-gprofng

$(HOST_OUT_DIR)/bin/gdb: $(GDB_HOST)

$(GDB_HOST):
cd $(GDB_HOST_BUILD_DIR) && make install -j $(THREADS)
touch $@

$(GDB_HOST_BUILD_DIR):
-mkdir $@
cd $@ && $(GDB_SRCS)/configure --prefix=$(abspath $(HOST_OUT_DIR))

GDB_COMMIT_HASH = 17de5033a28cd04f9e16730b353ad7c08ec5d8c1
GDB_REPO = https://sourceware.org/git/binutils-gdb.git
projects/gdb/sources:
git clone $(GDB_REPO) $@
cd $@ && git checkout $(GDB_COMMIT_HASH)
cd $@ && git am ../*patch
30 changes: 30 additions & 0 deletions projects/gmp/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$(eval $(call project-define,gmp))

$(GMP_ANDROID):
cd $(GMP_ANDROID_BUILD_DIR) && make -j $(THREADS)
cd $(GMP_ANDROID_BUILD_DIR) && make install
cp $(GMP_SRCS)/COPYING $(ANDROID_OUT_DIR)/licenses/gmp
touch $@

$(GMP_ANDROID_BUILD_DIR): $(ANDROID_CONFIG_SITE)
-mkdir $@
cd $@ && $(GMP_SRCS)/configure $(ANDROID_EXTRA_CONFIGURE_FLAGS)

$(HOST_OUT_DIR)/bin/gmp: $(GMP_HOST)

$(GMP_HOST):
cd $(GMP_HOST_BUILD_DIR) && make install -j $(THREADS)
touch $@

$(GMP_HOST_BUILD_DIR):
-mkdir $@
cd $@ && $(GMP_SRCS)/configure --prefix=$(abspath $(HOST_OUT_DIR)) \
--enable-maintainer-mode

GMP_COMMIT_HASH = 14fe69d7f56e00917e9fd9ab616afc798a1af6c1
GMP_REPO = https://github.com/gmp-mirror/gmp.git
projects/gmp/sources:
git clone $(GMP_REPO) $@
cd $@ && git checkout $(GMP_COMMIT_HASH)
cd $@ && autoreconf -v -f -i
cp $@/../version.texi $@/doc/
4 changes: 4 additions & 0 deletions projects/gmp/version.texi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@set UPDATED 29 July 2023
@set UPDATED-MONTH July 2023
@set EDITION 6.3.0
@set VERSION 6.3.0
33 changes: 33 additions & 0 deletions projects/mpfr/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

MPFR_ANDROID_DEPS = gmp

$(eval $(call project-define,mpfr))

$(MPFR_ANDROID):
cd $(MPFR_ANDROID_BUILD_DIR) && make -j $(THREADS)
cd $(MPFR_ANDROID_BUILD_DIR)/src && make install
touch $@

$(MPFR_ANDROID_BUILD_DIR): $(ANDROID_CONFIG_SITE)
-mkdir $@
cd $@ && $(MPFR_SRCS)/configure $(ANDROID_EXTRA_CONFIGURE_FLAGS) --with-gmp=$(abspath $(ANDROID_OUT_DIR))

$(HOST_OUT_DIR)/bin/mpfr: $(MPFR_HOST)

$(MPFR_HOST):
cd $(MPFR_HOST_BUILD_DIR) && make install -j $(THREADS)
touch $@

$(MPFR_HOST_BUILD_DIR):
-mkdir $@
echo "ANDROID_OUT_DIR:$(ANDROID_OUT_DIR)"
cd $@ && $(MPFR_SRCS)/configure --prefix=$(abspath $(HOST_OUT_DIR)) \
--with-gmp=$(ANDROID_OUT_DIR) \
--enable-maintainer-mode

MPFR_COMMIT_HASH = 5b3bdbf1ffe5ebbb9c2641cef250d9b1e016d951
MPFR_REPO = https://gitlab.inria.fr/mpfr/mpfr.git
projects/mpfr/sources:
git clone $(MPFR_REPO) $@
cd $@ && git checkout $(MPFR_COMMIT_HASH)
cd $@ && ./autogen.sh -i
4 changes: 2 additions & 2 deletions scripts/download-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ TMP_NDK="/tmp/android-ndk-r23b-linux.zip"

echo "downloading ndk to ${dest}..."

curl -s -o "${TMP_NDK}" https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
curl -s -o "${TMP_NDK}" https://dl.google.com/android/repository/android-ndk-r26d-linux.zip
unzip -q "${TMP_NDK}" -d "${dest}"
rm /tmp/android-ndk-r23b-linux.zip
rm /tmp/android-ndk-r26d-linux.zip

echo "done"
3 changes: 2 additions & 1 deletion scripts/jammy-install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ apt-get install -y \
unzip \
wget \
zlib1g-dev \
zstd
zstd \
texinfo

echo "done"
1 change: 1 addition & 0 deletions toolchains/config.site.host.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
test -z "$PKG_CONFIG_LIBDIR" && PKG_CONFIG_LIBDIR=<SITE_PATH>/lib/pkgconfig
test -z "$CFLAGS" && CFLAGS="-fPIC -I<SITE_PATH>/include $EXTRA_CFLAGS"
test -z "$LDFLAGS" && LDFLAGS="-L<SITE_PATH>/lib -L<SITE_PATH>/lib64 $EXTRA_LDFLAGS -Wl,-rpath,<SITE_PATH>/lib -Wl,-rpath,<SITE_PATH>/lib64"
true
1 change: 1 addition & 0 deletions toolchains/config.site.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ test -z "$PKG_CONFIG_LIBDIR" && PKG_CONFIG_LIBDIR=<SITE_PATH>/lib/pkgconfig
test -z "$CPPFLAGS" && CPPFLAGS="-I<SITE_PATH>/include $EXTRA_CPPFLAGS"
test -z "$CFLAGS" && CFLAGS="-fPIC $EXTRA_CFLAGS"
test -z "$LDFLAGS" && LDFLAGS="-L<SITE_PATH>/lib -L<SITE_PATH>/lib64 $EXTRA_LDFLAGS"
true
4 changes: 2 additions & 2 deletions toolchains/toolchains.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.

NDK_API = 28
NDK_PATH = /opt/ndk/android-ndk-r23b
NDK_API = 34
NDK_PATH = /opt/ndk/android-ndk-r26d
ANDROID_TOOLCHAIN_PATH = \
$(abspath $(NDK_PATH)/toolchains/llvm/prebuilt/linux-x86_64/bin)
ANDROID_TOOLCHAIN_STRIP_PATH = $(ANDROID_TOOLCHAIN_PATH)/llvm-strip
Expand Down