From 01a97e1e03ca9600815d4cd48a18f438102d8104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Mon, 26 May 2025 10:21:07 +0200 Subject: [PATCH 1/7] Implement `stabilize_sig_stack` --- winsup/cygwin/scripts/gendef | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index 97ec62374d..03b6199999 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -399,7 +399,74 @@ _sigdelayed_end: .seh_proc stabilize_sig_stack stabilize_sig_stack: + // prologue + stp fp, lr, [sp, #-0x10]! // save FP and LR registers + .seh_save_fplr_x+ 16 .seh_endprologue + + ldr x10, [x18, #0x8] // keep thread local storage base address in x10 + + // try to acquire the lock + mov w9, #1 // set up value for atomic exchange + ldr x11, =_cygtls.stacklock // load the symbol address/offset + add x12, x10, x11 // calculate final address +1: + ldaxr w13, [x12] // load with acquire semantics + stlxr w14, w9, [x12] // store with release semantics + cbnz w14, 1b // if store failed, retry + cbz w13, 2f // if lock was acquired, continue + yield // yield to allow other threads to run + b 1b // retry acquiring the lock +2: + // lock acquired, increment incyg counter + ldr x11, =_cygtls.incyg // load the symbol address/offset + add x12, x10, x11 // calculate final address + ldr w9, [x12] // load current value of incyg counter + add w9, w9, #1 // increment incyg counter + str w9, [x12] // store incremented value back + + // check if there is a current signal to handle + ldr x11, =_cygtls.current_sig // load the symbol address/offset + ldr w9, [x10, x11] // load current value of current_sig + cbz w9, 3f // if no current signal, jump to cleanup + + // release lock before calling signal handler + ldr x11, =_cygtls.stacklock // load the symbol address/offset + add x12, x10, x11 // calculate final address + ldr w9, [x12] // load current value of stacklock counter + sub w9, w9, #1 // decrement stacklock counter + stlr w9, [x12] // store with release semantics + + // prepare arguments and call signal handler + ldr x0, =_cygtls.start_offset // load the symbol address/offset + add x0, x10, x0 // calculate final address + bl _ZN7_cygtls19call_signal_handlerEv + ldr x10, [x18, #0x8] // restore x10 that may have been modified by the call + + // decrement incyg counter + ldr x11, =_cygtls.incyg // load the symbol address/offset + add x12, x10, x11 // calculate final address + ldr w9, [x12] // load current value of incyg counter + sub w9, w9, #1 // decrement incyg counter + str w9, [x12] // store decremented value back + + // go to the beginning to handle another signal + b 1b +3: + // no signal to handle, decrement incyg counter + ldr x11, =_cygtls.incyg // load the symbol address/offset + add x12, x10, x11 // calculate final address + ldr w9, [x12] // load current value of incyg counter + sub w9, w9, #1 // decrement incyg counter + str w9, [x12] // store decremented value back + + mov x0, x10 // return TLS address in x0 (return value) + + // epilogue + .seh_startepilogue + ldp fp, lr, [sp], #0x10 + .seh_save_fplr_x+ 16 + .seh_endepilogue ret .seh_endproc EOF From 287ceb21c31ec23f8833a6816789616ddd36416c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Mon, 26 May 2025 17:00:04 +0200 Subject: [PATCH 2/7] Implement `setjmp` --- winsup/cygwin/scripts/gendef | 47 +++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index 03b6199999..a4415970ff 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -622,8 +622,53 @@ sigsetjmp: .globl setjmp .seh_proc setjmp setjmp: + // prologue + stp fp, lr, [sp, #-0x10]! // save FP and LR registers .seh_endprologue - mov x0, 0 + + // save callee-saved registers from jump buffer + stp x19, x20, [x0, #0x08] // save x19 and x20 + stp x21, x22, [x0, #0x18] // save x21 and x22 + stp x23, x24, [x0, #0x28] // save x23 and x24 + stp x25, x26, [x0, #0x38] // save x25 and x26 + stp x27, x28, [x0, #0x48] // save x27 and x28 + stp fp, lr, [x0, #0x58] // save x29 (frame pointer) and x30 (link register) + mov x1, sp // get the current stack pointer + str x1, [x0, #0x68] // save SP + mrs x1, fpcr // get floating-point control register + str x1, [x0, #0x70] // save FPCR + mrs x1, fpsr // get floating-point status register + str x1, [x0, #0x78] // save FPSR + + // save floating-point registers (d8-d15) + stp d8, d9, [x0, #0x80] + stp d10, d11, [x0, #0x90] + stp d12, d13, [x0, #0xA0] + stp d14, d15, [x0, #0xB0] + + // save TLS stack pointer + ldr x1, [sp] + str x1, [x0, #0xB8] + + bl stabilize_sig_stack // call stabilize_sig_stack (returns TLS in x0) + + // store the stack pointer to ... + ldr x2, =_cygtls.stackptr + add x2, x0, x2 + ldr x3, [x2] + // TODO: Save the value somewhere. + + // decrement the stack lock + ldr x2, =_cygtls.stacklock + add x2, x0, x2 + ldr w3, [x2] + sub w3, w3, #1 + str w3, [x2] + + mov w0, #0 // return 0 + + // epilogue + ldp fp, lr, [sp], #0x10 // restore saved FP and LR registers ret .seh_endproc From 8c9821fbcc7fa9538f23de65638ab36356d2b17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Mon, 26 May 2025 17:00:45 +0200 Subject: [PATCH 3/7] Implement `longjmp` --- winsup/cygwin/scripts/gendef | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index a4415970ff..eda373e085 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -682,7 +682,67 @@ siglongjmp: .globl longjmp .seh_proc longjmp longjmp: + // prologue + stp fp, lr, [sp, #-0x20]! // save FP and LR registers, allocate additional 16 bytes for function arguments + stp x0, x1, [sp, #0x10] // save function arguments (jump buffer and return value) + mov fp, sp // establishing frame chain .seh_endprologue +1: + bl stabilize_sig_stack // call stabilize_sig_stack which returns TLS pointer in x0 + ldr x2, [sp, #0x10] // get jump buffer pointer from stack + ldr x10, [x2] // get old signal stack from jump buffer + + // restore stack pointer in TLS + ldr x11, =_cygtls.stackptr + add x11, x0, x11 + str x10, [x11] + + // release lock by decrementing counter + ldr x11, =_cygtls.stacklock + add x11, x0, x11 + ldr w12, [x11] + sub w12, w12, #1 + str w12, [x11] + + // we're not in cygwin anymore, clear "in cygwin" flag + ldr x11, =_cygtls.incyg + add x11, x0, x11 + mov w12, #0 + str w12, [x11] + + // get saved return value before SP is restored + ldr x0, [sp, #0x10] + + // restore callee-saved registers from jump buffer + ldp x19, x20, [x2, #0x08] // restore x19, x20 + ldp x21, x22, [x2, #0x18] // restore x21, x22 + ldp x23, x24, [x2, #0x28] // restore x23, x24 + ldp x25, x26, [x2, #0x38] // restore x25, x26 + ldp x27, x28, [x2, #0x48] // restore x27, x28 + ldp fp, lr, [x2, #0x58] // restore x29 (frame pointer) and x30 (link register) + ldr x10, [x2, #0x68] // get saved stack pointer + mov sp, x10 // restore stack pointer + ldr x10, [x2, #0x70] // load floating-point control register + msr fpcr, x10 // restore FPCR + ldr x10, [x2, #0x78] // load floating-point status register + msr fpsr, x10 // restore FPSR + + // restore floating-point registers (d8-d15) + ldp d8, d9, [x2, #0x80] + ldp d10, d11, [x2, #0x90] + ldp d12, d13, [x2, #0xA0] + ldp d14, d15, [x2, #0xB0] + + // restore TLS stack pointer + ldr x1, [x0, #0xB8] + str x1, [sp] + + // ensure return value is non-zero (C standard requirement) + cbnz x0, 0f + mov x0, #1 +0: + // epilogue + add sp, sp, #0x10 // FP and LR are already restored, just restore SP as it would be popped ret .seh_endproc EOF From a157c660cb045abc7be19f7ce203e7810b5d4d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Wed, 16 Apr 2025 14:09:14 +0200 Subject: [PATCH 4/7] WIP: Implement `_sigfe_maybe`, `_sigfe` and `_sigbe` --- winsup/cygwin/scripts/gendef | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index eda373e085..0d0fde661a 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -370,14 +370,15 @@ EOF .seh_proc _sigfe_maybe _sigfe_maybe: # stack is aligned on entry! .seh_endprologue + ldr x10, [x18, #0x8] 0: ret .seh_endproc .seh_proc _sigfe _sigfe: # stack is aligned on entry! .seh_endprologue - ldr x9, [sp], #16 - br x9 + ldr x10, [sp], #0x10 + br x10 .seh_endproc .global _sigbe @@ -385,6 +386,7 @@ _sigfe: # stack is aligned on entry! _sigbe: # return here after cygwin syscall # stack is aligned on entry! .seh_endprologue + ret .seh_endproc .global sigdelayed From d7bf92cdcbdd476956b8b47400b26c796d4b30fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Wed, 16 Apr 2025 14:10:06 +0200 Subject: [PATCH 5/7] WIP: Implement `sigsetjmp` --- winsup/cygwin/scripts/gendef | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index 0d0fde661a..900508a242 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -616,8 +616,16 @@ EOF .globl sigsetjmp .seh_proc sigsetjmp sigsetjmp: + // prologue + stp fp, lr, [sp, #-0x10]! // save FP and LR registers + mov fp, sp // set FP to current SP + sub sp, sp, #0x20 // allocate 32 bytes on stack .seh_endprologue - mov x0, 0 + + bl setjmp + + // epilogue + ldp fp, lr, [sp], #0x10 // restore saved FP and LR registers ret .seh_endproc From c71723f221e8f1cf9ac96961a4aaa80bb5058e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Wed, 16 Apr 2025 14:09:44 +0200 Subject: [PATCH 6/7] WIP: Implement `siglongjmp` --- winsup/cygwin/scripts/gendef | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef index 900508a242..07db143b39 100755 --- a/winsup/cygwin/scripts/gendef +++ b/winsup/cygwin/scripts/gendef @@ -685,7 +685,16 @@ setjmp: .globl siglongjmp .seh_proc siglongjmp siglongjmp: + // prologue + stp fp, lr, [sp, #-0x10]! // save FP and LR registers + mov fp, sp // set FP to current SP + sub sp, sp, #32 // allocate 32 bytes on stack .seh_endprologue + + bl longjmp + + // epilogue + ldp fp, lr, [sp], #0x10 // restore saved FP and LR registers ret .seh_endproc From 2e038205f916fa84c4bc87afef62fc637876c0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= Date: Wed, 16 Apr 2025 13:00:26 +0200 Subject: [PATCH 7/7] Disable optimizations for easier debugging --- Makefile.in | 4 ++-- Makefile.tpl | 4 ++-- config/acinclude.m4 | 4 ++-- configure | 8 ++++---- configure.ac | 4 ++-- libgloss/config/default.mh | 2 +- libgloss/config/dos.mh | 2 +- libgloss/config/ppc.mh | 2 +- libgloss/configure | 2 +- libtool.m4 | 2 +- newlib/configure | 2 +- winsup/cygwin/aarch64/fastcwd.cc | 8 ++++---- winsup/cygwin/syscalls.cc | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Makefile.in b/Makefile.in index 25f82d37f1..32885d0433 100644 --- a/Makefile.in +++ b/Makefile.in @@ -364,7 +364,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ # Flags to pass to stage2 and later makes. They are defined # here so that they can be overridden by Makefile fragments. -BOOT_CFLAGS= -g -O2 +BOOT_CFLAGS= -g -Og BOOT_LDFLAGS= BOOT_ADAFLAGS= -gnatpg @@ -584,7 +584,7 @@ CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ -GOCFLAGS_FOR_TARGET = -O2 -g +GOCFLAGS_FOR_TARGET = -Og -g FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ diff --git a/Makefile.tpl b/Makefile.tpl index 21e12e897c..8c3e0cebc5 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -367,7 +367,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ # Flags to pass to stage2 and later makes. They are defined # here so that they can be overridden by Makefile fragments. -BOOT_CFLAGS= -g -O2 +BOOT_CFLAGS= -g -Og BOOT_LDFLAGS= BOOT_ADAFLAGS= -gnatpg @@ -517,7 +517,7 @@ CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ -GOCFLAGS_FOR_TARGET = -O2 -g +GOCFLAGS_FOR_TARGET = -Og -g FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ diff --git a/config/acinclude.m4 b/config/acinclude.m4 index 8242b2c7a8..5760acac82 100644 --- a/config/acinclude.m4 +++ b/config/acinclude.m4 @@ -24,7 +24,7 @@ dnl normal versions of a library), tasteless as that idea is. if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS="$ac_save_CXXFLAGS" elif test $ac_cv_prog_cxx_g = yes; then - CXXFLAGS="-g -O2" + CXXFLAGS="-g -Og" else CXXFLAGS="-O2" fi @@ -121,7 +121,7 @@ dnl normal versions of a library), tasteless as that idea is. if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" + CFLAGS="-g -Og" else CFLAGS="-O2" fi diff --git a/configure b/configure index 9477153056..4164e33ff3 100755 --- a/configure +++ b/configure @@ -4800,7 +4800,7 @@ if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then - CFLAGS="-g -O2" + CFLAGS="-g -Og" else CFLAGS="-g" fi @@ -5147,7 +5147,7 @@ if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then - CXXFLAGS="-g -O2" + CXXFLAGS="-g -Og" else CXXFLAGS="-g" fi @@ -6853,7 +6853,7 @@ fi # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET. if test "x$CFLAGS_FOR_TARGET" = x; then if test "x${is_cross_compiler}" = xyes; then - CFLAGS_FOR_TARGET="-g -O2" + CFLAGS_FOR_TARGET="-g -Og" else CFLAGS_FOR_TARGET=$CFLAGS case " $CFLAGS " in @@ -6870,7 +6870,7 @@ fi if test "x$CXXFLAGS_FOR_TARGET" = x; then if test "x${is_cross_compiler}" = xyes; then - CXXFLAGS_FOR_TARGET="-g -O2" + CXXFLAGS_FOR_TARGET="-g -Og" else CXXFLAGS_FOR_TARGET=$CXXFLAGS case " $CXXFLAGS " in diff --git a/configure.ac b/configure.ac index 7e8a6b1c61..48b830f37d 100644 --- a/configure.ac +++ b/configure.ac @@ -2381,7 +2381,7 @@ AC_SUBST(DEBUG_PREFIX_CFLAGS_FOR_TARGET) # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET. if test "x$CFLAGS_FOR_TARGET" = x; then if test "x${is_cross_compiler}" = xyes; then - CFLAGS_FOR_TARGET="-g -O2" + CFLAGS_FOR_TARGET="-g -Og" else CFLAGS_FOR_TARGET=$CFLAGS case " $CFLAGS " in @@ -2398,7 +2398,7 @@ AC_SUBST(CFLAGS_FOR_TARGET) if test "x$CXXFLAGS_FOR_TARGET" = x; then if test "x${is_cross_compiler}" = xyes; then - CXXFLAGS_FOR_TARGET="-g -O2" + CXXFLAGS_FOR_TARGET="-g -Og" else CXXFLAGS_FOR_TARGET=$CXXFLAGS case " $CXXFLAGS " in diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh index 64dc02f05c..df0f1a96f6 100644 --- a/libgloss/config/default.mh +++ b/libgloss/config/default.mh @@ -4,7 +4,7 @@ NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. -idirafter $(srcroot)/include # Note that when building the library, ${MULTILIB} is not the way multilib # options are passed; they're passed in $(CFLAGS). -CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +CFLAGS_FOR_TARGET = -Og -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} AR_FLAGS = rc diff --git a/libgloss/config/dos.mh b/libgloss/config/dos.mh index c5874cb424..0046963eba 100644 --- a/libgloss/config/dos.mh +++ b/libgloss/config/dos.mh @@ -4,7 +4,7 @@ NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/; f INCLUDES = -I. # Note that when building the library, ${MULTILIB} is not the way multilib # options are passed; they're passed in $(CFLAGS). -CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +CFLAGS_FOR_TARGET = -Og -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} ARFLAGS_FOR_TARGET = qc diff --git a/libgloss/config/ppc.mh b/libgloss/config/ppc.mh index d1bfd7588e..d8a957360a 100644 --- a/libgloss/config/ppc.mh +++ b/libgloss/config/ppc.mh @@ -8,7 +8,7 @@ CFLAGS_MRELOCATABLE = -mrelocatable-lib -mno-eabi INCLUDES = -I. -I$(srcdir)/.. -I$(objdir)/.. # Note that when building the library, ${MULTILIB} is not the way multilib # options are passed; they're passed in $(CFLAGS). -CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +CFLAGS_FOR_TARGET = -Og -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} AR_FLAGS = qc diff --git a/libgloss/configure b/libgloss/configure index 3eb4c27402..dd5d52d9a3 100755 --- a/libgloss/configure +++ b/libgloss/configure @@ -4077,7 +4077,7 @@ if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then - CFLAGS="-g -O2" + CFLAGS="-g -Og" else CFLAGS="-g" fi diff --git a/libtool.m4 b/libtool.m4 index a216bb14e9..3c4b0be976 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -7074,7 +7074,7 @@ AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -Og" AC_SUBST(GCJFLAGS)])])[]dnl ]) diff --git a/newlib/configure b/newlib/configure index 004a4a9975..3462881339 100755 --- a/newlib/configure +++ b/newlib/configure @@ -4029,7 +4029,7 @@ if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then - CFLAGS="-g -O2" + CFLAGS="-g -Og" else CFLAGS="-g" fi diff --git a/winsup/cygwin/aarch64/fastcwd.cc b/winsup/cygwin/aarch64/fastcwd.cc index 17ce6bbf3d..b95c3dba6b 100644 --- a/winsup/cygwin/aarch64/fastcwd.cc +++ b/winsup/cygwin/aarch64/fastcwd.cc @@ -128,8 +128,8 @@ find_fast_cwd_pointer_aarch64 () start = pc = (const uint32_t *) use_cwd; const uint32_t *ldrpc = NULL; - uint32_t ldroffset, ldrsz; - uint32_t ldrrn, ldrrd; + uint32_t ldroffset = 0, ldrsz = 0; + uint32_t ldrrn = 0, ldrrd = 0; /* find the ldr (immediate unsigned offset) for RtlpCurDirRef */ for (; pc < start + 20 && !IS_INSN (pc, ret) && !IS_INSN (pc, b); pc++) @@ -163,8 +163,8 @@ find_fast_cwd_pointer_aarch64 () if (IS_INSN (pc, bl) && extract_bl_target (pc) == ent_crit) break; } - uint32_t addoffset; - uint32_t addrn; + uint32_t addoffset = 0; + uint32_t addrn = 0; for (; pc >= start; pc--) { if (IS_INSN (pc, add) && (*pc & 0x1F) == 0) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index d6a2c2d3b3..8742829a1b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1595,7 +1595,7 @@ static int posix_getdents_lseek (cygheap_fdget &cfd, off_t pos, int dir) { long cur = cfd->telldir (cfd->getdents_dir ()); - long abs_pos; + long abs_pos = 0; switch (dir) {