From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7557A15808B for ; Tue, 22 Feb 2022 00:56:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58BA7E0A07; Tue, 22 Feb 2022 00:56:09 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2BACCE0A07 for ; Tue, 22 Feb 2022 00:56:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C8DE43435F1 for ; Tue, 22 Feb 2022 00:56:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 339B52CC for ; Tue, 22 Feb 2022 00:56:06 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1645491341.bbbbbaf24b7ec12927d0ac7e2b853cccec4e28fe.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/ocaml/, dev-lang/ocaml/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-lang/ocaml/Manifest dev-lang/ocaml/files/ocaml-4.05.0-glibc-2.34.patch dev-lang/ocaml/files/ocaml-4.09.0-glibc-2.34.patch dev-lang/ocaml/files/ocaml-4.10.2-glibc-2.34.patch dev-lang/ocaml/ocaml-4.05.0-r9.ebuild dev-lang/ocaml/ocaml-4.09.0-r3.ebuild dev-lang/ocaml/ocaml-4.10.2-r3.ebuild X-VCS-Directories: dev-lang/ocaml/files/ dev-lang/ocaml/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: bbbbbaf24b7ec12927d0ac7e2b853cccec4e28fe X-VCS-Branch: master Date: Tue, 22 Feb 2022 00:56:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 057a164b-5c1a-40c3-8c51-2119e276bb47 X-Archives-Hash: 5ad1ec8f59ff2df436b11d956f9b259f commit: bbbbbaf24b7ec12927d0ac7e2b853cccec4e28fe Author: Sam James gentoo org> AuthorDate: Tue Feb 22 00:55:02 2022 +0000 Commit: Sam James gentoo org> CommitDate: Tue Feb 22 00:55:41 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbbbbaf2 dev-lang/ocaml: use tarball for 4.05/4.09/4.10 patches Signed-off-by: Sam James gentoo.org> dev-lang/ocaml/Manifest | 3 + dev-lang/ocaml/files/ocaml-4.05.0-glibc-2.34.patch | 186 ---------------- dev-lang/ocaml/files/ocaml-4.09.0-glibc-2.34.patch | 178 --------------- dev-lang/ocaml/files/ocaml-4.10.2-glibc-2.34.patch | 239 --------------------- dev-lang/ocaml/ocaml-4.05.0-r9.ebuild | 7 +- dev-lang/ocaml/ocaml-4.09.0-r3.ebuild | 12 +- dev-lang/ocaml/ocaml-4.10.2-r3.ebuild | 11 +- 7 files changed, 18 insertions(+), 618 deletions(-) diff --git a/dev-lang/ocaml/Manifest b/dev-lang/ocaml/Manifest index eda27fba03db..9466e909f6b9 100644 --- a/dev-lang/ocaml/Manifest +++ b/dev-lang/ocaml/Manifest @@ -1,5 +1,8 @@ +DIST ocaml-4.05.0-patches-1.tar.bz2 4009 BLAKE2B 052c3a6859a942f2993d0b06ab57ca8f7469650c096f20bff7ff7cf5c2842e8d5019d595a4eca0dc1a4e5feda2db8a831a6917b3b6d9f39166c8ae7af1e894e7 SHA512 b349e6613201d9400f736c5b2d0ede01e7e113524cbc6989999a71fb97cb1eb67f90af8c2fbd3fd8abeccf3193e317cdd8258aee328c3e078634385c21558619 DIST ocaml-4.05.0.tar.gz 4431750 BLAKE2B c2ab003a13e0a581ebd0e1c96eeb8a9baea9bfe6bee08823b0e4541819201ec109f1846e13fc1aefa51a001eefbb8f73320ba854d41975fc68cef41bc75b1ecc SHA512 9a060ae4b741e1687277403e5bdb8f6eda2e2ebf6c45f7c0149b66ea1213cb26d13febfbb3f11c12543e244cfdd053b786b09c4145e2348e5d89a7206f7de225 +DIST ocaml-4.09.0-patches-1.tar.bz2 3300 BLAKE2B ef710ea5ed5a243ae684f68b7f203ba454192c9f8f19c32697d336bf18cf2a0e8ea08df232b0fd8e2475a000758a5ba95b3794096ec7d0d1b292a715ab3de86f SHA512 94096b99fd58b32232e418c5736203f08ab3c1558154ed00d4290730bd4db849bc60dfae6160f344acce63bbb8eaceecee25cf836bb73fa419d7bbf4eac433f1 DIST ocaml-4.09.0.tar.gz 4838748 BLAKE2B 80f29d535c64bf2371b480217723ed20b2b21cfd93ce31366a7b91e7ddffdf68db4e88d085288b7e21efee567a13f42ecff24c3a0115507b006acf844239cefd SHA512 dc0271e591bf929b751705835790949a9d741e12d085c8b207c3689b5838a02ea8de80da8b2605d2e6744f2f541b0d1694ffafff9509e99ce01f3a391f6ef2ae +DIST ocaml-4.10.2-patches-1.tar.bz2 3180 BLAKE2B 474471e10c4525e4da730fcf8602fddf5209f7d8eb15bd76894ed2bc22213a6e61aa7f52b1b67dff6c8bf04eac7d759ada28f1783c83a075cc65e7e5caadc715 SHA512 1456f90c0c833461eb9d1c140ba1a7358aa9351f6303e83b0e19bb8688dcb17bdad211f4cec1281a47180bbdddcfdbf44367b47a6b301d2ea41fa9d926bd03a5 DIST ocaml-4.10.2.tar.gz 4933135 BLAKE2B ec5e92adb23c28a254247182c79ab555fd82603e02f24799049b8057abf869d18234302408c8ae89b9997a2b210ed6965e45c2c03e4f0cab34262ad3f6ebb528 SHA512 1dd827da07f01e815fd74dd7ee84db0900f24782f8f7fd426e2d71b9fb03c7b8045f22e018120a0446c362315751365d1bd8c1724edef2b182394e76eb0a07b2 DIST ocaml-4.11.2.tar.gz 5075323 BLAKE2B bdc503d9a8d0e39dd11060febcd0287657b460e50ed81e55578a3e778af990ca5d4ef9011753eee4e1a144da33eb76c95b1672dc99b76e65a2e107eee472fe06 SHA512 03d8a9f6e130142c121ff2eb3d54f584f1e7c8475f066a5803bb0edd2fa172ca06a56a3ec548b225f5c8b12112d7a68511b1e16f3ade075b5f02610d4247bbb3 DIST ocaml-4.12.1.tar.gz 5181696 BLAKE2B 9d21438e09b1a9680eabb65f5c78d9fe84459592ef7bb797a1933e5383f7b6d5cefffa8cdc184abc102417f5dbc0fca8ef624c9b560f89eaff6537544b5b395f SHA512 e942e5cf5530804690ec45c40936ad2acbb60e11279fc676e0f04181fe1855f84ee5c3cb9c337fc5d01f6ee0e7b2251a6c04f7de56d99c20bb62026dff6c5671 diff --git a/dev-lang/ocaml/files/ocaml-4.05.0-glibc-2.34.patch b/dev-lang/ocaml/files/ocaml-4.05.0-glibc-2.34.patch deleted file mode 100644 index d95d2bb0fa50..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.05.0-glibc-2.34.patch +++ /dev/null @@ -1,186 +0,0 @@ -https://github.com/ocaml/ocaml/commit/50c2d1275e537906ea144bd557fde31e0bf16e5f -https://bugs.gentoo.org/804498 - -From 50c2d1275e537906ea144bd557fde31e0bf16e5f Mon Sep 17 00:00:00 2001 -From: Xavier Leroy -Date: Fri, 5 Mar 2021 19:14:07 +0100 -Subject: [PATCH] Dynamically allocate the alternate signal stack - -In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant. -It is no longer possible to statically allocate the alternate signal -stack for the main thread, as we've been doing for the last 25 years. - -This commit implements dynamic allocation of the alternate signal stack -even for the main thread. It reuses the code already in place to allocate -the alternate signal stack for other threads. - -The alternate signal stack is freed when the main OCaml code / an OCaml thread -stops. - -(partial back-port of PR#10266 and PR#10726) ---- a/asmrun/fail.c -+++ b/asmrun/fail.c -@@ -31,6 +31,8 @@ - #include "caml/roots.h" - #include "caml/callback.h" - -+extern void caml_terminate_signals(void); -+ - /* The globals holding predefined exceptions */ - - typedef value caml_generated_constant[1]; -@@ -60,7 +62,10 @@ char * caml_exception_pointer = NULL; - void caml_raise(value v) - { - Unlock_exn(); -- if (caml_exception_pointer == NULL) caml_fatal_uncaught_exception(v); -+ if (caml_exception_pointer == NULL) { -+ caml_terminate_signals(); -+ caml_fatal_uncaught_exception(v); -+ } - - #ifndef Stack_grows_upwards - #define PUSHED_AFTER < ---- a/asmrun/signals_asm.c -+++ b/asmrun/signals_asm.c -@@ -194,7 +194,6 @@ DECLARE_SIGNAL_HANDLER(trap_handler) - #ifdef HAS_STACK_OVERFLOW_DETECTION - - static char * system_stack_top; --static char sig_alt_stack[SIGSTKSZ]; - - #if defined(SYS_linux) - /* PR#4746: recent Linux kernels with support for stack randomization -@@ -295,17 +294,69 @@ void caml_init_signals(void) - { - stack_t stk; - struct sigaction act; -- stk.ss_sp = sig_alt_stack; -- stk.ss_size = SIGSTKSZ; -- stk.ss_flags = 0; -- SET_SIGACT(act, segv_handler); -- act.sa_flags |= SA_ONSTACK | SA_NODEFER; -- sigemptyset(&act.sa_mask); -- system_stack_top = (char *) &act; -- if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); } -+ /* Allocate and select an alternate stack for handling signals, -+ especially SIGSEGV signals. -+ The alternate stack used to be statically-allocated for the main thread, -+ but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ -+ may not be a compile-time constant. */ -+ stk.ss_sp = malloc(SIGSTKSZ); -+ if (stk.ss_sp != NULL) { -+ stk.ss_size = SIGSTKSZ; -+ stk.ss_flags = 0; -+ SET_SIGACT(act, segv_handler); -+ act.sa_flags |= SA_ONSTACK | SA_NODEFER; -+ sigemptyset(&act.sa_mask); -+ system_stack_top = (char *) &act; -+ if (sigaltstack(&stk, NULL) == 0) -+ sigaction(SIGSEGV, &act, NULL); -+ else -+ free(stk.ss_sp); -+ } - } - #endif - #if defined(_WIN32) && !defined(_WIN64) - caml_win32_overflow_detection(); - #endif - } -+ -+/* Termination of signal stuff */ -+ -+#if defined(TARGET_power) || defined(TARGET_s390x) \ -+ || defined(TARGET_sparc) && defined(SYS_solaris) \ -+ || defined(HAS_STACK_OVERFLOW_DETECTION) -+static void set_signal_default(int signum) -+{ -+ struct sigaction act; -+ sigemptyset(&act.sa_mask); -+ act.sa_handler = SIG_DFL; -+ act.sa_flags = 0; -+ sigaction(signum, &act, NULL); -+} -+#endif -+ -+void caml_terminate_signals(void) -+{ -+#if defined(TARGET_sparc) && defined(SYS_solaris) -+ set_signal_default(SIGILL); -+#endif -+ -+#if defined(TARGET_power) -+ set_signal_default(SIGTRAP); -+#endif -+ -+#if defined(TARGET_s390x) -+ set_signal_default(SIGFPE); -+#endif -+ -+#ifdef HAS_STACK_OVERFLOW_DETECTION -+ set_signal_default(SIGSEGV); -+ stack_t oldstk, stk; -+ stk.ss_flags = SS_DISABLE; -+ if (sigaltstack(&stk, &oldstk) == 0) { -+ /* If caml_init_signals failed, we are not using an alternate signal stack. -+ SS_DISABLE will be set in oldstk, and there is nothing to free in this -+ case. */ -+ if (! (oldstk.ss_flags & SS_DISABLE)) free(oldstk.ss_sp); -+ } -+#endif -+} ---- a/asmrun/startup.c -+++ b/asmrun/startup.c -@@ -92,6 +92,7 @@ void (*caml_termination_hook)(void *) = NULL; - extern value caml_start_program (void); - extern void caml_init_ieee_floats (void); - extern void caml_init_signals (void); -+extern void caml_terminate_signals(void); - - #if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L - -@@ -103,6 +104,7 @@ extern void caml_install_invalid_parameter_handler(); - value caml_startup_exn(char **argv) - { - char * exe_name, * proc_self_exe; -+ value res; - char tos; - - #ifdef WITH_SPACETIME -@@ -138,10 +140,13 @@ value caml_startup_exn(char **argv) - exe_name = caml_search_exe_in_path(exe_name); - caml_sys_init(exe_name, argv); - if (sigsetjmp(caml_termination_jmpbuf.buf, 0)) { -+ caml_terminate_signals(); - if (caml_termination_hook != NULL) caml_termination_hook(NULL); - return Val_unit; - } -- return caml_start_program(); -+ res = caml_start_program(); -+ caml_terminate_signals(); -+ return res; - } - - void caml_startup(char **argv) ---- a/byterun/sys.c -+++ b/byterun/sys.c -@@ -111,6 +111,8 @@ static void caml_sys_check_path(value name) - } - } - -+extern void caml_terminate_signals(void); -+ - CAMLprim value caml_sys_exit(value retcode_v) - { - int retcode = Int_val(retcode_v); -@@ -144,6 +146,9 @@ CAMLprim value caml_sys_exit(value retcode_v) - caml_debugger(PROGRAM_EXIT); - #endif - CAML_INSTR_ATEXIT (); -+#ifdef NATIVE_CODE -+ caml_terminate_signals(); -+#endif - CAML_SYS_EXIT(retcode); - return Val_unit; - } - diff --git a/dev-lang/ocaml/files/ocaml-4.09.0-glibc-2.34.patch b/dev-lang/ocaml/files/ocaml-4.09.0-glibc-2.34.patch deleted file mode 100644 index 48127343a3f4..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.09.0-glibc-2.34.patch +++ /dev/null @@ -1,178 +0,0 @@ -https://github.com/ocaml/ocaml/commit/8eed2e441222588dc385a98ae8bd6f5820eb0223 -https://github.com/gentoo/gentoo/pull/22851#pullrequestreview-882504245 - -From 8eed2e441222588dc385a98ae8bd6f5820eb0223 Mon Sep 17 00:00:00 2001 -From: Xavier Leroy -Date: Fri, 5 Mar 2021 19:14:07 +0100 -Subject: [PATCH] Dynamically allocate the alternate signal stack - -In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant. -It is no longer possible to statically allocate the alternate signal -stack for the main thread, as we've been doing for the last 25 years. - -This commit implements dynamic allocation of the alternate signal stack -even for the main thread. It reuses the code already in place to allocate -the alternate signal stack for other threads. - -The alternate signal stack is freed when the main OCaml code / an OCaml thread -stops. - -(partial back-port of PR#10266 and PR#10726) ---- a/runtime/fail_nat.c -+++ b/runtime/fail_nat.c -@@ -31,6 +31,8 @@ - #include "caml/roots.h" - #include "caml/callback.h" - -+extern void caml_terminate_signals(void); -+ - /* The globals holding predefined exceptions */ - - typedef value caml_generated_constant[1]; -@@ -60,7 +62,10 @@ char * caml_exception_pointer = NULL; - void caml_raise(value v) - { - Unlock_exn(); -- if (caml_exception_pointer == NULL) caml_fatal_uncaught_exception(v); -+ if (caml_exception_pointer == NULL) { -+ caml_terminate_signals(); -+ caml_fatal_uncaught_exception(v); -+ } - - while (caml_local_roots != NULL && - (char *) caml_local_roots < caml_exception_pointer) { ---- a/runtime/signals_nat.c -+++ b/runtime/signals_nat.c -@@ -182,7 +182,6 @@ DECLARE_SIGNAL_HANDLER(trap_handler) - #ifdef HAS_STACK_OVERFLOW_DETECTION - - static char * system_stack_top; --static char sig_alt_stack[SIGSTKSZ]; - - #if defined(SYS_linux) - /* PR#4746: recent Linux kernels with support for stack randomization -@@ -275,14 +274,61 @@ void caml_init_signals(void) - { - stack_t stk; - struct sigaction act; -- stk.ss_sp = sig_alt_stack; -- stk.ss_size = SIGSTKSZ; -- stk.ss_flags = 0; -- SET_SIGACT(act, segv_handler); -- act.sa_flags |= SA_ONSTACK | SA_NODEFER; -- sigemptyset(&act.sa_mask); -- system_stack_top = (char *) &act; -- if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); } -+ /* Allocate and select an alternate stack for handling signals, -+ especially SIGSEGV signals. -+ The alternate stack used to be statically-allocated for the main thread, -+ but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ -+ may not be a compile-time constant. */ -+ stk.ss_sp = malloc(SIGSTKSZ); -+ if (stk.ss_sp != NULL) { -+ stk.ss_size = SIGSTKSZ; -+ stk.ss_flags = 0; -+ SET_SIGACT(act, segv_handler); -+ act.sa_flags |= SA_ONSTACK | SA_NODEFER; -+ sigemptyset(&act.sa_mask); -+ system_stack_top = (char *) &act; -+ if (sigaltstack(&stk, NULL) == 0) -+ sigaction(SIGSEGV, &act, NULL); -+ else -+ free(stk.ss_sp); -+ } -+ } -+#endif -+} -+ -+/* Termination of signal stuff */ -+ -+#if defined(TARGET_power) || defined(TARGET_s390x) \ -+ || defined(HAS_STACK_OVERFLOW_DETECTION) -+static void set_signal_default(int signum) -+{ -+ struct sigaction act; -+ sigemptyset(&act.sa_mask); -+ act.sa_handler = SIG_DFL; -+ act.sa_flags = 0; -+ sigaction(signum, &act, NULL); -+} -+#endif -+ -+void caml_terminate_signals(void) -+{ -+#if defined(TARGET_power) -+ set_signal_default(SIGTRAP); -+#endif -+ -+#if defined(TARGET_s390x) -+ set_signal_default(SIGFPE); -+#endif -+ -+#ifdef HAS_STACK_OVERFLOW_DETECTION -+ set_signal_default(SIGSEGV); -+ stack_t oldstk, stk; -+ stk.ss_flags = SS_DISABLE; -+ if (sigaltstack(&stk, &oldstk) == 0) { -+ /* If caml_init_signals failed, we are not using an alternate signal stack. -+ SS_DISABLE will be set in oldstk, and there is nothing to free in this -+ case. */ -+ if (! (oldstk.ss_flags & SS_DISABLE)) free(oldstk.ss_sp); - } - #endif - } ---- a/runtime/startup_nat.c -+++ b/runtime/startup_nat.c -@@ -92,6 +92,7 @@ void (*caml_termination_hook)(void *) = NULL; - extern value caml_start_program (void); - extern void caml_init_ieee_floats (void); - extern void caml_init_signals (void); -+extern void caml_terminate_signals(void); - #ifdef _WIN32 - extern void caml_win32_overflow_detection (void); - #endif -@@ -106,6 +107,7 @@ extern void caml_install_invalid_parameter_handler(); - value caml_startup_common(char_os **argv, int pooling) - { - char_os * exe_name, * proc_self_exe; -+ value res; - char tos; - - /* Determine options */ -@@ -153,10 +155,13 @@ value caml_startup_common(char_os **argv, int pooling) - exe_name = caml_search_exe_in_path(exe_name); - caml_sys_init(exe_name, argv); - if (sigsetjmp(caml_termination_jmpbuf.buf, 0)) { -+ caml_terminate_signals(); - if (caml_termination_hook != NULL) caml_termination_hook(NULL); - return Val_unit; - } -- return caml_start_program(); -+ res = caml_start_program(); -+ caml_terminate_signals(); -+ return res; - } - - value caml_startup_exn(char_os **argv) ---- a/runtime/sys.c -+++ b/runtime/sys.c -@@ -112,6 +112,8 @@ static void caml_sys_check_path(value name) - } - } - -+extern void caml_terminate_signals(void); -+ - CAMLprim value caml_sys_exit(value retcode_v) - { - int retcode = Int_val(retcode_v); -@@ -155,6 +157,9 @@ CAMLprim value caml_sys_exit(value retcode_v) - caml_shutdown(); - #ifdef _WIN32 - caml_restore_win32_terminal(); -+#endif -+#ifdef NATIVE_CODE -+ caml_terminate_signals(); - #endif - exit(retcode); - } - diff --git a/dev-lang/ocaml/files/ocaml-4.10.2-glibc-2.34.patch b/dev-lang/ocaml/files/ocaml-4.10.2-glibc-2.34.patch deleted file mode 100644 index 4c157ddd90b8..000000000000 --- a/dev-lang/ocaml/files/ocaml-4.10.2-glibc-2.34.patch +++ /dev/null @@ -1,239 +0,0 @@ -https://github.com/ocaml/ocaml/commit/4b4c643d1d5d28738f6d900cd902851ed9dc5364 -https://bugs.gentoo.org/804498 - -From 4b4c643d1d5d28738f6d900cd902851ed9dc5364 Mon Sep 17 00:00:00 2001 -From: Xavier Leroy -Date: Fri, 5 Mar 2021 19:14:07 +0100 -Subject: [PATCH] Dynamically allocate the alternate signal stack - -In Glibc 2.34 and later, SIGSTKSZ may not be a compile-time constant. -It is no longer possible to statically allocate the alternate signal -stack for the main thread, as we've been doing for the last 25 years. - -This commit implements dynamic allocation of the alternate signal stack -even for the main thread. It reuses the code already in place to allocate -the alternate signal stack for other threads. - -The alternate signal stack is freed when the main OCaml code / an OCaml thread -stops. - -(partial back-port of PR#10266 and PR#10726) ---- a/otherlibs/systhreads/st_stubs.c -+++ b/otherlibs/systhreads/st_stubs.c -@@ -140,6 +140,7 @@ static st_retcode caml_threadstatus_wait (value); - #ifdef NATIVE_CODE - extern struct longjmp_buffer caml_termination_jmpbuf; - extern void (*caml_termination_hook)(void); -+extern int caml_stop_stack_overflow_detection(void); - #endif - - /* Hook for scanning the stacks of the other threads */ -@@ -576,6 +577,7 @@ static ST_THREAD_FUNCTION caml_thread_start(void * arg) - caml_thread_stop(); - #ifdef NATIVE_CODE - } -+ caml_stop_stack_overflow_detection(); - #endif - /* The thread now stops running */ - return 0; ---- a/runtime/fail_nat.c -+++ b/runtime/fail_nat.c -@@ -32,6 +32,8 @@ - #include "caml/roots.h" - #include "caml/callback.h" - -+extern void caml_terminate_signals(void); -+ - /* The globals holding predefined exceptions */ - - typedef value caml_generated_constant[1]; -@@ -62,7 +64,10 @@ CAMLno_asan - void caml_raise(value v) - { - Unlock_exn(); -- if (Caml_state->exception_pointer == NULL) caml_fatal_uncaught_exception(v); -+ if (Caml_state->exception_pointer == NULL) { -+ caml_terminate_signals(); -+ caml_fatal_uncaught_exception(v); -+ } - - while (Caml_state->local_roots != NULL && - (char *) Caml_state->local_roots < Caml_state->exception_pointer) { ---- a/runtime/signals_nat.c -+++ b/runtime/signals_nat.c -@@ -191,8 +191,6 @@ DECLARE_SIGNAL_HANDLER(trap_handler) - #error "CONTEXT_SP is required if HAS_STACK_OVERFLOW_DETECTION is defined" - #endif - --static char sig_alt_stack[SIGSTKSZ]; -- - /* Code compiled with ocamlopt never accesses more than - EXTRA_STACK bytes below the stack pointer. */ - #define EXTRA_STACK 256 -@@ -254,6 +252,10 @@ DECLARE_SIGNAL_HANDLER(segv_handler) - - /* Initialization of signal stuff */ - -+#ifdef HAS_STACK_OVERFLOW_DETECTION -+static int setup_stack_overflow_detection(void); -+#endif -+ - void caml_init_signals(void) - { - /* Bound-check trap handling */ -@@ -278,28 +280,91 @@ void caml_init_signals(void) - #endif - - #ifdef HAS_STACK_OVERFLOW_DETECTION -- { -- stack_t stk; -+ if (setup_stack_overflow_detection() != -1) { - struct sigaction act; -- stk.ss_sp = sig_alt_stack; -- stk.ss_size = SIGSTKSZ; -- stk.ss_flags = 0; - SET_SIGACT(act, segv_handler); - act.sa_flags |= SA_ONSTACK | SA_NODEFER; - sigemptyset(&act.sa_mask); -- if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); } -+ sigaction(SIGSEGV, &act, NULL); - } - #endif - } - --void caml_setup_stack_overflow_detection(void) -+/* Termination of signal stuff */ -+ -+#if defined(TARGET_power) || defined(TARGET_s390x) \ -+ || defined(HAS_STACK_OVERFLOW_DETECTION) -+static void set_signal_default(int signum) -+{ -+ struct sigaction act; -+ sigemptyset(&act.sa_mask); -+ act.sa_handler = SIG_DFL; -+ act.sa_flags = 0; -+ sigaction(signum, &act, NULL); -+} -+#endif -+ -+int caml_stop_stack_overflow_detection(void); -+ -+void caml_terminate_signals(void) - { -+#if defined(TARGET_power) -+ set_signal_default(SIGTRAP); -+#endif -+ -+#if defined(TARGET_s390x) -+ set_signal_default(SIGFPE); -+#endif -+ - #ifdef HAS_STACK_OVERFLOW_DETECTION -+ set_signal_default(SIGSEGV); -+ caml_stop_stack_overflow_detection(); -+#endif -+} -+ -+/* Allocate and select an alternate stack for handling signals, -+ especially SIGSEGV signals. -+ Each thread needs its own alternate stack. -+ The alternate stack used to be statically-allocated for the main thread, -+ but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ -+ may not be a compile-time constant (issue #10250). */ -+ -+#ifdef HAS_STACK_OVERFLOW_DETECTION -+static int setup_stack_overflow_detection(void) -+{ - stack_t stk; - stk.ss_sp = malloc(SIGSTKSZ); -+ if (stk.ss_sp == NULL) return -1; - stk.ss_size = SIGSTKSZ; - stk.ss_flags = 0; -- if (stk.ss_sp) -- sigaltstack(&stk, NULL); -+ if (sigaltstack(&stk, NULL) == -1) { -+ free(stk.ss_sp); -+ return -1; -+ } -+ /* Success (or stack overflow detection not available) */ -+ return 0; -+} -+#endif -+ -+CAMLexport void caml_setup_stack_overflow_detection(void) -+{ -+#ifdef HAS_STACK_OVERFLOW_DETECTION -+ setup_stack_overflow_detection(); -+#endif -+} -+ -+CAMLexport int caml_stop_stack_overflow_detection(void) -+{ -+#ifdef HAS_STACK_OVERFLOW_DETECTION -+ stack_t oldstk, stk; -+ stk.ss_flags = SS_DISABLE; -+ if (sigaltstack(&stk, &oldstk) == -1) return -1; -+ /* If caml_setup_stack_overflow_detection failed, we are not using -+ an alternate signal stack. SS_DISABLE will be set in oldstk, -+ and there is nothing to free in this case. */ -+ if (! (oldstk.ss_flags & SS_DISABLE)) free(oldstk.ss_sp); -+ return 0; -+#else -+ return 0; - #endif - } ---- a/runtime/startup_nat.c -+++ b/runtime/startup_nat.c -@@ -93,6 +93,7 @@ void (*caml_termination_hook)(void *) = NULL; - extern value caml_start_program (caml_domain_state*); - extern void caml_init_ieee_floats (void); - extern void caml_init_signals (void); -+extern void caml_terminate_signals(void); - #ifdef _WIN32 - extern void caml_win32_overflow_detection (void); - #endif -@@ -107,6 +108,7 @@ extern void caml_install_invalid_parameter_handler(); - value caml_startup_common(char_os **argv, int pooling) - { - char_os * exe_name, * proc_self_exe; -+ value res; - char tos; - - /* Initialize the domain */ -@@ -156,10 +158,13 @@ value caml_startup_common(char_os **argv, int pooling) - exe_name = caml_search_exe_in_path(exe_name); - caml_sys_init(exe_name, argv); - if (sigsetjmp(caml_termination_jmpbuf.buf, 0)) { -+ caml_terminate_signals(); - if (caml_termination_hook != NULL) caml_termination_hook(NULL); - return Val_unit; - } -- return caml_start_program(Caml_state); -+ res = caml_start_program(Caml_state); -+ caml_terminate_signals(); -+ return res; - } - - value caml_startup_exn(char_os **argv) ---- a/runtime/sys.c -+++ b/runtime/sys.c -@@ -112,6 +112,8 @@ static void caml_sys_check_path(value name) - } - } - -+extern void caml_terminate_signals(void); -+ - CAMLprim value caml_sys_exit(value retcode_v) - { - int retcode = Int_val(retcode_v); -@@ -156,6 +158,9 @@ CAMLprim value caml_sys_exit(value retcode_v) - caml_shutdown(); - #ifdef _WIN32 - caml_restore_win32_terminal(); -+#endif -+#ifdef NATIVE_CODE -+ caml_terminate_signals(); - #endif - exit(retcode); - } - diff --git a/dev-lang/ocaml/ocaml-4.05.0-r9.ebuild b/dev-lang/ocaml/ocaml-4.05.0-r9.ebuild index f2bb2369ad69..836f967b59ce 100644 --- a/dev-lang/ocaml/ocaml-4.05.0-r9.ebuild +++ b/dev-lang/ocaml/ocaml-4.05.0-r9.ebuild @@ -10,7 +10,8 @@ MY_P="${P/_/-}" DESCRIPTION="Type-inferring functional programming language descended from the ML family" HOMEPAGE="https://ocaml.org" SRC_URI="https://github.com/ocaml/ocaml/archive/${PV/_/+}.tar.gz -> ${MY_P}.tar.gz - mirror://gentoo/${PN}-patches-${PATCHLEVEL}.tar.bz2" + mirror://gentoo/${PN}-patches-${PATCHLEVEL}.tar.bz2 + https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-patches-1.tar.bz2" LICENSE="QPL-1.0 LGPL-2" # Everytime ocaml is updated to a new version, everything ocaml must be rebuilt, @@ -36,9 +37,7 @@ S="${WORKDIR}/${MY_P}" PATCHES=( "${FILESDIR}"/${PN}-4.04.2-tinfo.patch #459512 - "${FILESDIR}"/${P}-gcc10.patch - "${FILESDIR}"/${P}-CVE-2018-9838.patch - "${FILESDIR}"/${P}-glibc-2.34.patch + "${WORKDIR}"/${P}-patches-1/ ) pkg_setup() { diff --git a/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild b/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild index 8bf41d439d5a..7d1b5b6f6592 100644 --- a/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild +++ b/dev-lang/ocaml/ocaml-4.09.0-r3.ebuild @@ -5,9 +5,10 @@ EAPI=7 inherit flag-o-matic -HOMEPAGE="https://ocaml.org/" -SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz" DESCRIPTION="Programming language supporting functional, imperative & object-oriented styles" +HOMEPAGE="https://ocaml.org/" +SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-patches-1.tar.bz2" LICENSE="LGPL-2.1" SLOT="0/$(ver_cut 1-2)" @@ -24,9 +25,7 @@ PDEPEND="emacs? ( app-emacs/ocaml-mode ) QA_FLAGS_IGNORED='usr/lib.*/ocaml/bigarray.cmxs' PATCHES=( - "${FILESDIR}"/${PN}-4.09.0-gcc-10.patch - "${FILESDIR}"/${P}-cflags.patch - "${FILESDIR}"/${P}-glibc-2.34.patch + "${WORKDIR}"/${P}-patches-1/ ) src_prepare() { @@ -65,7 +64,8 @@ src_configure() { $(use_enable flambda) $(use_enable spacetime) ) - econf ${opt[@]} + + econf "${opt[@]}" } src_compile() { diff --git a/dev-lang/ocaml/ocaml-4.10.2-r3.ebuild b/dev-lang/ocaml/ocaml-4.10.2-r3.ebuild index b298bea0d51b..b0b37115a35c 100644 --- a/dev-lang/ocaml/ocaml-4.10.2-r3.ebuild +++ b/dev-lang/ocaml/ocaml-4.10.2-r3.ebuild @@ -5,9 +5,10 @@ EAPI=7 inherit flag-o-matic -HOMEPAGE="https://ocaml.org/" -SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz" DESCRIPTION="Programming language supporting functional, imperative & object-oriented styles" +HOMEPAGE="https://ocaml.org/" +SRC_URI="https://github.com/ocaml/ocaml/archive/${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-patches-1.tar.bz2" LICENSE="LGPL-2.1" SLOT="0/$(ver_cut 1-2)" @@ -24,8 +25,7 @@ PDEPEND="emacs? ( app-emacs/ocaml-mode ) QA_FLAGS_IGNORED='usr/lib.*/ocaml/bigarray.cmxs' PATCHES=( - "${FILESDIR}"/${P}-cflags.patch - "${FILESDIR}"/${P}-glibc-2.34.patch + "${WORKDIR}"/${P}-patches-1/ ) src_prepare() { @@ -64,7 +64,8 @@ src_configure() { $(use_enable flambda) $(use_enable spacetime) ) - econf ${opt[@]} + + econf "${opt[@]}" } src_compile() {