On Feb 13 13:32, Jon Turney wrote:
> On 12/02/2026 20:34, Corinna Vinschen wrote:
> > On Feb 12 16:57, Igor Podgainoi wrote:
> > > diff --git a/winsup/cygwin/hookapi.cc b/winsup/cygwin/hookapi.cc
> > > index ee2edbafe..b0126ac04 100644
> > > --- a/winsup/cygwin/hookapi.cc
> > > +++ b/winsup/cygwin/hookapi.cc
> > > @@ -45,6 +45,8 @@ PEHeaderFromHModule (HMODULE hModule)
> > >       {
> > >       case IMAGE_FILE_MACHINE_AMD64:
> > >         break;
> > > +    case IMAGE_FILE_MACHINE_ARM64:
> > > +      break;
> > >       default:
> > >         return NULL;
> > >       }
> > 
> > Pushed.
> 
> This whole switch statement looks like a wart left over from x86 times?
> 
> Either that or it should be properly checking that we're not trying to mix
> architectures somehow? (See the comment where PEHeaderFromHModule is used in
> hook_or_detect_cygwin).

Good point.

Kind of like this?

diff --git a/winsup/cygwin/hookapi.cc b/winsup/cygwin/hookapi.cc
index b0126ac04e3e..861eea003660 100644
--- a/winsup/cygwin/hookapi.cc
+++ b/winsup/cygwin/hookapi.cc
@@ -43,10 +43,13 @@ PEHeaderFromHModule (HMODULE hModule)
   /* Return valid PIMAGE_NT_HEADERS only for supported architectures. */
   switch (pNTHeader->FileHeader.Machine)
     {
+#ifdef __x86_64__
     case IMAGE_FILE_MACHINE_AMD64:
       break;
+#elif __aarch64__
     case IMAGE_FILE_MACHINE_ARM64:
       break;
+#endif
     default:
       return NULL;
     }


Corinna

Reply via email to