From 1f3be1e79303711927bf7462625a7522ef57a3d9 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github@jdrake.com>
Date: Tue, 20 Feb 2024 10:18:56 -0800
Subject: [PATCH 51/N] Move _cygheap_start into .cygheap section.

Binutils >= 2.41 started making .rsrc section read-only, which caused
memset(_cygheap_start, ...) to segfault.  Instead, put _cygheap_start in
the .cygheap section, which makes more sense anyway, but may result in
reducing the difference between _cygheap_start and _cygheap_end by the
fraction of a page not used in the .rsrc section.

Fixes #200
See-also: https://cygwin.com/pipermail/cygwin/2024-February/255472.html
Signed-off-by: Jeremy Drake <github@jdrake.com>
---
 winsup/cygwin/cygwin.sc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/cygwin.sc.in b/winsup/cygwin/cygwin.sc.in
index 264e240..dec8f87 100644
--- a/winsup/cygwin/cygwin.sc.in
+++ b/winsup/cygwin/cygwin.sc.in
@@ -142,10 +142,10 @@ SECTIONS
   {
     *(.rsrc)
     *(SORT(.rsrc$*))
-    _SYM (_cygheap_start) = .;
   }
   .cygheap ALIGN(__section_alignment__) :
   {
+    _SYM (_cygheap_start) = .;
 #ifdef __x86_64__
     . = . + (3072 * 1024);
 #else
